画像の各RGB値を反転させます。非常にシンプルな処理なので特に説明はいらないでしょう。このサンプルコードではビット演算を行っていますが、
Dest := 255 - Source;
としても同様の結果が得られます。
procedure NegaPosi(Bitmap: TBitmap);
// ネガポジ反転
var
X, Y: Integer;
pLine: PLine24;
begin
Bitmap.PixelFormat := pf24bit;
for Y := 0 to Bitmap.Height -1 do
begin
pLine := Bitmap.ScanLine[Y];
for X := 0 to Bitmap.Width -1 do
with pLine^[X] do
begin
R := R xor $FF;
G := G xor $FF;
B := B xor $FF;
end;
end;
if Assigned(Bitmap.OnChange) then
Bitmap.OnChange(Bitmap);
end;
|