Changeset 36 for trunk/Packages


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.
Location:
trunk/Packages/FastGraphics
Files:
3 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
  • trunk/Packages/FastGraphics/UFGraphics.pas

    r33 r36  
    4242    procedure Mirror; virtual;
    4343    procedure Flip; virtual;
     44    procedure Negative; virtual;
    4445    procedure Fill(Color: IBColor); virtual; overload;
    4546    procedure Fill(Func: TGetColorPos); virtual; overload;
     
    391392procedure TBImage.Mirror;
    392393begin
    393 
    394394end;
    395395
    396396procedure TBImage.Flip;
     397begin
     398end;
     399
     400procedure TBImage.Negative;
    397401begin
    398402end;
     
    505509procedure TFPixmap.Negative;
    506510begin
    507 
     511  FBackend.Negative;
    508512end;
    509513
  • trunk/Packages/FastGraphics/UGGraphics.pas

    r35 r36  
    344344      for X := 0 to FSize.X - 1 do begin
    345345        if (X >= 0) and (X < FSize.X) and (Y >= 0) and (Y < FSize.Y) then
    346           PInteger(DstPtr.Pixel)^ := ColorConvertFunc(PInteger(SrcPtr.Pixel)^);
     346          PGColor(DstPtr.Pixel)^ := ColorConvertFunc(PInteger(SrcPtr.Pixel)^);
    347347        SrcPtr.NextPixel;
    348348        DstPtr.NextPixel;
Note: See TracChangeset for help on using the changeset viewer.