Стартовый пул
This commit is contained in:
BIN
bgracontrols/test/test_extra/shadow/logo.png
Normal file
BIN
bgracontrols/test/test_extra/shadow/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
86
bgracontrols/test/test_extra/shadow/shadow.lpi
Normal file
86
bgracontrols/test/test_extra/shadow/shadow.lpi
Normal file
@@ -0,0 +1,86 @@
|
||||
<?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="shadow"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes Count="1">
|
||||
<Mode0 Name="default"/>
|
||||
</Modes>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="2">
|
||||
<Item1>
|
||||
<PackageName Value="bgracontrols"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item2>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="shadow.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="shadow"/>
|
||||
</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>
|
21
bgracontrols/test/test_extra/shadow/shadow.lpr
Normal file
21
bgracontrols/test/test_extra/shadow/shadow.lpr
Normal file
@@ -0,0 +1,21 @@
|
||||
program shadow;
|
||||
|
||||
{$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(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
24
bgracontrols/test/test_extra/shadow/umain.lfm
Normal file
24
bgracontrols/test/test_extra/shadow/umain.lfm
Normal file
@@ -0,0 +1,24 @@
|
||||
object Form1: TForm1
|
||||
Left = 720
|
||||
Height = 240
|
||||
Top = 193
|
||||
Width = 320
|
||||
Caption = 'Form1'
|
||||
ClientHeight = 240
|
||||
ClientWidth = 320
|
||||
OnCreate = FormCreate
|
||||
OnDestroy = FormDestroy
|
||||
LCLVersion = '1.2.4.0'
|
||||
object BGRAVirtualScreen1: TBGRAVirtualScreen
|
||||
Left = 0
|
||||
Height = 240
|
||||
Top = 0
|
||||
Width = 320
|
||||
OnRedraw = BGRAVirtualScreen1Redraw
|
||||
Align = alClient
|
||||
Alignment = taLeftJustify
|
||||
Color = clWhite
|
||||
ParentColor = False
|
||||
TabOrder = 0
|
||||
end
|
||||
end
|
83
bgracontrols/test/test_extra/shadow/umain.pas
Normal file
83
bgracontrols/test/test_extra/shadow/umain.pas
Normal file
@@ -0,0 +1,83 @@
|
||||
unit umain;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
|
||||
BGRAVirtualScreen, BGRABitmap, BCTypes, BGRABitmapTypes;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
BGRAVirtualScreen1: TBGRAVirtualScreen;
|
||||
procedure BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
public
|
||||
{ public declarations }
|
||||
blurSize: integer;
|
||||
offset: TPoint;
|
||||
logo, logoShadow: TBGRABitmap;
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
procedure SingleColor(Bitmap: TBGRABitmap; Color: TBGRAPixel);
|
||||
var
|
||||
i: integer;
|
||||
p: PBGRAPixel;
|
||||
begin
|
||||
p := Bitmap.Data;
|
||||
|
||||
for i := Bitmap.NBPixels - 1 downto 0 do
|
||||
begin
|
||||
p^.red := Color.Red;
|
||||
p^.green := Color.Green;
|
||||
p^.blue := Color.Blue;
|
||||
Inc(p);
|
||||
end;
|
||||
end;
|
||||
|
||||
function Shadow(Source: TBGRABitmap; Color: TBGRAPixel; Blur: integer): TBGRABitmap;
|
||||
begin
|
||||
Result := TBGRABitmap.Create(Source.Width + (2 * Blur), Source.Height + (2 * Blur));
|
||||
Result.PutImage(Blur, Blur, Source, dmDrawWithTransparency);
|
||||
SingleColor(Result, Color);
|
||||
BGRAReplace(Result, Result.FilterBlurRadial(Blur, rbFast));
|
||||
end;
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
procedure TForm1.BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);
|
||||
begin
|
||||
Bitmap.PutImage(blurSize + offSet.x, blurSize + offset.y, logoShadow,
|
||||
dmDrawWithTransparency);
|
||||
Bitmap.PutImage(blurSize * 2, blurSize * 2, logo, dmDrawWithTransparency);
|
||||
end;
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
begin
|
||||
blurSize := 5;
|
||||
offSet := Point(5, 5);
|
||||
logo := TBGRABitmap.Create('logo.png');
|
||||
logoShadow := Shadow(logo, BGRA(0, 200, 200, 255), blurSize);
|
||||
end;
|
||||
|
||||
procedure TForm1.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
logo.Free;
|
||||
logoShadow.Free;
|
||||
end;
|
||||
|
||||
end.
|
Reference in New Issue
Block a user