mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-09 20:42:21 +01:00
* Restore pattern demo, remove text writing.
git-svn-id: trunk@36400 -
This commit is contained in:
parent
1f4432af6b
commit
6a457fb06c
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -2439,6 +2439,7 @@ packages/fcl-image/examples/Makefile.fpc svneol=native#text/plain
|
||||
packages/fcl-image/examples/drawing.pp svneol=native#text/plain
|
||||
packages/fcl-image/examples/imgconv.pp svneol=native#text/plain
|
||||
packages/fcl-image/examples/interpoldemo.pp svneol=native#text/plain
|
||||
packages/fcl-image/examples/pattern.png -text svneol=unset#image/png
|
||||
packages/fcl-image/examples/xwdtobmp.pas svneol=native#text/plain
|
||||
packages/fcl-image/fpmake.pp svneol=native#text/plain
|
||||
packages/fcl-image/src/bmpcomn.pp svneol=native#text/plain
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{$mode objfpc}{$h+}
|
||||
program Drawing;
|
||||
|
||||
uses classes, sysutils,
|
||||
uses cwstring,classes, sysutils,
|
||||
FPImage, FPCanvas, FPImgCanv, ftFont,
|
||||
FPWritePNG, FPReadPNG;
|
||||
|
||||
@ -9,11 +9,14 @@ const
|
||||
MyColor : TFPColor = (Red: $7FFF; Green: $0000; Blue: $FFFF; Alpha: alphaOpaque);
|
||||
|
||||
procedure DoDraw;
|
||||
var canvas : TFPcustomCAnvas;
|
||||
ci, image : TFPCustomImage;
|
||||
writer : TFPCustomImageWriter;
|
||||
reader : TFPCustomImageReader;
|
||||
f : TFreeTypeFont;
|
||||
|
||||
var
|
||||
canvas : TFPcustomCAnvas;
|
||||
ci,image : TFPCustomImage;
|
||||
writer : TFPCustomImageWriter;
|
||||
reader : TFPCustomImageReader;
|
||||
f : TFreeTypeFont;
|
||||
|
||||
begin
|
||||
f:=Nil;
|
||||
image := TFPMemoryImage.Create (100,100);
|
||||
@ -29,7 +32,7 @@ begin
|
||||
GrayScale := false;
|
||||
end;
|
||||
try
|
||||
// ci.LoadFromFile ('test.png', reader);
|
||||
ci.LoadFromFile ('pattern.png', reader);
|
||||
with Canvas as TFPImageCanvas do
|
||||
begin
|
||||
brush.FPcolor:=colwhite;
|
||||
@ -54,14 +57,14 @@ begin
|
||||
blue := green;
|
||||
end;
|
||||
pen.style := psSolid;
|
||||
|
||||
RelativeBrushImage := true;
|
||||
{
|
||||
brush.image := ci;
|
||||
brush.style := bsimage;
|
||||
with brush.FPColor do
|
||||
green := green div 2;
|
||||
Ellipse (11,11, 89,89);
|
||||
}
|
||||
|
||||
|
||||
brush.style := bsSolid;
|
||||
brush.FPColor := MyColor;
|
||||
@ -74,36 +77,19 @@ begin
|
||||
pen.FPColor := colCyan;
|
||||
ellipseC (50,50, 1,1);
|
||||
|
||||
InitEngine;
|
||||
F:=TFreeTypeFont.Create;
|
||||
F.Angle:=StrToFloatDef(ParamStr(1),0);
|
||||
Font:=F;
|
||||
{$IFDEF UNIX}
|
||||
Font.Name:='/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf';
|
||||
{$ELSE}
|
||||
// On windows, this should be present
|
||||
Font.Name:='arial.ttf';
|
||||
{$ENDIF}
|
||||
Font.Size:=10;
|
||||
Font.FPColor:=colWhite;
|
||||
// Font.Orientation:=StrToIntDef(ParamStr(1),0);
|
||||
|
||||
Canvas.TextOut(10,90,'abc');
|
||||
end;
|
||||
writeln ('Saving to "DrawTest.png" for inspection !');
|
||||
image.SaveToFile ('DrawTest.png', writer);
|
||||
image.SaveToFile ('DrawTest.png', writer);
|
||||
finally
|
||||
F.Free;
|
||||
Canvas.Free;
|
||||
ci.free;
|
||||
image.Free;
|
||||
writer.Free;
|
||||
ci.free;
|
||||
reader.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
// DefaultFontPath := '/usr/share/fonts/truetype/ttf-dejavu/';
|
||||
DoDraw;
|
||||
|
||||
end.
|
||||
|
||||
BIN
packages/fcl-image/examples/pattern.png
Normal file
BIN
packages/fcl-image/examples/pattern.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 471 B |
Loading…
Reference in New Issue
Block a user