Стартовый пул

This commit is contained in:
2024-04-02 08:46:59 +03:00
parent fd57fffd3a
commit 3bb34d000b
5591 changed files with 3291734 additions and 0 deletions

View File

@@ -0,0 +1,169 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="10"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="bgramacosbutton"/>
<Scaled Value="True"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<XPManifest>
<DpiAware Value="True"/>
</XPManifest>
</General>
<BuildModes Count="3">
<Item1 Name="Debug" Default="True"/>
<Item2 Name="Release">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="bin\$(TargetCPU)-$(TargetOS)\release\bgramacosbutton"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
</Item2>
<Item3 Name="Release macOS 64">
<MacroValues Count="1">
<Macro1 Name="LCLWidgetType" Value="cocoa"/>
</MacroValues>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="bin\$(TargetCPU)-$(TargetOS)\release\bgramacosbutton"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<TargetCPU Value="x86_64"/>
<TargetOS Value="darwin"/>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
</Item3>
<SharedMatrixOptions Count="1">
<Item1 ID="031221446204" Modes="Release macOS 64" Type="IDEMacro" MacroName="LCLWidgetType" Value="cocoa"/>
</SharedMatrixOptions>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<RequiredPackages Count="2">
<Item1>
<PackageName Value="bgracontrols"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="bgramacosbutton.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="umain.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmMain"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="bin\$(TargetCPU)-$(TargetOS)\debug\bgramacosbutton"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<IncludeAssertionCode Value="True"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<Checks>
<IOChecks Value="True"/>
<RangeChecks Value="True"/>
<OverflowChecks Value="True"/>
<StackChecks Value="True"/>
</Checks>
<VerifyObjMethodCallValidity Value="True"/>
</CodeGeneration>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf2Set"/>
<UseHeaptrc Value="True"/>
<TrashVariables Value="True"/>
<UseExternalDbgSyms Value="True"/>
</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>

View File

@@ -0,0 +1,22 @@
program bgramacosbutton;
{$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
Application.Scaled:=True;
RequireDerivedFormResource:=True;
Application.Initialize;
Application.CreateForm(TfrmMain, frmMain);
Application.Run;
end.

View File

@@ -0,0 +1,81 @@
unit bgramacosdraw;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, BGRABitmap, BGRABitmapTypes, BGRAGradientScanner, Math;
type
{ TBGRAMacOS }
TBGRAMacOS = class
class var BUTTONLINEWIDTH: single;
// Generic gradient button that's used by the other methods
class procedure GradientButton(
const lineTop, lineBottom, fillTop, fillBottom: TBGRAPixel;
const ADest: TBGRABitmap; const ARect: TRect);
// Button
class procedure Button(const ADest: TBGRABitmap; const ARect: TRect);
class procedure ButtonActive(const ADest: TBGRABitmap; const ARect: TRect);
class procedure ButtonPressed(const ADest: TBGRABitmap; const ARect: TRect);
end;
implementation
{ TBGRAMacOS }
class procedure TBGRAMacOS.GradientButton(
const lineTop, lineBottom, fillTop, fillBottom: TBGRAPixel;
const ADest: TBGRABitmap; const ARect: TRect);
var
gradient, gradientfill: TBGRAGradientScanner;
halflinewidth: integer;
begin
if (BUTTONLINEWIDTH * 2) + 3 > ARect.Height then
Exit;
if (BUTTONLINEWIDTH * 2) + 3 > ARect.Width then
Exit;
gradient := TBGRAGradientScanner.Create(lineTop, lineBottom, gtLinear,
PointF(0, 0), PointF(0, ARect.Bottom));
gradientfill := TBGRAGradientScanner.Create(fillTop, fillBottom,
gtLinear, PointF(0, BUTTONLINEWIDTH), PointF(0, ARect.Bottom - BUTTONLINEWIDTH));
halflinewidth := ceil(BUTTONLINEWIDTH * 0.5);
ADest.RoundRectAntialias(ARect.Left + halflinewidth,
ARect.Top + halflinewidth, ARect.Right - halflinewidth - 1,
ARect.Bottom - halflinewidth - 1,
4, 4, gradient, BUTTONLINEWIDTH, gradientfill);
FreeAndNil(gradient);
FreeAndNil(gradientfill);
end;
class procedure TBGRAMacOS.Button(const ADest: TBGRABitmap; const ARect: TRect);
begin
GradientButton(BGRA(210, 210, 210), BGRA(180, 180, 180), BGRAWhite,
BGRAWhite, ADest, ARect);
end;
class procedure TBGRAMacOS.ButtonActive(const ADest: TBGRABitmap; const ARect: TRect);
begin
GradientButton(BGRA(83, 160, 246), BGRA(43, 93, 251), BGRA(111, 177, 248),
BGRA(45, 127, 252), ADest, ARect);
end;
class procedure TBGRAMacOS.ButtonPressed(const ADest: TBGRABitmap; const ARect: TRect);
begin
GradientButton(BGRA(55, 124, 251), BGRA(36, 60, 218), BGRA(84, 149, 250),
BGRA(39, 102, 225), ADest, ARect);
end;
initialization
TBGRAMacOS.BUTTONLINEWIDTH := 1;
end.

View File

@@ -0,0 +1,19 @@
object frmMain: TfrmMain
Left = 268
Height = 257
Top = 126
Width = 322
Caption = 'BGRA macOS Button'
ClientHeight = 257
ClientWidth = 322
LCLVersion = '1.8.4.0'
object BCXButton1: TBCXButton
Left = 8
Height = 26
Top = 8
Width = 112
OnRenderControl = BCXButton1RenderControl
Anchors = [akTop, akLeft, akRight, akBottom]
Caption = 'Hello World'
end
end

View File

@@ -0,0 +1,66 @@
unit umain;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
BGRAGraphicControl, BGRABitmap, BCTypes, BCTrackbarUpdown, BCImageButton,
BGRABitmapTypes;
type
{ TfrmMain }
TfrmMain = class(TForm)
BCXButton1: TBCXButton;
procedure BCXButton1RenderControl(Sender: TObject; Bitmap: TBGRABitmap;
State: TBCGraphicButtonState);
private
public
end;
var
frmMain: TfrmMain;
implementation
uses
bgramacosdraw;
{$R *.lfm}
{ TfrmMain }
procedure TfrmMain.BCXButton1RenderControl(Sender: TObject;
Bitmap: TBGRABitmap; State: TBCGraphicButtonState);
var
r: TRect;
begin
r := Rect(0, 0, Bitmap.Width, Bitmap.Height);
Bitmap.FontHeight := 12;
Bitmap.FontQuality := fqSystemClearType;
case State of
gbsNormal:
begin
TBGRAMacOs.Button(Bitmap, r);
Bitmap.TextRect(r, BCXButton1.Caption, taCenter, tlCenter, BGRABlack);
end;
gbsHover:
begin
TBGRAMacOs.ButtonActive(Bitmap, r);
Bitmap.TextRect(r, BCXButton1.Caption, taCenter, tlCenter, BGRAWhite);
end;
gbsActive:
begin
TBGRAMacOs.ButtonPressed(Bitmap, r);
Bitmap.TextRect(r, BCXButton1.Caption, taCenter, tlCenter, BGRA(224, 230, 243));
end;
end;
end;
end.