My system adds tiles to a texture by reading in a bitmap image, and then to ensure the proper alpha channels it goes through it pixel by pixel, checking the colours using ReadPixelFast.
If the pixel is all black (i.e. $000000) then the game will make it fully transparent ($00), otherwise it will make it fully opaque ($FF).
However, one of my graphics uses $010101 to represent black. Ideally my system will make this fully opaque, yet it comes through transparent.
The code that adds the image to the texture is as follows:
I've also noticed in the past that $FFFFFF, which is white, has been coming out something like $F8FAF8 or thereabouts. What's going on that I'm losing values? This means I cannot use black in any of my images, which isn't acceptable.
Any help appreciated.
If the pixel is all black (i.e. $000000) then the game will make it fully transparent ($00), otherwise it will make it fully opaque ($FF).
However, one of my graphics uses $010101 to represent black. Ideally my system will make this fully opaque, yet it comes through transparent.
The code that adds the image to the texture is as follows:
Function E2_editTexture(image, texture, x, y) LockBuffer TextureBuffer(texture) LockBuffer ImageBuffer(image) width = ImageWidth(image) height = ImageHeight(image) For a = 0 To height-1 For b = 0 To width-1 colour = ReadPixelFast (b, a, ImageBuffer(image)) If (colour And $00FFFFFF) = $00000000 Then WritePixelFast x+b, y+a, $00000000, TextureBuffer(texture) Else colour = (colour Or $FF000000) WritePixelFast x+b, y+a, colour, TextureBuffer(texture) End If Next Next UnlockBuffer TextureBuffer(texture) UnlockBuffer ImageBuffer(image) End Function
I've also noticed in the past that $FFFFFF, which is white, has been coming out something like $F8FAF8 or thereabouts. What's going on that I'm losing values? This means I cannot use black in any of my images, which isn't acceptable.
Any help appreciated.