How do I make an image all one colour when there are lots of colours within the image (therefore I can't use paint), and without being slow (using line and drawing rectangle over entire image which gets slow with large ones, and doesn't work with my example because it's like drawing a rectangle in air :P).
Direct pixel manipulation, right?
Code: Select all
for y as integer = 0 to 617 'height of graphic
'address of first pixel/row = graphic+sizeof(fb.IMAGE)
dim as ulong ptr row = graphic+sizeof(fb.IMAGE)+y*graphic->pitch
for x as integer = 0 to gw-1 'holds graphic's width
row[x] = rgba(0, 0, 0, 0)
I am trying to set every pixel's value to empty, i.e. entirely alpha so that you can see through image if it was drawn over something. Unfortunately, my game likes to crash when I do this :|.
What am I doing wrong?
And is it just me or should this be a part of FB? We have cls for the screen (both for graphic and text ports) but what about image buffers? This would be helpful for a lot of programmers I feel :/