| 1 |
{ |
| 2 |
Copyright 2018-2021 Michalis Kamburelis. |
| 3 |
|
| 4 |
This file is part of "Castle Game Engine". |
| 5 |
|
| 6 |
"Castle Game Engine" is free software; see the file COPYING.txt, |
| 7 |
included in this distribution, for details about the copyright. |
| 8 |
|
| 9 |
"Castle Game Engine" is distributed in the hope that it will be useful, |
| 10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 12 |
|
| 13 |
---------------------------------------------------------------------------- |
| 14 |
} |
| 15 |
|
| 16 |
{ Test TCastleImage.Draw3x3. |
| 17 |
See README.md for details. } |
| 18 |
|
| 19 |
uses SysUtils, |
| 20 |
CastleVectors, CastleColors, CastleImages, CastleRectangles; |
| 21 |
|
| 22 |
var |
| 23 |
SourceImage, DestImage: TCastleImage; |
| 24 |
begin |
| 25 |
try |
| 26 |
SourceImage := LoadImage('castle-data:/box_with_borders.png'); |
| 27 |
|
| 28 |
DestImage := TRGBAlphaImage.Create(1000, 1000); |
| 29 |
DestImage.Clear(Yellow); |
| 30 |
DestImage.DrawFrom3x3(Rectangle(10, 10, 128, 128), |
| 31 |
SourceImage, Vector4Integer(40, 40, 40, 40), dmBlend); |
| 32 |
DestImage.DrawFrom3x3(Rectangle(300, 350, 200, 200), |
| 33 |
SourceImage, Vector4Integer(40, 40, 40, 40), dmBlend); |
| 34 |
DestImage.DrawFrom3x3(Rectangle(500, 500, 500, 500), |
| 35 |
SourceImage, Vector4Integer(40, 40, 40, 40), dmBlend); |
| 36 |
|
| 37 |
SaveImage(DestImage, 'test_castleimage_draw3x3_output.png'); |
| 38 |
finally |
| 39 |
FreeAndNil(SourceImage); |
| 40 |
FreeAndNil(DestImage); |
| 41 |
end; |
| 42 |
end. |