mit hilfe div. weiterer Post jetzt endlich am Ziel
Delphi-Quellcode:
procedure TForm2.SingleChannelImage(
Bit : TBitmap;
c : integer );
var
bitdata1 : TBitmapData;
i : integer;
j : integer;
Color : TAlphaColor;
begin
if ( Bit.Map( TMapAccess.maReadWrite, bitdata1 ) )
then
try
for i := 0 to Bit.width - 1 do
for j := 0 to Bit.height - 1 do
begin
begin
Color := PixelToAlphaColor( @PAlphaColorArray( bitdata1.Data )
[ j * ( bitdata1.Pitch div PixelFormatBytes[ Bit.PixelFormat ]
) + 1 * i ], Bit.PixelFormat );
case c of
1 :
begin
TAlphaColorRec( Color ).B := 0;
TAlphaColorRec( Color ).G := 0;
end;
2 :
begin
TAlphaColorRec( Color ).R := 0;
TAlphaColorRec( Color ).G := 0;
end;
3 :
begin
TAlphaColorRec( Color ).B := 0;
TAlphaColorRec( Color ).R := 0;
end;
end;
AlphaColorToPixel( Color, @PAlphaColorArray( bitdata1.Data )
[ j * ( bitdata1.Pitch div PixelFormatBytes[ Bit.PixelFormat ]
) + 1 * i ], Bit.PixelFormat );
end;
end;
finally
Bit.Unmap( bitdata1 );
end;
end;