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/ColorFormats/UColorRGB8.pas

    r29 r31  
    3737    constructor Create(Color: TColorRGB8);
    3838    procedure SetColorName(ColorName: TColorName); override;
     39    procedure SetColor(Color: TColor); override;
    3940    procedure SetRandom; override;
    4041  end;
     
    4748    function FillGetColor(Position: TPoint): TColorRGB8;
    4849  protected
     50    function GetPixel(X, Y: Integer): IBColor;  override;
     51    procedure SetPixel(X, Y: Integer; AValue: IBColor); override;
    4952    procedure SetSize(AValue: TPoint); override;
    5053  public
    5154    Pixmap: TPixmapRGB8;
     55    procedure Mirror; override;
     56    procedure Flip; override;
    5257    procedure Fill(Color: IBColor); override;
    5358    procedure Fill(Func: TGetColorPos); override;
     
    121126end;
    122127
     128procedure TBColorRGB8.SetColor(Color: TColor);
     129begin
     130  Value := TColorRGB8.Create((Color shr 0) and $ff, (Color shr 8) and $ff, (Color shr 16) and $ff);
     131end;
     132
    123133procedure TBColorRGB8.SetRandom;
    124134begin
     
    131141begin
    132142  Result := (FillCallBack(Position) as TBColorRGB8).Value;
     143end;
     144
     145function TBPixmapRGB8.GetPixel(X, Y: Integer): IBColor;
     146begin
     147  Result := TBColorRGB8.Create(Pixmap.Pixels[X, Y]);
     148end;
     149
     150procedure TBPixmapRGB8.SetPixel(X, Y: Integer; AValue: IBColor);
     151begin
     152  Pixmap.Pixels[X, Y] := (AValue as TBColorRGB8).Value;
    133153end;
    134154
     
    139159end;
    140160
     161procedure TBPixmapRGB8.Mirror;
     162begin
     163  Pixmap.Mirror;
     164end;
     165
     166procedure TBPixmapRGB8.Flip;
     167begin
     168  Pixmap.Flip;
     169end;
     170
    141171procedure TBPixmapRGB8.Fill(Color: IBColor);
    142172begin
Note: See TracChangeset for help on using the changeset viewer.