WritePixelTrouble

Blitz3D Forums/Blitz3D Beginners Area/WritePixelTrouble

GrrBrr(Posted 2004) [#1]
Hello, I have this little Problem with WritePixelFast:

i just want to copy the frontbuffer into an image and then make every third pixel black...

it just makes a copy of the frontbuffer.....

if you remove the copyrect command,it writes the image of the frontbuffer in every third pixel... (strange strange?!???!? I didn't do any ReadPixel Operation )

Am I blind or stupid??

Please help!

SetBuffer ImageBuffer(BackG)
 
CopyRect (0,0,ScreenWidth%,ScreenHeight%,0,0,FrontBuffer(),ImageBuffer(BackG))
	    
LockBuffer(ImageBuffer(BackG))
			
For yy% = 0 To ScreenHeight% - 1 Step 3
  For xx% = 0 To ScreenWidth% - 1 Step 3
    WritePixelFast ( xx%,     yy%   , 0 )
  Next
Next
        
UnlockBuffer(ImageBuffer(BackG))




Ross C(Posted 2004) [#2]
Try including the optional Buffer parameter in the writepixelfast command.


BlackJumper(Posted 2004) [#3]
Just a guess... I'm assuming that you do a Flip somewhere...

In which case you HAVE copied the Back to the Front at some point.

OR

since WritePixelFast takes a buffer as an arguement, and you are not specifying one inside the loop, Blitz is sending a transparent pixel to the FrontBuffer (i.e. black = mask) so that the Back is showing through ??
[I know your code above uses SetBuffer... but your problem seems to happen when you start commenting out sections ?]

try WritePixelFast ( xx%, yy% , 0, ImageBuffer(BackG) )


GrrBrr(Posted 2004) [#4]
thank you...
the error was in another position, i just forgot to copy the image back to the frontbuffer to see the change...

i thought the problem is here, because it showed some strange results when i removed the copyrect command..
it should have shown nothing !???!!!

hmmm.. now everything works... thats all what matters...
:)

thx