Стартовый пул
This commit is contained in:
BIN
bgracontrols/test/test_mddrawings/test.ico
Normal file
BIN
bgracontrols/test/test_mddrawings/test.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 134 KiB |
85
bgracontrols/test/test_mddrawings/test.lpi
Normal file
85
bgracontrols/test/test_mddrawings/test.lpi
Normal file
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="12"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<CompatibilityMode Value="True"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<Title Value="test"/>
|
||||
<Scaled Value="True"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<XPManifest>
|
||||
<DpiAware Value="True"/>
|
||||
</XPManifest>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="2">
|
||||
<Item1>
|
||||
<PackageName Value="bgracontrols"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item2>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="test.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="umain.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="test"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsDwarf2Set"/>
|
||||
</Debugging>
|
||||
<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>
|
22
bgracontrols/test/test_mddrawings/test.lpr
Normal file
22
bgracontrols/test/test_mddrawings/test.lpr
Normal file
@@ -0,0 +1,22 @@
|
||||
program test;
|
||||
|
||||
{$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.Scaled:=True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
43
bgracontrols/test/test_mddrawings/umain.lfm
Normal file
43
bgracontrols/test/test_mddrawings/umain.lfm
Normal file
@@ -0,0 +1,43 @@
|
||||
object Form1: TForm1
|
||||
Left = 409
|
||||
Height = 400
|
||||
Top = 143
|
||||
Width = 820
|
||||
Caption = 'Drawings'
|
||||
ChildSizing.LeftRightSpacing = 10
|
||||
ChildSizing.TopBottomSpacing = 10
|
||||
ChildSizing.HorizontalSpacing = 10
|
||||
ChildSizing.VerticalSpacing = 10
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkVertical = crsHomogenousChildResize
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 2
|
||||
ClientHeight = 400
|
||||
ClientWidth = 820
|
||||
DesignTimePPI = 120
|
||||
LCLVersion = '1.9.0.0'
|
||||
object g1: TBGRAGraphicControl
|
||||
Left = 10
|
||||
Height = 380
|
||||
Top = 10
|
||||
Width = 395
|
||||
OnRedraw = g1Redraw
|
||||
BevelOuter = bvNone
|
||||
Color = clWhite
|
||||
ColorOpacity = 128
|
||||
Alignment = taCenter
|
||||
end
|
||||
object g2: TBGRAGraphicControl
|
||||
Left = 415
|
||||
Height = 380
|
||||
Top = 10
|
||||
Width = 395
|
||||
OnRedraw = g2Redraw
|
||||
BevelOuter = bvNone
|
||||
Color = clWhite
|
||||
ColorOpacity = 128
|
||||
Alignment = taCenter
|
||||
end
|
||||
end
|
71
bgracontrols/test/test_mddrawings/umain.pas
Normal file
71
bgracontrols/test/test_mddrawings/umain.pas
Normal file
@@ -0,0 +1,71 @@
|
||||
unit umain;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, BGRAGraphicControl, BGRABitmap, BCTypes,
|
||||
BGRABitmapTypes, Math;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
g1: TBGRAGraphicControl;
|
||||
g2: TBGRAGraphicControl;
|
||||
procedure g1Redraw(Sender: TObject; Bitmap: TBGRABitmap);
|
||||
procedure g2Redraw(Sender: TObject; Bitmap: TBGRABitmap);
|
||||
private
|
||||
|
||||
public
|
||||
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
procedure TForm1.g1Redraw(Sender: TObject; Bitmap: TBGRABitmap
|
||||
);
|
||||
const
|
||||
offset = 8;
|
||||
var
|
||||
temp: TBGRABitmap;
|
||||
begin
|
||||
Bitmap.FillTransparent;
|
||||
Bitmap.FillEllipseAntialias(g1.Width div 2, (g1.Height) div 2, (g1.Width - 10) div 2, (g1.Height - 10) div 2, BGRA(150, 150, 150));
|
||||
temp := TBGRABitmap.Create;
|
||||
BGRAReplace(temp, Bitmap.FilterBlurRadial(5, 5, rbFast));
|
||||
Bitmap.FillTransparent;
|
||||
Bitmap.PutImage(0, 0, temp, dmDrawWithTransparency);
|
||||
temp.Free;
|
||||
Bitmap.FillEllipseAntialias(g1.Width div 2, (g1.Height - offset) div 2, (g1.Width - offset) div 2, (g1.Height - offset) div 2, BGRAWhite);
|
||||
Bitmap.FontHeight := Min(g1.Height div 2, g1.Width div 2);
|
||||
Bitmap.TextRect(Rect(0, 0, g1.Width, g1.Height - offset), '🐣', TAlignment.taCenter, TTextLayout.tlCenter, BGRABlack);
|
||||
end;
|
||||
|
||||
procedure TForm1.g2Redraw(Sender: TObject; Bitmap: TBGRABitmap);
|
||||
var
|
||||
temp: TBGRABitmap;
|
||||
begin
|
||||
Bitmap.FillTransparent;
|
||||
Bitmap.FillRoundRectAntialias(10, 10, g2.Width - 10, g2.Height - 10, 8, 8, BGRA(100,100,100));
|
||||
temp := TBGRABitmap.Create;
|
||||
BGRAReplace(temp, Bitmap.FilterBlurRadial(5, 5, rbFast));
|
||||
Bitmap.FillTransparent;
|
||||
Bitmap.PutImage(0, 0, temp, dmDrawWithTransparency);
|
||||
temp.Free;
|
||||
Bitmap.FillRoundRectAntialias(8, 0, g2.Width - 8, g2.Height - 10, 10, 10, BGRAWhite, [], False);
|
||||
Bitmap.FontHeight := Min(g2.Height div 2, g2.Width div 2);
|
||||
Bitmap.TextRect(Rect(0, 0, g2.Width, g2.Height - 8), '🐣', TAlignment.taCenter, TTextLayout.tlCenter, BGRABlack);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Reference in New Issue
Block a user