[Truco Delphi] Invertir un Bitmap
function InvertBmp(SourceBmp:Tbitmap): TBitMap; var i,j :longint; tmp : TBitMap; Red, Green, Blue: Byte; PixelColor: Longint; begin tmp := TBitmap.Create; tmp.width := SourceBmp.width; tmp.height := SourceBmp.height; for i := 0 to SourceBmp.width-1 do begin for j := 0 to SourceBmp.height-1 do begin PixelColor := ColorToRGB(SourceBmp.Canvas.Pixels[i,j]); Red := PixelColor; Green := PixelColor shr 8; Blue := PixelColor shr 16; red := 255-red; green := 255-green; blue := 255-blue; tmp.canvas.pixels[i,j] := (red shl 8+green) shl 8+blue; end; end; Result := tmp; end;
Saludos!