Ignore:
Timestamp:
May 4, 2018, 1:36:00 PM (7 years ago)
Author:
chronos
Message:
  • Modified: Drawing using pen with connected lines instead of individual pixels.
  • Added: Negative image function for RGB8 format.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/FastGraphics/ColorFormats/UColorRGB8.pas

    r31 r36  
    4747    FillCallBack: TGetColorPos;
    4848    function FillGetColor(Position: TPoint): TColorRGB8;
     49    function NegativeFunc(Position: TPoint): TColorRGB8;
    4950  protected
    5051    function GetPixel(X, Y: Integer): IBColor;  override;
     
    5556    procedure Mirror; override;
    5657    procedure Flip; override;
     58    procedure Negative; override;
    5759    procedure Fill(Color: IBColor); override;
    5860    procedure Fill(Func: TGetColorPos); override;
     61    procedure Line(P1, P2: TPoint; Color: IBColor); override;
    5962    procedure PaintToCanvas(Canvas: TCanvas); override;
    6063    procedure PaintToCanvas(Canvas: TCanvas; Rect: TRect); override;
     
    143146end;
    144147
     148function TBPixmapRGB8.NegativeFunc(Position: TPoint): TColorRGB8;
     149var
     150  C: TColorRGB8;
     151begin
     152  C := Pixmap.Pixels[Position.X, Position.Y];
     153  Result.R := 255 - C.R;
     154  Result.G := 255 - C.G;
     155  Result.B := 255 - C.B;
     156end;
     157
    145158function TBPixmapRGB8.GetPixel(X, Y: Integer): IBColor;
    146159begin
     
    169182end;
    170183
     184procedure TBPixmapRGB8.Negative;
     185begin
     186  Pixmap.Fill(NegativeFunc);
     187end;
     188
    171189procedure TBPixmapRGB8.Fill(Color: IBColor);
    172190begin
     
    181199end;
    182200
     201procedure TBPixmapRGB8.Line(P1, P2: TPoint; Color: IBColor);
     202begin
     203  Pixmap.Canvas.Pen.Color := (Color as TBColorRGB8).Value;
     204  Pixmap.Canvas.Pen.MoveTo(P1);
     205  Pixmap.Canvas.Pen.LineTo(P2);
     206end;
     207
    183208procedure TBPixmapRGB8.PaintToCanvas(Canvas: TCanvas);
    184209begin
Note: See TracChangeset for help on using the changeset viewer.