procedure TMainForm.PesudocolorClick(Sender: TObject); var
p: PByteArray;
x, y: Integer;
Bmp: TBitmap;
Gray: byte;
begin
Bmp := TBitmap.Create;
Bmp.Assign(ChildForm.Image1.Picture.Bitmap);
Bmp.PixelFormat := pf24Bit;
for y := 0 to Bmp.Height - 1 do
begin
p := Bmp.scanline[y];
for x := 0 to Bmp.Width - 1 do
begin
Gray := Round(p[x * 3 + 2] * 0.3 + p[x * 3 + 1] * 0.59 + p[x
* 3]
* 0.11);
if gray < 63 then
begin
p[x * 3 + 2] := 0;
p[x * 3 + 1] := 254 - 4 * gray;
p[x * 3] := 255;
end;
if (64 <= gray) and (gray < 127) then
begin
p[x * 3 + 2] := 0;
p[x * 3 + 1] := 4 * gray - 254;
p[x * 3] := 510 - 4 * gray;
end;
if (128 <= gray) and (gray < 191) then
begin
p[x * 3 + 2] := 4 * gray - 510;
p[x * 3 + 1] := 255;
p[x * 3] := 0;
end;
if (192 <= gray) then
begin
p[x * 3 + 2] := 255;
p[x * 3 + 1] := 1022 - 4 * gray;
p[x * 3] := 0;
end;
end;
end;
ChildForm.Image1.Picture.Bitmap.Assign(Bmp);
Bmp.Free;
end;