Jump to content



Delphi-7 and delphix (directx draw): ploting pixels issue

  • You cannot reply to this topic
No replies to this topic

#1 Vagos   Members   -  Reputation: 100

Like
0Likes
Like

Posted 20 February 2012 - 07:32 PM

I use delphi 7 and delphix so I can have ddraw and be able to create a surface to play with pixels.

so in a button trigger i use this:

for i:=1 to 100 do
for j:=1 to 100 do
dxdraw1.Surface.Pixels[i,j]:=250;

where dxdraw1 is a ddraw object, a surface.

The problem is that it works, but the result shows after I hoover another window above my program, like it is not updating the rectangle area with the pixels.
(I press the button, the cpu usage is getting up for a short and the rectangle remains black until I hoover another window.)

Also its slow, as I read somewhere else:

"...
DXDraw.Surface.Canvas.Pixels[X,Y]:=clBlue;
DXDraw.Surface.Canvas.Release;
..."

for using do play with pixels, and after another said this:

"... Just remember that this function (above) is extremely slow . It's locking and unlocking the surface on every pixel set.. not very usable. PixelDX and turboPixel don't, you manually lock the surface, do all of your pixel operations and then unlock it.. 1000 times faster. ..."

How to use these functions? I cant find them (and I have no idea since I am beginner on ddraw)? How to lock first and then unlock?

Ad:





We are working on generating results for this topic
PARTNERS