Request:PF_A8 ReadPixel returning only alpha value

BlitzMax Forums/BlitzMax Programming/Request:PF_A8 ReadPixel returning only alpha value

BlackSp1der(Posted 2006) [#1]
I think that when you're working with PF_A8 pixmaps (only alpha channel) the ReadPixel function should return only the alpha channel with zeros for RGB.

I can mask the returned value with $FF000000, but I think it should return only the alpha value.

Local pixmap:TPixmap=CreatePixmap(1,1,PF_A8)

pixmap.WritePixel(0,0,$FF000000)
Print Hex$(pixmap.ReadPixel(0,0))
If pixmap.ReadPixel(0,0) Then Print "alpha on" Else Print "alpha off"

Print
pixmap.WritePixel(0,0,$00000000)
Print Hex$(pixmap.ReadPixel(0,0))
If pixmap.ReadPixel(0,0) Then Print "alpha on" Else Print "alpha off"


'Module BRL.Pixmap
'
'	Method ReadPixel( x,y )
'		Assert x>=0 And x<width And y>=0 And y<height Else "Pixmap coordinates out of bounds"
'		Local p:Byte Ptr=PixelPtr(x,y)
'		Select format
'		Case PF_A8
'			Return p[0] Shl 24 | $00ffffff <--------------------