Einzelnen Beitrag anzeigen

bernhard_LA

Registriert seit: 8. Jun 2009
Ort: Bayern
1.120 Beiträge
 
Delphi 11 Alexandria
 
#4

AW: Bildverarbeitung unter FMX und dann FMLinux ....

  Alt 22. Jul 2018, 09:35
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;

Geändert von bernhard_LA (22. Jul 2018 um 09:38 Uhr)
  Mit Zitat antworten Zitat