Ignore:
Timestamp:
Jan 4, 2017, 11:49:56 PM (8 years ago)
Author:
chronos
Message:
  • Added: Pen tool to draw pixels by mouse with selected color.
  • Added: Mirror and Flip image operation.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/FastGraphics/UGGraphics.pas

    r30 r31  
    7171    procedure Fill(Color: TGColor); overload;
    7272    procedure Fill(Func: TGGetColor); overload;
     73    procedure Mirror;
     74    procedure Flip;
    7375    function GetDataSize: Int64; virtual;
    7476    property Canvas: TGCanvas<TGColor> read FCanvas;
     
    278280end;
    279281
     282procedure TGPixmap<TGColor>.Mirror;
     283var
     284  X, Y: Integer;
     285  Color: TGColor;
     286begin
     287  for Y := 0 to FSize.Y - 1 do
     288    for X := 0 to FSize.X div 2 - 1 do begin
     289      Color := Pixels[X, Y];
     290      Pixels[X, Y] := Pixels[Size.X - 1 - X, Y];
     291      Pixels[Size.X - 1 - X, Y] := Color;
     292    end;
     293end;
     294
     295procedure TGPixmap<TGColor>.Flip;
     296var
     297  X, Y: Integer;
     298  Color: TGColor;
     299begin
     300  for Y := 0 to FSize.Y div 2 - 1 do
     301    for X := 0 to FSize.X - 1 do begin
     302      Color := Pixels[X, Y];
     303      Pixels[X, Y] := Pixels[X, Size.Y - 1 - Y];
     304      Pixels[X, Size.Y - 1 - Y] := Color;
     305    end;
     306end;
     307
    280308{ TGPen }
    281309
Note: See TracChangeset for help on using the changeset viewer.