Read/WritePixelFast
Blitz3D Forums/Blitz3D Beginners Area/Read/WritePixelFast
| ||
How can I remove any transparency (alpha) from the ARGB values returned by ReadPixelFast or used by WritePixelFast? For Example: What would I need for rgb in the code below? Dim pix(GraphicsWidth(),GraphicsHeight()) LockBuffer For y=0 To GraphicsHeight() For x=0 To GraphicsWidth() argb=ReadPixelFast(x,y) ;rgb=argb Shr ???????????????????????????????? pix(x,y)=rgb Next Next UnlockBuffer |
| ||
rgb = argb Or $FF000000 ;Set the alpha to 1 rgb = argb And $00FFFFFF ;Set the alpha to 0 |
| ||
Thanks very much, Yasha, just to check though: Setting Alpha to 1 is opaque, as with 3D, right? |
| ||
Yes |
| ||
I have handy functions in my code archive entries for removing or inserting alpha or masking also based on colour if it helps? |
| ||
Ah thanks Ross, no worries, though Ive sorted it now. Incidentally, I did try a search and looking through the archives, but I don't think I found them - Maybe I just didn't know really what I was looking for! |
| ||
or: a=argb shr 24 argb=(a shl 24)+(r shl 16)+(g shl 8)+b ... |