Ignore:
Timestamp:
Oct 10, 2018, 3:48:47 PM (6 years ago)
Author:
chronos
Message:
  • Added: Mirror, Flip, Gradient, Negative for 4-bit gray image.
Location:
trunk/Packages/FastGraphics/ColorFormats
Files:
4 edited

Legend:

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

    r32 r39  
    3636  { TBPixmapGray1 }
    3737
    38   TBPixmapGray1 = class(TBImage)
     38  TBPixmapGray1 = class(TBPixmap)
    3939  private
    4040    FillCallBack: TGetColorPos;
     
    7373  BitDepth := 1;
    7474  BackendColorClass := TBColorGray1;
    75   BackendImageClass := TBPixmapGray1;
     75  BackendPixmapClass := TBPixmapGray1;
    7676  AddChannel('Gray', 0, 1);
    7777end;
  • trunk/Packages/FastGraphics/ColorFormats/UColorGray2.pas

    r30 r39  
    3535  { TBPixmapGray2 }
    3636
    37   TBPixmapGray2 = class(TBImage)
     37  TBPixmapGray2 = class(TBPixmap)
    3838  private
    3939    FillCallBack: TGetColorPos;
     
    7171  BitDepth := 2;
    7272  BackendColorClass := TBColorGray2;
    73   BackendImageClass := TBPixmapGray2;
     73  BackendPixmapClass := TBPixmapGray2;
    7474  AddChannel('Gray', 0, 2);
    7575end;
  • trunk/Packages/FastGraphics/ColorFormats/UColorGray4.pas

    r30 r39  
    3131    procedure SetColorName(ColorName: TColorName); override;
    3232    procedure SetRandom; override;
     33    procedure SetColor(Color: TColor); override;
    3334  end;
    3435
    3536  { TBPixmapGray4 }
    3637
    37   TBPixmapGray4 = class(TBImage)
     38  TBPixmapGray4 = class(TBPixmap)
    3839  private
    3940    FillCallBack: TGetColorPos;
    4041    function FillGetColor(Position: TPoint): TColorGray4;
     42    function NegativeFunc(Position: TPoint): TColorGray4;
    4143  protected
    4244    procedure SetSize(AValue: TPoint); override;
     
    4547  public
    4648    Pixmap: TPixmapGray4;
     49    procedure Flip; override;
     50    procedure Mirror; override;
     51    procedure Negative; override;
    4752    procedure Fill(Color: IBColor); override;
    4853    procedure Fill(Func: TGetColorPos); override;
     
    7075  BitDepth := 4;
    7176  BackendColorClass := TBColorGray4;
    72   BackendImageClass := TBPixmapGray4;
     77  BackendPixmapClass := TBPixmapGray4;
    7378  AddChannel('Gray', 0, 4);
    7479end;
     
    110115end;
    111116
     117procedure TBColorGray4.SetColor(Color: TColor);
     118begin
     119  Value := ((Color shr 0) and $ff + (Color shr 8) and $ff + (Color shr 16) and $ff) div (3 * 16);
     120end;
     121
    112122{ TBPixmapGray2 }
    113123
     
    115125begin
    116126  Result := (FillCallBack(Position) as TBColorGray4).Value;
     127end;
     128
     129function TBPixmapGray4.NegativeFunc(Position: TPoint): TColorGray4;
     130var
     131  C: TColorGray4;
     132begin
     133  C := Pixmap.Pixels[Position.X, Position.Y];
     134  Result := 16 - (C and $f);
    117135end;
    118136
     
    131149begin
    132150  Pixmap.Pixels[X, Y] := (AValue as TBColorGray4).Value;
     151end;
     152
     153procedure TBPixmapGray4.Flip;
     154begin
     155  Pixmap.Flip;
     156end;
     157
     158procedure TBPixmapGray4.Mirror;
     159begin
     160  Pixmap.Mirror;
     161end;
     162
     163procedure TBPixmapGray4.Negative;
     164begin
     165  Pixmap.Fill(NegativeFunc);
    133166end;
    134167
  • trunk/Packages/FastGraphics/ColorFormats/UColorRGB8.pas

    r36 r39  
    4343  { TBPixmapRGB8 }
    4444
    45   TBPixmapRGB8 = class(TBImage)
     45  TBPixmapRGB8 = class(TBPixmap)
    4646  private
    4747    FillCallBack: TGetColorPos;
     
    8181  BitDepth := 24;
    8282  Name := 'RGB8';
    83   BackendImageClass := TBPixmapRGB8;
     83  BackendPixmapClass := TBPixmapRGB8;
    8484  BackendColorClass := TBColorRGB8;
    8585  AddChannel('Red', 0, 8);
Note: See TracChangeset for help on using the changeset viewer.