Changeset 23 for branches/gbitmap/ColorFormats/UColorGray2.pas
- Timestamp:
- Dec 22, 2016, 1:20:06 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gbitmap/ColorFormats/UColorGray2.pas
r21 r23 6 6 7 7 uses 8 Classes, SysUtils, Graphics, GPixmap, GImage;8 Classes, SysUtils, Graphics, UGGraphics, UFGraphics; 9 9 10 10 type … … 20 20 21 21 TPixmapGray2 = class(TGPixmapBit<TColorGray2>) 22 function Gray2ToColor(Value: TColorGray2): Graphics.TColor;22 function Gray2ToColor(Value: TColorGray2): TColor; 23 23 end; 24 24 … … 32 32 end; 33 33 34 { TB ImageGray2 }34 { TBPixmapGray2 } 35 35 36 TB ImageGray2 = class(TBImage)36 TBPixmapGray2 = class(TBImage) 37 37 private 38 38 FillCallBack: TGetColorPos; … … 65 65 BitDepth := 2; 66 66 BackendColorClass := TBColorGray2; 67 BackendImageClass := TB ImageGray2;67 BackendImageClass := TBPixmapGray2; 68 68 AddChannel('Gray', 0, 2); 69 69 end; … … 92 92 end; 93 93 94 { TB ImageGray2 }94 { TBPixmapGray2 } 95 95 96 function TB ImageGray2.FillGetColor(Position: TPoint): TColorGray2;96 function TBPixmapGray2.FillGetColor(Position: TPoint): TColorGray2; 97 97 begin 98 98 Result := (FillCallBack(Position) as TBColorGray2).Value; 99 99 end; 100 100 101 procedure TB ImageGray2.SetSize(AValue: TPoint);101 procedure TBPixmapGray2.SetSize(AValue: TPoint); 102 102 begin 103 103 inherited; … … 105 105 end; 106 106 107 function TB ImageGray2.GetPixel(X, Y: Integer): IBColor;107 function TBPixmapGray2.GetPixel(X, Y: Integer): IBColor; 108 108 begin 109 109 Result := TBColorGray2.Create(Pixmap.Pixels[X, Y]); 110 110 end; 111 111 112 procedure TB ImageGray2.SetPixel(X, Y: Integer; AValue: IBColor);112 procedure TBPixmapGray2.SetPixel(X, Y: Integer; AValue: IBColor); 113 113 begin 114 114 Pixmap.Pixels[X, Y] := (AValue as TBColorGray2).Value; 115 115 end; 116 116 117 procedure TB ImageGray2.Fill(Color: IBColor);117 procedure TBPixmapGray2.Fill(Color: IBColor); 118 118 begin 119 119 if Color is TBColorGray2 then … … 121 121 end; 122 122 123 procedure TB ImageGray2.Fill(Func: TGetColorPos);123 procedure TBPixmapGray2.Fill(Func: TGetColorPos); 124 124 begin 125 125 FillCallBack := Func; … … 127 127 end; 128 128 129 procedure TB ImageGray2.PaintToCanvas(Canvas: TCanvas);129 procedure TBPixmapGray2.PaintToCanvas(Canvas: TCanvas); 130 130 begin 131 131 Pixmap.PaintToCanvas(Canvas, Pixmap.Gray2ToColor); 132 132 end; 133 133 134 function TB ImageGray2.GetDataSize: Integer;134 function TBPixmapGray2.GetDataSize: Integer; 135 135 begin 136 136 Result := Pixmap.GetDataSize; 137 137 end; 138 138 139 constructor TB ImageGray2.Create;139 constructor TBPixmapGray2.Create; 140 140 begin 141 141 Pixmap := TPixmapGray2.Create; … … 143 143 end; 144 144 145 destructor TB ImageGray2.Destroy;145 destructor TBPixmapGray2.Destroy; 146 146 begin 147 147 FreeAndNil(Pixmap); … … 151 151 { TPixmapGray2 } 152 152 153 function TPixmapGray2.Gray2ToColor(Value: TColorGray2): Graphics.TColor;153 function TPixmapGray2.Gray2ToColor(Value: TColorGray2): TColor; 154 154 begin 155 155 Value := (Value and $3) * (255 div (4 - 1));
Note:
See TracChangeset
for help on using the changeset viewer.