Comments

: Hi,: : Here's my code :: : I am trying to change all the blue pixels in a bitmap to : a color I choose.: : 2 questions : : 1) I would like to know how to compare a Bitmap byte color: with a TColor Value ?: 2) Is there a better way of doing this ?: : [code]: var: liY, liX : Integer;: loGusBitmap : TBitmap;: loBytes : PByteArray;: ...: For liY := 0 to loGusBitmap.Height- 1 do: begin: loBytes := loGusBitmap.ScanLine[liY];: For liX := 0 to loGusBitmap.Width - 1 do: begin: if (loBytes[liX] = clBlue) // Problem Here !!!!!: then loBytes[liX] := ReportColor;: end;: end;: ImaGustaveBleu.Canvas.Draw(0,0,loGusBitmap);: loGusBitmap.Free;: ...: [/code]: I would choose to use the TBitmap.Canvas.Pixels() property instead of the ScanLine.The error is generated not in the comparison itself, but in the fact that loBytes is a pointer, which points to an array of byte. In your case you need to change the code to get the array itself. Here is how:[code] if (loBytes^[liX] = integer(clBlue)) [/code]The typecast of clBlue into an integer is not really necessary I believe, but I included it to be on the save side.