Changeset 39 for trunk/Packages/FastGraphics/ColorFormats/UColorGray4.pas
- Timestamp:
- Oct 10, 2018, 3:48:47 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/FastGraphics/ColorFormats/UColorGray4.pas
r30 r39 31 31 procedure SetColorName(ColorName: TColorName); override; 32 32 procedure SetRandom; override; 33 procedure SetColor(Color: TColor); override; 33 34 end; 34 35 35 36 { TBPixmapGray4 } 36 37 37 TBPixmapGray4 = class(TB Image)38 TBPixmapGray4 = class(TBPixmap) 38 39 private 39 40 FillCallBack: TGetColorPos; 40 41 function FillGetColor(Position: TPoint): TColorGray4; 42 function NegativeFunc(Position: TPoint): TColorGray4; 41 43 protected 42 44 procedure SetSize(AValue: TPoint); override; … … 45 47 public 46 48 Pixmap: TPixmapGray4; 49 procedure Flip; override; 50 procedure Mirror; override; 51 procedure Negative; override; 47 52 procedure Fill(Color: IBColor); override; 48 53 procedure Fill(Func: TGetColorPos); override; … … 70 75 BitDepth := 4; 71 76 BackendColorClass := TBColorGray4; 72 Backend ImageClass := TBPixmapGray4;77 BackendPixmapClass := TBPixmapGray4; 73 78 AddChannel('Gray', 0, 4); 74 79 end; … … 110 115 end; 111 116 117 procedure TBColorGray4.SetColor(Color: TColor); 118 begin 119 Value := ((Color shr 0) and $ff + (Color shr 8) and $ff + (Color shr 16) and $ff) div (3 * 16); 120 end; 121 112 122 { TBPixmapGray2 } 113 123 … … 115 125 begin 116 126 Result := (FillCallBack(Position) as TBColorGray4).Value; 127 end; 128 129 function TBPixmapGray4.NegativeFunc(Position: TPoint): TColorGray4; 130 var 131 C: TColorGray4; 132 begin 133 C := Pixmap.Pixels[Position.X, Position.Y]; 134 Result := 16 - (C and $f); 117 135 end; 118 136 … … 131 149 begin 132 150 Pixmap.Pixels[X, Y] := (AValue as TBColorGray4).Value; 151 end; 152 153 procedure TBPixmapGray4.Flip; 154 begin 155 Pixmap.Flip; 156 end; 157 158 procedure TBPixmapGray4.Mirror; 159 begin 160 Pixmap.Mirror; 161 end; 162 163 procedure TBPixmapGray4.Negative; 164 begin 165 Pixmap.Fill(NegativeFunc); 133 166 end; 134 167
Note:
See TracChangeset
for help on using the changeset viewer.