Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Bildverarbeitung unter FMX und dann FMLinux .... (https://www.delphipraxis.net/197000-bildverarbeitung-unter-fmx-und-dann-fmlinux.html)

bernhard_LA 8. Jul 2018 22:27

Bildverarbeitung unter FMX und dann FMLinux ....
 
wie muss ich diese Funktion überarbeiten, damit die unter FMX und dann später auch unter FMLinux funktioniert ?
Was wird aus Bit.ScanLine am besten?



Delphi-Quellcode:
procedure SingleChannelImage(
  Bit : TBitMap;
  c  : integer );
  type
    PixArray = Array [ 1 .. 3 ] of Byte;
  var
    p : ^PixArray;
    h, w : integer;

  begin

    Bit.PixelFormat := pf24bit;

    For h := 0 to Bit.height - 1 do
      begin
        p := Bit.Scanline[ h ];
        For w := 0 to Bit.width - 1 do
          begin

            case c of
              1 :
                begin
                  { B-Channel }
                  p^[ 2 ] := 0;
                  p^[ 3 ] := 0;
                end;
              2 :
                begin
                  { G-Channel }
                  p^[ 1 ] := 0;
                  p^[ 3 ] := 0;
                end;
              3 :
                begin
                  { R-Channel }
                  p^[ 2 ] := 0;
                  p^[ 1 ] := 0;
                end;
              else

            end;

            inc( p );
          end;
      end;
  end;

TiGü 9. Jul 2018 08:28

AW: Bildverarbeitung unter FMX und dann FMLinux ....
 
Schaue mal das hier mit den Beispielen an:
http://docwiki.embarcadero.com/Libra...cs.TBitmap.Map

Unter FMX laufen die Zugriffe auf dieser Ebene über die Map- und Unmap-Methoden und dem TBitmapData-Record.

bernhard_LA 12. Jul 2018 08:40

AW: Bildverarbeitung unter FMX und dann FMLinux ....
 
kann ich ein Full code sample bekommen, speziell was muss man beachten wenn man FXM dann auch unter Linux verwenden will

bernhard_LA 22. Jul 2018 08:35

AW: Bildverarbeitung unter FMX und dann FMLinux ....
 
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;


Alle Zeitangaben in WEZ +1. Es ist jetzt 04:33 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz