Changeset 472 for GraphicTest/Packages/bgrabitmap/bgragradientscanner.pas
- Timestamp:
- Apr 9, 2015, 9:58:36 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GraphicTest/Packages/bgrabitmap/bgragradientscanner.pas
r452 r472 108 108 end; 109 109 110 { TBGRAConstantScanner } 111 112 TBGRAConstantScanner = class(TBGRAGradientScanner) 113 constructor Create(c: TBGRAPixel); 114 end; 115 116 { TBGRARandomScanner } 117 118 TBGRARandomScanner = class(TBGRACustomScanner) 119 private 120 FOpacity: byte; 121 FGrayscale: boolean; 122 public 123 constructor Create(AGrayscale: Boolean; AOpacity: byte); 124 function ScanAtInteger({%H-}X, {%H-}Y: integer): TBGRAPixel; override; 125 function ScanNextPixel: TBGRAPixel; override; 126 function ScanAt({%H-}X, {%H-}Y: Single): TBGRAPixel; override; 127 end; 128 110 129 { TBGRAGradientTriangleScanner } 111 130 … … 184 203 185 204 uses BGRABlend; 205 206 { TBGRAConstantScanner } 207 208 constructor TBGRAConstantScanner.Create(c: TBGRAPixel); 209 begin 210 inherited Create(c,c,gtLinear,PointF(0,0),PointF(0,0),false); 211 end; 212 213 { TBGRARandomScanner } 214 215 constructor TBGRARandomScanner.Create(AGrayscale: Boolean; AOpacity: byte); 216 begin 217 FGrayscale:= AGrayscale; 218 FOpacity:= AOpacity; 219 end; 220 221 function TBGRARandomScanner.ScanAtInteger(X, Y: integer): TBGRAPixel; 222 begin 223 Result:=ScanNextPixel; 224 end; 225 226 function TBGRARandomScanner.ScanNextPixel: TBGRAPixel; 227 begin 228 if FGrayscale then 229 begin 230 result.red := random(256); 231 result.green := result.red; 232 result.blue := result.red; 233 result.alpha:= FOpacity; 234 end else 235 Result:= BGRA(random(256),random(256),random(256),FOpacity); 236 end; 237 238 function TBGRARandomScanner.ScanAt(X, Y: Single): TBGRAPixel; 239 begin 240 Result:=ScanNextPixel; 241 end; 186 242 187 243 { TBGRAHueGradient } … … 758 814 InitScanInline(X,Y); 759 815 if FVertical then 760 FHorizColor := Scan At(X,Y);816 FHorizColor := ScanNextInline; 761 817 end; 762 818 … … 1247 1303 end; 1248 1304 1305 initialization 1306 1307 Randomize; 1308 1249 1309 end. 1250 1310
Note:
See TracChangeset
for help on using the changeset viewer.