Changeset 22 for branches/gbitmap/GImage.pas
- Timestamp:
- Dec 22, 2016, 1:13:04 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gbitmap/GImage.pas
r21 r22 24 24 25 25 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;35 26 36 27 { TBImage } … … 57 48 58 49 TBPixmapClass = class of TBImage; 59 60 { TBImageRGB8 }61 62 TBImageRGB8 = class(TBImage)63 protected64 procedure SetSize(AValue: TPoint); override;65 public66 Pixmap: TGPixmap<TColorRGB8>;67 procedure Fill(Color: IBColor); override;68 constructor Create;69 destructor Destroy; override;70 end;71 50 72 51 { TColorFormatChannel } … … 267 246 end; 268 247 269 { TBColorRGB8 }270 271 constructor TBColorRGB8.Create(Color: TColorRGB8);272 begin273 Value := Color;274 end;275 276 procedure TBColorRGB8.SetColorName(ColorName: TColorName);277 begin278 case ColorName of279 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 begin289 Value := TColorRGB8.Create(Random(256), Random(256), Random(256));290 end;291 292 { TBImageRGB8 }293 294 procedure TBImageRGB8.SetSize(AValue: TPoint);295 begin296 inherited;297 Pixmap.Size := AValue;298 end;299 300 procedure TBImageRGB8.Fill(Color: IBColor);301 begin302 if Color is TBColorRGB8 then303 Pixmap.Fill((Color as TBColorRGB8).Value);304 end;305 306 constructor TBImageRGB8.Create;307 begin308 Pixmap := TGPixmap<TColorRGB8>.Create;309 end;310 311 destructor TBImageRGB8.Destroy;312 begin313 FreeAndNil(Pixmap);314 inherited Destroy;315 end;316 317 248 { TBImage } 318 249
Note:
See TracChangeset
for help on using the changeset viewer.