Pixel compare problem

BlitzPlus Forums/BlitzPlus Programming/Pixel compare problem

dgroncki(Posted 2003) [#1]
Hello All,
I'm trying to load in an image to use as an overlay and write its pixels overtop another image IF the pixel is not the same color as my mask color.
I've tried this:
backColorHex% = GetRGB(BACKCOLOR_R, BACKCOLOR_G, BACKCOLOR_B)
SetBuffer ImageBuffer(hImg)
LockBuffer

For y = 0 To GLYPH_HEIGHT - 1
    For x = 0 To GLYPH_WIDTH - 1
	pixCol% = ReadPixel(x,y,ImageBuffer(overImg))
	DebugLog "pixCol(" + pixCol + ")   backColorHex(" + backColorHex + ")"
	If (pixCol <> backColorHex) Then
		CopyPixel x,y,ImageBuffer(overImg),(GLYPH_OVERLAY_START_X + x),(GLYPH_OVERLAY_START_Y + y),ImageBuffer(hImg)
	EndIf
    Next
Next
FreeImage overImg

where...
Const BACKCOLOR_R = 119
Const BACKCOLOR_G = 112
Const BACKCOLOR_B = 126


My problem seems to be the color comparison. when I write out what backColorHex% is, it prints 7827582.

But when I look at the values that ReadPixel is producing (pixCol), I'm getting numbers like -8949634.

What am I doing wrong?

thanks...Dave


Floyd(Posted 2003) [#2]
Answer is here.


dgroncki(Posted 2003) [#3]
Floyd,
Thanks! I'll try it when I get home.
Dave