* Restore pattern demo, remove text writing.

git-svn-id: trunk@36400 -
This commit is contained in:
michael 2017-06-03 03:46:26 +00:00
parent 1f4432af6b
commit 6a457fb06c
3 changed files with 15 additions and 28 deletions

1
.gitattributes vendored
View File

@ -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

View File

@ -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.

Binary file not shown.

After

Width:  |  Height:  |  Size: 471 B