PNG problems on different machines?

BlitzPlus Forums/BlitzPlus Programming/PNG problems on different machines?

dgroncki(Posted 2003) [#1]
I have some code that is suppose to overlay a hexagonal game board "square" with another image (to represent an "on" state). Here is some of the code:

; ----------------------
; composite image
; ----------------------
backColorHex% = GetRGB(BACKCOLOR_R, BACKCOLOR_G, BACKCOLOR_B)

SetBuffer ImageBuffer(boardImg)
LockBuffer
For y = 0 To HEX_ON_IMG_HEIGHT - 1
	For x = 0 To HEX_ON_IMG_WIDTH - 1
		pixCol% = ReadPixel(x,y,ImageBuffer(imgToUse))
		pixCol% = (pixCol% And $FFFFFF)
		If (pixCol <> backColorHex) Then
			CopyPixel x,y,ImageBuffer(imgToUse), _
                        (HEX_ON_START_X+bhx+x),(HEX_ON_START_Y+bhy+y),_
                         ImageBuffer(boardImg)
		EndIf
	Next
Next
UnlockBuffer


The important part is what I'm doing with the ReadPixel. I have the overlay image saved as a png file and thanks to an earlier post in a different topic, I had to add the
pixCol% = (pixCol% And $FFFFFF)

statement due to the alpha channel.

On my machine at home, this all works perfectly in that the color from the overlay image equal to the background does not get copied. But at work, my machine does not seem to handle this and I'm getting the entire overlay copied. I cannot install BB so I don't know exactly what is happening, and it has a low-end video card in it, but I don't know if that would make the difference or not? Otherwise, it seems to have no problem with PNG formats in general. Any ideas?

thanks...Dave


Floyd(Posted 2003) [#2]
Maybe the two machines are using different graphics depths.

If 16-bit graphics are used then pixel values will be slightly different.


dgroncki(Posted 2003) [#3]
Floyd,
Thanks! I had been using 16-bit color. I'll try tomorrow at work with a 32-bit version.