Ignore:
Timestamp:
Dec 21, 2016, 3:49:27 PM (8 years ago)
Author:
chronos
Message:
  • Modified: For single class layer TPixmap and TColor is used. They have TBPixmap and TBColor backends pairs.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/gbitmap/UFormMain.pas

    r19 r20  
    66
    77uses
    8   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Menus,
    9   ExtCtrls, StdCtrls, GPixmap, UPixmapSpecialized, GImage;
     8  GImage, Classes, SysUtils, FileUtil, Forms, Graphics, Controls, Dialogs, Menus,
     9  ExtCtrls, StdCtrls, GPixmap, UPixmapSpecialized;
    1010
    1111type
     
    2828    function RGB8Random(Position: TPoint): TColorRGB8;
    2929    function RGB16Random(Position: TPoint): TColorRGB16;
     30    function ColorRandom(Position: TPoint; ColorFormat: TColorFormat): GImage.TColor;
    3031  public
    3132    procedure TestGray1;
     
    9697end;
    9798
     99function TForm1.ColorRandom(Position: TPoint; ColorFormat: TColorFormat): GImage.TColor;
     100begin
     101  Result := GImage.TColor.Create;
     102  Result.ColorFormat := ColorFormat;
     103  Result.SetRandom;
     104end;
     105
    98106procedure TForm1.TestGray1;
    99107var
     
    262270procedure TForm1.TestImage;
    263271var
    264   Image: TGImage;
    265   Color: TBColorGray1;
    266 begin
    267   Image := TGImage.Create;
     272  Image: GImage.TPixmap;
     273begin
     274  Image := GImage.TPixmap.Create;
    268275  with Image do begin
    269276    Size := Point(100, 100);
    270     ColorFormat := cfGray1;
    271     Color := TBColorGray1.Create;
    272     Color.Value := 1;
    273     Fill(Color);
    274     Random;
     277    ColorFormat := cfGray2;
     278    Fill(GImage.TColor.Create(ColorFormat, cnWhite));
     279    Pixels[0, 0] := GImage.TColor.Create(ColorFormat, cnBlack);
     280    Fill(ColorRandom);
    275281    PaintToCanvas(Image1.Picture.Bitmap.Canvas);
     282    Label1.Caption := IntToStr(GetDataSize);
    276283    Free;
    277284  end;
Note: See TracChangeset for help on using the changeset viewer.