Changeset 23 for branches/gbitmap/ColorFormats/UColorGray1.pas
- Timestamp:
- Dec 22, 2016, 1:20:06 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gbitmap/ColorFormats/UColorGray1.pas
r21 r23 6 6 7 7 uses 8 Classes, SysUtils, Graphics, GImage, GPixmap;8 Classes, SysUtils, Graphics, UFGraphics, UGGraphics; 9 9 10 10 type … … 20 20 21 21 TPixmapGray1 = class(TGPixmapBit<TColorGray1>) 22 function Gray1ToColor(Value: TColorGray1): Graphics.TColor;22 function Gray1ToColor(Value: TColorGray1): TColor; 23 23 end; 24 24 … … 32 32 end; 33 33 34 { TB ImageGray1 }34 { TBPixmapGray1 } 35 35 36 TB ImageGray1 = class(TBImage)36 TBPixmapGray1 = class(TBImage) 37 37 private 38 38 FillCallBack: TGetColorPos; … … 64 64 BitDepth := 1; 65 65 BackendColorClass := TBColorGray1; 66 BackendImageClass := TB ImageGray1;66 BackendImageClass := TBPixmapGray1; 67 67 AddChannel('Gray', 0, 1); 68 68 end; … … 70 70 { TPixmapGray1 } 71 71 72 function TPixmapGray1.Gray1ToColor(Value: TColorGray1): Graphics.TColor;72 function TPixmapGray1.Gray1ToColor(Value: TColorGray1): TColor; 73 73 begin 74 74 Value := (Value and $1) * $ff; … … 97 97 end; 98 98 99 { TB ImageGray1 }99 { TBPixmapGray1 } 100 100 101 function TB ImageGray1.FillGetColor(Position: TPoint): TColorGray1;101 function TBPixmapGray1.FillGetColor(Position: TPoint): TColorGray1; 102 102 begin 103 103 Result := (FillCallBack(Position) as TBColorGray1).Value; 104 104 end; 105 105 106 procedure TB ImageGray1.SetSize(AValue: TPoint);106 procedure TBPixmapGray1.SetSize(AValue: TPoint); 107 107 begin 108 108 inherited; … … 110 110 end; 111 111 112 function TB ImageGray1.GetPixel(X, Y: Integer): IBColor;112 function TBPixmapGray1.GetPixel(X, Y: Integer): IBColor; 113 113 begin 114 114 Result := TBColorGray1.Create(Pixmap.Pixels[X, Y]); 115 115 end; 116 116 117 procedure TB ImageGray1.SetPixel(X, Y: Integer; AValue: IBColor);117 procedure TBPixmapGray1.SetPixel(X, Y: Integer; AValue: IBColor); 118 118 begin 119 119 Pixmap.Pixels[X, Y] := (AValue as TBColorGray1).Value; 120 120 end; 121 121 122 procedure TB ImageGray1.Fill(Color: IBColor);122 procedure TBPixmapGray1.Fill(Color: IBColor); 123 123 begin 124 124 if Color is TBColorGray1 then … … 126 126 end; 127 127 128 procedure TB ImageGray1.Fill(Func: TGetColorPos);128 procedure TBPixmapGray1.Fill(Func: TGetColorPos); 129 129 begin 130 130 FillCallBack := Func; … … 132 132 end; 133 133 134 procedure TB ImageGray1.PaintToCanvas(Canvas: TCanvas);134 procedure TBPixmapGray1.PaintToCanvas(Canvas: TCanvas); 135 135 begin 136 136 Pixmap.PaintToCanvas(Canvas, Pixmap.Gray1ToColor); 137 137 end; 138 138 139 function TB ImageGray1.GetDataSize: Integer;139 function TBPixmapGray1.GetDataSize: Integer; 140 140 begin 141 141 Result := Pixmap.GetDataSize; 142 142 end; 143 143 144 constructor TB ImageGray1.Create;144 constructor TBPixmapGray1.Create; 145 145 begin 146 146 Pixmap := TPixmapGray1.Create; … … 148 148 end; 149 149 150 destructor TB ImageGray1.Destroy;150 destructor TBPixmapGray1.Destroy; 151 151 begin 152 152 FreeAndNil(Pixmap);
Note:
See TracChangeset
for help on using the changeset viewer.