How to change the colours of a bitmap that is loaded into a TImage (Views: 30)
Problem/Question/Abstract: How do I change the colors of a bitmap that is loaded into a TImage object? I have bitmaps that are displayed with a white background. I want to change all of the white pixels to black and all of the black pixels to white. Answer: Go over the picture with scanlines or whatever: { ... } for x := 0 to width - 1 do for y := 0 to height - 1 do begin tc := img.canvas.pixels[x, y]; if tc = clBlack then img.canvas.pixels[x, y] := clWhite; if tc = clWhite then img.canvas.pixels[x, y] := clBlack; end; |