Ignore:
Timestamp:
Dec 22, 2016, 1:13:04 PM (8 years ago)
Author:
chronos
Message:
  • Modified: RGB8 related code moved to UColorRGB8 unit.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/gbitmap/GImage.pas

    r21 r22  
    2424
    2525  IBColorClass = class of TBColor;
    26 
    27   { TBColorRGB8 }
    28 
    29   TBColorRGB8 = class(TBColor)
    30     Value: TColorRGB8;
    31     constructor Create(Color: TColorRGB8);
    32     procedure SetColorName(ColorName: TColorName); override;
    33     procedure SetRandom; override;
    34   end;
    3526
    3627  { TBImage }
     
    5748
    5849  TBPixmapClass = class of TBImage;
    59 
    60   { TBImageRGB8 }
    61 
    62   TBImageRGB8 = class(TBImage)
    63   protected
    64     procedure SetSize(AValue: TPoint); override;
    65   public
    66     Pixmap: TGPixmap<TColorRGB8>;
    67     procedure Fill(Color: IBColor); override;
    68     constructor Create;
    69     destructor Destroy; override;
    70   end;
    7150
    7251  { TColorFormatChannel }
     
    267246end;
    268247
    269 { TBColorRGB8 }
    270 
    271 constructor TBColorRGB8.Create(Color: TColorRGB8);
    272 begin
    273   Value := Color;
    274 end;
    275 
    276 procedure TBColorRGB8.SetColorName(ColorName: TColorName);
    277 begin
    278   case ColorName of
    279     cnBlack: Value := TColorRGB8.Create(0, 0, 0);
    280     cnGray: Value := TColorRGB8.Create($80, $80, $80);
    281     cnSilver: Value := TColorRGB8.Create($C0, $C0, $C0);
    282     cnWhite: Value := TColorRGB8.Create($ff, $ff, $ff);
    283     else Value := TColorRGB8.Create(0, 0, 0);;
    284   end;
    285 end;
    286 
    287 procedure TBColorRGB8.SetRandom;
    288 begin
    289   Value := TColorRGB8.Create(Random(256), Random(256), Random(256));
    290 end;
    291 
    292 { TBImageRGB8 }
    293 
    294 procedure TBImageRGB8.SetSize(AValue: TPoint);
    295 begin
    296   inherited;
    297   Pixmap.Size := AValue;
    298 end;
    299 
    300 procedure TBImageRGB8.Fill(Color: IBColor);
    301 begin
    302   if Color is TBColorRGB8 then
    303     Pixmap.Fill((Color as TBColorRGB8).Value);
    304 end;
    305 
    306 constructor TBImageRGB8.Create;
    307 begin
    308   Pixmap := TGPixmap<TColorRGB8>.Create;
    309 end;
    310 
    311 destructor TBImageRGB8.Destroy;
    312 begin
    313   FreeAndNil(Pixmap);
    314   inherited Destroy;
    315 end;
    316 
    317248{ TBImage }
    318249
Note: See TracChangeset for help on using the changeset viewer.