diff --git a/.gitattributes b/.gitattributes index 272339702d..8fdfa6dfa4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/packages/fcl-image/examples/drawing.pp b/packages/fcl-image/examples/drawing.pp index 1eadcaf04c..3cae355246 100644 --- a/packages/fcl-image/examples/drawing.pp +++ b/packages/fcl-image/examples/drawing.pp @@ -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. diff --git a/packages/fcl-image/examples/pattern.png b/packages/fcl-image/examples/pattern.png new file mode 100644 index 0000000000..106e78f437 Binary files /dev/null and b/packages/fcl-image/examples/pattern.png differ