Стартовый пул
This commit is contained in:
BIN
bgrabitmap/test/testglyph/testglyph.ico
Normal file
BIN
bgrabitmap/test/testglyph/testglyph.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 134 KiB |
81
bgrabitmap/test/testglyph/testglyph.lpi
Normal file
81
bgrabitmap/test/testglyph/testglyph.lpi
Normal file
@@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="testglyph"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<VersionInfo>
|
||||
<StringTable ProductVersion=""/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="2">
|
||||
<Item1>
|
||||
<PackageName Value="BGRABitmapPack"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item2>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="testglyph.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="umain.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="FMain"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<Target>
|
||||
<Filename Value="testglyph"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
21
bgrabitmap/test/testglyph/testglyph.lpr
Normal file
21
bgrabitmap/test/testglyph/testglyph.lpr
Normal file
@@ -0,0 +1,21 @@
|
||||
program testglyph;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, umain
|
||||
{ you can add units after this };
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
RequireDerivedFormResource:=True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TFMain, FMain);
|
||||
Application.Run;
|
||||
end.
|
||||
|
10
bgrabitmap/test/testglyph/umain.lfm
Normal file
10
bgrabitmap/test/testglyph/umain.lfm
Normal file
@@ -0,0 +1,10 @@
|
||||
object FMain: TFMain
|
||||
Left = 313
|
||||
Height = 240
|
||||
Top = 35
|
||||
Width = 320
|
||||
Caption = 'Test glyph'
|
||||
OnPaint = FormPaint
|
||||
Position = poDefault
|
||||
LCLVersion = '1.6.0.4'
|
||||
end
|
74
bgrabitmap/test/testglyph/umain.pas
Normal file
74
bgrabitmap/test/testglyph/umain.pas
Normal file
@@ -0,0 +1,74 @@
|
||||
unit umain;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs;
|
||||
|
||||
type
|
||||
|
||||
{ TFMain }
|
||||
|
||||
TFMain = class(TForm)
|
||||
procedure FormPaint(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
public
|
||||
{ public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
FMain: TFMain;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
uses Math,BGRABitmapTypes,BGRABitmap,BGRATypewriter,BGRATransform;
|
||||
|
||||
{ TFMain }
|
||||
|
||||
procedure TFMain.FormPaint(Sender: TObject);
|
||||
const GoneCount = 8;
|
||||
var
|
||||
radius: single;
|
||||
bmp: TBGRABitmap;
|
||||
|
||||
procedure TestGlyph(center: TPointF; curve: boolean);
|
||||
var
|
||||
glyph: TBGRAPolygonalGlyph;
|
||||
pts: array of TPointF;
|
||||
mem: TMemoryStream;
|
||||
i: Integer;
|
||||
begin
|
||||
setlength(pts, GoneCount);
|
||||
for i := 0 to GoneCount-1 do
|
||||
pts[i] := AffineMatrixRotationDeg((i+0.5)/GoneCount*360)*PointF(0,radius) + center;
|
||||
glyph := TBGRAPolygonalGlyph.Create('o');
|
||||
glyph.SetPoints(pts);
|
||||
glyph.QuadraticCurves:= curve;
|
||||
mem := TMemoryStream.Create;
|
||||
glyph.SaveToStream(mem);
|
||||
glyph.Free;
|
||||
mem.Position:= 0;
|
||||
glyph := TBGRAGlyph.LoadFromStream(mem) as TBGRAPolygonalGlyph;
|
||||
mem.Free;
|
||||
bmp.Canvas2D.lineWidth:= radius*0.02;
|
||||
bmp.Canvas2D.strokeStyle(BGRABlack);
|
||||
glyph.Path(bmp.Canvas2D, AffineMatrixIdentity);
|
||||
glyph.Free;
|
||||
bmp.Canvas2D.stroke;
|
||||
end;
|
||||
|
||||
begin
|
||||
bmp := TBGRABitmap.Create(ClientWidth,ClientHeight,BGRAWhite);
|
||||
radius := min(bmp.Width*0.45,bmp.Height*0.9)*0.5;
|
||||
TestGlyph(PointF(bmp.Width/4,bmp.Height/2),false);
|
||||
TestGlyph(PointF(bmp.Width*3/4,bmp.Height/2),true);
|
||||
bmp.Draw(Canvas,0,0);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Reference in New Issue
Block a user