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

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,199 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<PathDelim Value="\"/>
<General>
<MainUnit Value="0"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1" Active="Default">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<RequiredPackages Count="2">
<Item1>
<PackageName Value="bgrabitmappack"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="5">
<Unit0>
<Filename Value="aa_demo.lpr"/>
<IsPartOfProject Value="True"/>
<CursorPos Y="15"/>
<UsageCount Value="21"/>
</Unit0>
<Unit1>
<Filename Value="aa_demo_main.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="aa_demo_main"/>
<TopLine Value="67"/>
<CursorPos X="72" Y="91"/>
<UsageCount Value="21"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
<Unit2>
<Filename Value="..\bgrabitmap\bgrapolygon.pas"/>
<UnitName Value="BGRAPolygon"/>
<EditorIndex Value="2"/>
<TopLine Value="244"/>
<CursorPos X="69" Y="259"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit2>
<Unit3>
<Filename Value="..\bgrabitmap\bgrafillinfo.pas"/>
<UnitName Value="BGRAFillInfo"/>
<EditorIndex Value="3"/>
<TopLine Value="497"/>
<CursorPos Y="504"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit3>
<Unit4>
<Filename Value="..\bgrabitmap\bgrapixel.inc"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="1"/>
<TopLine Value="326"/>
<CursorPos X="44" Y="330"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit4>
</Units>
<JumpHistory Count="20" HistoryIndex="19">
<Position1>
<Filename Value="aa_demo_main.pas"/>
<Caret Line="55" Column="12" TopLine="39"/>
</Position1>
<Position2>
<Filename Value="aa_demo_main.pas"/>
<Caret Line="42" TopLine="37"/>
</Position2>
<Position3>
<Filename Value="aa_demo_main.pas"/>
<Caret Line="55" Column="23" TopLine="45"/>
</Position3>
<Position4>
<Filename Value="aa_demo_main.pas"/>
<Caret Line="67" Column="36" TopLine="42"/>
</Position4>
<Position5>
<Filename Value="aa_demo_main.pas"/>
<Caret Line="102" Column="3" TopLine="84"/>
</Position5>
<Position6>
<Filename Value="aa_demo_main.pas"/>
<Caret Line="133" Column="30" TopLine="113"/>
</Position6>
<Position7>
<Filename Value="aa_demo_main.pas"/>
<Caret Line="134" TopLine="119"/>
</Position7>
<Position8>
<Filename Value="aa_demo_main.pas"/>
<Caret Line="112" Column="7" TopLine="98"/>
</Position8>
<Position9>
<Filename Value="aa_demo_main.pas"/>
<Caret Line="59" Column="66" TopLine="44"/>
</Position9>
<Position10>
<Filename Value="aa_demo_main.pas"/>
<Caret Line="146" Column="30" TopLine="109"/>
</Position10>
<Position11>
<Filename Value="aa_demo_main.pas"/>
<Caret Line="28" TopLine="17"/>
</Position11>
<Position12>
<Filename Value="aa_demo_main.pas"/>
<Caret Line="102" Column="5" TopLine="82"/>
</Position12>
<Position13>
<Filename Value="aa_demo_main.pas"/>
<Caret Line="76" Column="42" TopLine="55"/>
</Position13>
<Position14>
<Filename Value="aa_demo_main.pas"/>
<Caret Line="77" Column="71" TopLine="61"/>
</Position14>
<Position15>
<Filename Value="aa_demo_main.pas"/>
<Caret Line="78" Column="71" TopLine="62"/>
</Position15>
<Position16>
<Filename Value="aa_demo_main.pas"/>
<Caret Line="80" Column="71" TopLine="64"/>
</Position16>
<Position17>
<Filename Value="aa_demo_main.pas"/>
<Caret Line="125" Column="39" TopLine="118"/>
</Position17>
<Position18>
<Filename Value="aa_demo_main.pas"/>
<Caret Line="103" Column="3" TopLine="81"/>
</Position18>
<Position19>
<Filename Value="..\bgrabitmap\bgrapixel.inc"/>
</Position19>
<Position20>
<Filename Value="..\bgrabitmap\bgrapixel.inc"/>
<Caret Line="371" Column="10" TopLine="362"/>
</Position20>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="aa_demo"/>
</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>

View File

@@ -0,0 +1,20 @@
program aa_demo;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, aa_demo_main, bgrabitmappack
{ you can add units after this };
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@@ -0,0 +1,78 @@
object Form1: TForm1
Left = 516
Height = 429
Top = 160
Width = 557
Caption = 'BGRA Antialiasing demo'
ClientHeight = 429
ClientWidth = 557
OnCreate = FormCreate
OnMouseDown = FormMouseDown
OnMouseMove = FormMouseMove
OnMouseUp = FormMouseUp
OnPaint = FormPaint
Position = poDefaultPosOnly
LCLVersion = '1.4.0.4'
object Panel1: TPanel
Left = 88
Height = 55
Top = 374
Width = 469
Anchors = [akLeft, akRight, akBottom]
ClientHeight = 55
ClientWidth = 469
TabOrder = 0
object Label1: TLabel
Left = 4
Height = 15
Top = 2
Width = 46
Caption = 'Pixel size'
ParentColor = False
end
object TrackBar_PixelSize: TTrackBar
Left = 4
Height = 25
Top = 21
Width = 373
Frequency = 4
Max = 100
Min = 8
OnChange = TrackBar_PixelSizeChange
Position = 32
Anchors = [akTop, akLeft, akRight]
TabOrder = 0
end
object Label_PixelSizeValue: TLabel
Left = 56
Height = 15
Top = 2
Width = 16
Caption = '= ?'
ParentColor = False
end
object Label2: TLabel
Left = 383
Height = 15
Top = 2
Width = 76
Anchors = [akTop, akRight]
Caption = 'Gamma factor'
ParentColor = False
end
object SpinEdit_Gamma: TFloatSpinEdit
Left = 392
Height = 23
Top = 22
Width = 66
Anchors = [akTop, akRight]
DecimalPlaces = 1
Increment = 0.1
MaxValue = 3
MinValue = 0.1
OnChange = SpinEdit_GammaChange
TabOrder = 1
Value = 1.7
end
end
end

View File

@@ -0,0 +1,187 @@
unit aa_demo_main;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
ExtCtrls, StdCtrls, BGRABitmapTypes, BGRABitmap, lmessages, Spin;
type
{ TForm1 }
TForm1 = class(TForm)
SpinEdit_Gamma: TFloatSpinEdit;
Label1: TLabel;
Label2: TLabel;
Label_PixelSizeValue: TLabel;
Panel1: TPanel;
TrackBar_PixelSize: TTrackBar;
procedure FormCreate(Sender: TObject);
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
procedure FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormPaint(Sender: TObject);
procedure SpinEdit_GammaChange(Sender: TObject);
procedure TrackBar_PixelSizeChange(Sender: TObject);
procedure WMEraseBkgnd(var Message: TLMEraseBkgnd); message LM_ERASEBKGND;
private
{ private declarations }
public
{ public declarations }
pts: array[0..2] of TPointF;
formLoaded: boolean;
MovingPointIndex: integer;
MovingOrigin: TPointF;
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
procedure NicePoint(bmp: TBGRABitmap; x, y: single);
begin
bmp.EllipseAntialias(x,y,4,4,BGRA(0,0,0,192),1);
bmp.EllipseAntialias(x,y,3,3,BGRA(255,255,255,192),1);
bmp.EllipseAntialias(x,y,2,2,BGRA(0,0,0,192),1);
end;
{ TForm1 }
procedure TForm1.FormPaint(Sender: TObject);
var zoomTx,zoomTy,tx,ty,pixSize: integer;
bmp,bmpPreview: TBGRABitmap;
i: Integer;
x,y: integer;
function coordToBmp(pt: TPointF): TPointF;
begin
result := (pt+PointF(0.5,0.5))*(1/pixSize)-PointF(0.5,0.5);
end;
begin
zoomTx := ClientWidth;
zoomTy := Panel1.Top;
pixSize := TrackBar_PixelSize.Position;
tx := (zoomTx+pixSize-1) div pixSize;
ty := (zoomTy+pixSize-1) div pixSize;
//draw triangle
bmp := TBGRABitmap.Create(tx,ty,BGRAWhite);
bmp.FillPolyAntialias([coordToBmp(pts[0]),coordToBmp(pts[1]),coordToBmp(pts[2])],BGRABlack);
//draw lower-left preview
bmpPreview := TBGRABitmap.Create(panel1.left,panel1.height,BGRAWhite);
x := (bmpPreview.Width-bmp.width) div 2;
y := (bmpPreview.Height-bmp.Height) div 2;
if x < 1 then x := 1;
if y < 1 then y := 1;
bmpPreview.Rectangle(x-1,y-1,x+bmp.width+1,y+bmp.height+1,BGRA(255,0,0),dmSet);
bmpPreview.PutImage(x,y,bmp,dmSet);
bmpPreview.Draw(Canvas,0,panel1.top);
bmpPreview.Free;
//zoom
BGRAReplace(bmp,bmp.Resample(tx*pixSize,ty*pixSize,rmSimpleStretch));
bmp.DrawPolygonAntialias(pts,BGRA(0,128,128,192),1);
for i := 0 to 2 do
NicePoint(bmp,pts[i].x,pts[i].y);
BGRAReplace(bmp,bmp.GetPart(rect(0,0,zoomTx,zoomTy)));
bmp.Draw(Canvas,0,0);
bmp.free;
end;
procedure TForm1.SpinEdit_GammaChange(Sender: TObject);
begin
if formLoaded then
begin
BGRASetGamma(SpinEdit_Gamma.Value);
Invalidate;
end;
end;
procedure TForm1.TrackBar_PixelSizeChange(Sender: TObject);
begin
Label_PixelSizeValue.Caption := '= ' + IntToStr(TrackBar_PixelSize.Position);
Invalidate;
end;
procedure TForm1.WMEraseBkgnd(var Message: TLMEraseBkgnd);
begin
//
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
pts[0] := PointF(57,100);
pts[1] := PointF(369,170);
pts[2] := PointF(143,310);
Label_PixelSizeValue.Caption := '= ' + IntToStr(TrackBar_PixelSize.Position);
MovingPointIndex := -1;
SpinEdit_Gamma.Value := BGRAGetGamma;
formLoaded := true;
end;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var maxDist,dist: single;
mousePos,vect: TPointF;
i: Integer;
begin
if Button <> mbLeft then exit;
//select point to move
MovingPointIndex := -1;
maxDist := 10;
mousePos := PointF(X,Y);
MovingOrigin := mousePos;
for i := 0 to high(pts) do
begin
vect := pts[i] - mousePos;
dist := sqrt(vect*vect);
if dist < maxDist then
begin
maxDist := dist;
MovingPointIndex := i;
end;
end;
end;
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var
mousePos: TPointF;
i: Integer;
begin
if ssLeft in Shift then
begin
mousePos := PointF(X,Y);
if MovingPointIndex <> -1 then
pts[MovingPointIndex].Offset(mousePos-MovingOrigin) else
begin
for i := 0 to high(pts) do
pts[i].Offset(mousePos-MovingOrigin);
end;
Invalidate;
MovingOrigin := mousePos;
end;
end;
procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button = mbLeft then MovingPointIndex := -1;
end;
end.

View File

@@ -0,0 +1,148 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<PathDelim Value="\"/>
<General>
<MainUnit Value="0"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
<ActiveWindowIndexAtStart Value="0"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1" Active="Default">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
</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="alpha_gradient.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="alpha_gradient"/>
<UsageCount Value="20"/>
</Unit0>
<Unit1>
<Filename Value="alpha_gradient_main.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="alpha_gradient_main"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="0"/>
<WindowIndex Value="0"/>
<TopLine Value="110"/>
<CursorPos X="98" Y="133"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
</Units>
<JumpHistory Count="12" HistoryIndex="11">
<Position1>
<Filename Value="alpha_gradient_main.pas"/>
<Caret Line="63" Column="24" TopLine="31"/>
</Position1>
<Position2>
<Filename Value="alpha_gradient_main.pas"/>
<Caret Line="67" Column="11" TopLine="47"/>
</Position2>
<Position3>
<Filename Value="alpha_gradient_main.pas"/>
<Caret Line="68" Column="20" TopLine="45"/>
</Position3>
<Position4>
<Filename Value="alpha_gradient_main.pas"/>
<Caret Line="32" Column="26" TopLine="22"/>
</Position4>
<Position5>
<Filename Value="alpha_gradient_main.pas"/>
<Caret Line="71" Column="22" TopLine="53"/>
</Position5>
<Position6>
<Filename Value="alpha_gradient_main.pas"/>
<Caret Line="84" Column="20" TopLine="57"/>
</Position6>
<Position7>
<Filename Value="alpha_gradient_main.pas"/>
<Caret Line="41" Column="57" TopLine="19"/>
</Position7>
<Position8>
<Filename Value="alpha_gradient_main.pas"/>
<Caret Line="118" Column="31" TopLine="92"/>
</Position8>
<Position9>
<Filename Value="alpha_gradient_main.pas"/>
<Caret Line="56" Column="13" TopLine="38"/>
</Position9>
<Position10>
<Filename Value="alpha_gradient_main.pas"/>
<Caret Line="99" Column="84" TopLine="81"/>
</Position10>
<Position11>
<Filename Value="alpha_gradient_main.pas"/>
<Caret Line="114" Column="47" TopLine="94"/>
</Position11>
<Position12>
<Filename Value="alpha_gradient_main.pas"/>
<Caret Line="34" Column="1" TopLine="22"/>
</Position12>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>
<Version Value="9"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="alpha_gradient"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</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,20 @@
program alpha_gradient;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, alpha_gradient_main, bgrabitmappack
{ you can add units after this };
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@@ -0,0 +1,14 @@
object Form1: TForm1
Left = 541
Height = 389
Top = 140
Width = 564
Caption = 'BGRA Alpha gradient'
OnCreate = FormCreate
OnMouseDown = FormMouseDown
OnMouseMove = FormMouseMove
OnMouseUp = FormMouseUp
OnPaint = FormPaint
Position = poDefaultPosOnly
LCLVersion = '0.9.30'
end

View File

@@ -0,0 +1,215 @@
unit alpha_gradient_main;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics,
Dialogs, BGRABitmapTypes, BGRABitmap, LMessages;
type
{ TForm1 }
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
procedure FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormPaint(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
ellipses: array of record
x,y,w,h: integer;
c: TBGRAPixel;
end;
pts: array[0..2] of TPointF;
MovingPointIndex: integer;
MovingOrigin: TPointF;
procedure WMEraseBkgnd(var Message: TLMEraseBkgnd); message LM_ERASEBKGND;
end;
var
Form1: TForm1;
implementation
uses BGRAGradientScanner, BGRATransform;
procedure NicePoint(bmp: TBGRABitmap; x, y: single);
begin
bmp.EllipseAntialias(x,y,4,4,BGRA(0,0,0,192),1);
bmp.EllipseAntialias(x,y,3,3,BGRA(255,255,255,192),1);
bmp.EllipseAntialias(x,y,2,2,BGRA(0,0,0,192),1);
end;
{$R *.lfm}
type
{ TMultiplyGradient }
TMultiplyGradient = class(TBGRACustomScanner)
function ScanAt(X, Y: Single): TBGRAPixel; override;
end;
{ TMultiplyGradient }
function TMultiplyGradient.ScanAt(X, Y: Single): TBGRAPixel;
var fvalue: single;
value: integer;
begin
fvalue := abs(x*y*255);
if fvalue > 255 then
value := 255
else
value := round(fvalue);
result := BGRA(value,value,value,255);
end;
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
var
i: Integer;
begin
setlength(ellipses,100);
for i := 0 to high(ellipses) do
with ellipses[i] do
begin
x := random(65536);
y := random(65536);
w := random(100)+5;
h := random(100)+5;
c := BGRA(random(256),random(256),random(256),random(128)+64);
end;
pts[0] := PointF(250,200);
pts[1] := PointF(300,150);
pts[2] := PointF(300,250);
MovingPointIndex := -1;
end;
procedure TForm1.FormPaint(Sender: TObject);
const ellipseRadius = 160;
var bmp: TBGRABitmap;
tx,ty: integer;
i: Integer;
ellipseLayer: TBGRABitmap;
gradient: TBGRAGradientScanner;
multigrad: TBGRAMultiGradient;
affine: TBGRAAffineScannerTransform;
multiply: TMultiplyGradient;
mask: TBGRABitmap;
ellipseLayerOffset: TPointF;
begin
tx := ClientWidth;
ty := ClientHeight;
if (tx=0) or (ty=0) then exit;
//create background
bmp := TBGRABitmap.Create(tx,ty, BGRAWhite);
for i := 0 to high(ellipses) do
with ellipses[i] do
bmp.FillEllipseAntialias(x mod tx,y mod ty,w/2,h/2,c);
//create center red-yellow ellipse
ellipseLayerOffset := PointF((tx-(2*ellipseRadius+1))/2,(ty-(2*ellipseRadius+1))/2);
ellipseLayer := TBGRABitmap.Create(2*ellipseRadius +1 + 1,2*ellipseRadius +1 +1);
multiGrad := TBGRAMultiGradient.Create([BGRA(0,64,0),BGRA(160,160,0),BGRA(128,0,0)],[0,1/2,1],True);
gradient := TBGRAGradientScanner.Create(multiGrad,gtRadial,PointF(0,0),PointF(1,0));
affine := TBGRAAffineScannerTransform.Create(gradient);
affine.Scale(ellipseRadius*1.2,ellipseRadius*0.8);
affine.RotateDeg(30);
affine.Translate(ellipseRadius+frac(ellipseLayerOffset.X),ellipseRadius+frac(ellipseLayerOffset.Y));
ellipseLayer.FillEllipseAntialias(ellipseRadius+frac(ellipseLayerOffset.X),ellipseRadius+frac(ellipseLayerOffset.Y),
ellipseRadius,ellipseRadius,BGRA(192,128,0));
ellipseLayer.FillEllipseAntialias(ellipseRadius+frac(ellipseLayerOffset.X),ellipseRadius+frac(ellipseLayerOffset.Y),
ellipseRadius,ellipseRadius,affine);
affine.Free;
gradient.Free;
multiGrad.Free;
//apply multiply mask
multiply := TMultiplyGradient.Create;
affine := TBGRAAffineScannerTransform.Create(multiply);
affine.Fit(pts[0],pts[1],pts[2]);
affine.Translate(-trunc(ellipseLayerOffset.X),-trunc(ellipseLayerOffset.Y));
mask := TBGRABitmap.Create(ellipseLayer.Width,ellipseLayer.Height);
mask.Fill(affine);
ellipseLayer.ApplyMask(mask);
mask.Free;
affine.Free;
multiply.Free;
bmp.PutImage(trunc(ellipseLayerOffset.X),trunc(ellipseLayerOffset.Y),ellipseLayer,dmDrawWithTransparency);
ellipseLayer.Free;
for i := 0 to 2 do
NicePoint(bmp,pts[i].x,pts[i].y);
bmp.Draw(Canvas,0,0);
bmp.Free;
end;
procedure TForm1.WMEraseBkgnd(var Message: TLMEraseBkgnd);
begin
//
end;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var maxDist,dist: single;
mousePos,vect: TPointF;
i: Integer;
begin
if Button <> mbLeft then exit;
//select point to move
MovingPointIndex := -1;
maxDist := 10;
mousePos := PointF(X,Y);
for i := 0 to 2 do
begin
vect := pts[i] - mousePos;
dist := sqrt(vect*vect);
if dist < maxDist then
begin
maxDist := dist;
MovingPointIndex := i;
MovingOrigin := mousePos;
end;
end;
end;
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var
mousePos: TPointF;
begin
if MovingPointIndex <> -1 then
begin
mousePos := PointF(X,Y);
pts[MovingPointIndex].Offset(mousePos-MovingOrigin);
Invalidate;
MovingOrigin := mousePos;
end;
end;
procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button = mbLeft then MovingPointIndex := -1;
end;
end.

View File

@@ -0,0 +1,251 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<PathDelim Value="\"/>
<General>
<MainUnit Value="0"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1" Active="Default">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<RequiredPackages Count="3">
<Item1>
<PackageName Value="etpackage"/>
</Item1>
<Item2>
<PackageName Value="bgrabitmappack"/>
</Item2>
<Item3>
<PackageName Value="LCL"/>
</Item3>
</RequiredPackages>
<Units Count="6">
<Unit0>
<Filename Value="blur.lpr"/>
<IsPartOfProject Value="True"/>
<UsageCount Value="23"/>
</Unit0>
<Unit1>
<Filename Value="blur_main.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="blur_main"/>
<IsVisibleTab Value="True"/>
<TopLine Value="70"/>
<CursorPos X="24" Y="72"/>
<UsageCount Value="23"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
<Unit2>
<Filename Value="..\bgrabitmap\bgradefaultbitmap.pas"/>
<UnitName Value="BGRADefaultBitmap"/>
<EditorIndex Value="1"/>
<TopLine Value="3215"/>
<CursorPos X="32" Y="3218"/>
<UsageCount Value="12"/>
<Loaded Value="True"/>
</Unit2>
<Unit3>
<Filename Value="..\bgrabitmap\bgrafilters.pas"/>
<UnitName Value="BGRAFilters"/>
<EditorIndex Value="3"/>
<TopLine Value="36"/>
<CursorPos X="10" Y="47"/>
<UsageCount Value="12"/>
<Loaded Value="True"/>
</Unit3>
<Unit4>
<Filename Value="..\bgrabitmap\blurfast.inc"/>
<EditorIndex Value="4"/>
<TopLine Value="78"/>
<CursorPos X="32" Y="121"/>
<UsageCount Value="12"/>
<Loaded Value="True"/>
</Unit4>
<Unit5>
<Filename Value="..\bgrabitmap\blurnormal.inc"/>
<EditorIndex Value="2"/>
<TopLine Value="215"/>
<CursorPos X="73" Y="234"/>
<UsageCount Value="12"/>
<Loaded Value="True"/>
</Unit5>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="..\bgrabitmap\bgrafilters.pas"/>
<Caret Line="368" TopLine="356"/>
</Position1>
<Position2>
<Filename Value="..\bgrabitmap\bgrafilters.pas"/>
<Caret Line="369" TopLine="356"/>
</Position2>
<Position3>
<Filename Value="..\bgrabitmap\bgrafilters.pas"/>
<Caret Line="370" TopLine="356"/>
</Position3>
<Position4>
<Filename Value="..\bgrabitmap\bgrafilters.pas"/>
<Caret Line="371" TopLine="356"/>
</Position4>
<Position5>
<Filename Value="..\bgrabitmap\bgrafilters.pas"/>
<Caret Line="372" TopLine="356"/>
</Position5>
<Position6>
<Filename Value="..\bgrabitmap\blurfast.inc"/>
<Caret Line="124" Column="24" TopLine="113"/>
</Position6>
<Position7>
<Filename Value="..\bgrabitmap\blurfast.inc"/>
<Caret Line="95" Column="36" TopLine="72"/>
</Position7>
<Position8>
<Filename Value="..\bgrabitmap\blurfast.inc"/>
<Caret Line="105" Column="42" TopLine="102"/>
</Position8>
<Position9>
<Filename Value="..\bgrabitmap\bgrafilters.pas"/>
<Caret Line="513" Column="24" TopLine="493"/>
</Position9>
<Position10>
<Filename Value="..\bgrabitmap\bgrafilters.pas"/>
<Caret Line="520" Column="23" TopLine="501"/>
</Position10>
<Position11>
<Filename Value="..\bgrabitmap\bgrafilters.pas"/>
<Caret Line="522" Column="53" TopLine="501"/>
</Position11>
<Position12>
<Filename Value="..\bgrabitmap\bgrafilters.pas"/>
<Caret Line="520" Column="46" TopLine="502"/>
</Position12>
<Position13>
<Filename Value="..\bgrabitmap\bgrafilters.pas"/>
<Caret Line="527" Column="27" TopLine="509"/>
</Position13>
<Position14>
<Filename Value="..\bgrabitmap\bgrafilters.pas"/>
<Caret Line="559" Column="30" TopLine="502"/>
</Position14>
<Position15>
<Filename Value="..\bgrabitmap\bgrafilters.pas"/>
<Caret Line="527" Column="38" TopLine="509"/>
</Position15>
<Position16>
<Filename Value="..\bgrabitmap\blurnormal.inc"/>
<Caret Line="218" Column="17" TopLine="209"/>
</Position16>
<Position17>
<Filename Value="..\bgrabitmap\bgrafilters.pas"/>
<Caret Line="527" Column="16" TopLine="514"/>
</Position17>
<Position18>
<Filename Value="..\bgrabitmap\bgrafilters.pas"/>
<Caret Line="484" TopLine="471"/>
</Position18>
<Position19>
<Filename Value="..\bgrabitmap\bgrafilters.pas"/>
<Caret Line="578" Column="35" TopLine="569"/>
</Position19>
<Position20>
<Filename Value="..\bgrabitmap\bgrafilters.pas"/>
<Caret Line="581" Column="45" TopLine="494"/>
</Position20>
<Position21>
<Filename Value="..\bgrabitmap\bgrafilters.pas"/>
<Caret Line="519" Column="23" TopLine="506"/>
</Position21>
<Position22>
<Filename Value="..\bgrabitmap\bgrafilters.pas"/>
<Caret Line="518" Column="16" TopLine="506"/>
</Position22>
<Position23>
<Filename Value="..\bgrabitmap\bgrafilters.pas"/>
<Caret Line="519" TopLine="506"/>
</Position23>
<Position24>
<Filename Value="..\bgrabitmap\bgrafilters.pas"/>
<Caret Line="521" TopLine="506"/>
</Position24>
<Position25>
<Filename Value="..\bgrabitmap\bgrafilters.pas"/>
<Caret Line="523" TopLine="506"/>
</Position25>
<Position26>
<Filename Value="..\bgrabitmap\bgrafilters.pas"/>
<Caret Line="516" Column="12" TopLine="506"/>
</Position26>
<Position27>
<Filename Value="..\bgrabitmap\bgrafilters.pas"/>
<Caret Line="520" TopLine="506"/>
</Position27>
<Position28>
<Filename Value="..\bgrabitmap\bgrafilters.pas"/>
<Caret Line="524" TopLine="506"/>
</Position28>
<Position29>
<Filename Value="blur_main.pas"/>
<Caret Line="36" TopLine="30"/>
</Position29>
<Position30>
<Filename Value="blur_main.pas"/>
<Caret Line="9" Column="72" TopLine="5"/>
</Position30>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="blur"/>
</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>

View File

@@ -0,0 +1,20 @@
program blur;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, blur_main, bgrabitmappack, etpackage
{ you can add units after this };
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@@ -0,0 +1,153 @@
object Form1: TForm1
Left = 657
Height = 348
Top = 144
Width = 536
Caption = 'BGRA Blur'
ClientHeight = 348
ClientWidth = 536
OnCreate = FormCreate
OnDestroy = FormDestroy
OnMouseDown = FormMouseDown
OnMouseMove = FormMouseMove
OnMouseUp = FormMouseUp
OnPaint = FormPaint
Position = poDefaultPosOnly
LCLVersion = '1.4.0.4'
object Panel1: TPanel
Left = 0
Height = 100
Top = 248
Width = 536
Anchors = [akLeft, akRight, akBottom]
ClientHeight = 100
ClientWidth = 536
Color = clForm
ParentColor = False
TabOrder = 0
object TrackBar_BlurRadiusX: TTrackBar
Left = 152
Height = 25
Top = 24
Width = 353
Frequency = 10
Max = 400
OnChange = TrackBar_BlurRadiusChange
Position = 150
Anchors = [akTop, akLeft, akRight]
TabOrder = 0
end
object Label_RadiusX: TLabel
Left = 160
Height = 15
Top = 8
Width = 66
Caption = 'Blur radius X'
end
object Label2: TLabel
Left = 8
Height = 15
Top = 8
Width = 47
Caption = 'Blur type'
end
object Radio_Fast: TRadioButton
Left = 8
Height = 19
Top = 41
Width = 41
Caption = 'Fast'
Checked = True
OnChange = Radio_Change
TabOrder = 1
TabStop = True
end
object Radio_Corona: TRadioButton
Left = 72
Height = 19
Top = 24
Width = 59
Caption = 'Corona'
OnChange = Radio_Change
TabOrder = 3
end
object Radio_Disk: TRadioButton
Left = 72
Height = 19
Top = 41
Width = 42
Caption = 'Disk'
OnChange = Radio_Change
TabOrder = 4
end
object Radio_Motion: TRadioButton
Left = 72
Height = 19
Top = 58
Width = 59
Caption = 'Motion'
OnChange = Radio_Change
TabOrder = 5
end
object Radio_Radial: TRadioButton
Left = 8
Height = 19
Top = 58
Width = 52
Caption = 'Radial'
OnChange = Radio_Change
TabOrder = 6
end
object Label_RadiusValueX: TLabel
Left = 235
Height = 15
Top = 8
Width = 16
Caption = '= ?'
end
object Radio_Box: TRadioButton
Left = 8
Height = 19
Top = 24
Width = 40
Caption = 'Box'
OnChange = Radio_Change
TabOrder = 2
end
object TrackBar_BlurRadiusY: TTrackBar
Left = 152
Height = 25
Top = 72
Width = 353
Frequency = 10
Max = 400
OnChange = TrackBar_BlurRadiusChange
Position = 150
Anchors = [akTop, akLeft, akRight]
TabOrder = 7
end
object Label_RadiusY: TLabel
Left = 160
Height = 15
Top = 56
Width = 66
Caption = 'Blur radius Y'
end
object Label_RadiusValueY: TLabel
Left = 235
Height = 15
Top = 56
Width = 16
Caption = '= ?'
end
object Radio_OrientedMotion: TRadioButton
Left = 72
Height = 19
Top = 75
Width = 66
Caption = 'Oriented'
OnChange = Radio_Change
TabOrder = 8
end
end
end

View File

@@ -0,0 +1,201 @@
unit blur_main;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
ExtCtrls, StdCtrls, BGRABitmap, BGRABitmapTypes, EpikTimer, LMessages,
BGRAGrayscaleMask;
type
{ TForm1 }
TForm1 = class(TForm)
Label_RadiusValueY: TLabel;
Label_RadiusX: TLabel;
Label2: TLabel;
Label_RadiusY: TLabel;
Label_RadiusValueX: TLabel;
Panel1: TPanel;
Radio_Box: TRadioButton;
Radio_Motion: TRadioButton;
Radio_Fast: TRadioButton;
Radio_Corona: TRadioButton;
Radio_Disk: TRadioButton;
Radio_OrientedMotion: TRadioButton;
Radio_Radial: TRadioButton;
TrackBar_BlurRadiusX: TTrackBar;
TrackBar_BlurRadiusY: TTrackBar;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
{%H-}Shift: TShiftState; X, Y: Integer);
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
procedure FormMouseUp(Sender: TObject; Button: TMouseButton;
{%H-}Shift: TShiftState; {%H-}X, {%H-}Y: Integer);
procedure FormPaint(Sender: TObject);
procedure Radio_Change(Sender: TObject);
procedure TrackBar_BlurRadiusChange(Sender: TObject);
procedure WMEraseBkgnd(var {%H-}Message: TLMEraseBkgnd); message LM_ERASEBKGND;
private
{ private declarations }
procedure UpdateLabelRadius;
public
{ public declarations }
image: TBGRABitmap;
shadowBase: TGrayscaleMask;
timer : TEpikTimer;
movingShadow: boolean;
movingOrigin,shadowOfs: TPoint;
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
function ComputeAngle(dx, dy: single): single;
begin
if dy = 0 then
begin
if dx < 0 then result := 180 else result := 0;
end else
if dx = 0 then
begin
if dy < 0 then result := -90 else result := 90;
end else
begin
result := ArcTan(dy/dx)*180/Pi;
if dx < 0 then result += 180;
end;
end;
{ TForm1 }
procedure TForm1.FormPaint(Sender: TObject);
var bmp: TBGRABitmap;
ombre: TGrayscaleMask;
x,y,tx,ty: integer;
blurType: TRadialBlurType;
radiusX,radiusY,len: single;
begin
tx := clientWidth;
ty := Panel1.Top;
bmp := TBGRABitmap.Create(tx,ty,BGRAWhite);
x := (tx-image.Width) div 2;
y := (ty-image.Height) div 2;
radiusX := TrackBar_BlurRadiusX.Position/10;
radiusY := TrackBar_BlurRadiusY.Position/10;
timer.Clear;
timer.Start;
if Radio_Motion.Checked or Radio_OrientedMotion.Checked then
begin
len := sqrt(sqr(radiusX)+sqr(radiusY));
ombre := shadowBase.FilterBlurMotion(len*2,ComputeAngle(radiusX,radiusY),Radio_OrientedMotion.Checked) as TGrayscaleMask;
end else
begin
if Radio_Box.Checked then
begin
blurType := rbBox;
ombre := shadowBase.FilterBlurRadial(radiusX,radiusY,blurType) as TGrayscaleMask;
end else
begin
if Radio_Fast.Checked then blurType := rbFast else
if Radio_Corona.Checked then blurType := rbCorona else
if Radio_Disk.Checked then blurType := rbDisk else
if Radio_Radial.Checked then blurType := rbNormal;
ombre := shadowBase.FilterBlurRadial(radiusX,radiusY,blurType) as TGrayscaleMask;
end;
end;
timer.Stop;
ombre.Rectangle(0,0,ombre.width,ombre.height,TByteMask.New(128));
bmp.FillMask(x+shadowOfs.x,y+shadowOfs.y,ombre,BGRA(64,128,64), dmDrawWithTransparency);
ombre.free;
bmp.PutImage(x,y,image,dmDrawWithTransparency);
bmp.TextOut(0,0,inttostr(round(timer.Elapsed*1000))+' ms',BGRABlack);
bmp.Draw(Canvas,0,0);
bmp.Free;
end;
procedure TForm1.Radio_Change(Sender: TObject);
begin
Invalidate;
end;
procedure TForm1.TrackBar_BlurRadiusChange(Sender: TObject);
begin
UpdateLabelRadius;
Repaint;
end;
procedure TForm1.WMEraseBkgnd(var Message: TLMEraseBkgnd);
begin
//
end;
procedure TForm1.UpdateLabelRadius;
begin
Label_RadiusValueX.Caption := '= '+FloatToStrF(TrackBar_BlurRadiusX.Position/10,ffFixed,7,1);
Label_RadiusValueY.Caption := '= '+FloatToStrF(TrackBar_BlurRadiusY.Position/10,ffFixed,7,1);
Label_RadiusValueX.Update;
Label_RadiusValueY.Update;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
image := TBGRABitmap.Create(160,200);
image.FontName := 'Times New Roman';
image.FontHeight := 300;
image.FontAntialias:= true;
image.TextOut(image.Width div 2,-100,'a',BGRA(128,192,128,255),taCenter);
shadowBase := TGrayscaleMask.Create(image, cAlpha);
UpdateLabelRadius;
timer := TEpikTimer.Create(Self);
shadowOfs := Point(10,10);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
image.free;
shadowBase.free;
end;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button = mbLeft then
begin
movingOrigin := Point(X,Y);
movingShadow := true;
end;
end;
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if movingShadow then
begin
inc(shadowOfs.x, X-movingOrigin.X);
inc(shadowOfs.y, Y-movingOrigin.Y);
movingOrigin := Point(X,Y);
Invalidate;
end;
end;
procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button = mbLeft then
movingShadow:= false;
end;
end.

View File

@@ -0,0 +1,542 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<PathDelim Value="\"/>
<General>
<MainUnit Value="0"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1" Active="Default">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<RequiredPackages Count="2">
<Item1>
<PackageName Value="bgrabitmappack"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="50">
<Unit0>
<Filename Value="bspline.lpr"/>
<IsPartOfProject Value="True"/>
<UsageCount Value="85"/>
</Unit0>
<Unit1>
<Filename Value="bspline_main.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<IsVisibleTab Value="True"/>
<TopLine Value="132"/>
<CursorPos X="31" Y="150"/>
<UsageCount Value="85"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
<Unit2>
<Filename Value="..\bgrabitmap\bgradefaultbitmap.pas"/>
<UnitName Value="BGRADefaultBitmap"/>
<EditorIndex Value="-1"/>
<TopLine Value="568"/>
<CursorPos X="18" Y="589"/>
<UsageCount Value="40"/>
</Unit2>
<Unit3>
<Filename Value="..\bgrabitmap\bgrapolygon.pas"/>
<UnitName Value="BGRAPolygon"/>
<EditorIndex Value="-1"/>
<TopLine Value="930"/>
<CursorPos X="46" Y="949"/>
<UsageCount Value="42"/>
</Unit3>
<Unit4>
<Filename Value="..\bgrabitmap\bgraresample.pas"/>
<UnitName Value="BGRAResample"/>
<EditorIndex Value="-1"/>
<TopLine Value="68"/>
<CursorPos X="10" Y="87"/>
<UsageCount Value="42"/>
</Unit4>
<Unit5>
<Filename Value="..\bgrabitmap\bgrabitmaptypes.pas"/>
<UnitName Value="BGRABitmapTypes"/>
<EditorIndex Value="-1"/>
<UsageCount Value="23"/>
</Unit5>
<Unit6>
<Filename Value="..\bgrabitmap\bgrapen.pas"/>
<UnitName Value="BGRAPen"/>
<EditorIndex Value="-1"/>
<TopLine Value="732"/>
<CursorPos Y="753"/>
<UsageCount Value="38"/>
</Unit6>
<Unit7>
<Filename Value="D:\lazarus\lcl\graphics.pp"/>
<TopLine Value="82"/>
<CursorPos X="3" Y="95"/>
<UsageCount Value="6"/>
</Unit7>
<Unit8>
<Filename Value="..\bgrabitmap\bgrapath.pas"/>
<UnitName Value="BGRAPath"/>
<EditorIndex Value="-1"/>
<TopLine Value="2560"/>
<CursorPos X="21" Y="2570"/>
<UsageCount Value="39"/>
</Unit8>
<Unit9>
<Filename Value="C:\lazarus\fpc\2.6.2\source\rtl\objpas\math.pp"/>
<TopLine Value="175"/>
<CursorPos X="10" Y="193"/>
<UsageCount Value="15"/>
</Unit9>
<Unit10>
<Filename Value="..\bgrabitmap\bgrafillinfo.pas"/>
<UnitName Value="BGRAFillInfo"/>
<EditorIndex Value="-1"/>
<TopLine Value="234"/>
<CursorPos X="20" Y="253"/>
<UsageCount Value="15"/>
</Unit10>
<Unit11>
<Filename Value="..\bgrabitmap\csscolorconst.inc"/>
<EditorIndex Value="-1"/>
<UsageCount Value="14"/>
</Unit11>
<Unit12>
<Filename Value="..\bgrabitmap\geometrytypes.inc"/>
<EditorIndex Value="-1"/>
<UsageCount Value="29"/>
</Unit12>
<Unit13>
<Filename Value="..\bgrabitmap\bgragraphics.pas"/>
<UnitName Value="BGRAGraphics"/>
<EditorIndex Value="-1"/>
<TopLine Value="39"/>
<CursorPos X="3" Y="58"/>
<UsageCount Value="13"/>
</Unit13>
<Unit14>
<Filename Value="..\bgrabitmap\bgratransform.pas"/>
<UnitName Value="BGRATransform"/>
<EditorIndex Value="-1"/>
<CursorPos X="3" Y="14"/>
<UsageCount Value="15"/>
</Unit14>
<Unit15>
<Filename Value="C:\lazarus\lcl\graphtype.pp"/>
<TopLine Value="23"/>
<CursorPos X="5" Y="42"/>
<UsageCount Value="11"/>
</Unit15>
<Unit16>
<Filename Value="C:\lazarus\lcl\graphics.pp"/>
<TopLine Value="153"/>
<CursorPos X="3" Y="172"/>
<UsageCount Value="11"/>
</Unit16>
<Unit17>
<Filename Value="C:\lazarus\fpc\2.6.2\source\rtl\objpas\types.pp"/>
<TopLine Value="276"/>
<CursorPos X="10" Y="295"/>
<UsageCount Value="11"/>
</Unit17>
<Unit18>
<Filename Value="C:\lazarus\lcl\include\customcontrol.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="65"/>
<CursorPos Y="79"/>
<UsageCount Value="30"/>
</Unit18>
<Unit19>
<Filename Value="..\bgrabitmap\bgragifformat.pas"/>
<CursorPos X="26" Y="8"/>
<UsageCount Value="10"/>
</Unit19>
<Unit20>
<Filename Value="..\bgrabitmap\bgracustombitmap.inc"/>
<EditorIndex Value="-1"/>
<CursorPos X="62"/>
<UsageCount Value="27"/>
</Unit20>
<Unit21>
<Filename Value="C:\lazarus\fpc\2.6.2\source\packages\fcl-image\src\fpwritepcx.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="60"/>
<CursorPos X="79" Y="78"/>
<UsageCount Value="12"/>
</Unit21>
<Unit22>
<Filename Value="C:\lazarus\fpc\2.6.2\source\packages\fcl-image\src\fpimage.pp"/>
<TopLine Value="530"/>
<CursorPos X="11" Y="549"/>
<UsageCount Value="9"/>
</Unit22>
<Unit23>
<Filename Value="C:\lazarus\fpc\2.6.2\source\packages\fcl-image\src\fpreadpcx.pas"/>
<CursorPos Y="2"/>
<UsageCount Value="9"/>
</Unit23>
<Unit24>
<Filename Value="C:\lazarus\fpc\2.6.2\source\packages\fcl-image\src\fpwritexpm.pp"/>
<TopLine Value="5"/>
<CursorPos X="3" Y="24"/>
<UsageCount Value="9"/>
</Unit24>
<Unit25>
<Filename Value="C:\lazarus\fpc\2.6.2\source\packages\fcl-image\src\fphandler.inc"/>
<TopLine Value="88"/>
<CursorPos X="3" Y="92"/>
<UsageCount Value="9"/>
</Unit25>
<Unit26>
<Filename Value="..\bgrabitmap\bgrareadpcx.pas"/>
<UsageCount Value="9"/>
</Unit26>
<Unit27>
<Filename Value="..\bgrabitmap\bgrareadxpm.pas"/>
<UsageCount Value="9"/>
</Unit27>
<Unit28>
<Filename Value="..\bgrabitmap\bgracanvas2d.pas"/>
<UnitName Value="BGRACanvas2D"/>
<EditorIndex Value="-1"/>
<TopLine Value="248"/>
<CursorPos X="3" Y="263"/>
<UsageCount Value="15"/>
</Unit28>
<Unit29>
<Filename Value="..\bgrabitmap\bgrapixel.inc"/>
<EditorIndex Value="-1"/>
<UsageCount Value="12"/>
</Unit29>
<Unit30>
<Filename Value="..\bgrabitmap\bgrapolygonaliased.pas"/>
<UnitName Value="BGRAPolygonAliased"/>
<EditorIndex Value="-1"/>
<TopLine Value="719"/>
<CursorPos X="42" Y="737"/>
<UsageCount Value="12"/>
</Unit30>
<Unit31>
<Filename Value="..\bgrabitmap\polyaliaspersp.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="345"/>
<CursorPos X="42" Y="363"/>
<UsageCount Value="12"/>
</Unit31>
<Unit32>
<Filename Value="..\bgrabitmap\bgragradients.pas"/>
<UnitName Value="BGRAGradients"/>
<EditorIndex Value="-1"/>
<UsageCount Value="12"/>
</Unit32>
<Unit33>
<Filename Value="..\bgrabitmap\bgragradientscanner.pas"/>
<UnitName Value="BGRAGradientScanner"/>
<EditorIndex Value="-1"/>
<CursorPos X="14" Y="20"/>
<UsageCount Value="12"/>
</Unit33>
<Unit34>
<Filename Value="C:\lazarus\fpc\2.6.2\source\packages\fcl-image\src\fpwritetga.pp"/>
<EditorIndex Value="-1"/>
<TopLine Value="6"/>
<CursorPos X="3" Y="37"/>
<UsageCount Value="12"/>
</Unit34>
<Unit35>
<Filename Value="..\bgrabitmap\bgrareadtga.pas"/>
<UnitName Value="BGRAReadTGA"/>
<EditorIndex Value="-1"/>
<TopLine Value="67"/>
<CursorPos X="70" Y="84"/>
<UsageCount Value="12"/>
</Unit35>
<Unit36>
<Filename Value="C:\lazarus\fpc\2.6.2\source\packages\fcl-image\src\fpwritetiff.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="399"/>
<CursorPos X="51" Y="430"/>
<UsageCount Value="12"/>
</Unit36>
<Unit37>
<Filename Value="C:\lazarus\fpc\2.6.2\source\packages\fcl-image\src\fptiffcmn.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="24"/>
<CursorPos X="3" Y="43"/>
<UsageCount Value="12"/>
</Unit37>
<Unit38>
<Filename Value="C:\lazarus\fpc\2.6.2\source\packages\fcl-image\src\fpreadtiff.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="1461"/>
<CursorPos X="3" Y="1469"/>
<UsageCount Value="12"/>
</Unit38>
<Unit39>
<Filename Value="C:\lazarus\fpc\2.6.2\source\packages\fcl-image\src\fpreadxwd.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="218"/>
<CursorPos X="3" Y="255"/>
<UsageCount Value="12"/>
</Unit39>
<Unit40>
<Filename Value="..\bgrabitmap\bgratext.pas"/>
<UnitName Value="BGRAText"/>
<EditorIndex Value="-1"/>
<TopLine Value="44"/>
<CursorPos X="10" Y="63"/>
<UsageCount Value="12"/>
</Unit40>
<Unit41>
<Filename Value="..\bgrabitmap\bgravectorize.pas"/>
<UnitName Value="BGRAVectorize"/>
<EditorIndex Value="-1"/>
<TopLine Value="1267"/>
<CursorPos X="40" Y="1286"/>
<UsageCount Value="10"/>
</Unit41>
<Unit42>
<Filename Value="..\bgrabitmap\bgratextfx.pas"/>
<UnitName Value="BGRATextFX"/>
<EditorIndex Value="-1"/>
<TopLine Value="653"/>
<CursorPos X="49" Y="672"/>
<UsageCount Value="10"/>
</Unit42>
<Unit43>
<Filename Value="C:\lazarus\lcl\lclproc.pas"/>
<UnitName Value="LCLProc"/>
<EditorIndex Value="-1"/>
<TopLine Value="2661"/>
<CursorPos X="3" Y="2678"/>
<UsageCount Value="10"/>
</Unit43>
<Unit44>
<Filename Value="C:\lazarus\components\lazutils\lazutf8.pas"/>
<UnitName Value="LazUTF8"/>
<EditorIndex Value="-1"/>
<CursorPos X="71" Y="18"/>
<UsageCount Value="10"/>
</Unit44>
<Unit45>
<Filename Value="..\bgrabitmap\bgrautf8.pas"/>
<UnitName Value="BGRAUTF8"/>
<EditorIndex Value="-1"/>
<TopLine Value="270"/>
<CursorPos X="60" Y="279"/>
<UsageCount Value="10"/>
</Unit45>
<Unit46>
<Filename Value="..\..\bgrabitmap\geometrytypes.inc"/>
<EditorIndex Value="1"/>
<TopLine Value="1238"/>
<CursorPos X="62" Y="1250"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit46>
<Unit47>
<Filename Value="..\..\bgrabitmap\bgraresample.pas"/>
<UnitName Value="BGRAResample"/>
<EditorIndex Value="3"/>
<TopLine Value="1186"/>
<CursorPos X="10" Y="1197"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit47>
<Unit48>
<Filename Value="..\..\bgrabitmap\bgrapath.pas"/>
<UnitName Value="BGRAPath"/>
<EditorIndex Value="4"/>
<TopLine Value="599"/>
<CursorPos X="61" Y="616"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit48>
<Unit49>
<Filename Value="..\..\bgrabitmap\bgrabitmaptypes.pas"/>
<UnitName Value="BGRABitmapTypes"/>
<EditorIndex Value="2"/>
<CursorPos X="66" Y="13"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit49>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="..\..\bgrabitmap\bgrapath.pas"/>
<Caret Line="473" Column="10" TopLine="455"/>
</Position1>
<Position2>
<Filename Value="..\..\bgrabitmap\bgrapath.pas"/>
<Caret Line="529" Column="62" TopLine="508"/>
</Position2>
<Position3>
<Filename Value="..\..\bgrabitmap\bgrapath.pas"/>
<Caret Line="602" Column="10" TopLine="597"/>
</Position3>
<Position4>
<Filename Value="..\..\bgrabitmap\bgrapath.pas"/>
<Caret Line="2313" Column="39" TopLine="2295"/>
</Position4>
<Position5>
<Filename Value="..\..\bgrabitmap\bgrapath.pas"/>
<Caret Line="613" Column="69" TopLine="602"/>
</Position5>
<Position6>
<Filename Value="..\..\bgrabitmap\geometrytypes.inc"/>
<Caret Line="574" Column="63" TopLine="550"/>
</Position6>
<Position7>
<Filename Value="..\..\bgrabitmap\geometrytypes.inc"/>
<Caret Line="1293" Column="66" TopLine="1276"/>
</Position7>
<Position8>
<Filename Value="..\..\bgrabitmap\bgrapath.pas"/>
<Caret Line="613" Column="69" TopLine="602"/>
</Position8>
<Position9>
<Filename Value="..\..\bgrabitmap\bgrapath.pas"/>
<Caret Line="2388" Column="45" TopLine="2388"/>
</Position9>
<Position10>
<Filename Value="..\..\bgrabitmap\geometrytypes.inc"/>
<Caret Line="1298" TopLine="1279"/>
</Position10>
<Position11>
<Filename Value="bspline_main.pas"/>
<Caret Line="135" Column="61" TopLine="122"/>
</Position11>
<Position12>
<Filename Value="bspline_main.pas"/>
<Caret Line="141" Column="32" TopLine="122"/>
</Position12>
<Position13>
<Filename Value="bspline_main.pas"/>
<Caret Line="143" TopLine="132"/>
</Position13>
<Position14>
<Filename Value="..\..\bgrabitmap\bgrapath.pas"/>
<Caret Line="2292" TopLine="2277"/>
</Position14>
<Position15>
<Filename Value="..\..\bgrabitmap\bgrapath.pas"/>
<Caret Line="2297" TopLine="2286"/>
</Position15>
<Position16>
<Filename Value="..\..\bgrabitmap\bgrapath.pas"/>
<Caret Line="2298" TopLine="2286"/>
</Position16>
<Position17>
<Filename Value="..\..\bgrabitmap\bgrapath.pas"/>
<Caret Line="2299" TopLine="2286"/>
</Position17>
<Position18>
<Filename Value="..\..\bgrabitmap\bgrapath.pas"/>
<Caret Line="2300" TopLine="2286"/>
</Position18>
<Position19>
<Filename Value="..\..\bgrabitmap\bgrapath.pas"/>
<Caret Line="2301" TopLine="2286"/>
</Position19>
<Position20>
<Filename Value="..\..\bgrabitmap\bgrapath.pas"/>
<Caret Line="2302" TopLine="2286"/>
</Position20>
<Position21>
<Filename Value="..\..\bgrabitmap\bgrapath.pas"/>
<Caret Line="527" TopLine="509"/>
</Position21>
<Position22>
<Filename Value="..\..\bgrabitmap\geometrytypes.inc"/>
<Caret Line="1111" TopLine="1096"/>
</Position22>
<Position23>
<Filename Value="..\..\bgrabitmap\geometrytypes.inc"/>
<Caret Line="1112" TopLine="1096"/>
</Position23>
<Position24>
<Filename Value="..\..\bgrabitmap\geometrytypes.inc"/>
<Caret Line="1113" TopLine="1096"/>
</Position24>
<Position25>
<Filename Value="..\..\bgrabitmap\geometrytypes.inc"/>
<Caret Line="1253" TopLine="1238"/>
</Position25>
<Position26>
<Filename Value="..\..\bgrabitmap\geometrytypes.inc"/>
<Caret Line="1254" TopLine="1238"/>
</Position26>
<Position27>
<Filename Value="..\..\bgrabitmap\geometrytypes.inc"/>
<Caret Line="1255" TopLine="1238"/>
</Position27>
<Position28>
<Filename Value="..\..\bgrabitmap\geometrytypes.inc"/>
<Caret Line="1257" TopLine="1238"/>
</Position28>
<Position29>
<Filename Value="..\..\bgrabitmap\geometrytypes.inc"/>
<Caret Line="1258" TopLine="1238"/>
</Position29>
<Position30>
<Filename Value="..\..\bgrabitmap\geometrytypes.inc"/>
<Caret Line="1255" TopLine="1238"/>
</Position30>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="bspline"/>
</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>

View File

@@ -0,0 +1,20 @@
program bspline;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, bspline_main, bgrabitmappack
{ you can add units after this };
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@@ -0,0 +1,129 @@
object Form1: TForm1
Left = 540
Height = 595
Top = 37
Width = 647
Caption = 'BGRA Spline interpolation'
ClientHeight = 595
ClientWidth = 647
OnCreate = FormCreate
OnDestroy = FormDestroy
OnMouseDown = FormMouseDown
OnMouseMove = FormMouseMove
OnMouseUp = FormMouseUp
OnPaint = FormPaint
OnResize = FormResize
Position = poDefaultPosOnly
LCLVersion = '1.6.0.4'
object Panel1: TPanel
Left = 0
Height = 51
Top = 544
Width = 647
Align = alBottom
ClientHeight = 51
ClientWidth = 647
Color = clForm
ParentColor = False
TabOrder = 0
object CheckBox_Closed: TCheckBox
Left = 400
Height = 19
Top = 24
Width = 56
Caption = 'Closed'
OnChange = CheckBox_Change
TabOrder = 0
end
object Radio_Inside: TRadioButton
Left = 88
Height = 19
Top = 4
Width = 51
Caption = 'Inside'
OnChange = Radio_Change
TabOrder = 1
end
object Radio_Crossing: TRadioButton
Left = 192
Height = 19
Top = 4
Width = 66
Caption = 'Crossing'
OnChange = Radio_Change
TabOrder = 2
end
object Radio_Outside: TRadioButton
Left = 192
Height = 19
Top = 24
Width = 61
Caption = 'Outside'
OnChange = Radio_Change
TabOrder = 3
end
object Radio_Rounded: TRadioButton
Left = 280
Height = 19
Top = 4
Width = 68
Caption = 'Rounded'
Checked = True
OnChange = Radio_Change
TabOrder = 4
TabStop = True
end
object Radio_VertexToSide: TRadioButton
Left = 280
Height = 19
Top = 24
Width = 91
Caption = 'Vertex to side'
OnChange = Radio_Change
TabOrder = 6
end
object Radio_Bezier2: TRadioButton
Left = 8
Height = 19
Top = 4
Width = 57
Caption = 'Bezier2'
OnChange = Radio_Change
TabOrder = 7
end
object Radio_Bezier3: TRadioButton
Left = 8
Height = 19
Top = 24
Width = 57
Caption = 'Bezier3'
OnChange = Radio_Change
TabOrder = 8
end
object CheckBox_CanJump: TCheckBox
Left = 400
Height = 19
Top = 4
Width = 72
Caption = 'Can jump'
Checked = True
State = cbChecked
TabOrder = 9
end
object Radio_EasyBezier: TRadioButton
Left = 88
Height = 19
Top = 24
Width = 77
Caption = 'Easy Bezier'
OnChange = Radio_Change
TabOrder = 5
end
end
object Timer1: TTimer
Interval = 40
OnTimer = Timer1Timer
Left = 97
Top = 184
end
end

View File

@@ -0,0 +1,305 @@
unit bspline_main;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
BGRABitmap, BGRABitmapTypes, LMessages, ExtCtrls, BGRAPath;
type
{ TForm1 }
TForm1 = class(TForm)
CheckBox_CanJump: TCheckBox;
CheckBox_Closed: TCheckBox;
Panel1: TPanel;
Radio_Bezier2: TRadioButton;
Radio_Bezier3: TRadioButton;
Radio_Crossing: TRadioButton;
Radio_Inside: TRadioButton;
Radio_Outside: TRadioButton;
Radio_Rounded: TRadioButton;
Radio_EasyBezier: TRadioButton;
Radio_VertexToSide: TRadioButton;
Timer1: TTimer;
procedure CheckBox_Change(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormPaint(Sender: TObject);
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
{%H-}Shift: TShiftState; X, Y: Integer);
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
procedure FormMouseUp(Sender: TObject; Button: TMouseButton;
{%H-}Shift: TShiftState; {%H-}X, {%H-}Y: Integer);
procedure FormResize(Sender: TObject);
procedure Radio_Change(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure WMEraseBkgnd(var {%H-}Message: TLMEraseBkgnd); message LM_ERASEBKGND;
public
{ public declarations }
pts: array of TPointF;
MovingPointIndex: Integer;
MovingOrigin: TPointF;
PreviousSize: TPointF;
FPath: TBGRAPath;
FPathCursor: TBGRAPathCursor;
FPathThumbnail: TBGRAPath;
FPathSpeed: single;
FPathPos: single;
procedure PathChange;
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
uses math;
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
var
h: Integer;
begin
h := clientheight-Panel1.Height;
setlength(pts,7);
pts[1] := PointF(clientwidth/2,h/2);
pts[0] := pts[1] + pointF(0,75);
pts[2] := PointF(100,100);
pts[3] := pointF(clientwidth-100,100);
pts[4] := pointF(clientwidth-100,h-100);
pts[5] := pointF(100,h-100);
pts[6] := pointF(100,pts[0].y);
MovingPointIndex := -1;
FPathSpeed := 4;
FPathPos := 0;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
FreeAndNil(FPathCursor);
FreeAndNil(FPath);
end;
procedure TForm1.CheckBox_Change(Sender: TObject);
begin
PathChange;
end;
procedure TForm1.FormPaint(Sender: TObject);
var bmp: TBGRABitmap;
i: Integer;
style: TSplineStyle;
nbPoints: integer;
pt,tangent: TPointF;
closed: boolean;
thumbRect: TRect;
begin
PreviousSize := PointF(ClientWidth,clientheight);
bmp := TBGRABitmap.Create(clientwidth,panel1.top,BGRAWhite);
closed := CheckBox_Closed.Checked;
if Radio_Bezier2.Checked then
nbPoints := ((length(pts)-1+integer(closed)) div 2)*2+1-integer(closed)
else if Radio_Bezier3.Checked then
nbPoints := ((length(pts)-1+integer(closed)) div 3)*3+1-integer(closed)
else
nbPoints := length(pts);
if FPath = nil then
begin
FPath := TBGRAPath.Create;
if Radio_Bezier2.Checked then
begin
FPath.moveTo(pts[0]);
for i := 1 to (nbPoints-1+integer(closed)) div 2 do
FPath.quadraticCurveTo(pts[2*(i-1)+1],pts[(2*(i-1)+2) mod nbPoints]);
if closed then FPath.closePath;
end
else
if Radio_Bezier3.Checked then
begin
FPath.moveTo(pts[0]);
for i := 1 to (nbPoints-1+integer(closed)) div 3 do
FPath.bezierCurveTo(pts[3*(i-1)+1],pts[3*(i-1)+2],pts[(3*(i-1)+3) mod nbPoints]);
if closed then FPath.closePath;
end
else
begin
if Radio_Inside.Checked then style := ssInsideWithEnds else
if Radio_Crossing.Checked then style := ssCrossingWithEnds else
if Radio_Outside.checked then style := ssOutside else
if Radio_Rounded.Checked then style := ssRoundOutside else
if Radio_EasyBezier.Checked then style := ssEasyBezier else
style := ssVertexToSide;
if closed then
FPath.closedSpline(slice(pts,nbPoints), style)
else
FPath.openedSpline(slice(pts,nbPoints), style);
end;
end;
if Assigned(FPath) then
begin
FPath.fill(bmp, BGRA(250,250,230));
if closed then
bmp.DrawPolygonAntialias(slice(pts,nbPoints),BGRA(102,148,179),1)
else
bmp.DrawPolyLineAntialias(slice(pts,nbPoints),BGRA(102,148,179),1);
for i := 0 to nbPoints-1 do
bmp.FillEllipseAntialias(pts[i].x,pts[i].y,5,5,BGRA(102,148,179));
FPath.stroke(bmp, BGRABlack, 2);
if FPathCursor = nil then
begin
FPathCursor := FPath.CreateCursor;
FPathCursor.LoopPath:= true;
FPathCursor.Position := FPathPos*FPathCursor.PathLength;
end;
thumbRect := recT(bmp.Width-128,0,bmp.Width,128);
if FPathThumbnail = nil then
begin
FPathThumbnail := TBGRAPath.Create;
FPath.FitInto(FPathThumbnail, RectF(0,0,thumbRect.Right-thumbRect.Left-1,thumbRect.Bottom-thumbRect.Top-1));
end;
bmp.FillRect(thumbRect, BGRA(102,148,179,128), dmDrawWithTransparency);
FPathThumbnail.stroke(bmp, thumbRect.Left, thumbRect.Top, BGRABlack, 1);
with FPathCursor.Bounds do
bmp.RectangleAntialias(Left,Top,Right,Bottom,CSSFireBrick,1.5);
//bmp.TextOut(0,bmp.FontFullHeight, IntToStr(length(comp_pts))+' points', BGRABlack);
//bmp.DrawPolyLineAntialiasAutocycle(FPath.ToPoints(0.1),BGRABlack,1);
bmp.ArrowEndAsClassic;
pt := FPathCursor.CurrentCoordinate;
tangent := FPathCursor.CurrentTangent;
bmp.DrawLineAntialias(pt.x,pt.y,pt.x+tangent.x*40*Sign(FPathSpeed),pt.y+tangent.y*40*Sign(FPathSpeed),CSSFireBrick,3);
bmp.DrawLineAntialias(pt.x,pt.y,pt.x-tangent.y*40*Sign(FPathSpeed),pt.y+tangent.x*40*Sign(FPathSpeed),CSSFireBrick,3);
bmp.ArrowEndAsNone;
bmp.TextOut(0,0, 'Length: ' + IntToStr(round(FPathCursor.PathLength)), BGRABlack);
if FPathCursor.PathLength > 0 then
bmp.TextOut(0,bmp.FontFullHeight, IntToStr(round(FPathCursor.Position / FPathCursor.PathLength*100))+'%', BGRABlack);
end;
bmp.draw(Canvas,0,0);
bmp.Free;
end;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var maxDist,dist: single;
mousePos,vect: TPointF;
i: Integer;
begin
if Button <> mbLeft then exit;
//select point to move
MovingPointIndex := -1;
maxDist := 10;
mousePos := PointF(X,Y);
MovingOrigin := mousePos;
for i := 0 to high(pts) do
begin
vect := pts[i] - mousePos;
dist := sqrt(vect*vect);
if dist < maxDist then
begin
maxDist := dist;
MovingPointIndex := i;
end;
end;
end;
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var
mousePos: TPointF;
i: Integer;
begin
if ssLeft in Shift then
begin
mousePos := PointF(X,Y);
if MovingPointIndex <> -1 then
pts[MovingPointIndex].Offset(mousePos-MovingOrigin) else
begin
for i := 0 to high(pts) do
pts[i].Offset(mousePos-MovingOrigin);
end;
PathChange;
MovingOrigin := mousePos;
end;
end;
procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button = mbLeft then MovingPointIndex := -1;
end;
procedure TForm1.FormResize(Sender: TObject);
var factor: TPointF;
i,ph: Integer;
begin
ph := Panel1.Height;
if (clientWidth > 0) and (clientheight-ph > 0) and
(previousSize.X > 0) and (previousSize.Y-ph > 0) then
begin
factor.X := clientWidth/PreviousSize.X;
factor.Y := (clientheight-ph)/(PreviousSize.Y-ph);
for i := 0 to high(pts) do
begin
pts[i].x *= factor.X;
pts[i].y *= factor.y;
end;
PreviousSize := PointF(ClientWidth,clientheight);
PathChange;
end;
end;
procedure TForm1.Radio_Change(Sender: TObject);
begin
PathChange;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if Assigned(FPathCursor) then
begin
if FPathCursor.MoveForward(FPathSpeed, CheckBox_CanJump.Checked) <> FPathSpeed then
FPathSpeed:= -FPathSpeed;
if FPathCursor.PathLength > 0 then
FPathPos := FPathCursor.Position/FPathCursor.PathLength;
invalidate;
end;
end;
procedure TForm1.WMEraseBkgnd(var Message: TLMEraseBkgnd);
begin
//
end;
procedure TForm1.PathChange;
begin
FreeAndNil(FPathCursor);
FreeAndNil(FPathThumbnail);
FreeAndNil(FPath);
Invalidate;
end;
end.

View File

@@ -0,0 +1,243 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<PathDelim Value="\"/>
<General>
<MainUnit Value="0"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1" Active="Default">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<RequiredPackages Count="3">
<Item1>
<PackageName Value="etpackage"/>
</Item1>
<Item2>
<PackageName Value="bgrabitmappack"/>
</Item2>
<Item3>
<PackageName Value="LCL"/>
</Item3>
</RequiredPackages>
<Units Count="5">
<Unit0>
<Filename Value="distortions.lpr"/>
<IsPartOfProject Value="True"/>
<UsageCount Value="20"/>
</Unit0>
<Unit1>
<Filename Value="distortions_main.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="distortions_main"/>
<IsVisibleTab Value="True"/>
<TopLine Value="135"/>
<CursorPos X="43" Y="150"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
<Unit2>
<Filename Value="..\bgrabitmap\bgragradientscanner.pas"/>
<UnitName Value="BGRAGradientScanner"/>
<EditorIndex Value="2"/>
<CursorPos X="47" Y="10"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit2>
<Unit3>
<Filename Value="..\bgrabitmap\bgrabitmaptypes.pas"/>
<UnitName Value="BGRABitmapTypes"/>
<EditorIndex Value="1"/>
<TopLine Value="427"/>
<CursorPos X="3" Y="484"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit3>
<Unit4>
<Filename Value="..\bgrabitmap\bgratransform.pas"/>
<UnitName Value="BGRATransform"/>
<EditorIndex Value="3"/>
<TopLine Value="40"/>
<CursorPos X="3" Y="25"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit4>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="distortions_main.pas"/>
<Caret Line="38" Column="7" TopLine="7"/>
</Position1>
<Position2>
<Filename Value="distortions_main.pas"/>
<Caret Line="41" Column="53" TopLine="11"/>
</Position2>
<Position3>
<Filename Value="distortions_main.pas"/>
<Caret Line="22" Column="24" TopLine="22"/>
</Position3>
<Position4>
<Filename Value="distortions_main.pas"/>
<Caret Line="42" Column="61" TopLine="22"/>
</Position4>
<Position5>
<Filename Value="distortions_main.pas"/>
<Caret Line="48" Column="63" TopLine="40"/>
</Position5>
<Position6>
<Filename Value="distortions_main.pas"/>
<Caret Line="25" Column="19"/>
</Position6>
<Position7>
<Filename Value="distortions_main.pas"/>
<Caret Line="12" Column="34"/>
</Position7>
<Position8>
<Filename Value="distortions_main.pas"/>
<Caret Line="17" Column="15"/>
</Position8>
<Position9>
<Filename Value="distortions_main.pas"/>
<Caret Line="18" Column="45" TopLine="4"/>
</Position9>
<Position10>
<Filename Value="distortions_main.pas"/>
<Caret Line="94" Column="62" TopLine="73"/>
</Position10>
<Position11>
<Filename Value="distortions_main.pas"/>
<Caret Line="39" Column="19" TopLine="17"/>
</Position11>
<Position12>
<Filename Value="distortions_main.pas"/>
<Caret Line="41" Column="19" TopLine="21"/>
</Position12>
<Position13>
<Filename Value="distortions_main.pas"/>
<Caret Line="96" Column="17" TopLine="78"/>
</Position13>
<Position14>
<Filename Value="distortions_main.pas"/>
<Caret Line="88" Column="7" TopLine="72"/>
</Position14>
<Position15>
<Filename Value="distortions_main.pas"/>
<Caret Line="89" Column="7" TopLine="73"/>
</Position15>
<Position16>
<Filename Value="distortions_main.pas"/>
<Caret Line="91" Column="7" TopLine="75"/>
</Position16>
<Position17>
<Filename Value="distortions_main.pas"/>
<Caret Line="93" Column="45" TopLine="74"/>
</Position17>
<Position18>
<Filename Value="distortions_main.pas"/>
<Caret Line="41" Column="29" TopLine="19"/>
</Position18>
<Position19>
<Filename Value="distortions_main.pas"/>
<Caret Line="42" Column="29" TopLine="22"/>
</Position19>
<Position20>
<Filename Value="distortions_main.pas"/>
<Caret Line="43" Column="29" TopLine="23"/>
</Position20>
<Position21>
<Filename Value="distortions_main.pas"/>
<Caret Line="42" Column="29" TopLine="23"/>
</Position21>
<Position22>
<Filename Value="distortions_main.pas"/>
<Caret Line="43" Column="29" TopLine="23"/>
</Position22>
<Position23>
<Filename Value="distortions_main.pas"/>
<Caret Line="42" Column="29" TopLine="23"/>
</Position23>
<Position24>
<Filename Value="distortions_main.pas"/>
<Caret Line="39" Column="79" TopLine="20"/>
</Position24>
<Position25>
<Filename Value="distortions_main.pas"/>
<Caret Line="16" Column="38" TopLine="13"/>
</Position25>
<Position26>
<Filename Value="..\bgrabitmap\bgragradientscanner.pas"/>
<Caret Line="10" Column="47"/>
</Position26>
<Position27>
<Filename Value="distortions_main.pas"/>
<Caret Line="96" Column="29" TopLine="85"/>
</Position27>
<Position28>
<Filename Value="distortions_main.pas"/>
<Caret Line="124" Column="5" TopLine="100"/>
</Position28>
<Position29>
<Filename Value="distortions_main.pas"/>
<Caret Line="152" Column="120" TopLine="126"/>
</Position29>
<Position30>
<Filename Value="distortions_main.pas"/>
<Caret Line="129" Column="39" TopLine="127"/>
</Position30>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="distortions"/>
</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>

View File

@@ -0,0 +1,20 @@
program distortions;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, distortions_main, bgrabitmappack, etpackage
{ you can add units after this };
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@@ -0,0 +1,69 @@
object Form1: TForm1
Left = 307
Height = 387
Top = 220
Width = 622
Caption = 'BGRA Image and gradient distortions'
ClientHeight = 387
ClientWidth = 622
OnCreate = FormCreate
OnDestroy = FormDestroy
OnPaint = FormPaint
LCLVersion = '1.4.0.4'
object Panel1: TPanel
Left = 0
Height = 59
Top = 328
Width = 622
Align = alBottom
ClientHeight = 59
ClientWidth = 622
TabOrder = 0
object TrackBar_Angle: TTrackBar
Left = 0
Height = 25
Top = 24
Width = 320
Frequency = 30
Max = 360
Position = 20
Anchors = [akTop, akLeft, akRight]
TabOrder = 0
end
object Label1: TLabel
Left = 8
Height = 15
Top = 8
Width = 31
Caption = 'Angle'
ParentColor = False
end
object Label2: TLabel
Left = 337
Height = 15
Top = 8
Width = 27
Anchors = [akTop, akRight]
Caption = 'Scale'
ParentColor = False
end
object TrackBar_Scale: TTrackBar
Left = 328
Height = 25
Top = 24
Width = 288
Frequency = 10
Max = 50
Min = 1
Position = 10
Anchors = [akTop, akRight]
TabOrder = 1
end
end
object Timer1: TTimer
Interval = 16
OnTimer = Timer1Timer
left = 65
top = 139
end
end

View File

@@ -0,0 +1,162 @@
unit distortions_main;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
ComCtrls, StdCtrls, BGRABitmap, BGRABitmapTypes, BGRAGradientScanner,
LMessages, EpikTimer;
type
{ TWaveDistortion }
TWaveDistortion = class(TBGRACustomScanner)
private
FSource : IBGRAScanner;
FCenter : TPointF;
FRadius, FAmplitude: Single;
public
Delta: single;
constructor Create(source : IBGRAScanner; center : TPointF; radius, amplitude: single);
function ScanAt(X, Y: Single): TBGRAPixel; override;
end;
{ TForm1 }
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Panel1: TPanel;
Timer1: TTimer;
TrackBar_Angle: TTrackBar;
TrackBar_Scale: TTrackBar;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormPaint(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure WMEraseBkgnd(var Message: TLMEraseBkgnd); message LM_ERASEBKGND;
private
{ private declarations }
public
{ public declarations }
image: TBGRABitmap;
grad: TBGRAGradientScanner;
multigrad: TBGRAMultiGradient;
delta: single;
timer: TEpikTimer;
end;
var
Form1: TForm1;
implementation
uses BGRATransform;
{ TWaveDistortion }
constructor TWaveDistortion.Create(source: IBGRAScanner; center : TPointF; radius, amplitude: single);
begin
FSource := Source;
FCenter := center;
FRadius := radius;
FAmplitude := amplitude;
Delta := 0;
end;
function TWaveDistortion.ScanAt(X, Y: Single): TBGRAPixel;
var d: single;
p,v: TPointF;
begin
p := PointF(X,Y);
v := p-FCenter;
d := sqrt(v*v);
if d <> 0 then v.Scale(1/d);
p.Offset( v*(sin(d*2*Pi/FRadius+Delta)*FAmplitude) );
result := FSource.ScanAt(p.X,p.Y);
end;
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormPaint(Sender: TObject);
const ampl = 10;
var bmp: TBGRABitmap;
tx,ty: integer;
x,y,rx,ry,scale :single;
procedure DrawEllipse(source: IBGRAScanner);
var
disto: TWaveDistortion;
affine: TBGRAAffineScannerTransform;
begin
affine := TBGRAAffineScannerTransform.Create(source);
affine.RotateDeg(TrackBar_Angle.Position);
affine.Scale(scale,scale);
affine.Translate(x,y);
disto := TWaveDistortion.Create(affine,PointF(x,y),(rx+ry)/2*0.6,ampl);
disto.Delta := Delta;
bmp.FillEllipseAntialias(x,y,rx,ry,disto);
disto.Free;
affine.free;
end;
begin
timer.Clear;
timer.start;
tx := ClientWidth;
ty := Panel1.Top;
scale := TrackBar_Scale.Position/10;
bmp := TBGRABitmap.Create(tx,ty, BGRAWhite);
x := tx/4;
y := ty/2;
rx := tx/4*0.8;
ry := ty/2*0.8;
image.ScanOffset := Point(round(image.width/2),round(image.Height/2));
DrawEllipse(image);
x := 3*tx/4;
y := ty/2;
bmp.FillEllipseAntialias(x,y,rx,ry,BGRABlack);
grad := TBGRAGradientScanner.Create(multigrad,gtRadial,PointF(0.4*rx/scale,-0.4*ry/scale),PointF(0.4*rx/scale+rx,-0.4*ry/scale),False);
DrawEllipse(grad);
grad.free;
timer.Stop;
bmp.TextOut(0,0,inttostr(round(timer.Elapsed*1000))+ ' ms',BGRABlack);
bmp.Draw(Canvas,0,0);
bmp.Free;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Timer1.Enabled := false;
Delta -= 10*Pi/180;
Repaint;
Timer1.Enabled := true;
end;
procedure TForm1.WMEraseBkgnd(var Message: TLMEraseBkgnd);
begin
//
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
image := TBGRABitmap.Create('spheres.png');
timer := TEpikTimer.Create(self);
multigrad := TBGRAMultiGradient.Create([BGRAWhite,BGRA(255,235,96),BGRA(255,160,0),BGRA(140,0,0),BGRA(64,0,0),BGRA(160,64,0)],[0,0.2,0.4,0.8,0.9,1],True);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
image.free;
multigrad.Free;
end;
end.

View File

@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<PathDelim Value="\"/>
<General>
<MainUnit Value="0"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1" Active="Default">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<RequiredPackages Count="2">
<Item1>
<PackageName Value="bgrabitmappack"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="3">
<Unit0>
<Filename Value="gouraud.lpr"/>
<IsPartOfProject Value="True"/>
<UsageCount Value="20"/>
</Unit0>
<Unit1>
<Filename Value="gouraud_main.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="gouraud_main"/>
<IsVisibleTab Value="True"/>
<CursorPos X="55" Y="9"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
<Unit2>
<Filename Value="..\bgrabitmap\bgrapolygon.pas"/>
<UnitName Value="BGRAPolygon"/>
<EditorIndex Value="1"/>
<TopLine Value="19"/>
<CursorPos X="30" Y="250"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit2>
</Units>
<JumpHistory Count="6" HistoryIndex="5">
<Position1>
<Filename Value="gouraud_main.pas"/>
<Caret Line="65" Column="50" TopLine="45"/>
</Position1>
<Position2>
<Filename Value="gouraud_main.pas"/>
<Caret Line="8" Column="78"/>
</Position2>
<Position3>
<Filename Value="gouraud_main.pas"/>
<Caret Line="24" Column="15" TopLine="6"/>
</Position3>
<Position4>
<Filename Value="gouraud_main.pas"/>
<Caret Line="126" TopLine="91"/>
</Position4>
<Position5>
<Filename Value="gouraud_main.pas"/>
<Caret Line="42" Column="12" TopLine="39"/>
</Position5>
<Position6>
<Filename Value="gouraud_main.pas"/>
<Caret Line="28" Column="79" TopLine="19"/>
</Position6>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="gouraud"/>
</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>

View File

@@ -0,0 +1,20 @@
program gouraud;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, gouraud_main, bgrabitmappack
{ you can add units after this };
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@@ -0,0 +1,45 @@
object Form1: TForm1
Left = 298
Height = 319
Top = 215
Width = 404
Caption = 'Gouraud shading'
ClientHeight = 319
ClientWidth = 404
OnCreate = FormCreate
OnMouseDown = FormMouseDown
OnMouseMove = FormMouseMove
OnMouseUp = FormMouseUp
OnPaint = FormPaint
LCLVersion = '0.9.30'
object Panel1: TPanel
Left = 0
Height = 42
Top = 277
Width = 404
Align = alBottom
ClientHeight = 42
ClientWidth = 404
TabOrder = 0
object Label1: TLabel
Left = 8
Height = 16
Top = 11
Width = 42
Caption = 'Opacity'
ParentColor = False
end
object TrackBar1: TTrackBar
Left = 64
Height = 25
Top = 11
Width = 328
Frequency = 16
Max = 255
OnChange = TrackBar1Change
Position = 255
Anchors = [akTop, akLeft, akRight]
TabOrder = 0
end
end
end

View File

@@ -0,0 +1,156 @@
unit gouraud_main;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
StdCtrls, ComCtrls, BGRABitmap, BGRABitmapTypes, LMessages;
type
{ TForm1 }
TForm1 = class(TForm)
Label1: TLabel;
Panel1: TPanel;
TrackBar1: TTrackBar;
procedure FormCreate(Sender: TObject);
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
procedure FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
{ private declarations }
procedure FormPaint(Sender: TObject);
procedure TrackBar1Change(Sender: TObject);
procedure WMEraseBkgnd(var Message: TLMEraseBkgnd); message LM_ERASEBKGND;
public
{ public declarations }
MovingPointIndex: Integer;
MovingOrigin: TPointF;
pts: array[0..2] of TPointF;
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
uses BGRAPolygon;
procedure NicePoint(bmp: TBGRABitmap; x, y: single);
begin
bmp.EllipseAntialias(x,y,4,4,BGRA(0,0,0,192),1);
bmp.EllipseAntialias(x,y,3,3,BGRA(255,255,255,192),1);
bmp.EllipseAntialias(x,y,2,2,BGRA(0,0,0,192),1);
end;
{ TForm1 }
procedure TForm1.FormPaint(Sender: TObject);
var bmp: TBGRABitmap;
tx,ty,i: Integer;
c: TPointF;
multi: TBGRAMultishapeFiller;
opacity: byte;
begin
tx := ClientWidth;
ty := Panel1.Top;
bmp := TBGRABitmap.Create(tx,ty,BGRAWhite);
opacity := TrackBar1.Position;
c := (pts[0]+pts[1]+pts[2])*(1/3);
multi := TBGRAMultishapeFiller.Create;
multi.AddQuadLinearColor(pts[0],c,pts[2],pts[2]+(pts[0]-c),
BGRA(0,0,255,opacity),BGRA(255,255,255,opacity),BGRA(255,0,0,opacity),BGRA(0,0,0,opacity));
multi.AddQuadLinearColor(pts[0],c,pts[1],pts[1]+(pts[0]-c),
BGRA(0,0,255,opacity),BGRA(255,255,255,opacity),BGRA(0,255,0,opacity),BGRA(0,0,0,opacity));
multi.AddQuadLinearColor(pts[2],c,pts[1],pts[1]+(pts[2]-c),
BGRA(255,0,0,opacity),BGRA(255,255,255,opacity),BGRA(0,255,0,opacity),BGRA(0,0,0,opacity));
multi.Draw(bmp);
multi.free;
for i := 0 to 2 do
NicePoint(bmp,pts[i].x,pts[i].y);
bmp.Draw(Canvas,0,0);
bmp.free;
end;
procedure TForm1.TrackBar1Change(Sender: TObject);
begin
Invalidate;
end;
procedure TForm1.WMEraseBkgnd(var Message: TLMEraseBkgnd);
begin
//
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
pts[0] := PointF(150,10);
pts[1] := PointF(370,140);
pts[2] := PointF(50,260);
MovingPointIndex := -1;
end;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var maxDist,dist: single;
mousePos,vect: TPointF;
i: Integer;
begin
if Button <> mbLeft then exit;
//select point to move
MovingPointIndex := -1;
maxDist := 10;
mousePos := PointF(X,Y);
MovingOrigin := mousePos;
for i := 0 to high(pts) do
begin
vect := pts[i] - mousePos;
dist := sqrt(vect*vect);
if dist < maxDist then
begin
maxDist := dist;
MovingPointIndex := i;
end;
end;
end;
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var
mousePos: TPointF;
i: Integer;
begin
if ssLeft in Shift then
begin
mousePos := PointF(X,Y);
if MovingPointIndex <> -1 then
pts[MovingPointIndex].Offset(mousePos-MovingOrigin) else
begin
for i := 0 to high(pts) do
pts[i].Offset(mousePos-MovingOrigin);
end;
Invalidate;
MovingOrigin := mousePos;
end;
end;
procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button = mbLeft then MovingPointIndex := -1;
end;
end.

View File

@@ -0,0 +1,268 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<PathDelim Value="\"/>
<General>
<MainUnit Value="0"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
<ActiveWindowIndexAtStart Value="0"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1" Active="Default">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<RequiredPackages Count="3">
<Item1>
<PackageName Value="etpackage"/>
</Item1>
<Item2>
<PackageName Value="bgrabitmappack"/>
</Item2>
<Item3>
<PackageName Value="LCL"/>
</Item3>
</RequiredPackages>
<Units Count="6">
<Unit0>
<Filename Value="image_filters2.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="image_filters2"/>
<EditorIndex Value="1"/>
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="30" Y="10"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
<Filename Value="image_filters2_main.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="image_filters2_main"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="0"/>
<WindowIndex Value="0"/>
<TopLine Value="148"/>
<CursorPos X="76" Y="171"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
<Unit2>
<Filename Value="D:\lazarus\lcl\graphics.pp"/>
<UnitName Value="Graphics"/>
<EditorIndex Value="5"/>
<WindowIndex Value="0"/>
<TopLine Value="242"/>
<CursorPos X="3" Y="252"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit2>
<Unit3>
<Filename Value="..\bgrabitmap\bgrabitmaptypes.pas"/>
<UnitName Value="BGRABitmapTypes"/>
<EditorIndex Value="4"/>
<WindowIndex Value="0"/>
<TopLine Value="62"/>
<CursorPos X="59" Y="86"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit3>
<Unit4>
<Filename Value="..\bgrabitmap\bgradefaultbitmap.pas"/>
<UnitName Value="BGRADefaultBitmap"/>
<EditorIndex Value="2"/>
<WindowIndex Value="0"/>
<TopLine Value="3330"/>
<CursorPos X="33" Y="3333"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit4>
<Unit5>
<Filename Value="..\bgrabitmap\bgraresample.pas"/>
<UnitName Value="BGRAResample"/>
<EditorIndex Value="3"/>
<WindowIndex Value="0"/>
<TopLine Value="825"/>
<CursorPos X="1" Y="834"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit5>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="image_filters2_main.pas"/>
<Caret Line="75" Column="1" TopLine="55"/>
</Position1>
<Position2>
<Filename Value="image_filters2_main.pas"/>
<Caret Line="74" Column="18" TopLine="56"/>
</Position2>
<Position3>
<Filename Value="image_filters2_main.pas"/>
<Caret Line="68" Column="42" TopLine="57"/>
</Position3>
<Position4>
<Filename Value="image_filters2_main.pas"/>
<Caret Line="69" Column="42" TopLine="58"/>
</Position4>
<Position5>
<Filename Value="image_filters2_main.pas"/>
<Caret Line="70" Column="42" TopLine="59"/>
</Position5>
<Position6>
<Filename Value="image_filters2_main.pas"/>
<Caret Line="71" Column="42" TopLine="60"/>
</Position6>
<Position7>
<Filename Value="image_filters2_main.pas"/>
<Caret Line="72" Column="42" TopLine="61"/>
</Position7>
<Position8>
<Filename Value="image_filters2_main.pas"/>
<Caret Line="70" Column="15" TopLine="62"/>
</Position8>
<Position9>
<Filename Value="image_filters2_main.pas"/>
<Caret Line="71" Column="15" TopLine="63"/>
</Position9>
<Position10>
<Filename Value="image_filters2_main.pas"/>
<Caret Line="72" Column="15" TopLine="64"/>
</Position10>
<Position11>
<Filename Value="image_filters2_main.pas"/>
<Caret Line="73" Column="17" TopLine="49"/>
</Position11>
<Position12>
<Filename Value="image_filters2_main.pas"/>
<Caret Line="78" Column="30" TopLine="65"/>
</Position12>
<Position13>
<Filename Value="..\bgrabitmap\bgradefaultbitmap.pas"/>
<Caret Line="3346" Column="38" TopLine="3342"/>
</Position13>
<Position14>
<Filename Value="..\bgrabitmap\bgradefaultbitmap.pas"/>
<Caret Line="3333" Column="33" TopLine="3330"/>
</Position14>
<Position15>
<Filename Value="image_filters2_main.pas"/>
<Caret Line="79" Column="1" TopLine="65"/>
</Position15>
<Position16>
<Filename Value="image_filters2_main.pas"/>
<Caret Line="92" Column="14" TopLine="76"/>
</Position16>
<Position17>
<Filename Value="image_filters2_main.pas"/>
<Caret Line="91" Column="14" TopLine="75"/>
</Position17>
<Position18>
<Filename Value="image_filters2_main.pas"/>
<Caret Line="90" Column="14" TopLine="74"/>
</Position18>
<Position19>
<Filename Value="image_filters2_main.pas"/>
<Caret Line="91" Column="14" TopLine="75"/>
</Position19>
<Position20>
<Filename Value="image_filters2_main.pas"/>
<Caret Line="73" Column="51" TopLine="73"/>
</Position20>
<Position21>
<Filename Value="image_filters2_main.pas"/>
<Caret Line="52" Column="28" TopLine="45"/>
</Position21>
<Position22>
<Filename Value="image_filters2_main.pas"/>
<Caret Line="86" Column="9" TopLine="65"/>
</Position22>
<Position23>
<Filename Value="image_filters2_main.pas"/>
<Caret Line="95" Column="68" TopLine="67"/>
</Position23>
<Position24>
<Filename Value="image_filters2_main.pas"/>
<Caret Line="33" Column="76" TopLine="11"/>
</Position24>
<Position25>
<Filename Value="image_filters2_main.pas"/>
<Caret Line="100" Column="10" TopLine="70"/>
</Position25>
<Position26>
<Filename Value="image_filters2_main.pas"/>
<Caret Line="33" Column="59" TopLine="15"/>
</Position26>
<Position27>
<Filename Value="image_filters2_main.pas"/>
<Caret Line="115" Column="1" TopLine="95"/>
</Position27>
<Position28>
<Filename Value="image_filters2_main.pas"/>
<Caret Line="149" Column="50" TopLine="107"/>
</Position28>
<Position29>
<Filename Value="image_filters2_main.pas"/>
<Caret Line="160" Column="64" TopLine="137"/>
</Position29>
<Position30>
<Filename Value="image_filters2_main.pas"/>
<Caret Line="166" Column="83" TopLine="144"/>
</Position30>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>
<Version Value="9"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="image_filters2"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</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,20 @@
program image_filters2;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, image_filters2_main, bgrabitmappack, etpackage
{ you can add units after this };
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@@ -0,0 +1,122 @@
object Form1: TForm1
Left = 213
Height = 301
Top = 213
Width = 583
Caption = 'BGRA Image resample filters'
ClientHeight = 301
ClientWidth = 583
OnCreate = FormCreate
OnDestroy = FormDestroy
OnPaint = FormPaint
LCLVersion = '1.0.10.0'
object Panel1: TPanel
Left = 0
Height = 301
Top = 0
Width = 194
Align = alLeft
ClientHeight = 301
ClientWidth = 194
TabOrder = 0
object Radio_Linear: TRadioButton
Left = 11
Height = 19
Top = 64
Width = 52
Caption = 'Linear'
OnChange = Radio_Change
TabOrder = 1
end
object Label1: TLabel
Left = 5
Height = 16
Top = 8
Width = 27
Caption = 'Filter'
ParentColor = False
end
object Radio_None: TRadioButton
Left = 11
Height = 19
Top = 32
Width = 96
Caption = 'None (stretch)'
OnChange = Radio_Change
TabOrder = 0
end
object Radio_HalfCosine: TRadioButton
Left = 11
Height = 19
Top = 80
Width = 81
Caption = 'Half-cosine'
OnChange = Radio_Change
TabOrder = 2
end
object Radio_Cosine: TRadioButton
Left = 11
Height = 19
Top = 96
Width = 56
Caption = 'Cosine'
OnChange = Radio_Change
TabOrder = 3
end
object Radio_Bicubic: TRadioButton
Left = 11
Height = 19
Top = 112
Width = 91
Caption = 'Bicubic (blur)'
OnChange = Radio_Change
TabOrder = 4
end
object Radio_Mitchell: TRadioButton
Left = 11
Height = 19
Top = 128
Width = 63
Caption = 'Mitchell'
OnChange = Radio_Change
TabOrder = 5
end
object Radio_Spline: TRadioButton
Left = 11
Height = 19
Top = 144
Width = 75
Caption = 'Spline (16)'
OnChange = Radio_Change
TabOrder = 6
end
object Label_Ms: TLabel
Left = 88
Height = 16
Top = 8
Width = 97
Alignment = taRightJustify
AutoSize = False
Caption = 'ms'
ParentColor = False
end
object PaintBox1: TPaintBox
Left = 21
Height = 112
Top = 168
Width = 151
OnPaint = PaintBox1Paint
end
object Radio_BoxFilter: TRadioButton
Left = 11
Height = 19
Top = 48
Width = 66
Caption = 'Box filter'
Checked = True
OnChange = Radio_Change
TabOrder = 7
TabStop = True
end
end
end

View File

@@ -0,0 +1,194 @@
unit image_filters2_main;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
StdCtrls, BGRABitmap, BGRABitmapTypes, EpikTimer;
type
{ TForm1 }
TForm1 = class(TForm)
Label1: TLabel;
Label_Ms: TLabel;
PaintBox1: TPaintBox;
Panel1: TPanel;
Radio_Linear: TRadioButton;
Radio_Mitchell: TRadioButton;
Radio_None: TRadioButton;
Radio_HalfCosine: TRadioButton;
Radio_Cosine: TRadioButton;
Radio_Bicubic: TRadioButton;
Radio_BoxFilter: TRadioButton;
Radio_Spline: TRadioButton;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormPaint(Sender: TObject);
procedure PaintBox1Paint(Sender: TObject);
procedure Radio_Change(Sender: TObject);
private
{ private declarations }
procedure GetFilter(out filter : TResampleFilter; out noFilter: boolean);
public
{ public declarations }
image: TBGRABitmap;
stopwatch : TEpikTimer;
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
uses BGRAResample;
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
image := TBGRABitmap.Create(4,4,BGRAWhite);
image.SetPixel(0,0,clRed);
image.SetPixel(2,0,clBlack);
image.SetPixel(3,0,clLime);
image.SetPixel(2,1,clRed);
image.SetPixel(3,1,clBlue);
image.SetPixel(0,2,clBlue);
image.SetPixel(1,2,clBlack);
image.SetPixel(0,3,clLime);
image.SetPixel(1,3,clRed);
image.SetPixel(3,3,clBlue);
stopwatch := TEpikTimer.Create(self);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
image.Free;
end;
procedure TForm1.FormPaint(Sender: TObject);
var resampled: TBGRABitmap;
tx,ty: integer;
filter : TResampleFilter;
noFilter: boolean;
begin
tx := ClientWidth-Panel1.Width;
ty := ClientHeight;
if tx > ty then tx := ty else ty := tx;
GetFilter(filter, noFilter);
stopwatch.Clear;
stopwatch.Start;
if noFilter then
resampled := image.Resample(tx,ty,rmSimpleStretch) else
begin
image.ResampleFilter := filter;
resampled := image.Resample(tx,ty);
end;
stopwatch.stop;
Label_Ms.Caption := IntToStr(round(stopwatch.Elapsed*1000))+' ms';
resampled.Draw(Canvas,Panel1.width,0);
resampled.Free;
end;
procedure TForm1.PaintBox1Paint(Sender: TObject);
const
minx = -3;
maxx = 3;
miny = -1;
maxy = 2;
var
graph: TBGRABitmap;
curve: array of TPointF;
tx,ty,precision: integer;
filter : TResampleFilter;
noFilter: boolean;
i,numPt: integer;
filterPos,filterValue: single;
kernel: TWideKernelFilter;
function XToGraph(value: single): single;
begin
result := (value-minx)/(maxx-minx)*(tx-1);
end;
function YToGraph(value: single): single;
begin
result := ty-1-(value-miny)/(maxy-miny)*(ty-1);
end;
begin
tx := paintbox1.width;
ty := paintbox1.height;
if (tx=0) or (ty=0) then exit;
graph := TBGRABitmap.Create(tx,ty,BGRAWhite);
precision := tx div (maxx-minx)+1;
setlength(curve,precision*(maxx-minx)+1);
GetFilter(filter, noFilter);
numPt := 0;
case filter of
rfBicubic: kernel := TCubicKernel.Create;
rfSpline: kernel := TSplineKernel.Create;
rfMitchell: kernel := TMitchellKernel.Create;
else
kernel := nil;
end;
for i := minx*precision to maxx*precision do
begin
filterPos := i/precision;
if noFilter then
begin
if (filterPos >= 0) and (filterPos < 1) then
filterValue := 1
else
filterValue := 0;
end else
begin
if kernel = nil then
begin
if abs(filterPos) > 1 then
filterValue := 0
else
filterValue := 1-FineInterpolation(abs(filterPos),filter);
end
else
filterValue := kernel.Interpolation(filterPos);
end;
curve[numPt] := PointF(XToGraph(filterPos),YToGraph(filterValue));
inc(numPt);
end;
kernel.Free;
graph.DrawHorizLine(0,round(YToGraph(0)),tx-1,BGRA(0,0,0,96));
graph.DrawVertLine(round(XToGraph(0)),0,ty-1,BGRA(0,0,0,96));
graph.DrawLineAntialias(XToGraph(0)-8,YToGraph(1),XToGraph(0)+8,YToGraph(1),BGRA(0,0,0,96),1);
graph.DrawLineAntialias(XToGraph(-1),YToGraph(0)-8,XToGraph(-1),YToGraph(0)+8,BGRA(0,0,0,96),1);
graph.DrawLineAntialias(XToGraph(1),YToGraph(0)-8,XToGraph(1),YToGraph(0)+8,BGRA(0,0,0,96),1);
graph.DrawPolyLineAntialias(curve,BGRA(192,0,0),1);
graph.Draw(paintbox1.Canvas,0,0);
graph.free;
end;
procedure TForm1.Radio_Change(Sender: TObject);
begin
Invalidate;
PaintBox1.Invalidate;
end;
procedure TForm1.GetFilter(out filter: TResampleFilter; out noFilter: boolean);
begin
noFilter := Radio_None.Checked;
if Radio_BoxFilter.Checked then filter := rfBox else
if Radio_Bicubic.Checked then filter := rfBicubic else
if Radio_Cosine.Checked then filter := rfCosine else
if Radio_HalfCosine.Checked then filter := rfHalfCosine else
if Radio_Mitchell.Checked then filter := rfMitchell else
if Radio_Spline.Checked then filter := rfSpline else
filter := rfLinear;
end;
end.

View File

@@ -0,0 +1,207 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<PathDelim Value="\"/>
<General>
<MainUnit Value="0"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1" Active="Default">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<RequiredPackages Count="3">
<Item1>
<PackageName Value="etpackage"/>
</Item1>
<Item2>
<PackageName Value="bgrabitmappack"/>
</Item2>
<Item3>
<PackageName Value="LCL"/>
</Item3>
</RequiredPackages>
<Units Count="7">
<Unit0>
<Filename Value="image_perspective.lpr"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="4"/>
<CursorPos Y="14"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
<Filename Value="image_perspective_main.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="image_perspective_main"/>
<IsVisibleTab Value="True"/>
<TopLine Value="113"/>
<CursorPos X="43" Y="135"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
<Unit2>
<Filename Value="gouraud_main.pas"/>
<UnitName Value="gouraud_main"/>
<EditorIndex Value="5"/>
<TopLine Value="120"/>
<CursorPos Y="156"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit2>
<Unit3>
<Filename Value="uperspective.pas"/>
<TopLine Value="363"/>
<CursorPos X="18" Y="368"/>
<UsageCount Value="20"/>
</Unit3>
<Unit4>
<Filename Value="..\bgrabitmap\bgratransform.pas"/>
<UnitName Value="BGRATransform"/>
<EditorIndex Value="2"/>
<TopLine Value="433"/>
<CursorPos X="56" Y="471"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit4>
<Unit5>
<Filename Value="..\bgrabitmap\bgrabitmaptypes.pas"/>
<UnitName Value="BGRABitmapTypes"/>
<EditorIndex Value="3"/>
<TopLine Value="992"/>
<CursorPos X="7" Y="991"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit5>
<Unit6>
<Filename Value="..\bgrabitmap\bgradefaultbitmap.pas"/>
<UnitName Value="BGRADefaultBitmap"/>
<EditorIndex Value="1"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit6>
</Units>
<JumpHistory Count="17" HistoryIndex="16">
<Position1>
<Filename Value="..\bgrabitmap\bgrabitmaptypes.pas"/>
<Caret Line="557" Column="27" TopLine="539"/>
</Position1>
<Position2>
<Filename Value="..\bgrabitmap\bgrabitmaptypes.pas"/>
<Caret Line="556" Column="48" TopLine="538"/>
</Position2>
<Position3>
<Filename Value="..\bgrabitmap\bgrabitmaptypes.pas"/>
<Caret Line="1664" Column="30" TopLine="1636"/>
</Position3>
<Position4>
<Filename Value="image_perspective_main.pas"/>
<Caret Line="84" Column="16" TopLine="71"/>
</Position4>
<Position5>
<Filename Value="..\bgrabitmap\bgradefaultbitmap.pas"/>
<Caret Line="243" Column="27" TopLine="225"/>
</Position5>
<Position6>
<Filename Value="..\bgrabitmap\bgradefaultbitmap.pas"/>
<Caret Line="246" Column="28" TopLine="225"/>
</Position6>
<Position7>
<Filename Value="..\bgrabitmap\bgradefaultbitmap.pas"/>
<Caret Line="1798" Column="29" TopLine="1780"/>
</Position7>
<Position8>
<Filename Value="..\bgrabitmap\bgratransform.pas"/>
<Caret Line="134" Column="66" TopLine="115"/>
</Position8>
<Position9>
<Filename Value="image_perspective_main.pas"/>
<Caret Line="80" Column="22" TopLine="71"/>
</Position9>
<Position10>
<Filename Value="..\bgrabitmap\bgrabitmaptypes.pas"/>
<Caret Line="541" Column="63" TopLine="522"/>
</Position10>
<Position11>
<Filename Value="..\bgrabitmap\bgradefaultbitmap.pas"/>
<Caret Line="1801" TopLine="1780"/>
</Position11>
<Position12>
<Filename Value="..\bgrabitmap\bgradefaultbitmap.pas"/>
<Caret Line="1792" Column="6" TopLine="1774"/>
</Position12>
<Position13>
<Filename Value="..\bgrabitmap\bgradefaultbitmap.pas"/>
<Caret Line="1798" Column="83" TopLine="1774"/>
</Position13>
<Position14>
<Filename Value="..\bgrabitmap\bgradefaultbitmap.pas"/>
<Caret Line="1792" Column="7" TopLine="1774"/>
</Position14>
<Position15>
<Filename Value="..\bgrabitmap\bgradefaultbitmap.pas"/>
<Caret Line="1804" Column="5" TopLine="1774"/>
</Position15>
<Position16>
<Filename Value="..\bgrabitmap\bgradefaultbitmap.pas"/>
<Caret Line="1780" Column="38" TopLine="1778"/>
</Position16>
<Position17>
<Filename Value="image_perspective_main.pas"/>
<Caret Line="50" Column="19" TopLine="32"/>
</Position17>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="image_perspective"/>
</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>

View File

@@ -0,0 +1,19 @@
program image_perspective;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, image_perspective_main, bgrabitmappack, etpackage;
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@@ -0,0 +1,146 @@
object Form1: TForm1
Left = 627
Height = 490
Top = 220
Width = 514
Caption = 'Texture mapping'
ClientHeight = 490
ClientWidth = 514
OnCreate = FormCreate
OnDestroy = FormDestroy
OnMouseDown = FormMouseDown
OnMouseMove = FormMouseMove
OnMouseUp = FormMouseUp
OnPaint = FormPaint
Position = poDefaultPosOnly
LCLVersion = '1.4.0.4'
object Panel1: TPanel
Left = 376
Height = 130
Top = 360
Width = 138
Anchors = [akRight, akBottom]
ClientHeight = 130
ClientWidth = 138
TabOrder = 0
object Radio_Perspective: TRadioButton
Left = 8
Height = 19
Top = 40
Width = 80
Caption = 'Perspective'
OnChange = RadioButtonChange
TabOrder = 4
end
object Label1: TLabel
Left = 8
Height = 15
Top = 7
Width = 48
Caption = 'Mapping'
ParentColor = False
end
object Radio_LinearAntialias: TRadioButton
Left = 8
Height = 19
Top = 56
Width = 98
Caption = 'Linear antialias'
OnChange = RadioButtonChange
TabOrder = 0
end
object Radio_Linear: TRadioButton
Left = 8
Height = 19
Top = 72
Width = 52
Caption = 'Linear'
OnChange = RadioButtonChange
TabOrder = 1
end
object Radio_AffineAntialias: TRadioButton
Left = 8
Height = 19
Top = 88
Width = 98
Caption = 'Affine antialias'
OnChange = RadioButtonChange
TabOrder = 2
end
object Radio_Affine: TRadioButton
Left = 8
Height = 19
Top = 104
Width = 52
Caption = 'Affine'
OnChange = RadioButtonChange
TabOrder = 3
end
object Radio_PerspectiveAntialias: TRadioButton
Left = 8
Height = 19
Top = 24
Width = 126
Caption = 'Perspective antialias'
Checked = True
OnChange = RadioButtonChange
TabOrder = 5
TabStop = True
end
end
object Panel2: TPanel
Left = 240
Height = 130
Top = 360
Width = 136
Anchors = [akRight, akBottom]
ClientHeight = 130
ClientWidth = 136
TabOrder = 1
object Label2: TLabel
Left = 8
Height = 15
Top = 7
Width = 68
Caption = 'Interpolation'
ParentColor = False
end
object Radio_InterpBox: TRadioButton
Left = 15
Height = 19
Top = 32
Width = 39
Caption = 'Box'
Checked = True
OnChange = RadioButtonChange
TabOrder = 3
TabStop = True
end
object Radio_InterpLinear: TRadioButton
Left = 15
Height = 19
Top = 48
Width = 52
Caption = 'Linear'
OnChange = RadioButtonChange
TabOrder = 0
end
object Radio_InterpHalfCosine: TRadioButton
Left = 15
Height = 19
Top = 64
Width = 81
Caption = 'Half-cosine'
OnChange = RadioButtonChange
TabOrder = 1
end
object Radio_InterpCosine: TRadioButton
Left = 15
Height = 19
Top = 80
Width = 56
Caption = 'Cosine'
TabOrder = 2
end
end
end

View File

@@ -0,0 +1,220 @@
unit image_perspective_main;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
StdCtrls, ComCtrls, BGRABitmap, BGRABitmapTypes, LMessages, EpikTimer;
type
{ TForm1 }
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Panel1: TPanel;
Panel2: TPanel;
Radio_InterpBox: TRadioButton;
Radio_InterpLinear: TRadioButton;
Radio_InterpHalfCosine: TRadioButton;
Radio_InterpCosine: TRadioButton;
Radio_Perspective: TRadioButton;
Radio_LinearAntialias: TRadioButton;
Radio_Linear: TRadioButton;
Radio_AffineAntialias: TRadioButton;
Radio_Affine: TRadioButton;
Radio_PerspectiveAntialias: TRadioButton;
TrackBar1: TTrackBar;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
{%H-}Shift: TShiftState; X, Y: Integer);
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
procedure FormMouseUp(Sender: TObject; Button: TMouseButton;
{%H-}Shift: TShiftState; {%H-}X, {%H-}Y: Integer);
{ private declarations }
procedure FormPaint(Sender: TObject);
procedure RadioButtonChange(Sender: TObject);
procedure WMEraseBkgnd(var {%H-}Message: TLMEraseBkgnd); message LM_ERASEBKGND;
public
{ public declarations }
MovingPointIndex: Integer;
MovingOrigin: TPointF;
pts: array[0..3] of TPointF;
image: TBGRABitmap;
stopwatch: TEpikTimer;
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
procedure NicePoint(bmp: TBGRABitmap; x, y: single; scale: single = 1);
begin
bmp.EllipseAntialias(x,y,4*scale,4*scale,BGRA(0,0,0,192),scale);
bmp.EllipseAntialias(x,y,3*scale,3*scale,BGRA(255,255,255,192),scale);
bmp.EllipseAntialias(x,y,2*scale,2*scale,BGRA(0,0,0,192),scale);
end;
{ TForm1 }
procedure TForm1.FormPaint(Sender: TObject);
var bmp: TBGRABitmap;
tx,ty,i: Integer;
texPos, scaledPts: array of TPointF;
scale: double;
begin
tx := ClientWidth;
ty := clientHeight;
if Radio_InterpBox.Checked then
image.ScanInterpolationFilter := rfBox else
if Radio_InterpLinear.Checked then
image.ScanInterpolationFilter := rfLinear else
if Radio_InterpHalfCosine.Checked then
image.ScanInterpolationFilter := rfHalfCosine else
if Radio_InterpCosine.Checked then
image.ScanInterpolationFilter := rfCosine;
If Radio_Affine.Checked or Radio_AffineAntialias.Checked then
pts[2] := pts[1]+(pts[3]-pts[0]);
scale := GetCanvasScaleFactor;
bmp := TBGRABitmap.Create(round(tx*scale),round(ty*scale),BGRAWhite);
setLength({%H-}scaledPts, length(pts));
for i := 0 to high(pts) do scaledPts[i] := scale*pts[i];
stopwatch.clear;
stopwatch.start;
texPos := PointsF([PointF(0,0),PointF(image.width-1,0),
PointF(image.width-1,image.Height-1),PointF(0,image.Height-1)]);
if Radio_Perspective.Checked or Radio_PerspectiveAntialias.Checked then
begin
if Radio_PerspectiveAntialias.Checked then
bmp.FillQuadPerspectiveMappingAntialias(scaledPts[0],scaledPts[1],scaledPts[2],scaledPts[3], image,
texPos[0],texPos[1],texPos[2],texPos[3])
else
bmp.FillQuadPerspectiveMapping(scaledPts[0],scaledPts[1],scaledPts[2],scaledPts[3], image,
texPos[0],texPos[1],texPos[2],texPos[3]);
end else
if Radio_LinearAntialias.Checked then
begin
bmp.FillQuadLinearMappingAntialias(scaledPts[0],scaledPts[1],scaledPts[2],scaledPts[3], image,
texPos[0],texPos[1],texPos[2],texPos[3]);
end
else if Radio_Linear.Checked then
begin
bmp.FillQuadLinearMapping(scaledPts[0],scaledPts[1],scaledPts[2],scaledPts[3], image,
texPos[0],texPos[1],texPos[2],texPos[3], true, fcNone, false);
end
else if Radio_Affine.Checked then
begin
bmp.FillQuadAffineMapping(scaledPts[0],scaledPts[1],scaledPts[3],image);
end
else if Radio_AffineAntialias.checked then
begin
bmp.FillQuadAffineMappingAntialias(scaledPts[0],scaledPts[1],scaledPts[3],image);
end;
stopwatch.stop;
//bmp.DrawPolygonAntialias(scaledPts,BGRA(0,0,0,64),scale);
bmp.FontHeight:= round(bmp.FontHeight*scale);
bmp.textOut(0,0,inttostr(round(stopwatch.Elapsed*1000))+' ms',BGRABlack);
for i := 0 to 3 do
NicePoint(bmp,scaledPts[i].x,scaledPts[i].y, scale);
bmp.Draw(Canvas,rect(0,0,tx,ty));
bmp.free;
end;
procedure TForm1.RadioButtonChange(Sender: TObject);
begin
invalidate;
end;
procedure TForm1.WMEraseBkgnd(var Message: TLMEraseBkgnd);
begin
//
end;
procedure TForm1.FormCreate(Sender: TObject);
var
appPath: String;
begin
pts[0] := PointF(50,50);
pts[1] := PointF(clientwidth-150,50);
pts[2] := PointF(clientwidth-150,clientheight-150);
pts[3] := PointF(120,clientheight-200);
MovingPointIndex := -1;
appPath := ExtractFilePath(ParamStr(0));
image := TBGRABitmap.Create(appPath+'spheres.png');
stopwatch := TEpikTimer.Create(Self);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
image.free;
end;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var maxDist,dist: single;
mousePos,vect: TPointF;
i: Integer;
begin
if Button <> mbLeft then exit;
//select point to move
MovingPointIndex := -1;
maxDist := 10;
mousePos := PointF(X,Y);
MovingOrigin := mousePos;
for i := 0 to high(pts) do
begin
vect := pts[i] - mousePos;
dist := sqrt(vect*vect);
if dist < maxDist then
begin
maxDist := dist;
MovingPointIndex := i;
end;
end;
end;
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var
mousePos: TPointF;
i: Integer;
begin
if ssLeft in Shift then
begin
mousePos := PointF(X,Y);
if MovingPointIndex <> -1 then
pts[MovingPointIndex].Offset(mousePos-MovingOrigin) else
begin
for i := 0 to high(pts) do
pts[i].Offset(mousePos-MovingOrigin);
end;
Invalidate;
MovingOrigin := mousePos;
end;
end;
procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button = mbLeft then MovingPointIndex := -1;
end;
end.

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View File

@@ -0,0 +1,284 @@
procedure MyGetScanLine{$i lape.func}
begin
PBGRAPixel(Result^) := target.ScanLine[PInt32(Params^[0])^];
WillInvalidateBitmap(targetIndex);
end;
procedure MyGetBitmapWidth{$i lape.func}
begin
Int32(Result^) := target.Width;
end;
procedure MyGetBitmapHeight{$i lape.func}
begin
Int32(Result^) := target.Height;
end;
procedure MyPtInClipRect{$i lape.func}
begin
LongBool(Result^) := target.PtInClipRect(PInt32(Params^[0])^,PInt32(Params^[1])^);
end;
procedure MyPtInRectPointFirst{$i lape.func}
type PPoint = ^TPoint;
PRect = ^TRect;
begin
LongBool(Result^) := PtInRect(PPoint(Params^[0])^,PRect(Params^[1])^);
end;
procedure MyPtInRectPointLast{$i lape.func}
type PPoint = ^TPoint;
PRect = ^TRect;
begin
LongBool(Result^) := PtInRect(PPoint(Params^[1])^,PRect(Params^[0])^);
end;
procedure MyGetClipRect{$i lape.func}
begin
TRect(Result^) := target.ClipRect;
end;
procedure MySetClipRect{$i lape.proc}
type PRect = ^TRect;
begin
target.ClipRect := PRect(Params^[0])^;
end;
procedure MySetNoClip{$i lape.proc}
begin
target.NoClip;
end;
procedure MyBGRA3{$i lape.func}
begin
TBGRAPixel(Result^) := BGRA(PByte(Params^[0])^,PByte(Params^[1])^,PByte(Params^[2])^);
end;
procedure MyBGRA4{$i lape.func}
begin
TBGRAPixel(Result^) := BGRA(PByte(Params^[0])^,PByte(Params^[1])^,PByte(Params^[2])^,PByte(Params^[3])^);
end;
procedure MySetPixel{$i lape.proc}
begin
target.SetPixel(PInt32(Params^[0])^,PInt32(Params^[1])^,PBGRAPixel(Params^[2])^);
end;
procedure MyNormalPixel{$i lape.proc}
begin
target.DrawPixel(PInt32(Params^[0])^,PInt32(Params^[1])^,PBGRAPixel(Params^[2])^);
end;
procedure MyLinearPixel{$i lape.proc}
begin
target.FastBlendPixel(PInt32(Params^[0])^,PInt32(Params^[1])^,PBGRAPixel(Params^[2])^);
end;
procedure MyXorPixel{$i lape.proc}
begin
target.XorPixel(PInt32(Params^[0])^,PInt32(Params^[1])^,PBGRAPixel(Params^[2])^);
end;
procedure MyErasePixel{$i lape.proc}
begin
target.ErasePixel(PInt32(Params^[0])^,PInt32(Params^[1])^,PByte(Params^[2])^);
end;
procedure MyDrawPixel{$i lape.proc}
begin
case TDrawMode(PInt32(Params^[3])^) of
dmSet: target.SetPixel(PInt32(Params^[0])^,PInt32(Params^[1])^,PBGRAPixel(Params^[2])^);
dmSetExceptTransparent: if PBGRAPixel(Params^[2])^.alpha = 255 then target.SetPixel(PInt32(Params^[0])^,PInt32(Params^[1])^,PBGRAPixel(Params^[2])^);
dmLinearBlend: target.FastBlendPixel(PInt32(Params^[0])^,PInt32(Params^[1])^,PBGRAPixel(Params^[2])^);
dmDrawWithTransparency: target.DrawPixel(PInt32(Params^[0])^,PInt32(Params^[1])^,PBGRAPixel(Params^[2])^);
dmXor: target.XorPixel(PInt32(Params^[0])^,PInt32(Params^[1])^,PBGRAPixel(Params^[2])^);
end;
end;
procedure MyAlphaPixel{$i lape.proc}
begin
target.AlphaPixel(PInt32(Params^[0])^,PInt32(Params^[1])^,PByte(Params^[2])^);
end;
procedure MyGetPixel{$i lape.func}
begin
TBGRAPixel(Result^) := target.GetPixel(PInt32(Params^[0])^,PInt32(Params^[1])^);
end;
procedure MyGetPixelSingle{$i lape.func}
begin
TBGRAPixel(Result^) := target.GetPixel(PSingle(Params^[0])^,PSingle(Params^[1])^);
end;
procedure MyGetPixelSingleCycleX{$i lape.func}
begin
TBGRAPixel(Result^) := target.GetPixelCycle(PSingle(Params^[0])^,PSingle(Params^[1])^,rfLinear,true,false);
end;
procedure MyGetPixelSingleCycleY{$i lape.func}
begin
TBGRAPixel(Result^) := target.GetPixelCycle(PSingle(Params^[0])^,PSingle(Params^[1])^,rfLinear,false,true);
end;
procedure MyGetPixelSingleCycleXY{$i lape.func}
begin
TBGRAPixel(Result^) := target.GetPixelCycle(PSingle(Params^[0])^,PSingle(Params^[1])^,rfLinear,true,true);
end;
procedure MyFill{$i lape.proc}
begin
target.Fill(PBGRAPixel(Params^[0])^);
end;
procedure MyAlphaFill{$i lape.proc}
begin
target.AlphaFill(PByte(Params^[0])^);
end;
procedure MyPutImage{$i lape.proc}
begin
target.PutImage(PInt32(Params^[0])^,PInt32(Params^[1])^, GetBitmap(PInt32(Params^[2])^), TDrawMode(PInt32(Params^[3])^), PByte(Params^[4])^);
end;
procedure MyNewBitmap{$i lape.func}
var idx: integer;
bmp: TBGRABitmap;
begin
bmp := TBGRABitmap.Create(PInt32(Params^[0])^,PInt32(Params^[1])^);
idx := NewBitmapEntry;
Int32(result^) := idx;
bitmaps[idx].Bitmap := bmp;
bitmaps[idx].Registered := false;
end;
procedure MyNewBitmapFromColor{$i lape.func}
var idx: integer;
bmp: TBGRABitmap;
begin
bmp := TBGRABitmap.Create(PInt32(Params^[0])^,PInt32(Params^[1])^,PBGRAPixel(Params^[2])^);
idx := NewBitmapEntry;
Int32(result^) := idx;
bitmaps[idx].Bitmap := bmp;
bitmaps[idx].Registered := false;
end;
procedure MyNewBitmapFromFile{$i lape.func}
var idx: integer;
bmp: TBGRABitmap;
begin
bmp := TBGRABitmap.Create(PlpString(Params^[0])^,true);
idx := NewBitmapEntry;
Int32(result^) := idx;
bitmaps[idx].Bitmap := bmp;
bitmaps[idx].Registered := false;
end;
procedure MySelectedBitmap{$i lape.func}
begin
Int32(result^) := targetIndex;
end;
procedure MyFreeBitmap{$i lape.proc}
var idx: integer;
begin
idx := PInt32(Params^[0])^;
if idx = targetIndex then
raise exception.Create('You cannot free the active bitmap');
FreeBitmap(idx);
end;
procedure MyLockBitmap{$i lape.proc}
var idx: integer;
begin
idx := PInt32(Params^[0])^;
if (idx >= 0) and (idx < length(bitmaps)) then
inc(bitmaps[idx].LockedCount);
end;
procedure MyUnlockBitmap{$i lape.proc}
var idx: integer;
begin
idx := PInt32(Params^[0])^;
if (idx >= 0) and (idx < length(bitmaps)) then
begin
if bitmaps[idx].LockedCount <= 0 then
raise exception.Create('Bitmap is not locked');
dec(bitmaps[idx].LockedCount);
end;
end;
procedure MySelectBitmap{$i lape.proc}
var idx: integer;
begin
idx := PInt32(Params^[0])^;
SetTargetBitmap(idx);
end;
procedure MySetBitmapSize{$i lape.proc}
begin
if (targetIndex >= 0) and (targetIndex < length(bitmaps)) then
begin
if (bitmaps[targetIndex].LockedCount <> 0) then
raise exception.Create('Bitmap is locked');
target.SetSize(PInt32(Params^[0])^,PInt32(Params^[1])^);
end;
end;
procedure MyAssignBitmap{$i lape.proc}
begin
target.Assign(GetBitmap(PInt32(Params^[0])^));
end;
procedure MyDuplicateBitmap{$i lape.func}
var copy: TBGRABitmap;
srcIdx,idx: integer;
begin
srcIdx := PInt32(Params^[0])^;
copy := GetBitmap(srcIdx).Duplicate;
idx := NewBitmapEntry;
bitmaps[idx].Bitmap := copy;
bitmaps[idx].Invalidated := false;
bitmaps[idx].Registered := false;
Int32(result^) := idx;
end;
procedure RegisterBasicFunctions(Compiler: TLapeCompiler);
begin
Compiler.addGlobalFunc('function GetScanLine(y: Int32) : PBGRAPixel;', @MyGetScanline);
Compiler.addGlobalFunc('function BitmapWidth : Int32;', @MyGetBitmapWidth);
Compiler.addGlobalFunc('function BitmapHeight : Int32;', @MyGetBitmapHeight);
Compiler.addGlobalFunc('procedure FillBitmap(c: TBGRAPixel);', @MyFill);
Compiler.addGlobalFunc('procedure FillBitmapAlpha(alpha: byte);', @MyAlphaFill);
Compiler.addGlobalFunc('function BGRA(red,green,blue,alpha: byte): TBGRAPixel;', @MyBGRA4);
Compiler.addGlobalFunc('function BGRA(red,green,blue: byte): TBGRAPixel; overload;', @MyBGRA3);
Compiler.addGlobalFunc('function PtInClipRect(x, y: Int32): LongBool;', @MyPtInClipRect);
Compiler.addGlobalFunc('function GetClipRect: TRect;', @MyGetClipRect);
Compiler.addGlobalFunc('procedure SetClipRect(ARect: TRect);', @MySetClipRect);
Compiler.addGlobalFunc('function PtInRect(const APoint: TPoint; const ARect: TRect): LongBool;', @MyPtInRectPointFirst);
Compiler.addGlobalFunc('function PtInRect(const ARect: TRect; const APoint: TPoint): LongBool; overload;', @MyPtInRectPointLast);
Compiler.addGlobalFunc('procedure NoClip;', @MySetNoClip);
Compiler.addGlobalFunc('procedure SetPixel(x,y: Int32; c: TBGRAPixel);', @MySetPixel);
Compiler.addGlobalFunc('procedure NormalPixel(x,y: Int32; c: TBGRAPixel);', @MyNormalPixel);
Compiler.addGlobalFunc('procedure LinearPixel(x,y: Int32; c: TBGRAPixel);', @MyLinearPixel);
Compiler.addGlobalFunc('procedure XorPixel(x,y: Int32; c: TBGRAPixel);', @MyXorPixel);
Compiler.addGlobalFunc('procedure ErasePixel(x,y: Int32; alpha: byte);', @MyErasePixel);
Compiler.addGlobalFunc('procedure AlphaPixel(x,y: Int32; alpha: byte);', @MyAlphaPixel);
Compiler.addGlobalFunc('procedure _DrawPixel(x,y: Int32; c: TBGRAPixel; ADrawMode: Int32);', @MyDrawPixel);
Compiler.addGlobalFunc('function GetPixel(x,y: Int32): TBGRAPixel;', @MyGetPixel);
Compiler.addGlobalFunc('function GetPixel(x,y: single): TBGRAPixel; overload;', @MyGetPixelSingle);
Compiler.addGlobalFunc('function GetPixelCycle(x,y: single): TBGRAPixel; overload;', @MyGetPixelSingleCycleXY);
Compiler.addGlobalFunc('function GetPixelCycleX(x,y: single): TBGRAPixel; overload;', @MyGetPixelSingleCycleX);
Compiler.addGlobalFunc('function GetPixelCycleY(x,y: single): TBGRAPixel; overload;', @MyGetPixelSingleCycleY);
Compiler.addGlobalFunc('function CreateBitmap(width,height: Int32): TBGRABitmap;', @MyNewBitmap);
Compiler.addGlobalFunc('function CreateBitmap(width,height: Int32; c: TBGRAPixel): TBGRABitmap; overload;', @MyNewBitmapFromColor);
Compiler.addGlobalFunc('function CreateBitmap(filename: string): TBGRABitmap; overload;', @MyNewBitmapFromFile);
Compiler.addGlobalFunc('function SelectedBitmap: TBGRABitmap;', @MySelectedBitmap);
Compiler.addGlobalFunc('procedure TBGRABitmap.Free;', @MyFreeBitmap);
Compiler.addGlobalFunc('procedure TBGRABitmap.Select;', @MySelectBitmap);
Compiler.addGlobalFunc('procedure _PutImage(x,y: Int32; bmp: TBGRABitmap; ADrawMode: Int32; alpha: byte);', @MyPutImage);
Compiler.addGlobalFunc('procedure TBGRABitmap._Lock;', @MyLockBitmap);
Compiler.addGlobalFunc('procedure TBGRABitmap._Unlock;', @MyUnlockBitmap);
Compiler.addGlobalFunc('procedure AssignBitmap(bmp: TBGRABitmap);', @MyAssignBitmap);
Compiler.addGlobalFunc('procedure SetBitmapSize(width,height: integer);', @MySetBitmapSize);
Compiler.addGlobalFunc('function TBGRABitmap.Duplicate: TBGRABitmap;', @MyDuplicateBitmap);
end;

View File

@@ -0,0 +1,298 @@
procedure MyFillRect{$i lape.proc}
begin
target.FillRect(PInt32(Params^[0])^,PInt32(Params^[1])^,PInt32(Params^[2])^,PInt32(Params^[3])^,PBGRAPixel(Params^[4])^,TDrawMode(PInt32(Params^[5])^));
end;
procedure MyRectangle{$i lape.proc}
begin
target.Rectangle(PInt32(Params^[0])^,PInt32(Params^[1])^,PInt32(Params^[2])^,PInt32(Params^[3])^,PBGRAPixel(Params^[4])^,TDrawMode(PInt32(Params^[5])^));
end;
procedure MyRectangleWithFill{$i lape.proc}
begin
target.Rectangle(PInt32(Params^[0])^,PInt32(Params^[1])^,PInt32(Params^[2])^,PInt32(Params^[3])^,PBGRAPixel(Params^[4])^,PBGRAPixel(Params^[5])^,TDrawMode(PInt32(Params^[6])^));
end;
function GetSortedRect(x1,y1,x2,y2: integer): TRect;
begin
if x1 > x2 then
begin
result.left := x2;
result.right := x1;
end else
begin
result.left := x1;
result.right := x2;
end;
if y1 > y2 then
begin
result.top := y2;
result.bottom := y1;
end else
begin
result.top := y1;
result.bottom := y2;
end;
end;
procedure MyFillRoundRect{$i lape.proc}
var dm: TDrawMode;
begin
dm := TDrawMode(PInt32(Params^[7])^);
if (dm in[dmDrawWithTransparency,dmLinearBlend]) and PLongBool(Params^[8])^ then
begin
target.LinearAntialiasing:= (dm=dmLinearBlend);
with GetSortedRect(PInt32(Params^[0])^,PInt32(Params^[1])^,PInt32(Params^[2])^,PInt32(Params^[3])^) do
target.FillRoundRectAntialias(Left-0.5,top-0.5,right-0.5,bottom-0.5,PSingle(Params^[4])^,PSingle(Params^[5])^,PBGRAPixel(Params^[6])^,[]);
target.LinearAntialiasing:= false;
end
else
target.FillRoundRect(PInt32(Params^[0])^,PInt32(Params^[1])^,PInt32(Params^[2])^,PInt32(Params^[3])^,round(PSingle(Params^[4])^*2),round(PSingle(Params^[5])^*2),PBGRAPixel(Params^[6])^,dm);
end;
procedure MyRoundRect{$i lape.proc}
var dm: TDrawMode;
begin
dm := TDrawMode(PInt32(Params^[7])^);
if (dm in[dmDrawWithTransparency,dmLinearBlend]) and PLongBool(Params^[8])^ then
begin
target.LinearAntialiasing:= (dm=dmLinearBlend);
with GetSortedRect(PInt32(Params^[0])^,PInt32(Params^[1])^,PInt32(Params^[2])^,PInt32(Params^[3])^) do
if (right>left) and (bottom>top) then
target.RoundRectAntialias(Left,top,right-1,bottom-1,PSingle(Params^[4])^,PSingle(Params^[5])^,PBGRAPixel(Params^[6])^,1,[]);
target.LinearAntialiasing:= false;
end
else
target.RoundRect(PInt32(Params^[0])^,PInt32(Params^[1])^,PInt32(Params^[2])^,PInt32(Params^[3])^,round(PSingle(Params^[4])^*2),round(PSingle(Params^[5])^*2),PBGRAPixel(Params^[6])^,dm);
end;
procedure MyRoundRectWithFill{$i lape.proc}
var dm: TDrawMode;
begin
dm := TDrawMode(PInt32(Params^[8])^);
if (dm in[dmDrawWithTransparency,dmLinearBlend]) and PLongBool(Params^[9])^ then
begin
target.LinearAntialiasing:= (dm=dmLinearBlend);
with GetSortedRect(PInt32(Params^[0])^,PInt32(Params^[1])^,PInt32(Params^[2])^,PInt32(Params^[3])^) do
if (right>left) and (bottom>top) then
target.RoundRectAntialias(Left,top,right-1,bottom-1,PSingle(Params^[4])^,PSingle(Params^[5])^,PBGRAPixel(Params^[6])^,1,PBGRAPixel(Params^[7])^,[]);
target.LinearAntialiasing:= false;
end
else
target.RoundRect(PInt32(Params^[0])^,PInt32(Params^[1])^,PInt32(Params^[2])^,PInt32(Params^[3])^,round(PSingle(Params^[4])^*2),round(PSingle(Params^[5])^*2),PBGRAPixel(Params^[6])^,PBGRAPixel(Params^[7])^,dm);
end;
procedure MyFillEllipseInRect{$i lape.proc}
var dm: TDrawMode;
begin
dm := TDrawMode(PInt32(Params^[5])^);
if (dm in[dmDrawWithTransparency,dmLinearBlend]) and PLongBool(Params^[6])^ then
begin
target.LinearAntialiasing:= (dm=dmLinearBlend);
with GetSortedRect(PInt32(Params^[0])^,PInt32(Params^[1])^,PInt32(Params^[2])^,PInt32(Params^[3])^) do
target.FillEllipseAntialias((Left+right)*0.5-0.5,(top+bottom)*0.5-0.5,(right-left)*0.5,(bottom-top)*0.5,PBGRAPixel(Params^[4])^);
target.LinearAntialiasing:= false;
end
else
target.FillEllipseInRect(rect(PInt32(Params^[0])^,PInt32(Params^[1])^,PInt32(Params^[2])^,PInt32(Params^[3])^),PBGRAPixel(Params^[4])^,dm);
end;
procedure MyEllipseInRect{$i lape.proc}
var dm: TDrawMode;
begin
dm := TDrawMode(PInt32(Params^[5])^);
if (dm in[dmDrawWithTransparency,dmLinearBlend]) and PLongBool(Params^[6])^ then
begin
target.LinearAntialiasing:= (dm=dmLinearBlend);
with GetSortedRect(PInt32(Params^[0])^,PInt32(Params^[1])^,PInt32(Params^[2])^,PInt32(Params^[3])^) do
if (right>left) and (bottom>top) then
target.EllipseAntialias((Left+right)*0.5-0.5,(top+bottom)*0.5-0.5,(right-left-1)*0.5,(bottom-top-1)*0.5,PBGRAPixel(Params^[4])^,1);
target.LinearAntialiasing:= false;
end
else
target.EllipseInRect(rect(PInt32(Params^[0])^,PInt32(Params^[1])^,PInt32(Params^[2])^,PInt32(Params^[3])^),PBGRAPixel(Params^[4])^,dm);
end;
procedure MyEllipseInRectWithFill{$i lape.proc}
var dm: TDrawMode;
begin
dm := TDrawMode(PInt32(Params^[6])^);
if (dm in[dmDrawWithTransparency,dmLinearBlend]) and PLongBool(Params^[7])^ then
begin
target.LinearAntialiasing:= (dm=dmLinearBlend);
with GetSortedRect(PInt32(Params^[0])^,PInt32(Params^[1])^,PInt32(Params^[2])^,PInt32(Params^[3])^) do
if (right>left) and (bottom>top) then
target.EllipseAntialias((Left+right)*0.5-0.5,(top+bottom)*0.5-0.5,(right-left-1)*0.5,(bottom-top-1)*0.5,PBGRAPixel(Params^[4])^,1,PBGRAPixel(Params^[5])^);
target.LinearAntialiasing:= false;
end
else
target.EllipseInRect(rect(PInt32(Params^[0])^,PInt32(Params^[1])^,PInt32(Params^[2])^,PInt32(Params^[3])^),PBGRAPixel(Params^[4])^,PBGRAPixel(Params^[5])^,dm);
end;
procedure MyDrawLine{$i lape.proc}
var dm: TDrawMode;
begin
dm := TDrawMode(PInt32(Params^[5])^);
if (dm in[dmDrawWithTransparency,dmLinearBlend]) and PLongBool(Params^[6])^ then
begin
target.LinearAntialiasing:= (dm=dmLinearBlend);
target.DrawLineAntialias(PInt32(Params^[0])^,PInt32(Params^[1])^,PInt32(Params^[2])^,PInt32(Params^[3])^,PBGRAPixel(Params^[4])^,true);
target.LinearAntialiasing:= false;
end
else
target.DrawLine(PInt32(Params^[0])^,PInt32(Params^[1])^,PInt32(Params^[2])^,PInt32(Params^[3])^,PBGRAPixel(Params^[4])^,true,dm);
end;
procedure MyEraseLine{$i lape.proc}
begin
if PLongBool(Params^[5])^ then
target.EraseLineAntialias(PInt32(Params^[0])^,PInt32(Params^[1])^,PInt32(Params^[2])^,PInt32(Params^[3])^,PByte(Params^[4])^,true)
else
target.EraseLine(PInt32(Params^[0])^,PInt32(Params^[1])^,PInt32(Params^[2])^,PInt32(Params^[3])^,PByte(Params^[4])^,true);
end;
procedure MyDrawPolyLine{$i lape.proc}
type
ArrayOfTPoint = array of TPoint;
PArrayOfTPoint = ^ArrayOfTPoint;
var
pts: PArrayOfTPoint;
dm: TDrawMode;
begin
pts := Params^[0];
dm := TDrawMode(PInt32(Params^[2])^);
if (dm in[dmDrawWithTransparency,dmLinearBlend]) and PLongBool(Params^[3])^ then
begin
target.LinearAntialiasing:= (dm=dmLinearBlend);
target.DrawPolyLineAntialias(pts^,PBGRAPixel(Params^[1])^,true);
target.LinearAntialiasing:= false;
end
else
target.DrawPolyLine(pts^,PBGRAPixel(Params^[1])^,true,dm);
end;
procedure MyErasePolyLine{$i lape.proc}
type
ArrayOfTPoint = array of TPoint;
PArrayOfTPoint = ^ArrayOfTPoint;
var
pts: PArrayOfTPoint;
begin
pts := Params^[0];
if PLongBool(Params^[2])^ then
target.ErasePolyLineAntialias(pts^,PByte(Params^[1])^,true)
else
target.ErasePolyLine(pts^,PByte(Params^[1])^,true);
end;
procedure MyErasePolygonOutline{$i lape.proc}
type
ArrayOfTPoint = array of TPoint;
PArrayOfTPoint = ^ArrayOfTPoint;
var
pts: PArrayOfTPoint;
begin
pts := Params^[0];
if PLongBool(Params^[2])^ then
target.ErasePolygonOutlineAntialias(pts^,PByte(Params^[1])^)
else
target.ErasePolygonOutline(pts^,PByte(Params^[1])^);
end;
procedure MyDrawPolygon{$i lape.proc}
type
ArrayOfTPoint = array of TPoint;
PArrayOfTPoint = ^ArrayOfTPoint;
var
pts: PArrayOfTPoint;
dm: TDrawMode;
begin
pts := Params^[0];
dm := TDrawMode(PInt32(Params^[2])^);
if (dm in[dmDrawWithTransparency,dmLinearBlend]) and PLongBool(Params^[3])^ then
begin
target.LinearAntialiasing:= (dm=dmLinearBlend);
target.DrawPolygonAntialias(pts^,PBGRAPixel(Params^[1])^);
target.LinearAntialiasing:= false;
end
else
target.DrawPolygon(pts^,PBGRAPixel(Params^[1])^,dm);
end;
procedure MyFillPoly{$i lape.proc}
type
ArrayOfTPoint = array of TPoint;
PArrayOfTPoint = ^ArrayOfTPoint;
var
pts: PArrayOfTPoint;
ptsF: ArrayOfTPointF;
dm: TDrawMode;
i: integer;
begin
pts := Params^[0];
setlength(ptsF, length(pts^));
for i := 0 to high(pts^) do
with pts^[i] do
ptsF[i] := PointF(x,y);
dm := TDrawMode(PInt32(Params^[2])^);
if (dm in[dmDrawWithTransparency,dmLinearBlend]) and PLongBool(Params^[3])^ then
begin
target.LinearAntialiasing:= (dm=dmLinearBlend);
target.FillPolyAntialias(ptsF,PBGRAPixel(Params^[1])^);
target.LinearAntialiasing:= false;
end
else
target.FillPoly(ptsF,PBGRAPixel(Params^[1])^,dm);
end;
procedure MyErasePoly{$i lape.proc}
type
ArrayOfTPoint = array of TPoint;
PArrayOfTPoint = ^ArrayOfTPoint;
var
pts: PArrayOfTPoint;
ptsF: ArrayOfTPointF;
i: integer;
begin
pts := Params^[0];
setlength(ptsF, length(pts^));
for i := 0 to high(pts^) do
with pts^[i] do
ptsF[i] := PointF(x,y);
if PLongBool(Params^[2])^ then
target.ErasePolyAntialias(ptsF,PByte(Params^[1])^)
else
target.ErasePoly(ptsF,PByte(Params^[1])^);
end;
procedure RegisterBasicGeometryFunctions(Compiler: TLapeCompiler);
begin
Compiler.addGlobalFunc('procedure _FillRect(left, top, right, bottom: Int32; c: TBGRAPixel; ADrawMode: Int32);', @MyFillRect);
Compiler.addGlobalFunc('procedure _Rectangle(left, top, right, bottom: Int32; c: TBGRAPixel; ADrawMode: Int32);', @MyRectangle);
Compiler.addGlobalFunc('procedure _RectangleWithFill(left, top, right, bottom: Int32; c,fillcolor: TBGRAPixel; ADrawMode: Int32); overload;', @MyRectangleWithFill);
Compiler.addGlobalFunc('procedure _FillRoundRect(left, top, right, bottom: Int32; rx,ry: single; c: TBGRAPixel; ADrawMode: Int32; AA: LongBool);', @MyFillRoundRect);
Compiler.addGlobalFunc('procedure _RoundRect(left, top, right, bottom: Int32; rx,ry: single; c: TBGRAPixel; ADrawMode: Int32; AA: LongBool);', @MyRoundRect);
Compiler.addGlobalFunc('procedure _RoundRectWithFill(left, top, right, bottom: Int32; rx,ry: single; c,fillcolor: TBGRAPixel; ADrawMode: Int32; AA: LongBool); overload;', @MyRoundRectWithFill);
Compiler.addGlobalFunc('procedure _FillEllipseInRect(left, top, right, bottom: Int32; c: TBGRAPixel; ADrawMode: Int32; AA: LongBool);', @MyFillEllipseInRect);
Compiler.addGlobalFunc('procedure _EllipseInRect(left, top, right, bottom: Int32; c: TBGRAPixel; ADrawMode: Int32; AA: LongBool);', @MyEllipseInRect);
Compiler.addGlobalFunc('procedure _EllipseInRectWithFill(left, top, right, bottom: Int32; c,fillcolor: TBGRAPixel; ADrawMode: Int32; AA: LongBool); overload;', @MyEllipseInRectWithFill);
Compiler.addGlobalFunc('procedure _DrawLine(x1,y1,x2,y2: Int32; c: TBGRAPixel; ADrawMode: Int32; AA: LongBool);', @MyDrawLine);
Compiler.addGlobalFunc('procedure _EraseLine(x1,y1,x2,y2: Int32; alpha: byte; AA: LongBool);', @MyEraseLine);
Compiler.addGlobalFunc('procedure _DrawPolyLine(const points: array of TPoint; c: TBGRAPixel; ADrawMode: Int32; AA: LongBool);', @MyDrawPolyLine);
Compiler.addGlobalFunc('procedure _ErasePolyLine(const points: array of TPoint; alpha: byte; AA: LongBool);', @MyErasePolyLine);
Compiler.addGlobalFunc('procedure _DrawPolygon(const points: array of TPoint; c: TBGRAPixel; ADrawMode: Int32; AA: LongBool);', @MyDrawPolygon);
Compiler.addGlobalFunc('procedure _ErasePolygonOutline(const points: array of TPoint; alpha: byte; AA: LongBool);', @MyErasePolygonOutline);
Compiler.addGlobalFunc('procedure _FillPoly(const points: array of TPoint; c: TBGRAPixel; ADrawMode: Int32; AA: LongBool);', @MyFillPoly);
Compiler.addGlobalFunc('procedure _ErasePoly(const points: array of TPoint; alpha: byte; AA: LongBool);', @MyErasePoly);
end;

View File

@@ -0,0 +1,562 @@
{ This file contains definitions used in Lape scripts
written using the script language }
type
TBGRAPixel = packed record blue,green,red,alpha: byte; end;
PBGRAPixel = ^TBGRAPixel;
TExpandedPixel = packed record red, green, blue, alpha: word; end;
THSLAPixel = packed record hue, saturation, lightness, alpha: word; end;
TGSBAPixel = THSLAPixel;
TDrawMode = (dmSet,dmSetExceptTransparent,dmLinearBlend,dmDrawWithTransparency,dmXor);
TForEachPixelProc = procedure(x,y: Int32; var APixel: TBGRAPixel);
TFontStyle = (fsBold, fsItalic, fsStrikeOut, fsUnderline);
TFontStyles = set of TFontStyle;
TTextAlignment = (taLeft, taRight, taCenter);
TTextLayout = (tlTop, tlCenter, tlBottom);
TRect = record Left,Top,Right,Bottom : Int32; end;
TPoint = record x,y: Int32; end;
TPointF = record x,y: single; end;
TBGRABitmap = record _Handle: Int32; end;
implementation
//synonyms
const
taLeftJustify = taLeft;
taRightJustify = taRight;
dmNormal = dmDrawWithTransparency;
dmLinear = dmLinearBlend;
dmFastBlend = dmLinearBlend;
const
CSSTransparent : TBGRAPixel = [0,0,0,0];
CSSWhite : TBGRAPixel = [255,255,255,255];
CSSBlack : TBGRAPixel = [0,0,0,255];
//Red colors
CSSIndianRed: TBGRAPixel = [92,92,205,255];
CSSLightCoral: TBGRAPixel = [128,128,240,255];
CSSSalmon: TBGRAPixel = [114,128,250,255];
CSSDarkSalmon: TBGRAPixel = [122,150,233,255];
CSSRed: TBGRAPixel = [0,0,255,255];
CSSCrimson: TBGRAPixel = [60,20,220,255];
CSSFireBrick: TBGRAPixel = [34,34,178,255];
CSSDarkRed: TBGRAPixel = [0,0,139,255];
//Pink colors
CSSPink: TBGRAPixel = [203,192,255,255];
CSSLightPink: TBGRAPixel = [193,182,255,255];
CSSHotPink: TBGRAPixel = [180,105,255,255];
CSSDeepPink: TBGRAPixel = [147,20,255,255];
CSSMediumVioletRed: TBGRAPixel = [133,21,199,255];
CSSPaleVioletRed: TBGRAPixel = [147,112,219,255];
//Orange colors
CSSLightSalmon: TBGRAPixel = [122,160,255,255];
CSSCoral: TBGRAPixel = [80,127,255,255];
CSSTomato: TBGRAPixel = [71,99,255,255];
CSSOrangeRed: TBGRAPixel = [0,69,255,255];
CSSDarkOrange: TBGRAPixel = [0,140,255,255];
CSSOrange: TBGRAPixel = [0,165,255,255];
//Yellow colors
CSSGold: TBGRAPixel = [0,215,255,255];
CSSYellow: TBGRAPixel = [0,255,255,255];
CSSLightYellow: TBGRAPixel = [224,255,255,255];
CSSLemonChiffon: TBGRAPixel = [205,250,255,255];
CSSLightGoldenrodYellow: TBGRAPixel = [210,250,250,255];
CSSPapayaWhip: TBGRAPixel = [213,239,255,255];
CSSMoccasin: TBGRAPixel = [181,228,255,255];
CSSPeachPuff: TBGRAPixel = [185,218,255,255];
CSSPaleGoldenrod: TBGRAPixel = [170,232,238,255];
CSSKhaki: TBGRAPixel = [140,230,240,255];
CSSDarkKhaki: TBGRAPixel = [107,183,189,255];
//Purple colors
CSSLavender: TBGRAPixel = [250,230,230,255];
CSSThistle: TBGRAPixel = [216,191,216,255];
CSSPlum: TBGRAPixel = [221,160,221,255];
CSSViolet: TBGRAPixel = [238,130,238,255];
CSSOrchid: TBGRAPixel = [214,112,218,255];
CSSFuchsia: TBGRAPixel = [255,0,255,255];
CSSMagenta: TBGRAPixel = [255,0,255,255];
CSSMediumOrchid: TBGRAPixel = [211,85,186,255];
CSSMediumPurple: TBGRAPixel = [219,112,147,255];
CSSBlueViolet: TBGRAPixel = [226,43,138,255];
CSSDarkViolet: TBGRAPixel = [211,0,148,255];
CSSDarkOrchid: TBGRAPixel = [204,50,153,255];
CSSDarkMagenta: TBGRAPixel = [139,0,139,255];
CSSPurple: TBGRAPixel = [128,0,128,255];
CSSIndigo: TBGRAPixel = [130,0,75,255];
CSSDarkSlateBlue: TBGRAPixel = [139,61,72,255];
CSSSlateBlue: TBGRAPixel = [205,90,106,255];
CSSMediumSlateBlue: TBGRAPixel = [238,104,123,255];
//Green colors
CSSGreenYellow: TBGRAPixel = [47,255,173,255];
CSSChartreuse: TBGRAPixel = [0,255,127,255];
CSSLawnGreen: TBGRAPixel = [0,252,124,255];
CSSLime: TBGRAPixel = [0,255,0,255];
CSSLimeGreen: TBGRAPixel = [50,205,50,255];
CSSPaleGreen: TBGRAPixel = [152,251,152,255];
CSSLightGreen: TBGRAPixel = [144,238,144,255];
CSSMediumSpringGreen: TBGRAPixel = [154,250,0,255];
CSSSpringGreen: TBGRAPixel = [127,255,0,255];
CSSMediumSeaGreen: TBGRAPixel = [113,179,60,255];
CSSSeaGreen: TBGRAPixel = [87,139,46,255];
CSSForestGreen: TBGRAPixel = [34,139,34,255];
CSSGreen: TBGRAPixel = [0,128,0,255];
CSSDarkGreen: TBGRAPixel = [0,100,0,255];
CSSYellowGreen: TBGRAPixel = [50,205,154,255];
CSSOliveDrab: TBGRAPixel = [35,142,107,255];
CSSOlive: TBGRAPixel = [0,128,128,255];
CSSDarkOliveGreen: TBGRAPixel = [47,107,85,255];
CSSMediumAquamarine: TBGRAPixel = [170,205,102,255];
CSSDarkSeaGreen: TBGRAPixel = [143,188,143,255];
CSSLightSeaGreen: TBGRAPixel = [170,178,32,255];
CSSDarkCyan: TBGRAPixel = [139,139,0,255];
CSSTeal: TBGRAPixel = [128,128,0,255];
//Blue/Cyan colors
CSSAqua: TBGRAPixel = [255,255,0,255];
CSSCyan: TBGRAPixel = [255,255,0,255];
CSSLightCyan: TBGRAPixel = [255,255,224,255];
CSSPaleTurquoise: TBGRAPixel = [238,238,175,255];
CSSAquamarine: TBGRAPixel = [212,255,127,255];
CSSTurquoise: TBGRAPixel = [208,224,64,255];
CSSMediumTurquoise: TBGRAPixel = [204,209,72,255];
CSSDarkTurquoise: TBGRAPixel = [209,206,0,255];
CSSCadetBlue: TBGRAPixel = [160,158,95,255];
CSSSteelBlue: TBGRAPixel = [180,130,70,255];
CSSLightSteelBlue: TBGRAPixel = [222,196,176,255];
CSSPowderBlue: TBGRAPixel = [230,224,176,255];
CSSLightBlue: TBGRAPixel = [230,216,173,255];
CSSSkyBlue: TBGRAPixel = [235,206,135,255];
CSSLightSkyBlue: TBGRAPixel = [250,206,135,255];
CSSDeepSkyBlue: TBGRAPixel = [255,191,0,255];
CSSDodgerBlue: TBGRAPixel = [255,144,30,255];
CSSCornflowerBlue: TBGRAPixel = [237,149,100,255];
CSSRoyalBlue: TBGRAPixel = [255,105,65,255];
CSSBlue: TBGRAPixel = [255,0,0,255];
CSSMediumBlue: TBGRAPixel = [205,0,0,255];
CSSDarkBlue: TBGRAPixel = [139,0,0,255];
CSSNavy: TBGRAPixel = [128,0,0,255];
CSSMidnightBlue: TBGRAPixel = [112,25,25,255];
//Brown colors
CSSCornsilk: TBGRAPixel = [220,248,255,255];
CSSBlanchedAlmond: TBGRAPixel = [205,235,255,255];
CSSBisque: TBGRAPixel = [196,228,255,255];
CSSNavajoWhite: TBGRAPixel = [173,222,255,255];
CSSWheat: TBGRAPixel = [179,222,245,255];
CSSBurlyWood: TBGRAPixel = [135,184,222,255];
CSSTan: TBGRAPixel = [140,180,210,255];
CSSRosyBrown: TBGRAPixel = [143,143,188,255];
CSSSandyBrown: TBGRAPixel = [96,164,244,255];
CSSGoldenrod: TBGRAPixel = [32,165,218,255];
CSSDarkGoldenrod: TBGRAPixel = [11,134,184,255];
CSSPeru: TBGRAPixel = [63,133,205,255];
CSSChocolate: TBGRAPixel = [30,105,210,255];
CSSSaddleBrown: TBGRAPixel = [19,69,139,255];
CSSSienna: TBGRAPixel = [45,82,160,255];
CSSBrown: TBGRAPixel = [42,42,165,255];
CSSMaroon: TBGRAPixel = [0,0,128,255];
//White colors
CSSSnow: TBGRAPixel = [250,250,255,255];
CSSHoneydew: TBGRAPixel = [240,255,250,255];
CSSMintCream: TBGRAPixel = [250,255,245,255];
CSSAzure: TBGRAPixel = [255,255,240,255];
CSSAliceBlue: TBGRAPixel = [255,248,240,255];
CSSGhostWhite: TBGRAPixel = [255,248,248,255];
CSSWhiteSmoke: TBGRAPixel = [245,245,245,255];
CSSSeashell: TBGRAPixel = [255,245,238,255];
CSSBeige: TBGRAPixel = [220,245,245,255];
CSSOldLace: TBGRAPixel = [230,245,253,255];
CSSFloralWhite: TBGRAPixel = [240,250,255,255];
CSSIvory: TBGRAPixel = [240,255,255,255];
CSSAntiqueWhite: TBGRAPixel = [215,235,250,255];
CSSLinen: TBGRAPixel = [230,240,250,255];
CSSLavenderBlush: TBGRAPixel = [245,240,255,255];
CSSMistyRose: TBGRAPixel = [255,228,255,255];
//Gray colors
CSSGainsboro: TBGRAPixel = [220,220,220,255];
CSSLightGray: TBGRAPixel = [211,211,211,255];
CSSSilver: TBGRAPixel = [192,192,192,255];
CSSDarkGray: TBGRAPixel = [169,169,169,255];
CSSGray: TBGRAPixel = [128,128,128,255];
CSSDimGray: TBGRAPixel = [105,105,105,255];
CSSLightSlateGray: TBGRAPixel = [153,136,119,255];
CSSSlateGray: TBGRAPixel = [144,128,112,255];
CSSDarkSlateGray: TBGRAPixel = [79,79,47,255];
var
FontName: string = 'Arial';
FontStyle: TFontStyles;
TextAlignment: TTextAlignment;
TextLayout: TTextLayout;
DrawMode: TDrawMode = dmDrawWithTransparency;
Antialiasing: boolean = true;
function Odd(Value: Int32): boolean;
begin
result := (Value and 1) <> 0;
end;
function Even(Value: Int32): boolean;
begin
result := (Value and 1) = 0;
end;
procedure TextOut(x, y: single; sUTF8: string; c: TBGRAPixel); override;
begin
_SetFontName(FontName);
_SetFontStyle(fsBold in FontStyle, fsItalic in FontStyle, fsStrikeOut in FontStyle, fsUnderline in FontStyle);
_SetTextAlignment(Int32(TextAlignment));
_SetTextLayout(Int32(TextLayout));
inherited(x,y,sUTF8,c);
end;
procedure TextOutAngle(x, y, angle: single; sUTF8: string; c: TBGRAPixel); override;
begin
_SetFontName(FontName);
_SetFontStyle(fsBold in FontStyle, fsItalic in FontStyle, fsStrikeOut in FontStyle, fsUnderline in FontStyle);
_SetTextAlignment(Int32(TextAlignment));
_SetTextLayout(Int32(TextLayout));
inherited(x,y,angle,sUTF8,c);
end;
procedure TextRect(left,top,right,bottom: Int32; sUTF8: string; c: TBGRAPixel); override;
begin
_SetFontName(FontName);
_SetFontStyle(fsBold in FontStyle, fsItalic in FontStyle, fsStrikeOut in FontStyle, fsUnderline in FontStyle);
_SetTextAlignment(Int32(TextAlignment));
_SetTextLayout(Int32(TextLayout));
inherited(left,top,right,bottom,sUTF8,c);
end;
procedure TextRect(ARect: TRect; sUTF8: string; c: TBGRAPixel); overload;
begin
TextRect(ARect.Left, ARect.Top, ARect.Right, ARect.Bottom, sUTF8, c);
end;
procedure ForEachPixel(APixelProc: TForEachPixelProc); overload;
var
x,y,w,h: integer;
p: PBGRAPixel;
bmp: TBGRABitmap;
begin
w := BitmapWidth;
h := BitmapHeight;
bmp := SelectedBitmap;
bmp._Lock;
for y := 0 to h-1 do
begin
bmp.Select;
p := GetScanLine(y);
for x := 0 to w-1 do
begin
APixelProc(x,y,p^);
inc(p);
end;
end;
bmp._Unlock;
end;
procedure FillTransparent;
begin
FillBitmap(CSSTransparent);
end;
function Rect(left,top,right,bottom: Int32): TRect;
begin
result.Left := left;
result.Top := top;
result.Right := right;
result.Bottom := bottom;
end;
function RectWithSize(left,top,width,height: Int32): TRect;
begin
result.Left := left;
result.Top := top;
result.Right := left+width;
result.Bottom := top+height;
end;
function Point(x,y: Int32): TPoint;
begin
result.x := x;
result.y := y;
end;
procedure SetClipRect(left,top,right,bottom: Int32); overload;
begin
SetClipRect(rect(left,top,right,bottom));
end;
procedure DrawPixel(x,y : Int32; c: TBGRAPixel); overload;
begin
_DrawPixel(x,y,c,Int32(DrawMode));
end;
procedure DrawLine(x1,y1,x2,y2: Int32; c: TBGRAPixel); overload;
begin
_DrawLine(x1,y1,x2,y2, c, Int32(DrawMode), Antialiasing);
end;
procedure DrawPolyLine(const points: array of TPoint; c: TBGRAPixel); overload;
begin
_DrawPolyLine(points, c, Int32(DrawMode), Antialiasing);
end;
procedure DrawPolygon(const points: array of TPoint; c: TBGRAPixel); overload;
begin
_DrawPolygon(points, c, Int32(DrawMode), Antialiasing);
end;
procedure EraseLine(x1,y1,x2,y2: Int32; alpha: byte); overload;
begin
_EraseLine(x1,y1,x2,y2, alpha, Antialiasing);
end;
procedure ErasePolyLine(const points: array of TPoint; alpha: byte); overload;
begin
_ErasePolyLine(points, alpha, Antialiasing);
end;
procedure ErasePolygonOutline(const points: array of TPoint; alpha: byte); overload;
begin
_ErasePolygonOutline(points, alpha, Antialiasing);
end;
procedure FillRect(left,top,right,bottom: Int32; c: TBGRAPixel); overload;
begin
_FillRect(left,top,right,bottom, c, Int32(DrawMode));
end;
procedure FillRect(ARect: TRect; c: TBGRAPixel); overload;
begin
_FillRect(ARect.Left, ARect.Top, ARect.Right, ARect.Bottom, c, Int32(DrawMode));
end;
procedure Rectangle(left,top,right,bottom: Int32; c: TBGRAPixel); overload;
begin
_Rectangle(left,top,right,bottom, c, Int32(DrawMode));
end;
procedure Rectangle(ARect: TRect; c: TBGRAPixel); overload;
begin
_Rectangle(ARect.Left, ARect.Top, ARect.Right, ARect.Bottom, c, Int32(DrawMode));
end;
procedure Rectangle(left,top,right,bottom: Int32; c,fillcolor: TBGRAPixel); overload;
begin
_RectangleWithFill(left,top,right,bottom, c,fillcolor, Int32(DrawMode));
end;
procedure Rectangle(ARect: TRect; c,fillcolor: TBGRAPixel); overload;
begin
_RectangleWithFill(ARect.Left, ARect.Top, ARect.Right, ARect.Bottom, c,fillcolor, Int32(DrawMode));
end;
procedure FillRoundRect(left,top,right,bottom: Int32; rx,ry: single; c: TBGRAPixel); overload;
begin
_FillRoundRect(left,top,right,bottom,rx,ry, c, Int32(DrawMode), Antialiasing);
end;
procedure FillRoundRect(ARect: TRect; rx,ry: single; c: TBGRAPixel); overload;
begin
_FillRoundRect(ARect.Left, ARect.Top, ARect.Right, ARect.Bottom,rx,ry, c, Int32(DrawMode), Antialiasing);
end;
procedure RoundRect(left,top,right,bottom: Int32; rx,ry: single; c: TBGRAPixel); overload;
begin
_RoundRect(left,top,right,bottom, rx,ry,c, Int32(DrawMode), Antialiasing);
end;
procedure RoundRect(ARect: TRect; rx,ry: single; c: TBGRAPixel); overload;
begin
_RoundRect(ARect.Left, ARect.Top, ARect.Right, ARect.Bottom, rx,ry,c, Int32(DrawMode), Antialiasing);
end;
procedure RoundRect(left,top,right,bottom: Int32; rx,ry: single; c,fillcolor: TBGRAPixel); overload;
begin
_RoundRectWithFill(left,top,right,bottom, rx,ry,c,fillcolor, Int32(DrawMode), Antialiasing);
end;
procedure RoundRect(ARect: TRect; rx,ry: single; c,fillcolor: TBGRAPixel); overload;
begin
_RoundRectWithFill(ARect.Left, ARect.Top, ARect.Right, ARect.Bottom, rx,ry,c,fillcolor, Int32(DrawMode), Antialiasing);
end;
procedure FillEllipse(x,y: integer; rx,ry: single; c: TBGRAPixel);
begin
_FillEllipseInRect(round(x-rx+0.5),round(y-ry+0.5),round(x+rx+0.5),round(y+ry+0.5),c, Int32(DrawMode), Antialiasing);
end;
procedure Ellipse(x,y: integer; rx,ry: single; c: TBGRAPixel);
begin
_EllipseInRect(round(x-rx+0.5),round(y-ry+0.5),round(x+rx+0.5),round(y+ry+0.5),c, Int32(DrawMode), Antialiasing);
end;
procedure Ellipse(x,y: integer; rx,ry: single; c,fillcolor: TBGRAPixel); overload;
begin
_EllipseInRectWithFill(round(x-rx+0.5),round(y-ry+0.5),round(x+rx+0.5),round(y+ry+0.5),c,fillcolor, Int32(DrawMode), Antialiasing);
end;
procedure PutImage(x,y: integer; bmp: TBGRABitmap; alpha: byte = 255); overload;
begin
_PutImage(x,y, bmp, Int32(DrawMode), alpha);
end;
function BGRAToGrayscale(c: TBGRAPixel): TBGRAPixel;
begin
result := GrayscaleToBGRA(GetLightness(c));
result.alpha := c.alpha;
end;
function ExpandedToGrayscale(ec: TExpandedPixel): TExpandedPixel;
begin
result := GrayscaleToExpanded(GetLightness(ec));
result.alpha := ec.alpha;
end;
function PointF(x, y: single): TPointF;
begin
Result.x := x;
Result.y := y;
end;
function VectEq(const pt1, pt2: TPointF): boolean;
begin
result := (pt1.x = pt2.x) and (pt1.y = pt2.y);
end;
function VectSub(const pt1, pt2: TPointF): TPointF;
begin
result.x := pt1.x-pt2.x;
result.y := pt1.y-pt2.y;
end;
function VectNeg(const pt2: TPointF): TPointF;
begin
result.x := -pt2.x;
result.y := -pt2.y;
end;
function VectAdd(const pt1, pt2: TPointF): TPointF;
begin
result.x := pt1.x+pt2.x;
result.y := pt1.y+pt2.y;
end;
function VectDot(const pt1, pt2: TPointF): single;
begin
result := pt1.x*pt2.x + pt1.y*pt2.y;
end;
function VectScale(const pt1: TPointF; factor: single): TPointF;
begin
result.x := pt1.x*factor;
result.y := pt1.y*factor;
end;
function VectScale(factor: single; const pt1: TPointF): TPointF; overload;
begin
result.x := pt1.x*factor;
result.y := pt1.y*factor;
end;
function VectLen(dx, dy: single): single;
begin
result := sqrt(dx*dx+dy*dy);
end;
function VectLen(v: TPointF): single; overload;
begin
result := sqrt(v.x*v.x+v.y*v.y);
end;
procedure FillRectF(left, top, right, bottom: single; c: TBGRAPixel);
begin
_FillRectF(left,top,right,bottom,c,Int32(DrawMode),Antialiasing);
end;
procedure RectangleF(left, top, right, bottom: single; c: TBGRAPixel; w: single);
begin
_RectangleF(left,top,right,bottom,c,w,Int32(DrawMode),Antialiasing);
end;
procedure RectangleF(left, top, right, bottom: single; c: TBGRAPixel; w: single; fillcolor: TBGRAPixel); overload;
begin
_RectangleF(left,top,right,bottom,c,w,fillcolor,Int32(DrawMode),Antialiasing);
end;
procedure FillRoundRectF(left, top, right, bottom,rx,ry: single; c: TBGRAPixel);
begin
_FillRoundRectF(left,top,right,bottom,rx,ry,c,Int32(DrawMode),Antialiasing);
end;
procedure RoundRectF(left, top, right, bottom,rx,ry: single; c: TBGRAPixel; w: single);
begin
_RoundRectF(left,top,right,bottom,rx,ry,c,w,Int32(DrawMode),Antialiasing);
end;
procedure RoundRectF(left, top, right, bottom,rx,ry: single; c: TBGRAPixel; w: single; fillcolor: TBGRAPixel); overload;
begin
_RoundRectF(left,top,right,bottom,rx,ry,c,w,fillcolor,Int32(DrawMode),Antialiasing);
end;
procedure FillEllipseF(x,y,rx,ry: single; c: TBGRAPixel);
begin
_FillEllipseF(x,y,rx,ry,c,Int32(DrawMode),Antialiasing);
end;
procedure EllipseF(x,y,rx,ry: single; c: TBGRAPixel; w: single);
begin
_EllipseF(x,y,rx,ry,c,w,Int32(DrawMode),Antialiasing);
end;
procedure EllipseF(x,y,rx,ry: single; c: TBGRAPixel; w: single; fillcolor: TBGRAPixel); overload;
begin
_EllipseF(x,y,rx,ry,c,w,fillcolor,Int32(DrawMode),Antialiasing);
end;
procedure DrawLineF(x1,y1,x2,y2: single; c: TBGRAPixel; w: single);
begin
_DrawLineF(x1,y1,x2,y2,c,w,Int32(DrawMode),Antialiasing);
end;
procedure DrawPolyLineF(const pts: array of TPointF; c: TBGRAPixel; w: single);
begin
_DrawPolyLineF(pts,c,w,Int32(DrawMode),Antialiasing);
end;
procedure DrawPolygonF(const pts: array of TPointF; c: TBGRAPixel; w: single);
begin
_DrawPolygonF(pts,c,w,Int32(DrawMode),Antialiasing);
end;
procedure DrawPolyLineF(const pts: array of TPointF; c: TBGRAPixel; w: single; fillcolor: TBGRAPixel); overload;
begin
_DrawPolyLineF(pts,c,w,fillcolor,Int32(DrawMode),Antialiasing);
end;
procedure DrawPolygonF(const pts: array of TPointF; c: TBGRAPixel; w: single; fillcolor: TBGRAPixel); overload;
begin
_DrawPolygonF(pts,c,w,fillcolor,Int32(DrawMode),Antialiasing);
end;
procedure FillPolyF(const pts: array of TPointF; c: TBGRAPixel);
begin
_FillPolyF(pts,c,Int32(DrawMode),Antialiasing);
end;

View File

@@ -0,0 +1,222 @@
procedure MyGammaExpansionValue{$i lape.func}
begin
Word(Result^) := GammaExpansionTab[PByte(Params^[0])^];
end;
procedure MyGammaExpansionPixel{$i lape.func}
begin
TExpandedPixel(Result^) := GammaExpansion(PBGRAPixel(Params^[0])^);
end;
procedure MyGammaCompressionValue{$i lape.func}
begin
Byte(Result^) := GammaCompressionTab[PWord(Params^[0])^];
end;
procedure MyGammaCompressionPixel{$i lape.func}
type
PExpandedPixel = ^TExpandedPixel;
begin
TBGRAPixel(Result^) := GammaCompression(PExpandedPixel(Params^[0])^);
end;
procedure MyGetIntensityExpanded{$i lape.func}
type
PExpandedPixel = ^TExpandedPixel;
begin
Word(Result^) := GetIntensity(PExpandedPixel(Params^[0])^);
end;
procedure MySetIntensityExpanded{$i lape.func}
type
PExpandedPixel = ^TExpandedPixel;
var v: Int32;
begin
v := PInt32(Params^[1])^;
if v < 0 then v := 0;
if v > 65535 then v := 65535;
TExpandedPixel(Result^) := SetIntensity(PExpandedPixel(Params^[0])^, v);
end;
procedure MyGetIntensityBGRA{$i lape.func}
begin
Word(Result^) := GetIntensity(GammaExpansion(PBGRAPixel(Params^[0])^));
end;
procedure MySetIntensityBGRA{$i lape.func}
var v: Int32;
begin
v := PInt32(Params^[1])^;
if v < 0 then v := 0;
if v > 65535 then v := 65535;
TBGRAPixel(Result^) := GammaCompression(SetIntensity(GammaExpansion(PBGRAPixel(Params^[0])^), v));
end;
procedure MyGetLightnessExpanded{$i lape.func}
type
PExpandedPixel = ^TExpandedPixel;
begin
Word(Result^) := GetLightness(PExpandedPixel(Params^[0])^);
end;
procedure MySetLightnessExpanded{$i lape.func}
type
PExpandedPixel = ^TExpandedPixel;
var v: Int32;
begin
v := PInt32(Params^[1])^;
if v < 0 then v := 0;
if v > 65535 then v := 65535;
TExpandedPixel(Result^) := SetLightness(PExpandedPixel(Params^[0])^, v);
end;
procedure MyGetLightnessBGRA{$i lape.func}
begin
Word(Result^) := GetLightness(GammaExpansion(PBGRAPixel(Params^[0])^));
end;
procedure MySetLightnessBGRA{$i lape.func}
var v: Int32;
begin
v := PInt32(Params^[1])^;
if v < 0 then v := 0;
if v > 65535 then v := 65535;
TBGRAPixel(Result^) := GammaCompression(SetLightness(GammaExpansion(PBGRAPixel(Params^[0])^), v));
end;
procedure MyBGRAToHSLA{$i lape.func}
begin
THSLAPixel(Result^) := BGRAToHSLA(PBGRAPixel(Params^[0])^);
end;
procedure MyHSLAToBGRA{$i lape.func}
type PHSLAPixel = ^THSLAPixel;
begin
TBGRAPixel(Result^) := HSLAToBGRA(PHSLAPixel(Params^[0])^);
end;
procedure MyExpandedToHSLA{$i lape.func}
type
PExpandedPixel = ^TExpandedPixel;
begin
THSLAPixel(Result^) := ExpandedToHSLA(PExpandedPixel(Params^[0])^);
end;
procedure MyHSLAToExpanded{$i lape.func}
type PHSLAPixel = ^THSLAPixel;
begin
TExpandedPixel(Result^) := HSLAToExpanded(PHSLAPixel(Params^[0])^);
end;
procedure MyGrayscaleToBGRA{$i lape.func}
var v: Int32;
begin
v := PInt32(Params^[0])^;
if v < 0 then v := 0;
if v > 65535 then v := 65535;
TBGRAPixel(Result^) := GrayscaleToBGRA(v);
end;
procedure MyGrayscaleToExpanded{$i lape.func}
var v: Int32;
begin
v := PInt32(Params^[0])^;
if v < 0 then v := 0;
if v > 65535 then v := 65535;
with TExpandedPixel(Result^) do
begin
red := v;
green := v;
blue := v;
alpha := 65535;
end;
end;
procedure MyBGRAToGSBA{$i lape.func}
begin
TGSBAPixel(Result^) := BGRAToGSBA(PBGRAPixel(Params^[0])^);
end;
procedure MyGSBAToBGRA{$i lape.func}
type PGSBAPixel = ^TGSBAPixel;
begin
TBGRAPixel(Result^) := GSBAToBGRA(PGSBAPixel(Params^[0])^);
end;
procedure MyExpandedToGSBA{$i lape.func}
type
PExpandedPixel = ^TExpandedPixel;
begin
TGSBAPixel(Result^) := ExpandedToGSBA(PExpandedPixel(Params^[0])^);
end;
procedure MyGSBAToExpanded{$i lape.func}
type PGSBAPixel = ^TGSBAPixel;
begin
TExpandedPixel(Result^) := GSBAToExpanded(PGSBAPixel(Params^[0])^);
end;
procedure MyMergeBGRAArray{$i lape.func}
type
ArrayOfTBGRAPixel = array of TBGRAPixel;
PArrayOfTBGRAPixel = ^ArrayOfTBGRAPixel;
var
p: PArrayOfTBGRAPixel;
begin
p := PArrayOfTBGRAPixel(Params^[0]);
TBGRAPixel(Result^) := MergeBGRA(p^);
end;
procedure MyMergeBGRAWithWeight{$i lape.func}
begin
TBGRAPixel(Result^) := MergeBGRA(PBGRAPixel(Params^[0])^,PInt32(Params^[1])^,PBGRAPixel(Params^[2])^,PInt32(Params^[3])^);
end;
procedure MyBGRAToStr{$i lape.func}
begin
lpString(Result^) := BGRAToStr(PBGRAPixel(Params^[0])^,CSSColors);
end;
procedure MyStrToBGRA{$i lape.func}
begin
TBGRAPixel(Result^) := StrToBGRA(PlpString(Params^[0])^);
end;
procedure RegisterColorFunctions(Compiler: TLapeCompiler);
begin
Compiler.addGlobalFunc('function GammaExpansion(AValue: Byte): Word;', @MyGammaExpansionValue);
Compiler.addGlobalFunc('function GammaExpansion(APixel: TBGRAPixel): TExpandedPixel; overload;', @MyGammaExpansionPixel);
Compiler.addGlobalFunc('function GammaCompression(AValue: Word): Byte;', @MyGammaCompressionValue);
Compiler.addGlobalFunc('function GammaCompression(const APixel: TExpandedPixel): TBGRAPixel; overload;', @MyGammaCompressionPixel);
Compiler.addGlobalFunc('function GetIntensity(ec: TExpandedPixel): Word;', @MyGetIntensityExpanded);
Compiler.addGlobalFunc('function SetIntensity(ec: TExpandedPixel; AIntensity: Int32): TExpandedPixel;', @MySetIntensityExpanded);
Compiler.addGlobalFunc('function GetIntensity(c: TBGRAPixel): Word; overload;', @MyGetIntensityBGRA);
Compiler.addGlobalFunc('function SetIntensity(c: TBGRAPixel; AIntensity: Int32): TBGRAPixel; overload;', @MySetIntensityBGRA);
Compiler.addGlobalFunc('function GetLightness(ec: TExpandedPixel): Word;', @MyGetLightnessExpanded);
Compiler.addGlobalFunc('function SetLightness(ec: TExpandedPixel; ALightness: Int32): TExpandedPixel;', @MySetLightnessExpanded);
Compiler.addGlobalFunc('function GetLightness(c: TBGRAPixel): Word; overload;', @MyGetLightnessBGRA);
Compiler.addGlobalFunc('function SetLightness(c: TBGRAPixel; ALightness: Int32): TBGRAPixel; overload;', @MySetLightnessBGRA);
Compiler.addGlobalFunc('function BGRAToHSLA(c: TBGRAPixel): THSLAPixel;', @MyBGRAToHSLA);
Compiler.addGlobalFunc('function ExpandedToHSLA(c: TExpandedPixel): THSLAPixel;', @MyExpandedToHSLA);
Compiler.addGlobalFunc('function HSLAToBGRA(c: THSLAPixel): TBGRAPixel;', @MyHSLAToBGRA);
Compiler.addGlobalFunc('function HSLAToExpanded(c: THSLAPixel): TExpandedPixel;', @MyHSLAToExpanded);
Compiler.addGlobalFunc('function GrayscaleToBGRA(ALightness: Int32): TBGRAPixel;', @MyGrayscaleToBGRA);
Compiler.addGlobalFunc('function GrayscaleToExpanded(ALightness: Int32): TExpandedPixel;', @MyGrayscaleToExpanded);
Compiler.addGlobalFunc('function BGRAToGSBA(c: TBGRAPixel): TGSBAPixel;', @MyBGRAToGSBA);
Compiler.addGlobalFunc('function ExpandedToGSBA(c: TExpandedPixel): TGSBAPixel;', @MyExpandedToGSBA);
Compiler.addGlobalFunc('function GSBAToBGRA(c: TGSBAPixel): TBGRAPixel;', @MyGSBAToBGRA);
Compiler.addGlobalFunc('function GSBAToExpanded(c: TGSBAPixel): TExpandedPixel;', @MyGSBAToExpanded);
Compiler.addGlobalFunc('function MergeBGRA(const colors: array of TBGRAPixel): TBGRAPixel;', @MyMergeBGRAArray);
Compiler.addGlobalFunc('function MergeBGRA(c1: TBGRAPixel; w1: Int32; c2: TBGRAPixel; w2: Int32): TBGRAPixel; overload;', @MyMergeBGRAWithWeight);
Compiler.addGlobalFunc('function BGRAToStr(c: TBGRAPixel): string;', @MyBGRAToStr);
Compiler.addGlobalFunc('function StrToBGRA(s: string): TBGRAPixel;', @MyStrToBGRA);
end;

View File

@@ -0,0 +1,358 @@
procedure MyFillRectF{$i lape.proc}
var dm: TDrawMode; aa: boolean;
x1,y1,x2,y2: single;
begin
dm := TDrawMode(PInt32(Params^[5])^);
aa := PLongBool(Params^[6])^;
x1 := PSingle(Params^[0])^;
y1 := PSingle(Params^[1])^;
x2 := PSingle(Params^[2])^;
y2 := PSingle(Params^[3])^;
if (dm in[dmDrawWithTransparency,dmLinearBlend]) and aa then
begin
target.LinearAntialiasing:= (dm=dmLinearBlend);
target.FillRectAntialias(x1,y1,x2,y2,PBGRAPixel(Params^[4])^);
target.LinearAntialiasing:= false;
end
else
target.FillPoly([PointF(x1,y1),PointF(x2,y1),PointF(x2,y2),PointF(x1,y2)],PBGRAPixel(Params^[4])^,dm);
end;
procedure MyRectangleF{$i lape.proc}
var dm: TDrawMode; aa: boolean;
x1,y1,x2,y2: single;
begin
dm := TDrawMode(PInt32(Params^[6])^);
aa := PLongBool(Params^[7])^;
x1 := PSingle(Params^[0])^;
y1 := PSingle(Params^[1])^;
x2 := PSingle(Params^[2])^;
y2 := PSingle(Params^[3])^;
if (dm in[dmDrawWithTransparency,dmLinearBlend]) and aa then
begin
target.LinearAntialiasing:= (dm=dmLinearBlend);
target.RectangleAntialias(x1,y1,x2,y2,PBGRAPixel(Params^[4])^,PSingle(Params^[5])^);
target.LinearAntialiasing:= false;
end
else
target.FillPoly(target.ComputeWidePolygon([PointF(x1,y1),PointF(x2,y1),PointF(x2,y2),PointF(x1,y2)],PSingle(Params^[5])^),PBGRAPixel(Params^[4])^,dm);
end;
procedure MyRectangleWithFillF{$i lape.proc}
var dm: TDrawMode; aa: boolean;
x1,y1,x2,y2: single;
m: TBGRAMultishapeFiller;
begin
dm := TDrawMode(PInt32(Params^[7])^);
aa := PLongBool(Params^[8])^;
x1 := PSingle(Params^[0])^;
y1 := PSingle(Params^[1])^;
x2 := PSingle(Params^[2])^;
y2 := PSingle(Params^[3])^;
if (dm in[dmDrawWithTransparency,dmLinearBlend]) and aa then
begin
target.LinearAntialiasing:= (dm=dmLinearBlend);
target.RectangleAntialias(x1,y1,x2,y2,PBGRAPixel(Params^[4])^,PSingle(Params^[5])^,PBGRAPixel(Params^[6])^);
target.LinearAntialiasing:= false;
end
else
begin
m := TBGRAMultishapeFiller.Create;
m.PolygonOrder:= poLastOnTop;
m.Antialiasing := false;
m.AddRectangle(x1,y1,x2,y2,PBGRAPixel(Params^[6])^);
m.AddPolygon(target.ComputeWidePolygon([PointF(x1,y1),PointF(x2,y1),PointF(x2,y2),PointF(x1,y2)],PSingle(Params^[5])^),PBGRAPixel(Params^[4])^);
m.Draw(target, dm);
m.Free;
end;
end;
procedure MyFillRoundRectF{$i lape.proc}
var dm: TDrawMode; aa: boolean;
x1,y1,x2,y2: single;
fill: TFillShapeInfo;
begin
dm := TDrawMode(PInt32(Params^[7])^);
aa := PLongBool(Params^[8])^;
x1 := PSingle(Params^[0])^;
y1 := PSingle(Params^[1])^;
x2 := PSingle(Params^[2])^;
y2 := PSingle(Params^[3])^;
if (dm in[dmDrawWithTransparency,dmLinearBlend]) and aa then
begin
target.LinearAntialiasing:= (dm=dmLinearBlend);
target.FillRoundRectAntialias(x1,y1,x2,y2,PSingle(Params^[4])^,PSingle(Params^[5])^,PBGRAPixel(Params^[6])^,[]);
target.LinearAntialiasing := false;
end
else
begin
fill := TFillRoundRectangleInfo.Create(x1,y1,x2,y2,PSingle(Params^[4])^,PSingle(Params^[5])^,[]);
target.FillShape(fill,PBGRAPixel(Params^[6])^,dm);
fill.Free;
end;
end;
procedure MyRoundRectF{$i lape.proc}
var dm: TDrawMode; aa: boolean;
x1,y1,x2,y2: single;
begin
dm := TDrawMode(PInt32(Params^[8])^);
aa := PLongBool(Params^[9])^;
x1 := PSingle(Params^[0])^;
y1 := PSingle(Params^[1])^;
x2 := PSingle(Params^[2])^;
y2 := PSingle(Params^[3])^;
if (dm in[dmDrawWithTransparency,dmLinearBlend]) and aa then
begin
target.LinearAntialiasing:= (dm=dmLinearBlend);
target.RoundRectAntialias(x1,y1,x2,y2,PSingle(Params^[4])^,PSingle(Params^[5])^,PBGRAPixel(Params^[6])^,PSingle(Params^[7])^,[]);
target.LinearAntialiasing := false;
end
else
target.FillPoly(target.ComputeWidePolygon(target.ComputeRoundRect(x1,y1,x2,y2,PSingle(Params^[4])^,PSingle(Params^[5])^,[]),PSingle(Params^[7])^),PBGRAPixel(Params^[6])^,dm);
end;
procedure MyRoundRectWithFillF{$i lape.proc}
var dm: TDrawMode; aa: boolean;
x1,y1,x2,y2: single;
m: TBGRAMultishapeFiller;
begin
dm := TDrawMode(PInt32(Params^[9])^);
aa := PLongBool(Params^[10])^;
x1 := PSingle(Params^[0])^;
y1 := PSingle(Params^[1])^;
x2 := PSingle(Params^[2])^;
y2 := PSingle(Params^[3])^;
if (dm in[dmDrawWithTransparency,dmLinearBlend]) and aa then
begin
target.LinearAntialiasing:= (dm=dmLinearBlend);
target.RoundRectAntialias(x1,y1,x2,y2,PSingle(Params^[4])^,PSingle(Params^[5])^,PBGRAPixel(Params^[6])^,PSingle(Params^[7])^,PBGRAPixel(Params^[8])^,[]);
target.LinearAntialiasing := false;
end
else
begin
m := TBGRAMultishapeFiller.Create;
m.PolygonOrder:= poLastOnTop;
m.Antialiasing := false;
m.AddRoundRectangle(x1,y1,x2,y2,PSingle(Params^[4])^,PSingle(Params^[5])^,PBGRAPixel(Params^[8])^);
m.AddPolygon(target.ComputeWidePolygon(target.ComputeRoundRect(x1,y1,x2,y2,PSingle(Params^[4])^,PSingle(Params^[5])^,[]),PSingle(Params^[7])^),PBGRAPixel(Params^[6])^);
m.Draw(target, dm);
m.Free;
end;
end;
procedure MyFillEllipseF{$i lape.proc}
var dm: TDrawMode; aa: boolean;
x,y,rx,ry: single;
fill: TFillShapeInfo;
begin
dm := TDrawMode(PInt32(Params^[5])^);
aa := PLongBool(Params^[6])^;
x := PSingle(Params^[0])^;
y := PSingle(Params^[1])^;
rx := PSingle(Params^[2])^;
ry := PSingle(Params^[3])^;
if (dm in[dmDrawWithTransparency,dmLinearBlend]) and aa then
begin
target.LinearAntialiasing:= (dm=dmLinearBlend);
target.FillEllipseAntialias(x,y,rx,ry,PBGRAPixel(Params^[4])^);
target.LinearAntialiasing:= false;
end
else
begin
if (rx = 0) or (ry = 0) or (x = EmptySingle) or (y = EmptySingle) then exit;
fill := TFillEllipseInfo.Create(x,y,rx,ry);
target.FillShape(fill, PBGRAPixel(Params^[4])^,dm);
fill.Free;
end;
end;
procedure MyEllipseF{$i lape.proc}
var dm: TDrawMode; aa: boolean;
x,y,rx,ry: single;
begin
dm := TDrawMode(PInt32(Params^[6])^);
aa := PLongBool(Params^[7])^;
x := PSingle(Params^[0])^;
y := PSingle(Params^[1])^;
rx := PSingle(Params^[2])^;
ry := PSingle(Params^[3])^;
if (dm in[dmDrawWithTransparency,dmLinearBlend]) and aa then
begin
target.LinearAntialiasing:= (dm=dmLinearBlend);
target.EllipseAntialias(x,y,rx,ry,PBGRAPixel(Params^[4])^,PSingle(Params^[5])^);
target.LinearAntialiasing:= false;
end
else
target.FillPoly(target.ComputeEllipseBorder(x,y,rx,ry,PSingle(Params^[5])^),PBGRAPixel(Params^[4])^,dm);
end;
procedure MyEllipseWithFillF{$i lape.proc}
var dm: TDrawMode; aa: boolean;
x,y,rx,ry: single;
m: TBGRAMultishapeFiller;
begin
dm := TDrawMode(PInt32(Params^[7])^);
aa := PLongBool(Params^[8])^;
x := PSingle(Params^[0])^;
y := PSingle(Params^[1])^;
rx := PSingle(Params^[2])^;
ry := PSingle(Params^[3])^;
if (dm in[dmDrawWithTransparency,dmLinearBlend]) and aa then
begin
target.LinearAntialiasing:= (dm=dmLinearBlend);
target.EllipseAntialias(x,y,rx,ry,PBGRAPixel(Params^[4])^,PSingle(Params^[5])^,PBGRAPixel(Params^[6])^);
target.LinearAntialiasing:= false;
end
else
begin
m := TBGRAMultishapeFiller.Create;
m.PolygonOrder:= poLastOnTop;
m.Antialiasing := false;
m.AddEllipse(x,y,rx,ry,PBGRAPixel(Params^[6])^);
m.AddPolygon(target.ComputeEllipseBorder(x,y,rx,ry,PSingle(Params^[5])^),PBGRAPixel(Params^[4])^);
m.Draw(target, dm);
m.Free;
end;
end;
procedure MyDrawLineF{$i lape.proc}
var dm: TDrawMode; aa: boolean;
x1,y1,x2,y2: single;
begin
dm := TDrawMode(PInt32(Params^[6])^);
aa := PLongBool(Params^[7])^;
x1 := PSingle(Params^[0])^;
y1 := PSingle(Params^[1])^;
x2 := PSingle(Params^[2])^;
y2 := PSingle(Params^[3])^;
if (dm in[dmDrawWithTransparency,dmLinearBlend]) and aa then
target.DrawLineAntialias(x1,y1,x2,y2,PBGRAPixel(Params^[4])^,PSingle(Params^[5])^)
else
target.FillPoly(target.ComputeWidePolyline([PointF(x1,y1),PointF(x2,y2)],PSingle(Params^[5])^),PBGRAPixel(Params^[4])^,dm);
end;
procedure MyDrawPolyLineF{$i lape.proc}
type
PArrayOfTPointF = ^ArrayOfTPointF;
var
pts: PArrayOfTPointF;
dm: TDrawMode; aa: boolean;
begin
pts := Params^[0];
dm := TDrawMode(PInt32(Params^[3])^);
aa := PLongBool(Params^[4])^;
if (dm in[dmDrawWithTransparency,dmLinearBlend]) and aa then
target.DrawPolyLineAntialias(pts^,PBGRAPixel(Params^[1])^,PSingle(Params^[2])^)
else
target.FillPoly(target.ComputeWidePolyline(pts^,PSingle(Params^[2])^),PBGRAPixel(Params^[1])^,dm);
end;
procedure MyDrawPolygonF{$i lape.proc}
type
PArrayOfTPointF = ^ArrayOfTPointF;
var
pts: PArrayOfTPointF;
dm: TDrawMode; aa: boolean;
begin
pts := Params^[0];
dm := TDrawMode(PInt32(Params^[3])^);
aa := PLongBool(Params^[4])^;
if (dm in[dmDrawWithTransparency,dmLinearBlend]) and aa then
target.DrawPolygonAntialias(pts^,PBGRAPixel(Params^[1])^,PSingle(Params^[2])^)
else
target.FillPoly(target.ComputeWidePolygon(pts^,PSingle(Params^[2])^),PBGRAPixel(Params^[1])^,dm);
end;
procedure MyDrawPolyLineWithFillF{$i lape.proc}
type
PArrayOfTPointF = ^ArrayOfTPointF;
var
pts: PArrayOfTPointF;
dm: TDrawMode; aa: boolean;
multi: TBGRAMultishapeFiller;
begin
pts := Params^[0];
dm := TDrawMode(PInt32(Params^[4])^);
aa := PLongBool(Params^[5])^;
if (dm in[dmDrawWithTransparency,dmLinearBlend]) and aa then
target.DrawPolyLineAntialias(pts^,PBGRAPixel(Params^[1])^,PSingle(Params^[2])^,PBGRAPixel(Params^[3])^)
else
begin
multi := TBGRAMultishapeFiller.Create;
multi.PolygonOrder := poLastOnTop;
multi.Antialiasing := false;
multi.AddPolygon(pts^,PBGRAPixel(Params^[3])^);
multi.AddPolygon(target.ComputeWidePolyline(pts^,PSingle(Params^[2])^),PBGRAPixel(Params^[1])^);
multi.Draw(target,dm);
multi.Free;
end;
end;
procedure MyDrawPolygonWithFillF{$i lape.proc}
type
PArrayOfTPointF = ^ArrayOfTPointF;
var
pts: PArrayOfTPointF;
dm: TDrawMode; aa: boolean;
multi: TBGRAMultishapeFiller;
begin
pts := Params^[0];
dm := TDrawMode(PInt32(Params^[4])^);
aa := PLongBool(Params^[5])^;
if (dm in[dmDrawWithTransparency,dmLinearBlend]) and aa then
target.DrawPolygonAntialias(pts^,PBGRAPixel(Params^[1])^,PSingle(Params^[2])^,PBGRAPixel(Params^[3])^)
else
begin
multi := TBGRAMultishapeFiller.Create;
multi.PolygonOrder := poLastOnTop;
multi.Antialiasing := false;
multi.AddPolygon(pts^,PBGRAPixel(Params^[3])^);
multi.AddPolygon(target.ComputeWidePolygon(pts^,PSingle(Params^[2])^),PBGRAPixel(Params^[1])^);
multi.Draw(target,dm);
multi.Free;
end;
end;
procedure MyFillPolyF{$i lape.proc}
type
PArrayOfTPointF = ^ArrayOfTPointF;
var
pts: PArrayOfTPointF;
dm: TDrawMode; aa: boolean;
begin
pts := Params^[0];
dm := TDrawMode(PInt32(Params^[2])^);
aa := PLongBool(Params^[3])^;
if (dm in[dmDrawWithTransparency,dmLinearBlend]) and aa then
target.FillPolyAntialias(pts^,PBGRAPixel(Params^[1])^)
else
target.FillPoly(pts^,PBGRAPixel(Params^[1])^,dm);
end;
procedure RegisterExtendedGeometryFunctions(Compiler: TLapeCompiler);
begin
Compiler.addGlobalFunc('procedure _FillRectF(left, top, right, bottom: single; c: TBGRAPixel; ADrawMode: Int32; AA: LongBool);', @MyFillRectF);
Compiler.addGlobalFunc('procedure _RectangleF(left, top, right, bottom: single; c: TBGRAPixel; w: single; ADrawMode: Int32; AA: LongBool);', @MyRectangleF);
Compiler.addGlobalFunc('procedure _RectangleF(left, top, right, bottom: single; c: TBGRAPixel; w: single; fillcolor: TBGRAPixel; ADrawMode: Int32; AA: LongBool); overload;', @MyRectangleWithFillF);
Compiler.addGlobalFunc('procedure _FillRoundRectF(left, top, right, bottom, rx,ry: single; c: TBGRAPixel; ADrawMode: Int32; AA: LongBool);', @MyFillRoundRectF);
Compiler.addGlobalFunc('procedure _RoundRectF(left, top, right, bottom, rx,ry: single; c: TBGRAPixel; w: single; ADrawMode: Int32; AA: LongBool);', @MyRoundRectF);
Compiler.addGlobalFunc('procedure _RoundRectF(left, top, right, bottom, rx,ry: single; c: TBGRAPixel; w: single; fillcolor: TBGRAPixel; ADrawMode: Int32; AA: LongBool); overload;', @MyRoundRectWithFillF);
Compiler.addGlobalFunc('procedure _FillEllipseF(x,y,rx,ry: single; c: TBGRAPixel; ADrawMode: Int32; AA: LongBool);', @MyFillEllipseF);
Compiler.addGlobalFunc('procedure _EllipseF(x,y,rx,ry: single; c: TBGRAPixel; w: single; ADrawMode: Int32; AA: LongBool);', @MyEllipseF);
Compiler.addGlobalFunc('procedure _EllipseF(x,y,rx,ry: single; c: TBGRAPixel; w: single; fillcolor: TBGRAPixel; ADrawMode: Int32; AA: LongBool); overload;', @MyEllipseWithFillF);
Compiler.addGlobalFunc('procedure _DrawLineF(x1,y1,x2,y2: single; c: TBGRAPixel; w: single; ADrawMode: Int32; AA: LongBool);', @MyDrawLineF);
Compiler.addGlobalFunc('procedure _DrawPolyLineF(const pts: array of TPointF; c: TBGRAPixel; w: single; ADrawMode: Int32; AA: LongBool);', @MyDrawPolyLineF);
Compiler.addGlobalFunc('procedure _DrawPolygonF(const pts: array of TPointF; c: TBGRAPixel; w: single; ADrawMode: Int32; AA: LongBool);', @MyDrawPolygonF);
Compiler.addGlobalFunc('procedure _DrawPolyLineF(const pts: array of TPointF; c: TBGRAPixel; w: single; fillcolor: TBGRAPixel; ADrawMode: Int32; AA: LongBool); overload;', @MyDrawPolyLineWithFillF);
Compiler.addGlobalFunc('procedure _DrawPolygonF(const pts: array of TPointF; c: TBGRAPixel; w: single; fillcolor: TBGRAPixel; ADrawMode: Int32; AA: LongBool); overload;', @MyDrawPolygonWithFillF);
Compiler.addGlobalFunc('procedure _FillPolyF(const pts: array of TPointF; c: TBGRAPixel; ADrawMode: Int32; AA: LongBool);', @MyFillPolyF);
end;

View File

@@ -0,0 +1 @@
({%H-}Params: PParamArray; const Result: Pointer); {$IFDEF Lape_CDECL}cdecl;{$ENDIF}

View File

@@ -0,0 +1 @@
({%H-}Params: PParamArray); {$IFDEF Lape_CDECL}cdecl;{$ENDIF}

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View File

@@ -0,0 +1,163 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="10"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="pbgralape"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<BuildModes Count="2">
<Item1 Name="Debug" Default="True"/>
<Item2 Name="Release">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="pbgralape"/>
</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>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<RequiredPackages Count="4">
<Item1>
<PackageName Value="lape"/>
</Item1>
<Item2>
<PackageName Value="SynEdit"/>
</Item2>
<Item3>
<PackageName Value="bgracontrols"/>
</Item3>
<Item4>
<PackageName Value="LCL"/>
</Item4>
</RequiredPackages>
<Units Count="8">
<Unit0>
<Filename Value="pbgralape.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="umain.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit1>
<Unit2>
<Filename Value="ubgralape.pas"/>
<IsPartOfProject Value="True"/>
</Unit2>
<Unit3>
<Filename Value="lape_proc.inc"/>
<IsPartOfProject Value="True"/>
</Unit3>
<Unit4>
<Filename Value="lape_func.inc"/>
<IsPartOfProject Value="True"/>
</Unit4>
<Unit5>
<Filename Value="text_functions.inc"/>
<IsPartOfProject Value="True"/>
</Unit5>
<Unit6>
<Filename Value="basic_functions.inc"/>
<IsPartOfProject Value="True"/>
</Unit6>
<Unit7>
<Filename Value="basic_geometry_functions.inc"/>
<IsPartOfProject Value="True"/>
</Unit7>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="pbgralape"/>
</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,20 @@
program pbgralape;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, umain, ubgralape;
{$R *.res}
begin
RequireDerivedFormResource := True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +1,556 @@
{ This file contains Lape test scripts }
procedure TestDone(s: string);
begin
ShowMessage(s);
end;
var w,h: integer;
///////////////// pixel
procedure TestPixelAndLine;
var i : integer;
r : TRect;
c1,c2: TBGRAPixel;
pt : TPoint;
begin
FillBitmap(CSSBlack);
Antialiasing := False;
for i := 1 to 10 do
DrawLine(random(w),random(h),random(w),random(h),MergeBGRA(StrToBGRA('Blue'), 11-i, StrToBGRA('Lime'), i));
Antialiasing := True;
for i := 1 to 10 do
DrawLine(random(w),random(h),random(w),random(h),BGRA(0,255,0,i*255 div 10));
Antialiasing := False;
for i := 1 to 10 do
EraseLine(random(w),random(h),random(w),random(h),255);
Antialiasing := True;
for i := 1 to 10 do
EraseLine(random(w),random(h),random(w),random(h),255);
r := RectWithSize(w div 4, h div 4, w div 2, h div 2);
c1 := MergeBGRA([CSSYellow,CSSWhite]);
c2 := MergeBGRA([CSSYellow,CSSRed]);
for i := 1 to 100 do
begin
pt := Point(random(w),random(h));
if PtInRect(pt,r) then
DrawPixel(pt.x,pt.y,c1)
else
DrawPixel(pt.x,pt.y,c2);
end;
for i := 1 to 100 do
ErasePixel(random(w),random(h),128);
TestDone('DrawPixel+ErasePixel+DrawLine[Antialias]+EraseLine[Antialias]+MergeBGRA');
end;
procedure TestForEachPixel;
procedure PixelProc(x,y: Int32; var pix: TBGRAPixel);
var hsla: THSLAPixel;
begin
hsla.hue := (x shl 16) div w;
hsla.saturation := ((y shl 17) div h) and 65535;
hsla.alpha := 65535;
if y > h shr 1 then
begin
hsla.lightness := 48000;
pix := GSBAToBGRA(hsla);
end
else
begin
hsla.lightness := 32768;
pix := HSLAToBGRA(hsla);
end;
end;
begin
ForEachPixel(@PixelProc);
TestDone('ForEachPixel+HSLAToBGRA+GSBAToBGRA');
end;
procedure TestScanline;
var x,y,v: integer;
p: PBGRAPixel;
c: TBGRAPixel;
ec: TExpandedPixel;
begin
for y := 0 to h-1 do
begin
p := GetScanLine(y);
v := (h-1-y)*65536*2 div h;
if v > 65535 then ec.red := 65535 else ec.red := v;
if v > 65535 then ec.green := v-65536 else ec.green := 0;
ec.blue := 0;
ec.alpha := 65535;
c := GammaCompression(ec);
for x := w-1 downto 0 do
begin
p^ := c;
inc(p);
end;
end;
TestDone('ScanLine+GammaCompression: yellow-red gradient');
end;
procedure TestFillRect;
const r = 10;
var i : integer;
c: TBGRAPixel;
begin
FillBitmap(CSSBlack);
c := BGRA(255,255,255,0);
for i := 1 to 10 do
begin
Antialiasing := Odd(i);
if Antialiasing then
begin
DrawMode := dmNormal;
FillRoundRect(random(w),random(h),random(w),random(h),r,r,CSSOrange);
end
else
begin
DrawMode := dmXor;
FillRoundRect(random(w),random(h),random(w),random(h),r,r,c);
end;
end;
DrawMode := dmXor;
for i := 1 to 10 do
FillRect(random(w),random(h),random(w),random(h),c);
DrawMode := dmNormal;
TestDone('FillRect+FillRoundRect (r=' + IntToStr(r)+')');
Antialiasing := true;
end;
procedure TestRect;
const n = 5; r = 10;
var i : integer;
c: TBGRAPixel;
begin
FillBitmap(CSSWhite);
for i := 1 to n do
Rectangle(random(w),random(h),random(w),random(h),BGRA(128,160,255),BGRA(0,0,255));
for i := 1 to n do
begin
Antialiasing := Odd(i);
RoundRect(random(w),random(h),random(w),random(h),r,r,BGRA(128,160,255),BGRA(0,0,255));
end;
for i := 1 to n do
Rectangle(random(w),random(h),random(w),random(h),CSSBlack);
for i := 1 to n do
begin
Antialiasing := Odd(i);
RoundRect(random(w),random(h),random(w),random(h),r,r,CSSBlack);
end;
TestDone('Rectangle+RoundRect (r=' + IntToStr(r)+')');
Antialiasing := true;
end;
procedure TestEllipse;
const n = 5;
var i : integer;
c: TBGRAPixel;
begin
FillBitmap(CSSBlack);
for i := 1 to n do
begin
Antialiasing := Odd(i);
Ellipse(random(w),random(h),random(w)/2,random(h)/2,CSSMaroon,CSSRed);
end;
for i := 1 to n do
begin
Antialiasing := Odd(i);
FillEllipse(random(w),random(h),random(w)/2,random(h)/2,BGRA(128,160,255,64));
end;
for i := 1 to n do
begin
Antialiasing := Odd(i);
Ellipse(random(w),random(h),random(w)/2,random(h)/2,CSSPaleTurquoise);
end;
TestDone('FillEllipse+Ellipse');
Antialiasing := true;
end;
///////////// text
procedure TestTextOut;
var x,y,i,txtw,txth: integer;
c: TBGRAPixel;
text: string;
begin
text := 'Hello ' + BGRAToStr(BGRA(0,0,255));
FillBitmap(CSSWhite);
x := BitmapWidth div 2;
y := 0;
txth := BitmapHeight div 5;
SetFontFullHeight(txth);
txtw := TextWidth(text);
if txtw > BitmapWidth then SetFontFullHeight(txth*BitmapWidth div txtw);
TextAlignment := taCenter;
FontStyle := []; TextOut(x,y,text,CSSBlack); inc(y, txth);
FontStyle := [fsBold]; TextOut(x,y,text,CSSBlack); inc(y, txth);
FontStyle := [fsItalic]; TextOut(x,y,text,CSSBlack); inc(y, txth);
FontStyle := [fsStrikeOut]; TextOut(x,y,text,CSSBlack); inc(y, txth);
FontStyle := [fsUnderline]; TextOut(x,y,text,CSSBlack); inc(y, txth);
for i := 1 to 100 do
begin
x := random(w);
y := random(h);
FillRect(x-5,y-5,x+5,y+5,GetPixel(x,y));
end;
FontStyle := [];
TextAlignment := taLeft;
TestDone('TextOut+GetPixel');
end;
procedure TestTextOutAngle;
var x,y,i : integer;
begin
FillBitmap(CSSWhite);
x := w div 2;
y := h div 2;
SetFontEmHeight(20);
TextLayout := tlCenter;
SetClipRect(0,0,w,y);
for i := 0 to 5 do
TextOutAngle(x,y,i*3600 div 6, ' Text with angle',BGRA(192,192,192));
SetClipRect(0,y,w,h);
for i := 0 to 5 do
TextOutAngle(x,y,i*3600 div 6, ' Text with angle',CSSBlack);
NoClip;
TextLayout := tlTop;
TextLayout := tlBottom;
TextAlignment := taCenter;
TextOut(x, BitmapHeight, 'Text in all directions', CSSBlack);
TextLayout := tlTop;
TextAlignment := taLeft;
TestDone('TextOutAngle+Clipping');
end;
procedure TestTextRect;
var r : TRect;
begin
FillBitmap(CSSWhite);
r := rect(0,0,w,h);
SetFontEmHeight(20);
TextLayout := tlTop;
TextAlignment := taLeft;
TextRect(r, 'Top-left',CSSBlack);
TextLayout := tlCenter;
TextAlignment := taCenter;
TextRect(r, 'Center',CSSBlack);
TextLayout := tlBottom;
TextAlignment := taRight;
TextRect(r, 'Bottom-Right',CSSBlack);
TextLayout := tlTop;
TextAlignment := taLeft;
FillBitmapAlpha(224);
Antialiasing := False;
DrawPolygon([Point(w div 2,0),Point(w-1,h-1),Point(0,h-1)],CSSRed);
Antialiasing := True;
DrawPolygon([Point(w div 2,h-1),Point(w-1,0),Point(0,0)],CSSGreen);
Antialiasing := False;
ErasePolygonOutline([Point(0,h div 2),Point(w-1,0),Point(w-1,h-1)],192);
Antialiasing := True;
ErasePolygonOutline([Point(w-1,h div 2),Point(0,0),Point(0,h-1)],192);
TestDone('TextRect+DrawPolygon[Antialias]+ErasePolygonOutline[Antialias]');
end;
/////////////////// bitmap
procedure TestBitmap;
var mainBitmap, sprite, sprite2: TBGRABitmap;
i: integer;
procedure PixelSwapRedBlue(x,y: Int32; var pix: TBGRAPixel);
var oldRed: byte;
begin
oldRed := pix.red;
pix.red := pix.blue;
pix.blue := oldRed;
end;
begin
FillBitmap(CSSWhite);
mainBitmap := SelectedBitmap;
sprite := CreateBitmap(32,32);
sprite.Select;
for i := 1 to 100 do
SetPixel(random(BitmapWidth),random(BitmapHeight),CSSBlack);
mainBitmap.Select;
for i := 1 to 50 do
PutImage(random(BitmapWidth),random(BitmapHeight), sprite, i*255 div 50);
sprite.Select;
SetBitmapSize(16,16);
FillTransparent;
for i := 1 to 100 do
SetPixel(random(BitmapWidth),random(BitmapHeight),CSSBlack);
mainBitmap.Select;
for i := 1 to 50 do
PutImage(random(BitmapWidth),random(BitmapHeight), sprite, i*255 div 50);
sprite.Free;
sprite := CreateBitmap('testimage.png');
sprite2 := sprite.Duplicate;
sprite2.Select;
// ToDo: fix
//ForEachPixel(@PixelSwapRedBlue);
mainBitmap.Select;
for i := 1 to 50 do
begin
PutImage(random(BitmapWidth),random(BitmapHeight), sprite, i*255 div 50);
PutImage(random(BitmapWidth),random(BitmapHeight), sprite2, i*255 div 50);
end;
sprite.Free;
sprite2.Free;
TestDone('CreateBitmap+PutImage');
end;
procedure TestColors;
var x: integer;
procedure DoStuff(var x: integer; pixProc1,pixProc2: TForEachPixelProc);
var
mainBitmap, sprite,sprite2: TBGRABitmap;
tx,ty: integer;
begin
mainBitmap := SelectedBitmap;
sprite := CreateBitmap('testimage.png');
sprite.Select;
tx := BitmapWidth;
ty := BitmapHeight;
sprite2 := sprite.Duplicate;
sprite.Select;
ForEachPixel(@pixProc1);
mainBitmap.Select;
PutImage(x,0,sprite);
sprite.Select;
ForEachPixel(@pixProc1);
mainBitmap.Select;
PutImage(x,ty,sprite);
sprite.Select;
ForEachPixel(@pixProc1);
mainBitmap.Select;
PutImage(x,2*ty,sprite);
inc(x, tx);
sprite2.Select;
ForEachPixel(@pixProc2);
mainBitmap.Select;
PutImage(x,0,sprite2);
sprite2.Select;
ForEachPixel(@pixProc2);
mainBitmap.Select;
PutImage(x,ty,sprite2);
sprite2.Select;
ForEachPixel(@pixProc2);
mainBitmap.Select;
PutImage(x,2*ty,sprite2);
inc(x, tx);
sprite.Free;
sprite2.Free;
end;
procedure IntensityNotExpanded(x,y: Int32; var pix: TBGRAPixel);
begin
pix := SetIntensity(pix, GetIntensity(pix)*3 div 4);
end;
procedure IntensityExpanded(x,y: Int32; var pix: TBGRAPixel);
begin //should be the same, but via explicit conversion between TBGRAPixel and TExpandedPixel
pix := GammaCompression(SetIntensity(GammaExpansion(pix), GetIntensity(GammaExpansion(pix))*3 div 4));
end;
procedure LightnessNotExpanded(x,y: Int32; var pix: TBGRAPixel);
begin
pix := SetLightness(pix, GetLightness(pix)*4 div 3);
end;
procedure LightnessExpanded(x,y: Int32; var pix: TBGRAPixel);
begin //should be the same, but via explicit conversion between TBGRAPixel and TExpandedPixel
pix := GammaCompression(SetLightness(GammaExpansion(pix), GetLightness(GammaExpansion(pix))*4 div 3));
end;
procedure HSLANotExpanded(x,y: Int32; var pix: TBGRAPixel);
var hsla: THSLAPixel;
begin
hsla := BGRAToHSLA(pix);
hsla.hue := hsla.hue+5000;
pix := HSLAToBGRA(hsla);
end;
procedure HSLAExpanded(x,y: Int32; var pix: TBGRAPixel);
//should be the same, but via explicit conversion between TBGRAPixel and TExpandedPixel
var hsla: THSLAPixel;
begin
hsla := ExpandedToHSLA(GammaExpansion(pix));
hsla.hue := hsla.hue+5000;
pix := GammaCompression(HSLAToExpanded(hsla));
end;
procedure GSBANotExpanded(x,y: Int32; var pix: TBGRAPixel);
var GSBA: TGSBAPixel;
begin
GSBA := BGRAToGSBA(pix);
GSBA.hue := GSBA.hue+5000;
pix := GSBAToBGRA(GSBA);
end;
procedure GSBAExpanded(x,y: Int32; var pix: TBGRAPixel);
//should be the same, but via explicit conversion between TBGRAPixel and TExpandedPixel
var GSBA: TGSBAPixel;
begin
GSBA := ExpandedToGSBA(GammaExpansion(pix));
GSBA.hue := GSBA.hue+5000;
pix := GammaCompression(GSBAToExpanded(GSBA));
end;
procedure GrayscaleNotExpanded(x,y: Int32; var pix: TBGRAPixel);
begin
pix := BGRAToGrayscale(pix);
end;
procedure GrayscaleExpanded(x,y: Int32; var pix: TBGRAPixel);
//should be the same, but via explicit conversion between TBGRAPixel and TExpandedPixel
begin
pix := GammaCompression(ExpandedToGrayscale(GammaExpansion(pix)));
end;
begin
FillBitmap(CSSWhite);
x := 0;
// ToDo: fix
{DoStuff(x, @IntensityNotExpanded, @IntensityExpanded);
DoStuff(x, @LightnessNotExpanded, @LightnessExpanded);
DoStuff(x, @HSLANotExpanded, @HSLAExpanded);
DoStuff(x, @GrayscaleNotExpanded, @GrayscaleExpanded);
DoStuff(x, @GSBANotExpanded, @GSBAExpanded);}
TestDone('Intensity,Lightness,HSLA,Grayscale,GSBA');
end;
////////////////// extended geometry
function RandomPointF: TPointF;
begin
result := PointF((random(w*10-1)-4)/10,(random(h*10-1)-4)/10);
end;
function RandomX: single;
begin
result := (random(w*10-1)-4)/10;
end;
function RandomY: single;
begin
result := (random(h*10-1)-4)/10;
end;
procedure TestRectF;
const n = 3; r= 10;
var i: integer;
c,c2: TBGRAPixel;
begin
FillBitmap(CSSWhite);
c := BGRA(0,0,0,128);
c2 := BGRA(0,128,0,128);
for i := 1 to n do
FillRectF(RandomX,RandomY,RandomX,RandomY, c2);
for i := 1 to n do
RectangleF(RandomX,RandomY,RandomX,RandomY, c,3);
for i := 1 to n do
RectangleF(RandomX,RandomY,RandomX,RandomY, c,3,c2);
for i := 1 to n do
FillRoundRectF(RandomX,RandomY,RandomX,RandomY,r,r, c2);
for i := 1 to n do
RoundRectF(RandomX,RandomY,RandomX,RandomY,r,r, c,3);
for i := 1 to n do
RoundRectF(RandomX,RandomY,RandomX,RandomY,r,r, c,3,c2);
for i := 1 to n do
FillEllipseF(RandomX,RandomY,RandomX/2,RandomY/2, c2);
for i := 1 to n do
EllipseF(RandomX,RandomY,RandomX/2,RandomY/2, c,3);
for i := 1 to n do
EllipseF(RandomX,RandomY,RandomX/2,RandomY/2, c,3,c2);
TestDone('RectangleF/RoundRectF/EllipseF');
end;
procedure TestLineF;
const n = 3;
var i: integer;
c,c2: TBGRAPixel;
begin
FillBitmap(CSSWhite);
c := BGRA(0,0,0,128);
c2 := BGRA(0,128,0,128);
for i := 1 to n do
DrawLineF(RandomX,RandomY,RandomX,RandomY, c,3);
for i := 1 to n do
FillPolyF([RandomPointF,RandomPointF,RandomPointF], c2);
for i := 1 to n do
DrawPolyLineF([RandomPointF,RandomPointF,RandomPointF], c,3);
for i := 1 to n do
DrawPolygonF([RandomPointF,RandomPointF,RandomPointF], c,3);
for i := 1 to n do
DrawPolyLineF([RandomPointF,RandomPointF,RandomPointF], c,3,c2);
for i := 1 to n do
DrawPolygonF([RandomPointF,RandomPointF,RandomPointF], c,3,c2);
TestDone('DrawLineF, PolyLineF, PolygonF');
end;
///////////////// tests
begin
w := BitmapWidth;
h := BitmapHeight;
TestBitmap;
TestColors;
TestRectF;
TestLineF;
Antialiasing := false;
TestRectF;
TestLineF;
DrawMode := dmSet;
TestRectF;
TestLineF;
DrawMode := dmNormal;
Antialiasing := true;
TestPixelAndLine;
TestForEachPixel;
TestScanline;
TestFillRect;
TestRect;
TestEllipse;
TestTextOut;
TestTextOutAngle;
TestTextRect;
FillTransparent;
end;

View File

@@ -0,0 +1,102 @@
var
textAlignment: TAlignment;
textLayout: TTextLayout;
procedure MySetFontName{$i lape.proc}
begin
target.FontName := PlpString(Params^[0])^;
end;
procedure MySetFontStyle{$i lape.proc}
var fs: TFontStyles;
begin
fs := [];
if PLongBool(Params^[0])^ then fs += [fsBold];
if PLongBool(Params^[1])^ then fs += [fsItalic];
if PLongBool(Params^[2])^ then fs += [fsStrikeOut];
if PLongBool(Params^[3])^ then fs += [fsUnderline];
target.FontStyle := fs;
end;
procedure MySetTextAlignment{$i lape.proc}
begin
textAlignment:= TAlignment(PInt32(Params^[0])^);
end;
procedure MySetTextLayout{$i lape.proc}
begin
textLayout:= TTextLayout(PInt32(Params^[0])^);
end;
procedure MyGetFontFullHeight{$i lape.func}
begin
Int32(Result^) := target.FontFullHeight;
end;
procedure MySetFontFullHeight{$i lape.proc}
begin
target.FontFullHeight := PInt32(Params^[0])^;
end;
procedure MySetFontEmHeight{$i lape.proc}
begin
target.FontHeight := PInt32(Params^[0])^;
end;
procedure MyGetFontEmHeight{$i lape.func}
begin
Int32(Result^) := target.FontHeight;
end;
procedure MyGetTextWidth{$i lape.func}
begin
Int32(Result^) := target.TextSize(PlpString(Params^[0])^).cx;
end;
procedure MyTextOut{$i lape.proc}
var y: single;
begin
y := PSingle(Params^[1])^;
if textLayout = tlCenter then y -= target.FontFullHeight/2
else if textLayout = tlBottom then y -= target.FontFullHeight;
target.TextOut(PSingle(Params^[0])^,y,PlpString(Params^[2])^,PBGRAPixel(Params^[3])^,textAlignment);
end;
procedure MyTextRect{$i lape.proc}
var r: TRect;
begin
r := rect(PInt32(Params^[0])^,PInt32(Params^[1])^,PInt32(Params^[2])^,round(PInt32(Params^[3])^));
target.TextRect(r,PlpString(Params^[4])^,textAlignment,textLayout,PBGRAPixel(Params^[5])^);
end;
procedure MyTextOutAngle{$i lape.proc}
var x,y,h,angle: single;
begin
x := PSingle(Params^[0])^;
y := PSingle(Params^[1])^;
if textLayout <> tlTop then
begin
h := target.FontFullHeight;
if textLayout = tlCenter then h *= 0.5;
angle := round(PSingle(Params^[2])^)*Pi/1800 + Pi/2;
x += cos(angle)*h;
y -= sin(angle)*h;
end;
target.TextOutAngle(x,y,round(PSingle(Params^[2])^),PlpString(Params^[3])^,PBGRAPixel(Params^[4])^,textAlignment);
end;
procedure RegisterTextFunctions(Compiler: TLapeCompiler);
begin
Compiler.addGlobalFunc('procedure _SetFontName(s: string);', @MySetFontName);
Compiler.addGlobalFunc('procedure _SetFontStyle(ABold, AItalic, AStrikeOut, AUnderline: LongBool);', @MySetFontStyle);
Compiler.addGlobalFunc('procedure _SetTextAlignment(AAlign: Int32);', @MySetTextAlignment);
Compiler.addGlobalFunc('procedure _SetTextLayout(ALayout: Int32);', @MySetTextLayout);
Compiler.addGlobalFunc('function TextWidth(s: string) : Int32;', @MyGetTextWidth);
Compiler.addGlobalFunc('function GetFontFullHeight : Int32;', @MyGetFontFullHeight);
Compiler.addGlobalFunc('function GetFontEmHeight : Int32;', @MyGetFontEmHeight);
Compiler.addGlobalFunc('procedure SetFontFullHeight(AValue : Int32);', @MySetFontFullHeight);
Compiler.addGlobalFunc('procedure SetFontEmHeight(AValue : Int32);', @MySetFontEmHeight);
Compiler.addGlobalFunc('procedure TextOut(x, y: single; sUTF8: string; c: TBGRAPixel);', @MyTextOut);
Compiler.addGlobalFunc('procedure TextOutAngle(x, y, angle: single; sUTF8: string; c: TBGRAPixel);', @MyTextOutAngle);
Compiler.addGlobalFunc('procedure TextRect(left, top, right, bottom: integer; sUTF8: string; c: TBGRAPixel);', @MyTextRect);
end;

View File

@@ -0,0 +1,220 @@
unit ubgralape;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, BGRABitmap, BGRABitmapTypes, lptypes, lpcompiler;
function RegisterBitmap(ABitmap: TBGRABitmap): integer;
procedure UnregisterBitmap(AIndex: integer);
procedure EnsureInvalidate(AIndex: integer);
procedure SetTargetBitmap(AIndex: integer);
procedure AddScriptSystemTypes(Compiler: TLapeCompiler);
procedure AddScriptSystemFunctions(Compiler: TLapeCompiler);
procedure FreeBitmaps;
implementation
uses FileUtil, Graphics, GraphType, BGRAPolygon, BGRAFillInfo;
var
bitmaps: array of record
Bitmap: TBGRABitmap;
Registered: boolean;
Invalidated: boolean;
LockedCount: Int32or64;
end;
target: TBGRABitmap;
targetIndex: integer;
function NewBitmapEntry: integer;
var i: integer;
begin
for i:= 0 to high(bitmaps) do
if bitmaps[i].Bitmap = nil then
begin
result := i;
bitmaps[i].LockedCount:= 0;
exit;
end;
result := length(bitmaps);
setlength(bitmaps,length(bitmaps)*2+1);
bitmaps[result].LockedCount:= 0;
end;
procedure FreeBitmap(AIndex: integer);
begin
if (AIndex >= 0) and (AIndex < length(bitmaps)) then
if not bitmaps[AIndex].Registered then
begin
if bitmaps[AIndex].LockedCount > 0 then
raise exception.Create('Bitmap is locked');
FreeAndNil(bitmaps[AIndex].Bitmap);
bitmaps[AIndex].Invalidated:= false;
end;
end;
function RegisterBitmap(ABitmap: TBGRABitmap): integer;
begin
result := NewBitmapEntry;
bitmaps[result].Bitmap := ABitmap;
bitmaps[result].Invalidated := false;
bitmaps[result].Registered := true;
end;
procedure UnregisterBitmap(AIndex: integer);
begin
if (AIndex >= 0) and (AIndex < length(bitmaps)) then
begin
EnsureInvalidate(AIndex);
if not bitmaps[AIndex].Registered then
raise Exception.Create('This bitmap has not been registered');
if target = bitmaps[AIndex].Bitmap then
begin
target := nil;
targetIndex := -1;
end;
bitmaps[AIndex].Bitmap := nil;
bitmaps[AIndex].Registered := false;
end;
end;
procedure EnsureInvalidate(AIndex: integer);
begin
if (AIndex >= 0) and (AIndex < length(bitmaps)) then
begin
if bitmaps[AIndex].Invalidated then
begin
bitmaps[AIndex].Bitmap.InvalidateBitmap;
bitmaps[AIndex].Invalidated := false;
end;
end;
end;
procedure WillInvalidateBitmap(AIndex: integer);
begin
if (AIndex >= 0) and (AIndex < length(bitmaps)) then
Bitmaps[AIndex].Invalidated := true;
end;
procedure SetTargetBitmap(AIndex: integer);
begin
if (AIndex < 0) or (AIndex >= length(bitmaps)) or (bitmaps[AIndex].Bitmap = nil) then
raise exception.create('Bitmap does not exist');
target := bitmaps[AIndex].Bitmap;
targetIndex := AIndex;
end;
function GetBitmap(AIndex: integer): TBGRABitmap;
begin
if (AIndex < 0) or (AIndex >= length(bitmaps)) or (Bitmaps[AIndex].Bitmap = nil) then
raise exception.Create('Bitmap does not exist');
result := Bitmaps[AIndex].Bitmap;
end;
function GetScriptSystemInlineFunctions: string; forward;
///////////////////////////// Function implementation ///////////////////////////
{$I basic_functions.inc}
{$I basic_geometry_functions.inc}
{$I extended_geometry_functions.inc}
{$I text_functions.inc}
{$I color_functions.inc}
/////////////////////////// Function list /////////////////////////////////////////////
procedure AddScriptSystemFunctions(Compiler: TLapeCompiler);
begin
RegisterBasicFunctions(Compiler);
RegisterBasicGeometryFunctions(Compiler);
RegisterExtendedGeometryFunctions(Compiler);
RegisterTextFunctions(Compiler);
RegisterColorFunctions(Compiler);
Compiler.addDelayedCode(GetScriptSystemInlineFunctions, '',false,true);
end;
procedure FreeBitmaps;
var i: integer;
begin
for i := 0 to High(bitmaps) do
if (bitmaps[i].Bitmap <> nil) and not bitmaps[i].Registered then
begin
bitmaps[i].LockedCount := 0;
FreeBitmap(i);
end;
end;
////////////////////////////// Load script system //////////////////////////////
var
scriptSystemFunctions,scriptSystemTypes: TStringList;
function GetScriptSystemInlineFunctions: string;
var i: integer;
begin
result := LineEnding;
for i := 0 to scriptSystemFunctions.Count-1 do
result += scriptSystemFunctions[i]+LineEnding;
textAlignment:= taLeftJustify;
end;
procedure AddScriptSystemTypes(Compiler: TLapeCompiler);
var line: string;
i,idxEq: integer;
begin
for i := 0 to scriptSystemTypes.Count-1 do
begin
line := scriptSystemTypes[i];
idxEq := pos('=',line);
if idxEq <> 0 then
Compiler.addGlobalType(trim(copy(line,idxEq+1,length(line)-idxEq)),trim(copy(line,1,idxEq-1)));
end;
end;
procedure LoadScriptSystem;
var
scriptSystem: TStringList;
i: integer;
dest: TStringList;
begin
scriptSystemFunctions := TStringList.Create;
scriptSystemTypes := TStringList.Create;
dest := nil;
scriptSystem := TStringList.Create;
scriptSystem.LoadFromFile('bgralapesys.pas');
for i := 0 to scriptSystem.Count-1 do
begin
if CompareText(Trim(scriptSystem[i]),'implementation') = 0 then
dest := scriptSystemFunctions else
if CompareText(Trim(scriptSystem[i]),'type') = 0 then
dest := scriptSystemTypes else
if CompareText(Trim(scriptSystem[i]),'end.') = 0 then break
else
if Assigned(dest) then dest.Add(scriptSystem[i]);
end;
scriptSystem.Free;
end;
procedure FreeScriptSystem;
begin
scriptSystemTypes.Free;
scriptSystemFunctions.Free;
end;
initialization
LoadScriptSystem;
Randomize;
finalization
FreeScriptSystem;
end.

View File

@@ -0,0 +1,552 @@
object Form1: TForm1
Left = 316
Height = 476
Top = 156
Width = 717
Caption = 'Form1'
ClientHeight = 476
ClientWidth = 717
OnCreate = FormCreate
OnDestroy = FormDestroy
LCLVersion = '1.0.10.0'
object BGRAVirtualScreen1: TBGRAVirtualScreen
Left = 376
Height = 424
Top = 41
Width = 335
OnRedraw = BGRAVirtualScreen1Redraw
Alignment = taLeftJustify
Anchors = [akTop, akLeft, akRight, akBottom]
Color = clBtnFace
ParentColor = False
TabOrder = 0
end
object Button1: TButton
Left = 9
Height = 25
Top = 9
Width = 75
Caption = 'Run'
OnClick = Button1Click
TabOrder = 1
end
inline SynEdit1: TSynEdit
Left = 8
Height = 426
Top = 41
Width = 360
Anchors = [akTop, akLeft, akBottom]
Font.Height = -13
Font.Name = 'Courier New'
Font.Pitch = fpFixed
Font.Quality = fqNonAntialiased
ParentColor = False
ParentFont = False
TabOrder = 2
Gutter.Width = 57
Gutter.MouseActions = <>
RightGutter.Width = 0
RightGutter.MouseActions = <>
Highlighter = SynFreePascalSyn1
Keystrokes = <
item
Command = ecUp
ShortCut = 38
end
item
Command = ecSelUp
ShortCut = 8230
end
item
Command = ecScrollUp
ShortCut = 16422
end
item
Command = ecDown
ShortCut = 40
end
item
Command = ecSelDown
ShortCut = 8232
end
item
Command = ecScrollDown
ShortCut = 16424
end
item
Command = ecLeft
ShortCut = 37
end
item
Command = ecSelLeft
ShortCut = 8229
end
item
Command = ecWordLeft
ShortCut = 16421
end
item
Command = ecSelWordLeft
ShortCut = 24613
end
item
Command = ecRight
ShortCut = 39
end
item
Command = ecSelRight
ShortCut = 8231
end
item
Command = ecWordRight
ShortCut = 16423
end
item
Command = ecSelWordRight
ShortCut = 24615
end
item
Command = ecPageDown
ShortCut = 34
end
item
Command = ecSelPageDown
ShortCut = 8226
end
item
Command = ecPageBottom
ShortCut = 16418
end
item
Command = ecSelPageBottom
ShortCut = 24610
end
item
Command = ecPageUp
ShortCut = 33
end
item
Command = ecSelPageUp
ShortCut = 8225
end
item
Command = ecPageTop
ShortCut = 16417
end
item
Command = ecSelPageTop
ShortCut = 24609
end
item
Command = ecLineStart
ShortCut = 36
end
item
Command = ecSelLineStart
ShortCut = 8228
end
item
Command = ecEditorTop
ShortCut = 16420
end
item
Command = ecSelEditorTop
ShortCut = 24612
end
item
Command = ecLineEnd
ShortCut = 35
end
item
Command = ecSelLineEnd
ShortCut = 8227
end
item
Command = ecEditorBottom
ShortCut = 16419
end
item
Command = ecSelEditorBottom
ShortCut = 24611
end
item
Command = ecToggleMode
ShortCut = 45
end
item
Command = ecCopy
ShortCut = 16429
end
item
Command = ecPaste
ShortCut = 8237
end
item
Command = ecDeleteChar
ShortCut = 46
end
item
Command = ecCut
ShortCut = 8238
end
item
Command = ecDeleteLastChar
ShortCut = 8
end
item
Command = ecDeleteLastChar
ShortCut = 8200
end
item
Command = ecDeleteLastWord
ShortCut = 16392
end
item
Command = ecUndo
ShortCut = 32776
end
item
Command = ecRedo
ShortCut = 40968
end
item
Command = ecLineBreak
ShortCut = 13
end
item
Command = ecSelectAll
ShortCut = 16449
end
item
Command = ecCopy
ShortCut = 16451
end
item
Command = ecBlockIndent
ShortCut = 24649
end
item
Command = ecLineBreak
ShortCut = 16461
end
item
Command = ecInsertLine
ShortCut = 16462
end
item
Command = ecDeleteWord
ShortCut = 16468
end
item
Command = ecBlockUnindent
ShortCut = 24661
end
item
Command = ecPaste
ShortCut = 16470
end
item
Command = ecCut
ShortCut = 16472
end
item
Command = ecDeleteLine
ShortCut = 16473
end
item
Command = ecDeleteEOL
ShortCut = 24665
end
item
Command = ecUndo
ShortCut = 16474
end
item
Command = ecRedo
ShortCut = 24666
end
item
Command = ecGotoMarker0
ShortCut = 16432
end
item
Command = ecGotoMarker1
ShortCut = 16433
end
item
Command = ecGotoMarker2
ShortCut = 16434
end
item
Command = ecGotoMarker3
ShortCut = 16435
end
item
Command = ecGotoMarker4
ShortCut = 16436
end
item
Command = ecGotoMarker5
ShortCut = 16437
end
item
Command = ecGotoMarker6
ShortCut = 16438
end
item
Command = ecGotoMarker7
ShortCut = 16439
end
item
Command = ecGotoMarker8
ShortCut = 16440
end
item
Command = ecGotoMarker9
ShortCut = 16441
end
item
Command = ecSetMarker0
ShortCut = 24624
end
item
Command = ecSetMarker1
ShortCut = 24625
end
item
Command = ecSetMarker2
ShortCut = 24626
end
item
Command = ecSetMarker3
ShortCut = 24627
end
item
Command = ecSetMarker4
ShortCut = 24628
end
item
Command = ecSetMarker5
ShortCut = 24629
end
item
Command = ecSetMarker6
ShortCut = 24630
end
item
Command = ecSetMarker7
ShortCut = 24631
end
item
Command = ecSetMarker8
ShortCut = 24632
end
item
Command = ecSetMarker9
ShortCut = 24633
end
item
Command = EcFoldLevel1
ShortCut = 41009
end
item
Command = EcFoldLevel2
ShortCut = 41010
end
item
Command = EcFoldLevel1
ShortCut = 41011
end
item
Command = EcFoldLevel1
ShortCut = 41012
end
item
Command = EcFoldLevel1
ShortCut = 41013
end
item
Command = EcFoldLevel6
ShortCut = 41014
end
item
Command = EcFoldLevel7
ShortCut = 41015
end
item
Command = EcFoldLevel8
ShortCut = 41016
end
item
Command = EcFoldLevel9
ShortCut = 41017
end
item
Command = EcFoldLevel0
ShortCut = 41008
end
item
Command = EcFoldCurrent
ShortCut = 41005
end
item
Command = EcUnFoldCurrent
ShortCut = 41003
end
item
Command = EcToggleMarkupWord
ShortCut = 32845
end
item
Command = ecNormalSelect
ShortCut = 24654
end
item
Command = ecColumnSelect
ShortCut = 24643
end
item
Command = ecLineSelect
ShortCut = 24652
end
item
Command = ecTab
ShortCut = 9
end
item
Command = ecShiftTab
ShortCut = 8201
end
item
Command = ecMatchBracket
ShortCut = 24642
end
item
Command = ecColSelUp
ShortCut = 40998
end
item
Command = ecColSelDown
ShortCut = 41000
end
item
Command = ecColSelLeft
ShortCut = 40997
end
item
Command = ecColSelRight
ShortCut = 40999
end
item
Command = ecColSelPageDown
ShortCut = 40994
end
item
Command = ecColSelPageBottom
ShortCut = 57378
end
item
Command = ecColSelPageUp
ShortCut = 40993
end
item
Command = ecColSelPageTop
ShortCut = 57377
end
item
Command = ecColSelLineStart
ShortCut = 40996
end
item
Command = ecColSelLineEnd
ShortCut = 40995
end
item
Command = ecColSelEditorTop
ShortCut = 57380
end
item
Command = ecColSelEditorBottom
ShortCut = 57379
end>
MouseActions = <>
MouseSelActions = <>
Lines.Strings = (
'begin'
' Fill(BGRABlack);'
' ShowMessage(''Done'');'
'end;'
)
VisibleSpecialChars = [vscSpace, vscTabAtLast]
SelectedColor.BackPriority = 50
SelectedColor.ForePriority = 50
SelectedColor.FramePriority = 50
SelectedColor.BoldPriority = 50
SelectedColor.ItalicPriority = 50
SelectedColor.UnderlinePriority = 50
BracketHighlightStyle = sbhsBoth
BracketMatchColor.Background = clNone
BracketMatchColor.Foreground = clNone
BracketMatchColor.Style = [fsBold]
FoldedCodeColor.Background = clNone
FoldedCodeColor.Foreground = clGray
FoldedCodeColor.FrameColor = clGray
MouseLinkColor.Background = clNone
MouseLinkColor.Foreground = clBlue
LineHighlightColor.Background = clNone
LineHighlightColor.Foreground = clNone
inline SynLeftGutterPartList1: TSynGutterPartList
object SynGutterMarks1: TSynGutterMarks
Width = 24
MouseActions = <>
end
object SynGutterLineNumber1: TSynGutterLineNumber
Width = 17
MouseActions = <>
MarkupInfo.Background = clBtnFace
MarkupInfo.Foreground = clNone
DigitCount = 2
ShowOnlyLineNumbersMultiplesOf = 1
ZeroStart = False
LeadingZeros = False
end
object SynGutterChanges1: TSynGutterChanges
Width = 4
MouseActions = <>
ModifiedColor = 59900
SavedColor = clGreen
end
object SynGutterSeparator1: TSynGutterSeparator
Width = 2
MouseActions = <>
MarkupInfo.Background = clWhite
MarkupInfo.Foreground = clGray
end
object SynGutterCodeFolding1: TSynGutterCodeFolding
MouseActions = <>
MarkupInfo.Background = clNone
MarkupInfo.Foreground = clGray
MouseActionsExpanded = <>
MouseActionsCollapsed = <>
end
end
end
object SynFreePascalSyn1: TSynFreePascalSyn
Enabled = False
AsmAttri.FrameEdges = sfeAround
CommentAttri.FrameEdges = sfeAround
IDEDirectiveAttri.FrameEdges = sfeAround
IdentifierAttri.FrameEdges = sfeAround
KeyAttri.FrameEdges = sfeAround
NumberAttri.FrameEdges = sfeAround
SpaceAttri.FrameEdges = sfeAround
StringAttri.FrameEdges = sfeAround
SymbolAttri.FrameEdges = sfeAround
CaseLabelAttri.FrameEdges = sfeAround
DirectiveAttri.FrameEdges = sfeAround
CompilerMode = pcmObjFPC
NestedComments = True
left = 248
top = 8
end
end

View File

@@ -0,0 +1,127 @@
unit umain;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, SynHighlighterPas, SynEdit, Forms, Controls,
Graphics, Dialogs, StdCtrls, BGRAVirtualScreen, BGRABitmap;
type
{ TForm1 }
TForm1 = class(TForm)
BGRAVirtualScreen1: TBGRAVirtualScreen;
Button1: TButton;
SynEdit1: TSynEdit;
SynFreePascalSyn1: TSynFreePascalSyn;
procedure BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
bmp: TBGRABitmap;
idxBmp: integer;
procedure UpdateBitmap;
end;
var
Form1: TForm1;
implementation
uses lpparser, lpcompiler, lputils, lpvartypes, lptypes, lpeval, lpinterpreter,
BGRABitmapTypes, ubgralape;
{$R *.lfm}
procedure MyShowMessage{$I lape.proc}
begin
Form1.UpdateBitmap;
ShowMessage(PlpString(Params^[0])^);
end;
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
var
Parser: TLapeTokenizerBase;
Compiler: TLapeCompiler;
begin
Parser := nil;
Compiler := nil;
try
Parser := TLapeTokenizerString.Create(SynEdit1.Lines.Text);
Compiler := TLapeCompiler.Create(Parser);
InitializePascalScriptBasics(Compiler, [psiTypeAlias]);
ExposeGlobals(Compiler);
Compiler.addGlobalFunc('procedure ShowMessage(s: string);', @MyShowMessage);
ubgralape.AddScriptSystemTypes(Compiler);
ubgralape.AddScriptSystemFunctions(Compiler);
// Compiler.addGlobalMethod('procedure _writeln; override;', @MyWriteLn, Form1);
// c := LapeImportWrapper(@StupidProc, Compiler, 'function(abc: array of integer): array of integer', FFI_SYSV);
// Compiler.addGlobalFunc('function StupidProc(abc: array of integer): array of integer', c.Func);
if not Compiler.Compile() then
raise Exception.Create('Error');
try
FreeAndNil(bmp);
bmp := TBGRABitmap.Create(BGRAVirtualScreen1.Width,BGRAVirtualScreen1.Height);
idxBmp:= ubgralape.RegisterBitmap(bmp);
ubgralape.SetTargetBitmap(idxBmp);
RunCode(Compiler.Emitter.Code);
finally
ubgralape.UnregisterBitmap(idxBmp);
idxBmp := -1;
end;
except
on E: Exception do
begin
ShowMessage(E.Message);
end;
end;
If Assigned(Compiler) then
FreeAndNil(Compiler)
else
FreeAndNil(Parser);
BGRAVirtualScreen1.DiscardBitmap;
end;
procedure TForm1.BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);
begin
Bitmap.DrawCheckers(rect(0,0,Bitmap.Width,Bitmap.Height),BGRAWhite,CSSSilver);
if Assigned(bmp) then Bitmap.PutImage(0,0,bmp,dmDrawWithTransparency);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
SynEdit1.Lines.LoadFromFile('tests.pas');
bmp := nil;
idxBmp := -1;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
FreeAndNil(bmp);
end;
procedure TForm1.UpdateBitmap;
begin
if (idxBmp = -1) or (bmp = nil) then exit;
ubgralape.EnsureInvalidate(idxBmp);
Form1.BGRAVirtualScreen1.RedrawBitmap;
end;
end.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -0,0 +1,851 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="10"/>
<PathDelim Value="\"/>
<General>
<MainUnit Value="0"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<BuildModes Count="1" Active="Default">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<RequiredPackages Count="5">
<Item1>
<PackageName Value="BGLControls"/>
</Item1>
<Item2>
<PackageName Value="BGRABitmapPack"/>
</Item2>
<Item3>
<PackageName Value="etpackage"/>
</Item3>
<Item4>
<PackageName Value="bgracontrols"/>
<MinVersion Major="1" Release="9" Build="7" Valid="True"/>
</Item4>
<Item5>
<PackageName Value="LCL"/>
</Item5>
</RequiredPackages>
<Units Count="93">
<Unit0>
<Filename Value="bgratutorial3d.lpr"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/>
<CursorPos X="21" Y="9"/>
<UsageCount Value="207"/>
</Unit0>
<Unit1>
<Filename Value="umain.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<TopLine Value="162"/>
<CursorPos X="18" Y="176"/>
<UsageCount Value="207"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
<Unit2>
<Filename Value="ubgrasamples.pas"/>
<IsPartOfProject Value="True"/>
<CursorPos X="20" Y="9"/>
<UsageCount Value="207"/>
</Unit2>
<Unit3>
<Filename Value="ex1.pas"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="14"/>
<CursorPos X="40" Y="22"/>
<UsageCount Value="207"/>
<Loaded Value="True"/>
</Unit3>
<Unit4>
<Filename Value="utexture.pas"/>
<IsPartOfProject Value="True"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="11"/>
<CursorPos X="17" Y="6"/>
<UsageCount Value="207"/>
<Loaded Value="True"/>
</Unit4>
<Unit5>
<Filename Value="ex2.pas"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="7"/>
<TopLine Value="137"/>
<CursorPos X="30" Y="147"/>
<UsageCount Value="207"/>
<Loaded Value="True"/>
</Unit5>
<Unit6>
<Filename Value="ex3.pas"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="6"/>
<TopLine Value="37"/>
<CursorPos Y="64"/>
<UsageCount Value="207"/>
<Loaded Value="True"/>
</Unit6>
<Unit7>
<Filename Value="..\bgrabitmap\bgrascene3d.pas"/>
<UnitName Value="BGRAScene3D"/>
<EditorIndex Value="-1"/>
<TopLine Value="1149"/>
<CursorPos X="53" Y="1175"/>
<UsageCount Value="101"/>
</Unit7>
<Unit8>
<Filename Value="ex4.pas"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/>
<TopLine Value="26"/>
<CursorPos X="12" Y="239"/>
<UsageCount Value="207"/>
</Unit8>
<Unit9>
<Filename Value="..\bgrabitmap\bgrabitmaptypes.pas"/>
<EditorIndex Value="-1"/>
<UsageCount Value="86"/>
</Unit9>
<Unit10>
<Filename Value="..\bgrabitmap\bgrapolygonaliased.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="154"/>
<CursorPos X="40" Y="182"/>
<UsageCount Value="77"/>
</Unit10>
<Unit11>
<Filename Value="..\bgrabitmap\perspectivescan.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="103"/>
<UsageCount Value="72"/>
</Unit11>
<Unit12>
<Filename Value="..\bgrabitmap\bgradefaultbitmap.pas"/>
<EditorIndex Value="-1"/>
<CursorPos X="38" Y="146"/>
<UsageCount Value="50"/>
</Unit12>
<Unit13>
<Filename Value="D:\lazarus\fpc\2.4.2\source\rtl\inc\objpash.inc"/>
<TopLine Value="256"/>
<CursorPos X="8" Y="274"/>
<UsageCount Value="13"/>
</Unit13>
<Unit14>
<Filename Value="D:\lazarus\fpc\2.4.2\source\rtl\objpas\math.pp"/>
<EditorIndex Value="-1"/>
<TopLine Value="937"/>
<CursorPos X="6" Y="940"/>
<UsageCount Value="8"/>
</Unit14>
<Unit15>
<Filename Value="..\bgrabitmap\bgragradients.pas"/>
<EditorIndex Value="-1"/>
<CursorPos X="80" Y="12"/>
<UsageCount Value="26"/>
</Unit15>
<Unit16>
<Filename Value="..\bgrabitmap\bgrasse.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="54"/>
<CursorPos X="24" Y="76"/>
<UsageCount Value="102"/>
</Unit16>
<Unit17>
<Filename Value="..\bgrabitmap\bgraphongtypes.pas"/>
<CursorPos X="18" Y="8"/>
<UsageCount Value="6"/>
</Unit17>
<Unit18>
<Filename Value="D:\lazarus\fpc\2.4.2\source\rtl\i386\mmx.pp"/>
<TopLine Value="45"/>
<CursorPos X="52" Y="55"/>
<UsageCount Value="9"/>
</Unit18>
<Unit19>
<Filename Value="..\bgrabitmap\phongdraw.inc"/>
<TopLine Value="202"/>
<CursorPos X="49" Y="229"/>
<UsageCount Value="36"/>
</Unit19>
<Unit20>
<Filename Value="..\bgrabitmap\perspectivescan2.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="91"/>
<CursorPos X="45" Y="115"/>
<UsageCount Value="85"/>
</Unit20>
<Unit21>
<Filename Value="..\bgrabitmap\bgrafillinfo.pas"/>
<TopLine Value="1095"/>
<CursorPos X="58" Y="1097"/>
<UsageCount Value="9"/>
</Unit21>
<Unit22>
<Filename Value="..\bgrabitmap\shape3D.inc"/>
<CursorPos X="7" Y="7"/>
<UsageCount Value="37"/>
</Unit22>
<Unit23>
<Filename Value="..\bgrabitmap\bgrascene3dinterface.inc"/>
<EditorIndex Value="-1"/>
<UsageCount Value="88"/>
</Unit23>
<Unit24>
<Filename Value="..\bgrabitmap\bgramatrix3d.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="25"/>
<UsageCount Value="68"/>
</Unit24>
<Unit25>
<Filename Value="bgracolorint.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="107"/>
<CursorPos Y="143"/>
<UsageCount Value="4"/>
</Unit25>
<Unit26>
<Filename Value="..\bgrabitmap\bgracolorint.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="267"/>
<CursorPos X="3" Y="268"/>
<UsageCount Value="9"/>
</Unit26>
<Unit27>
<Filename Value="..\bgrabitmap\bgrapolygon.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="27"/>
<CursorPos X="58" Y="34"/>
<UsageCount Value="11"/>
</Unit27>
<Unit28>
<Filename Value="..\bgrabitmap\csscolorconst.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="110"/>
<CursorPos X="3" Y="128"/>
<UsageCount Value="11"/>
</Unit28>
<Unit29>
<Filename Value="..\bgrabitmap\bgratransform.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="73"/>
<UsageCount Value="8"/>
</Unit29>
<Unit30>
<Filename Value="..\bgrabitmap\bgracanvas.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="67"/>
<CursorPos X="22" Y="8"/>
<UsageCount Value="3"/>
</Unit30>
<Unit31>
<Filename Value="..\bgrabitmap\lightingclasses3d.inc"/>
<EditorIndex Value="-1"/>
<CursorPos X="15" Y="12"/>
<UsageCount Value="90"/>
</Unit31>
<Unit32>
<Filename Value="..\bgrabitmap\phonglight.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="26"/>
<CursorPos X="95" Y="67"/>
<UsageCount Value="67"/>
</Unit32>
<Unit33>
<Filename Value="..\bgrabitmap\polyaliaspersp.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="126"/>
<CursorPos X="29" Y="160"/>
<UsageCount Value="30"/>
</Unit33>
<Unit34>
<Filename Value="..\bgrabitmap\lineartexscan.inc"/>
<EditorIndex Value="-1"/>
<CursorPos X="40" Y="11"/>
<UsageCount Value="8"/>
</Unit34>
<Unit35>
<Filename Value="..\bgrabitmap\lineartexscan2.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="11"/>
<CursorPos X="36" Y="34"/>
<UsageCount Value="8"/>
</Unit35>
<Unit36>
<Filename Value="D:\lazarus\fpc\2.4.2\source\rtl\inc\varianth.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="485"/>
<CursorPos X="10" Y="503"/>
<UsageCount Value="10"/>
</Unit36>
<Unit37>
<Filename Value="..\bgrabitmap\perspectivecolorscan.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="14"/>
<CursorPos Y="21"/>
<UsageCount Value="8"/>
</Unit37>
<Unit38>
<Filename Value="..\bgrabitmap\phongdrawsse.inc"/>
<EditorIndex Value="-1"/>
<UsageCount Value="8"/>
</Unit38>
<Unit39>
<Filename Value="..\bgrabitmap\phonglightsse.inc"/>
<EditorIndex Value="-1"/>
<UsageCount Value="9"/>
</Unit39>
<Unit40>
<Filename Value="..\bgrabitmap\bgracoordpool3d.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="284"/>
<CursorPos X="36" Y="295"/>
<UsageCount Value="21"/>
</Unit40>
<Unit41>
<Filename Value="ex5.pas"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/>
<TopLine Value="87"/>
<CursorPos X="31" Y="110"/>
<UsageCount Value="160"/>
</Unit41>
<Unit42>
<Filename Value="..\bgrabitmap\bgraresample.pas"/>
<TopLine Value="14"/>
<CursorPos X="10" Y="32"/>
<UsageCount Value="25"/>
</Unit42>
<Unit43>
<Filename Value="C:\lazarussrc\components\lazutils\lazfreetype.pas"/>
<TopLine Value="1282"/>
<CursorPos X="76" Y="1290"/>
<UsageCount Value="11"/>
</Unit43>
<Unit44>
<Filename Value="C:\lazarussrc\components\lazutils\tterror.pas"/>
<CursorPos X="14" Y="22"/>
<UsageCount Value="11"/>
</Unit44>
<Unit45>
<Filename Value="C:\lazarussrc\components\lazutils\ttraster.pas"/>
<TopLine Value="42"/>
<CursorPos Y="50"/>
<UsageCount Value="11"/>
</Unit45>
<Unit46>
<Filename Value="C:\lazarussrc\components\lazutils\easylazfreetype.pas"/>
<TopLine Value="150"/>
<CursorPos X="35" Y="159"/>
<UsageCount Value="11"/>
</Unit46>
<Unit47>
<Filename Value="C:\lazarussrc\lcl\forms.pp"/>
<TopLine Value="770"/>
<CursorPos X="14" Y="788"/>
<UsageCount Value="3"/>
</Unit47>
<Unit48>
<Filename Value="C:\lazarussrc\lcl\controls.pp"/>
<TopLine Value="1383"/>
<CursorPos X="14" Y="1401"/>
<UsageCount Value="3"/>
</Unit48>
<Unit49>
<Filename Value="..\bgrabitmap\bgrapixel.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="199"/>
<CursorPos X="58" Y="228"/>
<UsageCount Value="31"/>
</Unit49>
<Unit50>
<Filename Value="..\bgrabitmap\geometrytypes.inc"/>
<EditorIndex Value="-1"/>
<CursorPos X="27" Y="17"/>
<UsageCount Value="33"/>
</Unit50>
<Unit51>
<Filename Value="..\bgrabitmap\bgracustombitmap.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="23"/>
<CursorPos X="5" Y="37"/>
<UsageCount Value="18"/>
</Unit51>
<Unit52>
<Filename Value="..\bgrabitmap\bgrasse.inc"/>
<EditorIndex Value="-1"/>
<UsageCount Value="14"/>
</Unit52>
<Unit53>
<Filename Value="..\bgrabitmap\shapes3d.inc"/>
<EditorIndex Value="-1"/>
<CursorPos X="117" Y="6"/>
<UsageCount Value="23"/>
</Unit53>
<Unit54>
<Filename Value="..\bgrabitmap\face3d.inc"/>
<EditorIndex Value="-1"/>
<CursorPos X="15" Y="75"/>
<UsageCount Value="29"/>
</Unit54>
<Unit55>
<Filename Value="..\bgrabitmap\object3d.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="80"/>
<CursorPos X="22" Y="83"/>
<UsageCount Value="24"/>
</Unit55>
<Unit56>
<Filename Value="..\bgrabitmap\vertex3d.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="182"/>
<CursorPos X="65" Y="193"/>
<UsageCount Value="30"/>
</Unit56>
<Unit57>
<Filename Value="C:\lazarus\fpc\2.6.4\source\rtl\inc\objpas.inc"/>
<EditorIndex Value="-1"/>
<UsageCount Value="17"/>
</Unit57>
<Unit58>
<Filename Value="C:\lazarus\fpc\2.6.4\source\rtl\objpas\sysutils\sysutilh.inc"/>
<EditorIndex Value="-1"/>
<UsageCount Value="17"/>
</Unit58>
<Unit59>
<Filename Value="C:\lazarus\fpc\2.6.4\source\rtl\inc\objpash.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="264"/>
<CursorPos X="8" Y="282"/>
<UsageCount Value="17"/>
</Unit59>
<Unit60>
<Filename Value="..\bgrabitmap\bgraopengltype.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="393"/>
<CursorPos X="60" Y="441"/>
<UsageCount Value="36"/>
</Unit60>
<Unit61>
<Filename Value="..\bgrabitmap\bgraopengl.pas"/>
<UnitName Value="BGRAOpenGL"/>
<EditorIndex Value="-1"/>
<TopLine Value="563"/>
<CursorPos X="57" Y="584"/>
<UsageCount Value="43"/>
</Unit61>
<Unit62>
<Filename Value="..\bgrabitmap\part3d.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="148"/>
<CursorPos X="3" Y="152"/>
<UsageCount Value="31"/>
</Unit62>
<Unit63>
<Filename Value="..\bgrabitmap\bgrarenderer3d.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="99"/>
<CursorPos X="31" Y="136"/>
<UsageCount Value="34"/>
</Unit63>
<Unit64>
<Filename Value="..\bgrabitmap\bgrascenetypes.pas"/>
<UnitName Value="BGRASceneTypes"/>
<EditorIndex Value="-1"/>
<TopLine Value="1033"/>
<CursorPos X="6" Y="1034"/>
<UsageCount Value="38"/>
</Unit64>
<Unit65>
<Filename Value="..\bgrabitmap\bgrareadbmp.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="678"/>
<CursorPos X="10" Y="696"/>
<UsageCount Value="8"/>
</Unit65>
<Unit66>
<Filename Value="..\bgrabitmap\bgraopengl3d.pas"/>
<UnitName Value="BGRAOpenGL3D"/>
<EditorIndex Value="-1"/>
<TopLine Value="727"/>
<CursorPos X="44" Y="801"/>
<UsageCount Value="39"/>
</Unit66>
<Unit67>
<Filename Value="..\bgrabitmap\bgracanvasgl.pas"/>
<UnitName Value="BGRACanvasGL"/>
<EditorIndex Value="-1"/>
<TopLine Value="56"/>
<CursorPos X="14" Y="78"/>
<UsageCount Value="37"/>
</Unit67>
<Unit68>
<Filename Value="C:\lazarus\fpc\2.6.4\source\packages\opengl\src\gl.pp"/>
<UnitName Value="GL"/>
<EditorIndex Value="-1"/>
<TopLine Value="426"/>
<CursorPos X="3" Y="448"/>
<UsageCount Value="22"/>
</Unit68>
<Unit69>
<Filename Value="..\..\bgracontrols_svn\bcrtti.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="239"/>
<CursorPos X="36" Y="264"/>
<UsageCount Value="17"/>
</Unit69>
<Unit70>
<Filename Value="C:\lazarus\fpc\2.6.4\source\packages\opengl\src\glext.pp"/>
<UnitName Value="GLext"/>
<EditorIndex Value="-1"/>
<TopLine Value="377"/>
<CursorPos X="10" Y="399"/>
<UsageCount Value="16"/>
</Unit70>
<Unit71>
<Filename Value="..\bgrabitmap\bgraspritegl.pas"/>
<EditorIndex Value="-1"/>
<UsageCount Value="8"/>
</Unit71>
<Unit72>
<Filename Value="..\..\epiktimer\epiktimer.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="449"/>
<CursorPos Y="461"/>
<UsageCount Value="9"/>
</Unit72>
<Unit73>
<Filename Value="..\bgrabitmap\bgrawinbitmap.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="217"/>
<CursorPos X="42" Y="229"/>
<UsageCount Value="14"/>
</Unit73>
<Unit74>
<Filename Value="C:\lazarus\fpc\2.6.4\source\rtl\win\wininc\func.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="818"/>
<CursorPos X="10" Y="832"/>
<UsageCount Value="14"/>
</Unit74>
<Unit75>
<Filename Value="..\bgrabitmap\bgraanimatedgif.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="175"/>
<CursorPos X="3" Y="181"/>
<UsageCount Value="14"/>
</Unit75>
<Unit76>
<Filename Value="..\bgrabitmap\bgragifformat.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="67"/>
<CursorPos X="45" Y="69"/>
<UsageCount Value="14"/>
</Unit76>
<Unit77>
<Filename Value="..\..\bgracontrols_svn\bcbasectrls.pas"/>
<UnitName Value="BCBaseCtrls"/>
<EditorIndex Value="-1"/>
<TopLine Value="22"/>
<CursorPos X="32" Y="38"/>
<UsageCount Value="16"/>
</Unit77>
<Unit78>
<Filename Value="..\bgrabitmap\bglvirtualscreen.pas"/>
<UnitName Value="BGLVirtualScreen"/>
<EditorIndex Value="-1"/>
<CursorPos X="58" Y="344"/>
<UsageCount Value="15"/>
</Unit78>
<Unit79>
<Filename Value="C:\lazarus\components\opengl\openglcontext.pas"/>
<UnitName Value="OpenGLContext"/>
<EditorIndex Value="4"/>
<TopLine Value="132"/>
<CursorPos X="14" Y="153"/>
<UsageCount Value="15"/>
<Loaded Value="True"/>
</Unit79>
<Unit80>
<Filename Value="C:\lazarus\components\opengl\glwin32wglcontext.pas"/>
<UnitName Value="GLWin32WGLContext"/>
<EditorIndex Value="5"/>
<TopLine Value="221"/>
<CursorPos X="23" Y="250"/>
<UsageCount Value="15"/>
<Loaded Value="True"/>
</Unit80>
<Unit81>
<Filename Value="C:\lazarus\fpc\2.6.4\source\rtl\win\wininc\base.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="100"/>
<CursorPos X="6" Y="122"/>
<UsageCount Value="15"/>
</Unit81>
<Unit82>
<Filename Value="C:\lazarus\fpc\2.6.4\source\rtl\win\sysosh.inc"/>
<EditorIndex Value="-1"/>
<CursorPos X="3" Y="22"/>
<UsageCount Value="15"/>
</Unit82>
<Unit83>
<Filename Value="C:\lazarus\fpc\2.6.4\source\rtl\objpas\classes\classesh.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="723"/>
<CursorPos X="20" Y="755"/>
<UsageCount Value="15"/>
</Unit83>
<Unit84>
<Filename Value="C:\lazarus\fpc\2.6.4\source\rtl\objpas\classes\stringl.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="616"/>
<CursorPos X="3" Y="619"/>
<UsageCount Value="15"/>
</Unit84>
<Unit85>
<Filename Value="C:\lazarus\lcl\include\control.inc"/>
<EditorIndex Value="3"/>
<TopLine Value="4833"/>
<CursorPos Y="4848"/>
<UsageCount Value="14"/>
<Loaded Value="True"/>
</Unit85>
<Unit86>
<Filename Value="..\..\..\bgracontrols\colorspeedbutton.pas"/>
<UnitName Value="ColorSpeedButton"/>
<EditorIndex Value="2"/>
<TopLine Value="28"/>
<CursorPos Y="28"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
<DefaultSyntaxHighlighter Value="Delphi"/>
</Unit86>
<Unit87>
<Filename Value="..\..\bgrabitmap\bgraopengl3d.pas"/>
<UnitName Value="BGRAOpenGL3D"/>
<EditorIndex Value="10"/>
<TopLine Value="8"/>
<CursorPos X="19" Y="84"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit87>
<Unit88>
<Filename Value="..\..\..\epiktimer\epiktimer.pas"/>
<UnitName Value="EpikTimer"/>
<EditorIndex Value="1"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit88>
<Unit89>
<Filename Value="..\..\bgrabitmap\bgracanvasgl.pas"/>
<UnitName Value="BGRACanvasGL"/>
<EditorIndex Value="12"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit89>
<Unit90>
<Filename Value="..\..\bgrabitmap\bgraopengltype.pas"/>
<UnitName Value="BGRAOpenGLType"/>
<EditorIndex Value="13"/>
<TopLine Value="46"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit90>
<Unit91>
<Filename Value="..\..\bgrabitmap\bgrascene3d.pas"/>
<UnitName Value="BGRAScene3D"/>
<EditorIndex Value="8"/>
<TopLine Value="166"/>
<CursorPos X="22" Y="169"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit91>
<Unit92>
<Filename Value="..\..\bgrabitmap\bgrascenetypes.pas"/>
<UnitName Value="BGRASceneTypes"/>
<EditorIndex Value="9"/>
<TopLine Value="416"/>
<CursorPos X="14" Y="429"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit92>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="umain.pas"/>
<Caret Line="197" Column="13" TopLine="177"/>
</Position1>
<Position2>
<Filename Value="umain.pas"/>
<Caret Line="199" Column="26" TopLine="190"/>
</Position2>
<Position3>
<Filename Value="umain.pas"/>
<Caret Line="207" Column="14" TopLine="204"/>
</Position3>
<Position4>
<Filename Value="umain.pas"/>
<Caret Line="212" Column="14" TopLine="204"/>
</Position4>
<Position5>
<Filename Value="umain.pas"/>
<Caret Line="223" Column="32" TopLine="204"/>
</Position5>
<Position6>
<Filename Value="umain.pas"/>
<Caret Line="224" Column="20" TopLine="204"/>
</Position6>
<Position7>
<Filename Value="umain.pas"/>
<Caret Line="225" Column="32" TopLine="204"/>
</Position7>
<Position8>
<Filename Value="umain.pas"/>
<Caret Line="226" Column="20"/>
</Position8>
<Position9>
<Filename Value="..\..\bgrabitmap\bgraopengl3d.pas"/>
<Caret Line="16" Column="32"/>
</Position9>
<Position10>
<Filename Value="..\..\bgrabitmap\bgracanvasgl.pas"/>
</Position10>
<Position11>
<Filename Value="umain.pas"/>
<Caret Line="226" Column="20"/>
</Position11>
<Position12>
<Filename Value="umain.pas"/>
<Caret Line="81" Column="19" TopLine="65"/>
</Position12>
<Position13>
<Filename Value="umain.pas"/>
<Caret Line="111" Column="21" TopLine="132"/>
</Position13>
<Position14>
<Filename Value="umain.pas"/>
<Caret Line="153" Column="21" TopLine="132"/>
</Position14>
<Position15>
<Filename Value="umain.pas"/>
<Caret Line="164" Column="21" TopLine="152"/>
</Position15>
<Position16>
<Filename Value="umain.pas"/>
<Caret Line="287" Column="21" TopLine="272"/>
</Position16>
<Position17>
<Filename Value="umain.pas"/>
<Caret Line="7" Column="11"/>
</Position17>
<Position18>
<Filename Value="umain.pas"/>
<Caret Line="81" Column="26" TopLine="74"/>
</Position18>
<Position19>
<Filename Value="..\..\bgrabitmap\bgraopengl3d.pas"/>
<Caret Line="84" Column="19" TopLine="8"/>
</Position19>
<Position20>
<Filename Value="utexture.pas"/>
<Caret Line="107" Column="35" TopLine="88"/>
</Position20>
<Position21>
<Filename Value="ex2.pas"/>
<Caret Line="64" Column="6" TopLine="50"/>
</Position21>
<Position22>
<Filename Value="ex2.pas"/>
<Caret Line="147" Column="30" TopLine="137"/>
</Position22>
<Position23>
<Filename Value="..\..\bgrabitmap\bgrascene3d.pas"/>
<Caret Line="174" Column="14" TopLine="164"/>
</Position23>
<Position24>
<Filename Value="umain.pas"/>
<Caret Line="66" Column="23" TopLine="56"/>
</Position24>
<Position25>
<Filename Value="umain.pas"/>
<Caret Line="176" Column="18" TopLine="156"/>
</Position25>
<Position26>
<Filename Value="umain.pas"/>
<Caret Line="165" Column="10" TopLine="159"/>
</Position26>
<Position27>
<Filename Value="umain.pas"/>
<Caret Line="174" Column="3" TopLine="161"/>
</Position27>
<Position28>
<Filename Value="umain.pas"/>
<Caret Line="176" Column="18" TopLine="162"/>
</Position28>
<Position29>
<Filename Value="utexture.pas"/>
<Caret Line="14" Column="11" TopLine="7"/>
</Position29>
<Position30>
<Filename Value="utexture.pas"/>
<Caret Line="53" Column="23" TopLine="40"/>
</Position30>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<Optimizations>
<VariablesInRegisters Value="True"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<DebugInfoType Value="dsStabs"/>
<UseHeaptrc 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,20 @@
program bgratutorial3d;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, umain, bgracontrols, ubgrasamples, ex1, utexture, ex2,
ex3, ex4, etpackage, ex5;
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -0,0 +1,818 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<PathDelim Value="\"/>
<General>
<MainUnit Value="0"/>
<Title Value="bgratutorial3dsoftware"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<BuildModes Count="1" Active="Default">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<RequiredPackages Count="4">
<Item1>
<PackageName Value="BGRABitmapPack"/>
</Item1>
<Item2>
<PackageName Value="etpackage"/>
</Item2>
<Item3>
<PackageName Value="bgracontrols"/>
<MinVersion Major="1" Release="9" Build="7" Valid="True"/>
</Item3>
<Item4>
<PackageName Value="LCL"/>
</Item4>
</RequiredPackages>
<Units Count="92">
<Unit0>
<Filename Value="bgratutorial3dsoftware.lpr"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/>
<CursorPos X="21" Y="9"/>
<UsageCount Value="207"/>
</Unit0>
<Unit1>
<Filename Value="umain.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<TopLine Value="181"/>
<CursorPos Y="194"/>
<UsageCount Value="207"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
<Unit2>
<Filename Value="ubgrasamples.pas"/>
<IsPartOfProject Value="True"/>
<CursorPos X="20" Y="9"/>
<UsageCount Value="207"/>
</Unit2>
<Unit3>
<Filename Value="ex1.pas"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="8"/>
<TopLine Value="81"/>
<CursorPos X="47" Y="81"/>
<UsageCount Value="207"/>
<Loaded Value="True"/>
</Unit3>
<Unit4>
<Filename Value="utexture.pas"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/>
<TopLine Value="79"/>
<CursorPos X="37" Y="99"/>
<UsageCount Value="207"/>
</Unit4>
<Unit5>
<Filename Value="ex2.pas"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="7"/>
<TopLine Value="19"/>
<CursorPos X="86" Y="34"/>
<UsageCount Value="207"/>
<Loaded Value="True"/>
</Unit5>
<Unit6>
<Filename Value="ex3.pas"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="6"/>
<TopLine Value="22"/>
<CursorPos X="36" Y="38"/>
<UsageCount Value="207"/>
<Loaded Value="True"/>
</Unit6>
<Unit7>
<Filename Value="..\bgrabitmap\bgrascene3d.pas"/>
<UnitName Value="BGRAScene3D"/>
<EditorIndex Value="-1"/>
<TopLine Value="1149"/>
<CursorPos X="53" Y="1175"/>
<UsageCount Value="101"/>
</Unit7>
<Unit8>
<Filename Value="ex4.pas"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/>
<TopLine Value="26"/>
<CursorPos X="12" Y="239"/>
<UsageCount Value="207"/>
</Unit8>
<Unit9>
<Filename Value="..\bgrabitmap\bgrabitmaptypes.pas"/>
<EditorIndex Value="-1"/>
<UsageCount Value="86"/>
</Unit9>
<Unit10>
<Filename Value="..\bgrabitmap\bgrapolygonaliased.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="154"/>
<CursorPos X="40" Y="182"/>
<UsageCount Value="77"/>
</Unit10>
<Unit11>
<Filename Value="..\bgrabitmap\perspectivescan.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="103"/>
<UsageCount Value="72"/>
</Unit11>
<Unit12>
<Filename Value="..\bgrabitmap\bgradefaultbitmap.pas"/>
<EditorIndex Value="-1"/>
<CursorPos X="38" Y="146"/>
<UsageCount Value="50"/>
</Unit12>
<Unit13>
<Filename Value="D:\lazarus\fpc\2.4.2\source\rtl\inc\objpash.inc"/>
<TopLine Value="256"/>
<CursorPos X="8" Y="274"/>
<UsageCount Value="13"/>
</Unit13>
<Unit14>
<Filename Value="D:\lazarus\fpc\2.4.2\source\rtl\objpas\math.pp"/>
<EditorIndex Value="-1"/>
<TopLine Value="937"/>
<CursorPos X="6" Y="940"/>
<UsageCount Value="8"/>
</Unit14>
<Unit15>
<Filename Value="..\bgrabitmap\bgragradients.pas"/>
<EditorIndex Value="-1"/>
<CursorPos X="80" Y="12"/>
<UsageCount Value="26"/>
</Unit15>
<Unit16>
<Filename Value="..\bgrabitmap\bgrasse.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="54"/>
<CursorPos X="24" Y="76"/>
<UsageCount Value="102"/>
</Unit16>
<Unit17>
<Filename Value="..\bgrabitmap\bgraphongtypes.pas"/>
<CursorPos X="18" Y="8"/>
<UsageCount Value="6"/>
</Unit17>
<Unit18>
<Filename Value="D:\lazarus\fpc\2.4.2\source\rtl\i386\mmx.pp"/>
<TopLine Value="45"/>
<CursorPos X="52" Y="55"/>
<UsageCount Value="9"/>
</Unit18>
<Unit19>
<Filename Value="..\bgrabitmap\phongdraw.inc"/>
<TopLine Value="202"/>
<CursorPos X="49" Y="229"/>
<UsageCount Value="36"/>
</Unit19>
<Unit20>
<Filename Value="..\bgrabitmap\perspectivescan2.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="91"/>
<CursorPos X="45" Y="115"/>
<UsageCount Value="85"/>
</Unit20>
<Unit21>
<Filename Value="..\bgrabitmap\bgrafillinfo.pas"/>
<TopLine Value="1095"/>
<CursorPos X="58" Y="1097"/>
<UsageCount Value="9"/>
</Unit21>
<Unit22>
<Filename Value="..\bgrabitmap\shape3D.inc"/>
<CursorPos X="7" Y="7"/>
<UsageCount Value="37"/>
</Unit22>
<Unit23>
<Filename Value="..\bgrabitmap\bgrascene3dinterface.inc"/>
<EditorIndex Value="-1"/>
<UsageCount Value="88"/>
</Unit23>
<Unit24>
<Filename Value="..\bgrabitmap\bgramatrix3d.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="25"/>
<UsageCount Value="68"/>
</Unit24>
<Unit25>
<Filename Value="bgracolorint.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="107"/>
<CursorPos Y="143"/>
<UsageCount Value="4"/>
</Unit25>
<Unit26>
<Filename Value="..\bgrabitmap\bgracolorint.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="267"/>
<CursorPos X="3" Y="268"/>
<UsageCount Value="9"/>
</Unit26>
<Unit27>
<Filename Value="..\bgrabitmap\bgrapolygon.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="27"/>
<CursorPos X="58" Y="34"/>
<UsageCount Value="11"/>
</Unit27>
<Unit28>
<Filename Value="..\bgrabitmap\csscolorconst.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="110"/>
<CursorPos X="3" Y="128"/>
<UsageCount Value="11"/>
</Unit28>
<Unit29>
<Filename Value="..\bgrabitmap\bgratransform.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="73"/>
<UsageCount Value="8"/>
</Unit29>
<Unit30>
<Filename Value="..\bgrabitmap\bgracanvas.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="67"/>
<CursorPos X="22" Y="8"/>
<UsageCount Value="3"/>
</Unit30>
<Unit31>
<Filename Value="..\bgrabitmap\lightingclasses3d.inc"/>
<EditorIndex Value="-1"/>
<CursorPos X="15" Y="12"/>
<UsageCount Value="90"/>
</Unit31>
<Unit32>
<Filename Value="..\bgrabitmap\phonglight.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="26"/>
<CursorPos X="95" Y="67"/>
<UsageCount Value="67"/>
</Unit32>
<Unit33>
<Filename Value="..\bgrabitmap\polyaliaspersp.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="126"/>
<CursorPos X="29" Y="160"/>
<UsageCount Value="30"/>
</Unit33>
<Unit34>
<Filename Value="..\bgrabitmap\lineartexscan.inc"/>
<EditorIndex Value="-1"/>
<CursorPos X="40" Y="11"/>
<UsageCount Value="8"/>
</Unit34>
<Unit35>
<Filename Value="..\bgrabitmap\lineartexscan2.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="11"/>
<CursorPos X="36" Y="34"/>
<UsageCount Value="8"/>
</Unit35>
<Unit36>
<Filename Value="D:\lazarus\fpc\2.4.2\source\rtl\inc\varianth.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="485"/>
<CursorPos X="10" Y="503"/>
<UsageCount Value="10"/>
</Unit36>
<Unit37>
<Filename Value="..\bgrabitmap\perspectivecolorscan.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="14"/>
<CursorPos Y="21"/>
<UsageCount Value="8"/>
</Unit37>
<Unit38>
<Filename Value="..\bgrabitmap\phongdrawsse.inc"/>
<EditorIndex Value="-1"/>
<UsageCount Value="8"/>
</Unit38>
<Unit39>
<Filename Value="..\bgrabitmap\phonglightsse.inc"/>
<EditorIndex Value="-1"/>
<UsageCount Value="9"/>
</Unit39>
<Unit40>
<Filename Value="..\bgrabitmap\bgracoordpool3d.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="284"/>
<CursorPos X="36" Y="295"/>
<UsageCount Value="21"/>
</Unit40>
<Unit41>
<Filename Value="ex5.pas"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/>
<TopLine Value="87"/>
<CursorPos X="31" Y="110"/>
<UsageCount Value="159"/>
</Unit41>
<Unit42>
<Filename Value="..\bgrabitmap\bgraresample.pas"/>
<TopLine Value="14"/>
<CursorPos X="10" Y="32"/>
<UsageCount Value="25"/>
</Unit42>
<Unit43>
<Filename Value="C:\lazarussrc\components\lazutils\lazfreetype.pas"/>
<TopLine Value="1282"/>
<CursorPos X="76" Y="1290"/>
<UsageCount Value="11"/>
</Unit43>
<Unit44>
<Filename Value="C:\lazarussrc\components\lazutils\tterror.pas"/>
<CursorPos X="14" Y="22"/>
<UsageCount Value="11"/>
</Unit44>
<Unit45>
<Filename Value="C:\lazarussrc\components\lazutils\ttraster.pas"/>
<TopLine Value="42"/>
<CursorPos Y="50"/>
<UsageCount Value="11"/>
</Unit45>
<Unit46>
<Filename Value="C:\lazarussrc\components\lazutils\easylazfreetype.pas"/>
<TopLine Value="150"/>
<CursorPos X="35" Y="159"/>
<UsageCount Value="11"/>
</Unit46>
<Unit47>
<Filename Value="C:\lazarussrc\lcl\forms.pp"/>
<TopLine Value="770"/>
<CursorPos X="14" Y="788"/>
<UsageCount Value="3"/>
</Unit47>
<Unit48>
<Filename Value="C:\lazarussrc\lcl\controls.pp"/>
<TopLine Value="1383"/>
<CursorPos X="14" Y="1401"/>
<UsageCount Value="3"/>
</Unit48>
<Unit49>
<Filename Value="..\bgrabitmap\bgrapixel.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="199"/>
<CursorPos X="58" Y="228"/>
<UsageCount Value="31"/>
</Unit49>
<Unit50>
<Filename Value="..\bgrabitmap\geometrytypes.inc"/>
<EditorIndex Value="-1"/>
<CursorPos X="27" Y="17"/>
<UsageCount Value="33"/>
</Unit50>
<Unit51>
<Filename Value="..\bgrabitmap\bgracustombitmap.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="23"/>
<CursorPos X="5" Y="37"/>
<UsageCount Value="18"/>
</Unit51>
<Unit52>
<Filename Value="..\bgrabitmap\bgrasse.inc"/>
<EditorIndex Value="-1"/>
<UsageCount Value="14"/>
</Unit52>
<Unit53>
<Filename Value="..\bgrabitmap\shapes3d.inc"/>
<EditorIndex Value="-1"/>
<CursorPos X="117" Y="6"/>
<UsageCount Value="23"/>
</Unit53>
<Unit54>
<Filename Value="..\bgrabitmap\face3d.inc"/>
<EditorIndex Value="-1"/>
<CursorPos X="15" Y="75"/>
<UsageCount Value="29"/>
</Unit54>
<Unit55>
<Filename Value="..\bgrabitmap\object3d.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="80"/>
<CursorPos X="22" Y="83"/>
<UsageCount Value="24"/>
</Unit55>
<Unit56>
<Filename Value="..\bgrabitmap\vertex3d.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="182"/>
<CursorPos X="65" Y="193"/>
<UsageCount Value="30"/>
</Unit56>
<Unit57>
<Filename Value="C:\lazarus\fpc\2.6.4\source\rtl\inc\objpas.inc"/>
<EditorIndex Value="-1"/>
<UsageCount Value="17"/>
</Unit57>
<Unit58>
<Filename Value="C:\lazarus\fpc\2.6.4\source\rtl\objpas\sysutils\sysutilh.inc"/>
<EditorIndex Value="-1"/>
<UsageCount Value="17"/>
</Unit58>
<Unit59>
<Filename Value="C:\lazarus\fpc\2.6.4\source\rtl\inc\objpash.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="264"/>
<CursorPos X="8" Y="282"/>
<UsageCount Value="17"/>
</Unit59>
<Unit60>
<Filename Value="..\bgrabitmap\bgraopengltype.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="393"/>
<CursorPos X="60" Y="441"/>
<UsageCount Value="36"/>
</Unit60>
<Unit61>
<Filename Value="..\bgrabitmap\bgraopengl.pas"/>
<UnitName Value="BGRAOpenGL"/>
<EditorIndex Value="-1"/>
<TopLine Value="563"/>
<CursorPos X="57" Y="584"/>
<UsageCount Value="43"/>
</Unit61>
<Unit62>
<Filename Value="..\bgrabitmap\part3d.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="148"/>
<CursorPos X="3" Y="152"/>
<UsageCount Value="31"/>
</Unit62>
<Unit63>
<Filename Value="..\bgrabitmap\bgrarenderer3d.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="99"/>
<CursorPos X="31" Y="136"/>
<UsageCount Value="34"/>
</Unit63>
<Unit64>
<Filename Value="..\bgrabitmap\bgrascenetypes.pas"/>
<UnitName Value="BGRASceneTypes"/>
<EditorIndex Value="-1"/>
<TopLine Value="1033"/>
<CursorPos X="6" Y="1034"/>
<UsageCount Value="38"/>
</Unit64>
<Unit65>
<Filename Value="..\bgrabitmap\bgrareadbmp.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="678"/>
<CursorPos X="10" Y="696"/>
<UsageCount Value="8"/>
</Unit65>
<Unit66>
<Filename Value="..\bgrabitmap\bgraopengl3d.pas"/>
<UnitName Value="BGRAOpenGL3D"/>
<EditorIndex Value="-1"/>
<TopLine Value="727"/>
<CursorPos X="44" Y="801"/>
<UsageCount Value="39"/>
</Unit66>
<Unit67>
<Filename Value="..\bgrabitmap\bgracanvasgl.pas"/>
<UnitName Value="BGRACanvasGL"/>
<EditorIndex Value="-1"/>
<TopLine Value="56"/>
<CursorPos X="14" Y="78"/>
<UsageCount Value="37"/>
</Unit67>
<Unit68>
<Filename Value="C:\lazarus\fpc\2.6.4\source\packages\opengl\src\gl.pp"/>
<UnitName Value="GL"/>
<EditorIndex Value="-1"/>
<TopLine Value="426"/>
<CursorPos X="3" Y="448"/>
<UsageCount Value="22"/>
</Unit68>
<Unit69>
<Filename Value="..\..\bgracontrols_svn\bcrtti.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="239"/>
<CursorPos X="36" Y="264"/>
<UsageCount Value="17"/>
</Unit69>
<Unit70>
<Filename Value="C:\lazarus\fpc\2.6.4\source\packages\opengl\src\glext.pp"/>
<UnitName Value="GLext"/>
<EditorIndex Value="-1"/>
<TopLine Value="377"/>
<CursorPos X="10" Y="399"/>
<UsageCount Value="16"/>
</Unit70>
<Unit71>
<Filename Value="..\bgrabitmap\bgraspritegl.pas"/>
<EditorIndex Value="-1"/>
<UsageCount Value="8"/>
</Unit71>
<Unit72>
<Filename Value="..\..\epiktimer\epiktimer.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="449"/>
<CursorPos Y="461"/>
<UsageCount Value="9"/>
</Unit72>
<Unit73>
<Filename Value="..\bgrabitmap\bgrawinbitmap.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="217"/>
<CursorPos X="42" Y="229"/>
<UsageCount Value="14"/>
</Unit73>
<Unit74>
<Filename Value="C:\lazarus\fpc\2.6.4\source\rtl\win\wininc\func.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="818"/>
<CursorPos X="10" Y="832"/>
<UsageCount Value="14"/>
</Unit74>
<Unit75>
<Filename Value="..\bgrabitmap\bgraanimatedgif.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="175"/>
<CursorPos X="3" Y="181"/>
<UsageCount Value="14"/>
</Unit75>
<Unit76>
<Filename Value="..\bgrabitmap\bgragifformat.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="67"/>
<CursorPos X="45" Y="69"/>
<UsageCount Value="14"/>
</Unit76>
<Unit77>
<Filename Value="..\..\bgracontrols_svn\bcbasectrls.pas"/>
<UnitName Value="BCBaseCtrls"/>
<EditorIndex Value="-1"/>
<TopLine Value="22"/>
<CursorPos X="32" Y="38"/>
<UsageCount Value="16"/>
</Unit77>
<Unit78>
<Filename Value="..\bgrabitmap\bglvirtualscreen.pas"/>
<UnitName Value="BGLVirtualScreen"/>
<EditorIndex Value="-1"/>
<CursorPos X="58" Y="344"/>
<UsageCount Value="15"/>
</Unit78>
<Unit79>
<Filename Value="C:\lazarus\components\opengl\openglcontext.pas"/>
<UnitName Value="OpenGLContext"/>
<EditorIndex Value="-1"/>
<TopLine Value="132"/>
<CursorPos X="14" Y="153"/>
<UsageCount Value="15"/>
</Unit79>
<Unit80>
<Filename Value="C:\lazarus\components\opengl\glwin32wglcontext.pas"/>
<UnitName Value="GLWin32WGLContext"/>
<EditorIndex Value="-1"/>
<TopLine Value="221"/>
<CursorPos X="23" Y="250"/>
<UsageCount Value="15"/>
</Unit80>
<Unit81>
<Filename Value="C:\lazarus\fpc\2.6.4\source\rtl\win\wininc\base.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="100"/>
<CursorPos X="6" Y="122"/>
<UsageCount Value="15"/>
</Unit81>
<Unit82>
<Filename Value="C:\lazarus\fpc\2.6.4\source\rtl\win\sysosh.inc"/>
<EditorIndex Value="-1"/>
<CursorPos X="3" Y="22"/>
<UsageCount Value="15"/>
</Unit82>
<Unit83>
<Filename Value="C:\lazarus\fpc\2.6.4\source\rtl\objpas\classes\classesh.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="723"/>
<CursorPos X="20" Y="755"/>
<UsageCount Value="15"/>
</Unit83>
<Unit84>
<Filename Value="C:\lazarus\fpc\2.6.4\source\rtl\objpas\classes\stringl.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="616"/>
<CursorPos X="3" Y="619"/>
<UsageCount Value="15"/>
</Unit84>
<Unit85>
<Filename Value="C:\lazarus\lcl\include\control.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="4833"/>
<CursorPos Y="4848"/>
<UsageCount Value="14"/>
</Unit85>
<Unit86>
<Filename Value="..\..\bgrabitmap\bgraopengl.pas"/>
<UnitName Value="BGRAOpenGL"/>
<EditorIndex Value="5"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit86>
<Unit87>
<Filename Value="..\..\bgrabitmap\bgrascene3d.pas"/>
<UnitName Value="BGRAScene3D"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="3"/>
<TopLine Value="691"/>
<CursorPos Y="693"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit87>
<Unit88>
<Filename Value="C:\lazarus\lcl\include\wincontrol.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="5669"/>
<CursorPos Y="5683"/>
<UsageCount Value="10"/>
</Unit88>
<Unit89>
<Filename Value="..\..\bgrabitmap\bgracoordpool3d.pas"/>
<UnitName Value="BGRACoordPool3D"/>
<EditorIndex Value="1"/>
<TopLine Value="361"/>
<CursorPos X="38" Y="368"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit89>
<Unit90>
<Filename Value="..\..\bgrabitmap\bgramatrix3d.pas"/>
<UnitName Value="BGRAMatrix3D"/>
<EditorIndex Value="2"/>
<TopLine Value="606"/>
<CursorPos X="55" Y="622"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit90>
<Unit91>
<Filename Value="..\..\bgrabitmap\bgrascenetypes.pas"/>
<UnitName Value="BGRASceneTypes"/>
<EditorIndex Value="4"/>
<TopLine Value="556"/>
<CursorPos X="14" Y="569"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit91>
</Units>
<JumpHistory Count="20" HistoryIndex="19">
<Position1>
<Filename Value="umain.pas"/>
<Caret Line="19" Column="11"/>
</Position1>
<Position2>
<Filename Value="ex1.pas"/>
<Caret Line="22" Column="40"/>
</Position2>
<Position3>
<Filename Value="ex3.pas"/>
<Caret Line="29" Column="52" TopLine="13"/>
</Position3>
<Position4>
<Filename Value="umain.pas"/>
<Caret Line="84" Column="24" TopLine="68"/>
</Position4>
<Position5>
<Filename Value="ex3.pas"/>
<Caret Line="38" Column="36" TopLine="22"/>
</Position5>
<Position6>
<Filename Value="umain.pas"/>
<Caret Line="68" Column="42" TopLine="50"/>
</Position6>
<Position7>
<Filename Value="umain.pas"/>
<Caret Line="190" Column="3" TopLine="188"/>
</Position7>
<Position8>
<Filename Value="umain.pas"/>
<Caret Line="194" TopLine="188"/>
</Position8>
<Position9>
<Filename Value="..\..\bgrabitmap\bgrascene3d.pas"/>
<Caret Line="347" Column="45" TopLine="328"/>
</Position9>
<Position10>
<Filename Value="..\..\bgrabitmap\bgrascene3d.pas"/>
<Caret Line="691" TopLine="677"/>
</Position10>
<Position11>
<Filename Value="umain.pas"/>
<Caret Line="186" Column="45" TopLine="180"/>
</Position11>
<Position12>
<Filename Value="..\..\bgrabitmap\bgracoordpool3d.pas"/>
<Caret Line="381" TopLine="409"/>
</Position12>
<Position13>
<Filename Value="umain.pas"/>
<Caret Line="157" Column="49" TopLine="144"/>
</Position13>
<Position14>
<Filename Value="umain.pas"/>
<Caret Line="229" Column="47" TopLine="223"/>
</Position14>
<Position15>
<Filename Value="umain.pas"/>
<Caret Line="194" TopLine="181"/>
</Position15>
<Position16>
<Filename Value="..\..\bgrabitmap\bgrascene3d.pas"/>
<Caret Line="342" TopLine="329"/>
</Position16>
<Position17>
<Filename Value="..\..\bgrabitmap\bgrascene3d.pas"/>
<Caret Line="691" TopLine="684"/>
</Position17>
<Position18>
<Filename Value="..\..\bgrabitmap\bgrascene3d.pas"/>
<Caret Line="342" TopLine="341"/>
</Position18>
<Position19>
<Filename Value="..\..\bgrabitmap\bgrascene3d.pas"/>
<Caret Line="698" Column="98" TopLine="691"/>
</Position19>
<Position20>
<Filename Value="..\..\bgrabitmap\bgrascenetypes.pas"/>
<Caret Line="577" Column="14" TopLine="565"/>
</Position20>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<Optimizations>
<VariablesInRegisters Value="True"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<DebugInfoType Value="dsStabs"/>
<UseHeaptrc Value="True"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CustomOptions Value="-dNO_OPENGL_SURFACE"/>
</Other>
</CompilerOptions>
<Debugging>
<BreakPoints Count="2">
<Item1>
<Kind Value="bpkSource"/>
<WatchScope Value="wpsLocal"/>
<WatchKind Value="wpkWrite"/>
<Source Value="..\..\bgrabitmap\bgrascene3d.pas"/>
<Line Value="704"/>
</Item1>
<Item2>
<Kind Value="bpkSource"/>
<WatchScope Value="wpsLocal"/>
<WatchKind Value="wpkWrite"/>
<Source Value="..\..\bgrabitmap\bgrascene3d.pas"/>
<Line Value="693"/>
</Item2>
</BreakPoints>
<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,20 @@
program bgratutorial3dsoftware;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, umain, bgracontrols, ubgrasamples, ex1, utexture, ex2,
ex3, ex4, etpackage, ex5;
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@@ -0,0 +1,109 @@
unit ex1;
{$mode objfpc}{$H+}
interface
{ This is a simple 3D objet, a pyramid with a hexagonal base. The object is designed in the constructor.
The CreateObject method returns an interface to an empty object. An interface is similar to a class
except you don't have to call Free.
A 3D object has a MainPart property, which contains the vertices describing the objet. It can contains subparts,
but here it is not the case. Parts can be rotated and scaled relative to their container. The MainPart is rotated
and scaled relative to the whole scene.
Faces are created using vertices, so that they will follow the movements of these vertices. Here the default color
SandColor is defined for the whole object.
In order to make it attractive, a lighting is defined. The simplest way is to use a directional light, so that
you don't have to bother with the coordinates of the light source.
The background is filled with a gradient. Note that it is a vertical gradient which is very fast to draw, because
each scanline is filled with one color. }
uses
Classes, SysUtils, BGRAScene3D, BGRABitmapTypes
{$IFNDEF NO_OPENGL_SURFACE}, BGRAOpenGL, BGRAOpenGL3D{$ENDIF};
type
{ TExample1 }
TExample1 = class({$IFNDEF NO_OPENGL_SURFACE}TBGLScene3D{$ELSE}TBGRAScene3D{$ENDIF})
SandColor: TBGRAPixel;
constructor Create;
procedure Render; override;
{$IFNDEF NO_OPENGL_SURFACE}
procedure RenderGL(ACanvas: TBGLCustomCanvas; AMaxZ: single=1000); override;
{$ENDIF}
end;
implementation
{ TExample1 }
constructor TExample1.Create;
var
base: array of IBGRAVertex3D;
top: IBGRAVertex3D;
begin
inherited Create;
SandColor := BGRA(255,240,128);
//create a pyramid
with CreateObject(SandColor) do
begin
top := MainPart.Add(0,-15,0);
//pyramid base is in a clockwise order if we look the pyramid from under
base := MainPart.Add([-20,15,-20, 0,15,-30, 20,15,-20, 20,15,20, 0,15,30, -20,15,20]);
AddFace(base);
//add four faces, the three vertices are in a clockwise order
AddFace([base[0],top,base[1]]);
AddFace([base[1],top,base[2]]);
AddFace([base[2],top,base[3]]);
AddFace([base[3],top,base[4]]);
AddFace([base[4],top,base[5]]);
AddFace([base[5],top,base[0]]);
MainPart.Scale(1.3);
MainPart.RotateYDeg(30);
MainPart.RotateXDeg(20);
MainPart.Translate(0,-5,0);
end;
//set ambiant lightness to dark (1 is normal lightness, 2 is complete whiteness)
AmbiantLightness := 0.5;
//add a directional light from top-left, maximum lightness will be 0.5 + 1 = 1.5
AddDirectionalLight(Point3D(1,1,1),0.5);
//we can have high quality antialiasing because it is a simple scene
RenderingOptions.PerspectiveMode := pmLinearMapping;
end;
procedure TExample1.Render;
begin
//fill background
Surface.GradientFill(0,0,Surface.Width,Surface.Height,
MergeBGRA(SandColor,1,BGRABlack,1),
MergeBGRA(SandColor,1,BGRABlack,2),
gtLinear,PointF(0,0),PointF(0,Surface.Height),dmSet);
inherited Render;
end;
{$IFNDEF NO_OPENGL_SURFACE}
procedure TExample1.RenderGL(ACanvas: TBGLCustomCanvas; AMaxZ: single);
begin
//fill background
ACanvas.FillRectLinearColor(0,0,BGLCanvas.Width,BGLCanvas.Height,
MergeBGRA(SandColor,1,BGRABlack,1),MergeBGRA(SandColor,1,BGRABlack,1),
MergeBGRA(SandColor,1,BGRABlack,2),MergeBGRA(SandColor,1,BGRABlack,2),
False);
inherited RenderGL(ACanvas, AMaxZ);
end;
{$ENDIF}
end.

View File

@@ -0,0 +1,203 @@
unit ex2;
{$mode objfpc}{$H+}
interface
{ This example draws a box. It comes with different flavors :
- e2lNone : without lighting but with water
- e2lLightness : with lighting and water
- e2lColored : with two lights of different colors, but without water
In this example, faces are textured. Each texture is generated with utexture unit.
Because we want to have a shiny effect on the box, we need to create different material.
The parameter of CreateMaterial is the exponent of the specular light, which is the
concentration of the reflected beam. The lamps are not shiny, but we must see some of the
light through them, that's why the LightThroughFactor is set to a small non zero number.
The lighting normals are the direction considered to be orthogonal to the surface. The box
uses lnFace, which means that each face is considered to be flat. On the contrary, lamps
are rounded, so their lighting normals are lnVertex, which means that the surface is considered
to be rounded between faces, using vertices as a reference. The example 3 show the difference
between these modes.
}
uses
Classes, SysUtils, BGRAScene3D, BGRABitmap, BGRABitmapTypes
{$IFNDEF NO_OPENGL_SURFACE}, BGRAOpenGL3D{$ENDIF};
type
TExample2Lighting = (e2lNone,e2lLightness,e2lColored);
{ TExample2 }
TExample2 = class({$IFNDEF NO_OPENGL_SURFACE}TBGLScene3D{$ELSE}TBGRAScene3D{$ENDIF})
private
water,wood,vWood: TBGRABitmap;
box,ground,light1,light2: IBGRAObject3D;
alpha: integer;
cury: single;
FLighting: TExample2Lighting;
procedure CreateScene;
procedure ApplyTexCoord(face: IBGRAFace3D; Times: integer = 1);
procedure SetLighting(AValue: TExample2Lighting);
public
constructor Create(ALighting: TExample2Lighting);
procedure Elapse;
destructor Destroy; override;
property Lighting: TExample2Lighting read FLighting write SetLighting;
end;
implementation
uses utexture;
const texSize = 256;
{ TExample2 }
constructor TExample2.Create(ALighting: TExample2Lighting);
begin
inherited Create;
//create textures
water := CreateWaterTexture(texSize,texSize);
vWood := CreateVerticalWoodTexture(texSize,texSize);
wood := CreateWoodTexture(texSize,texSize);
FLighting:= ALighting;
CreateScene;
end;
procedure TExample2.Elapse;
var dy: single;
begin
if light1 <> nil then light1.MainPart.RotateYDeg(1,False);
if light2 <> nil then light2.MainPart.RotateYDeg(-1.3,False);
if ground <> nil then
begin
dy := cos(alpha*Pi/180)*0.05;
cury += dy;
ground.MainPart.Translate(0,dy,0,False);
ViewPoint := Point3D(ViewPoint.x,-40+cury,ViewPoint.z);
LookAt(Point3D(0,cury,0),Point3D(0,-1,0));
inc(alpha);
if alpha = 360 then alpha := 0;
end;
end;
procedure TExample2.CreateScene;
var
base,v: array of IBGRAVertex3D;
lamp,shiny: IBGRAMaterial3D;
begin
Clear;
shiny := CreateMaterial(500);
lamp := CreateMaterial;
lamp.LightThroughFactor := 0.01;
//create wooden box
box := CreateObject(vWood);
with box do
begin
v := MainPart.Add([-1,-1,-1, 1,-1,-1, 1,1,-1, -1,1,-1,
-1,-1,+1, 1,-1,+1, 1,1,+1, -1,1,+1]);
ApplyTexCoord(AddFace([v[0],v[1],v[2],v[3]]));
ApplyTexCoord(AddFace([v[4],v[5],v[1],v[0]],wood));
ApplyTexCoord(AddFace([v[5],v[4],v[7],v[6]]));
ApplyTexCoord(AddFace([v[3],v[2],v[6],v[7]],wood));
ApplyTexCoord(AddFace([v[1],v[5],v[6],v[2]]));
ApplyTexCoord(AddFace([v[4],v[0],v[3],v[7]]));
MainPart.Scale(20);
end;
DefaultLightingNormal:= lnFace;
if Lighting = e2lColored then
begin
ViewPoint := Point3D(0,0,-150);
AmbiantLightColor := BGRA(192,192,192);
box.Material := shiny;
//lights
light1 := CreateHalfSphere(10, BGRA(255,128,0), 8,8);
with light1 do
begin
AddPointLight(MainPart.Add(0,0,-5),60,BGRA(255,128,0),0);
MainPart.Translate(-100,-50,0);
MainPart.LookAt(Point3D(0,0,0),Point3D(0,-1,0));
Material := lamp;
LightingNormal := lnVertex;
end;
light2 := CreateHalfSphere(10, BGRA(0,128,255), 8,8);
with light2 do
begin
AddPointLight(MainPart.Add(0,0,-5),100,BGRA(0,128,255),0);
MainPart.Translate(50,0,-100);
MainPart.LookAt(Point3D(0,0,0),Point3D(0,-1,0));
Material := lamp;
LightingNormal := lnVertex;
end;
end else
begin
//create ground
ground := CreateObject(water);
if Lighting = e2lLightness then
begin
with ground do
begin
base := MainPart.Add([-50,0,-50, -50,0,50, 50,0,50, 50,0,-50]);
ApplyTexCoord(AddFace(base,True),2);
end;
ViewPoint := Point3D(-40,-40,-100);
AmbiantLightness := 0.25;
with CreateObject do
AddPointLight(MainPart.Add(-100,-80,0),100,1.25, -0.15);
end else
begin
AmbiantLightness := 1;
with ground do
begin
base := MainPart.Add([-50,0,-50, -50,0,50, 50,0,50, 50,0,-50]);
MainPart.Scale(2);
ApplyTexCoord(AddFace(base,True),2);
end;
ViewPoint := Point3D(0,-40,-120);
end;
RenderingOptions.PerspectiveMode:= pmZBuffer;
end;
RenderingOptions.TextureInterpolation := false;
end;
procedure TExample2.ApplyTexCoord(face: IBGRAFace3D; Times: integer);
begin
with face do
begin
TexCoord[0] := PointF(0,0);
TexCoord[1] := PointF(texSize*Times-1,0);
TexCoord[2] := PointF(texSize*Times-1,texSize*Times-1);
TexCoord[3] := PointF(0,texSize*Times-1);
end;
end;
procedure TExample2.SetLighting(AValue: TExample2Lighting);
begin
if FLighting=AValue then Exit;
FLighting:=AValue;
CreateScene;
end;
destructor TExample2.Destroy;
begin
water.free;
wood.free;
vWood.free;
inherited Destroy;
end;
end.

View File

@@ -0,0 +1,106 @@
unit ex3;
{$mode objfpc}{$H+}
interface
{ This example is a cylinder. It aims at showing the difference
between lighting normals modes.
The lighting normals are the direction considered to be orthogonal
to the surface. The box uses lnFace, which means that each face is
considered to be flat. On the contrary, lamps are rounded, so
their lighting normals are lnVertex, which means that the surface
is considered to be rounded between faces, using vertices as a
reference.
Depending on the value of DefaultLightingNormal, the cylinder will
look polygonal or rounded. The value lnFaceVertexMix is an
intermediate between Face and Vertex, which allows to have some
light diffusion effect while keeping an angle between faces.
The SaturationLow and SaturationHigh properties of the material allows
to create a shiny effect without actually computing reflected light.
Simply when a pixel is very bright, it turns into white, as if we
could see the reflection of some white beam. }
uses
Classes, SysUtils, BGRAScene3D, BGRABitmapTypes
{$IFNDEF NO_OPENGL_SURFACE}, BGRAOpenGL3D{$ENDIF};
type
{ TExample3 }
TExample3 = class({$IFNDEF NO_OPENGL_SURFACE}TBGLScene3D{$ELSE}TBGRAScene3D{$ENDIF})
constructor Create;
end;
implementation
uses BGRAMatrix3D;
{ TExample3 }
constructor TExample3.Create;
const
radius = 20;
topY = -20;
bottomY = 20;
precision = 40;
var
bottom,top: array[1..precision] of IBGRAVertex3D;
topCoord,bottomCoord: TPoint3D;
rotateMatrix: TMatrix3D;
i,j: Integer;
begin
inherited Create;
DefaultMaterial.SpecularIndex := 50;
DefaultMaterial.AutoSpecularColor:= true;
//create a cylinder
with CreateObject(BGRA(0,0,255)) do
begin
for j := 1 to 2 do
begin
//top and bottom coordinates
topCoord := Point3D(radius,topY,0);
bottomCoord := Point3D(radius,bottomY,0);
//rotating around the Y axis
rotateMatrix := MatrixRotateY(2*Pi/precision);
//create the vertices
for i := 1 to precision do
begin
//store in reverse order the second time
if j = 2 then
begin
top[precision+1-i] := MainPart.Add(topCoord);
bottom[precision+1-i] := MainPart.Add(bottomCoord);
end
else
begin
top[i] := MainPart.Add(topCoord);
bottom[i] := MainPart.Add(bottomCoord);
end;
topCoord := rotateMatrix*topCoord;
bottomCoord := rotateMatrix*bottomCoord;
end;
//add faces : the second time, there will be in the opposite direction because of the reverse order
for i := 1 to precision do
AddFace([top[i],top[(i mod precision)+1],bottom[(i mod precision)+1],bottom[i]]);
end;
//apply a rotation to show the top of the cylinder
MainPart.RotateXDeg(30);
end;
//set ambiant lightness to dark (1 is normal lightness, 2 is complete whiteness)
AmbiantLightness := 0.5;
//add a directional light from top-left, maximum lightness will be 0.5 + 1 = 1.5
AddDirectionalLight(Point3D(1,1,1),1,-0.5);
end;
end.

View File

@@ -0,0 +1,257 @@
unit ex4;
{$mode objfpc}{$H+}
interface
{ This example demonstrate how to load 3D objects and show them with
appropriate material and color.
The LoadObjectFromFile returns an 3D object defined by an OBJ file.
Some things are ignored, like texture information or normal information.
But when a material name is used, the function UseMaterial is called.
So here it is overriden in order to give the best material possible.
Some objects have specific effects. For example, the teapot is defined
as Biface so that the reflected light is computed outside and inside
the glass.
The helicopter is divided into two parts. The upper part contains the
rotor in order to rotate it, so that the helicopter seems to fly.
The lamp contains in fact 4 lamps, and so 4 light sources are created.
}
uses
Classes, SysUtils, BGRAScene3D, BGRABitmapTypes,
BGRAOpenGL3D, BGRAOpenGL;
type
{ TExample4 }
TExample4 = class(TBGLScene3D)
protected
lamp,shiny,reflect: IBGRAMaterial3D;
rotated: IBGRAPart3D;
rotateCenter: TPoint3D;
message: string;
procedure UseMaterial(materialname: string; face: IBGRAFace3D); override;
procedure CreateScene;
public
procedure Render; override;
procedure Elapse;
procedure RenderGL(ACanvas: TBGLCustomCanvas; AMaxZ: single=1000); override;
procedure NextModel;
constructor Create;
end;
implementation
uses BGRATextFX;
var
numObj: integer= 3;
const
objList: array[0..9] of string = ( 'ciseau.obj',
'fourche.obj', 'pelle.obj', 'helico.obj', 'mario.obj', 'helice.obj',
'lampe.obj', 'teapot.obj', 'roue.obj', 'trumpet.obj');
{ TExample4 }
constructor TExample4.Create;
begin
inherited Create;
//create shiny material using saturation of diffusion (1.3 .. 1.5)
shiny := CreateMaterial;
shiny.SaturationLow := 1.3;
shiny.SaturationHigh := 1.5;
reflect := CreateMaterial(50);
lamp := CreateMaterial;
lamp.LightThroughFactor := 0.05;
CreateScene;
end;
procedure TExample4.UseMaterial(materialname: string; face: IBGRAFace3D);
var color : TBGRAPixel;
begin
if (materialname = 'globes') then
begin
color := BGRA(255,240,220);
face.Material := lamp;
end else
if (materialname = 'bone') then
begin
color := BGRA(255,240,220);
end else
if (materialname = 'bronze') then
begin
color := CSSSaddleBrown;
face.Material := reflect;
end else
if materialname = 'grey' then
begin
color := BGRA(230,192,80);
face.Material := shiny;
end else
begin
color := StrToBGRA(materialname);
if (objList[numObj] <> 'helice.obj') and (color.red = color.green) and (color.green = color.blue) then
begin
if (color.alpha <> 255) or (color.red = 0) then
face.Material := reflect
else
face.Material := shiny;
end else
if color.alpha <> 255 then
face.Material := reflect;
end;
face.SetColor( color );
end;
procedure TExample4.CreateScene;
var obj: IBGRAObject3D;
r: single;
i: integer;
basePath, filename: string;
begin
Clear;
basePath := ExtractFilePath(Paramstr(0));
filename := 'obj'+PathDelim+objList[numObj];
if not fileexists(basePath+filename) and fileexists(basePath+'..'+PathDelim+'..'+PathDelim+filename) then
filename := '..'+PathDelim+'..'+PathDelim+filename;
filename := basePath+ filename;
if not FileExists(filename) then
begin
message := 'File not found : '+ filename;
exit;
end;
obj := LoadObjectFromFile(filename, objList[numObj] <> 'teapot.obj');
if objList[numObj] = 'helico.obj' then
begin
with obj.MainPart do
begin
rotated := CreatePart;
rotateCenter := Point3D(0,0,0);
for i := VertexCount-1 downto 0 do
if (Vertex[i].SceneCoord.y >= 22.2) then
begin
rotated.Add(Vertex[i]);
rotateCenter.Offset(Vertex[i].SceneCoord);
end;
rotateCenter.Scale(1/rotated.VertexCount);
obj.SeparatePart(rotated);
obj.MainPart.Scale(2,2,2);
end;
end else
rotated := nil;
obj.LightingNormal := lnVertex;
if objList[numObj] = 'teapot.obj' then
for i := 0 to obj.FaceCount-1 do
obj.Face[i].Biface := true;
with obj.MainPart.BoundingBox do
obj.MainPart.Translate((min+max)*(-1/2), False);
r := obj.MainPart.Radius;
if r <> 0 then obj.MainPart.Scale(40/r, False);
if objList[numObj] = 'lampe.obj' then
begin
obj.MainPart.RotateXDeg(180, False);
obj.MainPart.Scale(1.5,1.5,1.5);
end else
if objList[numObj] = 'mario.obj' then
obj.MainPart.RotateXDeg(90, False)
else
begin
obj.MainPart.RotateXDeg(180-20, False);
obj.MainPart.RotateYDeg(-20, False);
if objList[numObj] = 'trumpet.obj' then
obj.MainPart.Scale(2,2,2,False);
end;
if objList[numObj] = 'lampe.obj' then
begin
AmbiantLightness := 0.7;
AddPointLight(obj.MainPart.Add(0,7.7,0),10);
AddPointLight(obj.MainPart.Add(1.9,6.5,0),10);
AddPointLight(obj.MainPart.Add(-0.9,6.5,1.5),10);
AddPointLight(obj.MainPart.Add(-0.9,6.5,-1.7),10);
end
else
begin
//set ambiant lightness to dark (1 is normal lightness)
AmbiantLightness := 0.5;
if objList[numObj] = 'helice.obj' then
AddDirectionalLight(Point3D(1,1,1),0.75,-0.5)
else
AddDirectionalLight(Point3D(1,1,1),1,-0.5); //add a directional light from top-left, maximum lightness will be 0.5 + 1 = 1.5
end;
RenderingOptions.PerspectiveMode:= pmZBuffer;
if objList[numObj] = 'helice.obj' then
RenderingOptions.LightingInterpolation := liAlwaysHighQuality
else
RenderingOptions.LightingInterpolation := liSpecularHighQuality;
end;
procedure TExample4.Render;
var fx: TBGRATextEffect;
begin
if objList[numObj] = 'teapot.obj' then
Surface.GradientFill(0,0,Surface.Width,Surface.Height,BGRABlack,BGRA(70,100,100),gtLinear,PointF(0,0),PointF(0,Surface.Height),dmSet) else
if objList[numObj] = 'lampe.obj' then
Surface.Fill(BGRA(0,0,60));
inherited Render;
if message <> '' then
begin
fx := TBGRATextEffect.Create(message,'Arial',20,True);
fx.DrawOutline(Surface,Surface.Width div 2,Surface.Height div 2-fx.TextHeight div 2,BGRABlack,taCenter);
fx.Draw(Surface,Surface.Width div 2,Surface.Height div 2-fx.TextHeight div 2,BGRAWhite,taCenter);
fx.Free;
end else
Surface.TextOut(Surface.Width,0,objList[numObj],BGRAWhite,taRightJustify);
end;
procedure TExample4.Elapse;
begin
if rotated <> nil then
begin
rotated.Translate(-rotateCenter,false);
rotated.RotateYDeg(20,False);
rotated.Translate(rotateCenter,false);
end;
end;
procedure TExample4.RenderGL(ACanvas: TBGLCustomCanvas; AMaxZ: single);
begin
if objList[numObj] = 'teapot.obj' then
ACanvas.FillRectLinearColor(0,0,BGLCanvas.Width,BGLCanvas.Height,
BGRABlack,BGRABlack,
BGRA(70,100,100),BGRA(70,100,100),
False) else
if objList[numObj] = 'lampe.obj' then
ACanvas.Fill(BGRA(0,0,60));
inherited RenderGL(ACanvas, AMaxZ);
end;
procedure TExample4.NextModel;
begin
inc(numObj);
if numObj = length(objList) then numObj := 0;
CreateScene;
end;
end.

View File

@@ -0,0 +1,123 @@
unit ex5;
{$mode objfpc}{$H+}
interface
{ This example is just a box on a grass ground. It aims at showing
how to create a first-person view. Scene rotation is thus
handled differently in umain }
uses
Classes, SysUtils, BGRAScene3D, BGRABitmap, BGRABitmapTypes,
BGRAOpenGL3D, BGRAOpenGL;
type
{ TExample5 }
TExample5 = class(TBGLScene3D)
grass,wood,vWood: TBGRABitmap;
box,ground,light1,light2: IBGRAObject3D;
constructor Create;
procedure ApplyTexCoord(face: IBGRAFace3D; Times: integer = 1);
procedure Render; override;
procedure RenderGL(ACanvas: TBGLCustomCanvas; AMaxZ: single=1000); override;
destructor Destroy; override;
end;
implementation
uses utexture;
const texSize = 256;
{ TExample5 }
constructor TExample5.Create;
var
base,v: array of IBGRAVertex3D;
begin
inherited Create;
//create textures
grass := CreateGrassTexture(texSize,texSize);
vWood := CreateVerticalWoodTexture(texSize,texSize);
wood := CreateWoodTexture(texSize,texSize);
//create wooden box
box := CreateObject(vWood);
with box do
begin
v := MainPart.Add([-1,-1,-1, 1,-1,-1, 1,1,-1, -1,1,-1,
-1,-1,+1, 1,-1,+1, 1,1,+1, -1,1,+1]);
ApplyTexCoord(AddFace([v[0],v[1],v[2],v[3]]));
ApplyTexCoord(AddFace([v[4],v[5],v[1],v[0]],wood));
ApplyTexCoord(AddFace([v[5],v[4],v[7],v[6]]));
ApplyTexCoord(AddFace([v[3],v[2],v[6],v[7]],wood));
ApplyTexCoord(AddFace([v[1],v[5],v[6],v[2]]));
ApplyTexCoord(AddFace([v[4],v[0],v[3],v[7]]));
MainPart.Translate(0,-1,0,False);
MainPart.Scale(20,False);
MainPart.Translate(0,0,200,FAlse);
end;
//create ground
ground := CreateObject(grass);
AmbiantLightness := 0.5;
with ground do
begin
base := MainPart.Add([-1,0,-1, -1,0,1, 1,0,1, 1,0,-1]);
MainPart.Scale(1000);
ApplyTexCoord(AddFace(base,True),10);
end;
Camera.ViewPoint := Point3D(0,-20,0);
Camera.LookAt(Point3D(0,-20,20),Point3D(0,-1,0));
RenderingOptions.PerspectiveMode:= pmZBuffer;
RenderingOptions.TextureInterpolation := false;
end;
procedure TExample5.ApplyTexCoord(face: IBGRAFace3D; Times: integer);
begin
with face do
begin
TexCoord[0] := PointF(0,0);
TexCoord[1] := PointF(texSize*Times-1,0);
TexCoord[2] := PointF(texSize*Times-1,texSize*Times-1);
TexCoord[3] := PointF(0,texSize*Times-1);
end;
end;
procedure TExample5.Render;
begin
Surface.GradientFill(0,0,Surface.Width,Surface.Height,
CSSSkyBlue,
MergeBGRA(CSSBlue,CSSSkyBlue),
gtLinear,PointF(0,0),PointF(0,Surface.Height),dmSet,
False);
inherited Render;
end;
procedure TExample5.RenderGL(ACanvas: TBGLCustomCanvas; AMaxZ: single);
begin
ACanvas.FillRectLinearColor(0,0,BGLCanvas.Width,BGLCanvas.Height,
CSSSkyBlue,CSSSkyBlue,
MergeBGRA(CSSBlue,CSSSkyBlue),MergeBGRA(CSSBlue,CSSSkyBlue),
False);
inherited RenderGL(ACanvas, AMaxZ);
end;
destructor TExample5.Destroy;
begin
grass.free;
wood.free;
vWood.free;
inherited Destroy;
end;
end.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,593 @@
v 5.7 0.1 -97.5
v 5.7 3.4 -97
v 5.7 6.1 -95
v 5.7 7.9 -92.2
v 5.7 -7.8 -92.2
v 5.7 -5.9 -95
v 5.7 -3.2 -96.8
v -5.7 3.2 -96.6
v -5.7 -0.1 -97.2
v -5.7 5.9 -94.8
v -5.7 7.8 -92
v -5.7 -7.9 -92
v -5.7 -6.1 -94.8
v -5.7 -3.3 -96.6
v -5.2 3.6 -97.6
v -5.2 -0.1 -98.3
v -5.2 6.7 -95.5
v -5.2 8.8 -92.4
v -5.2 -8.9 -92.4
v -5.2 -6.8 -95.5
v -5.2 -3.7 -97.6
v -4 4 -98.5
v -4 -0.1 -99.3
v -4 7.4 -96.2
v -4 9.6 -92.8
v -4 -9.8 -92.8
v -4 -7.5 -96.2
v -4 -4.1 -98.5
v -2.1 4.2 -99
v -2.1 -0.1 -99.9
v -2.1 7.8 -96.6
v -2.1 10.2 -93
v -2.1 -10.3 -93
v -2.1 -7.9 -96.6
v -2.1 -4.3 -99
v 2.1 4.2 -99
v 2.1 -0.1 -99.9
v 2.1 7.8 -96.6
v 2.1 10.2 -93
v 2.1 -10.3 -93
v 2.1 -7.9 -96.6
v 2.1 -4.3 -99
v 4 4.1 -98.7
v 4 0.1 -99.5
v 4 7.5 -96.4
v 4 9.8 -93
v 4 -9.6 -93
v 4 -7.4 -96.4
v 4 -3.9 -98.7
v 5.2 3.7 -97.8
v 5.2 0.1 -98.6
v 5.2 6.8 -95.8
v 5.2 8.9 -92.7
v 5.2 -8.8 -92.7
v 5.2 -6.7 -95.8
v 5.2 -3.6 -97.8
v 5.7 8.6 -89
v 5.2 9.6 -89
v 4 10.6 -89
v 2.1 11.1 -88.8
v -2.1 11.1 -88.8
v -4 10.5 -88.8
v -5.2 9.5 -88.8
v -5.7 8.5 -88.8
v 5.2 -9.5 -89
v 5.7 -8.4 -89
v -5.7 -8.5 -88.8
v -5.2 -9.6 -88.8
v -4 -10.5 -88.8
v -2.1 -11.2 -88.8
v 2.1 -11.2 -88.8
v 4 -10.4 -89
v 5.7 8.6 -86.4
v 5.2 9.6 -86.4
v 4 10.6 -86.4
v 2.1 11.1 -86.2
v -2.1 11.1 -86.2
v -4 10.5 -86.2
v -5.2 9.5 -86.2
v -5.7 8.5 -86.2
v 5.2 -9.5 -86.4
v 5.7 -8.4 -86.4
v -5.7 -8.5 -86.2
v -5.2 -9.6 -86.2
v -4 -10.5 -86.2
v -2.1 -11.2 -86.2
v 2.1 -11.2 -86.2
v 4 -10.4 -86.4
v 5.2 -2.4 -8.6
v 4.1 -5.4 -8.6
v 5.6 0.3 -8.7
v 5.3 2.9 -8.6
v 4.2 5.8 -8.6
v 2.2 7.7 -8.4
v -2.1 7.6 -8.4
v -4 5.7 -8.4
v -5.2 2.7 -8.4
v -5.2 -2.5 -8.4
v -5.6 0.2 -8.5
v -4 -5.4 -8.4
v -2.1 -7.4 -8.4
v 2.3 -7.4 -8.4
v 1.1 -0.1 -100
v 1.1 4.2 -99.1
v 1.1 7.9 -96.7
v 1.1 10.3 -93
v 1.1 11.1 -88.8
v 1.1 -11.3 -88.8
v 1.1 -10.4 -93
v 1.1 -8 -96.7
v 1.1 -4.4 -99.1
v 1.1 11.1 -86.2
v 1.1 -11.3 -86.2
v 1.1 8 -8.4
v 1.1 -7.8 -8.4
v -0.9 -0.1 -100
v -0.9 4.2 -99.1
v -0.9 7.9 -96.7
v -0.9 10.3 -93.1
v -0.9 11.2 -88.8
v -0.9 -11.3 -88.8
v -0.9 -10.4 -93.1
v -0.9 -8 -96.7
v -0.9 -4.4 -99.1
v -0.9 11.2 -86.2
v -0.9 -11.3 -86.2
v -0.9 8 -8.4
v -0.9 -7.8 -8.4
v 0 -15.6 100
v 0 15.5 100
v 1.1 -7.8 5.6
v -1.1 -7.8 5.6
v 4.3 -4.9 -0.3
v 2.9 -6.6 0.8
v -1.8 7.6 2.4
v -2.9 6.8 1
v -4.3 4.9 0
v 1.8 -7.5 2.4
v 4.3 5.4 -0.3
v 2.9 7 0.8
v 5.3 2.9 -0.7
v 1.2 7.9 5.6
v 1.8 7.6 2.4
v -4 -5.5 0.2
v -4.9 -3.2 -0.3
v -5.2 2.7 -0.4
v 5.3 -2.5 -0.7
v -2.9 -6.6 1
v -1.8 -7.4 2.4
v -1 7.9 5.6
v -5.7 0 -0.6
v 5.6 0.1 -0.7
v 0 -15.6 100
v 0 15.5 100
v -1.1 -7.8 5.6
v -1.8 7.6 2.4
v -2.9 6.8 1
v -4.3 4.9 0
v -4 -5.5 0.2
v -4.9 -3.2 -0.3
v -5.2 2.7 -0.4
v -2.9 -6.6 1
v -1.8 -7.4 2.4
v -1 7.9 5.6
v -4.1 0 0.1
v -2.9 0 1
v -1.8 0 2.4
v -5.1 0 -0.3
v -5.7 0 -0.6
v 0 -15.5 99.8
v 0 15.6 99.8
v 1.1 -7.7 5.4
v 4.3 -4.9 -0.3
v 2.9 -6.6 0.8
v 1.8 -7.4 2.2
v 4.3 5.4 -0.3
v 2.9 7 0.8
v 5.3 2.9 -0.7
v 1.2 8.1 5.4
v 1.8 7.8 2.2
v 5.3 -2.5 -0.7
v 2.9 0.1 0.8
v 1.8 0.1 2.2
v 5.3 0.1 -0.7
v 4.3 0.1 -0.3
v 5.6 0.1 -0.7
v 5.7 0.4 -95
v 5.7 0.4 -92.2
v 5.7 0.4 -89
v 5.7 0.4 -96.9
v -5.7 0.3 -96.6
v -5.7 0.3 -94.8
v -5.7 0.3 -92
v -5.7 0.3 -86.2
v -5.7 0.3 -88.8
v 5.7 0.4 -86.4
v 5.5 -1.1 -22.3
v -5.5 -1.3 -22
v -5.7 1.3 -84.3
v 5.7 -1.1 -83.5
v -5.6 0.2 -23.6
v -5.7 -1.3 -83.2
v 5.7 1.4 -84.6
v -5.7 1.3 -82.1
v 5.7 1.4 -82.3
v 5.7 1.9 -83.4
v -5.6 1.4 -53
v -5.6 0.3 -20.5
v 5.6 1.5 -53.3
v 5.6 0.4 -23.8
v 5.6 0.4 -20.7
v -5.6 -0.8 -50.8
v -5.6 0.3 -50.4
v -5.7 1.8 -83.2
v -5.6 0.3 -53.5
v 5.6 0.4 -53.7
v -5.6 1.4 -50.8
v -5.7 0.3 -84.7
v -5.7 -0.8 -84.3
v -5.5 -0.8 -20.9
v 5.7 0.4 -85
v 5.7 -0.7 -84.5
v 5.6 -0.7 -21.2
v -5.7 0.3 -81.6
v -5.6 -0.7 -53.1
v 5.7 -0.7 -82.3
v -5.5 -0.8 -23.1
v 5.6 1.5 -51.1
v 5.6 2 -22.3
v 5.6 0.4 -50.6
v 5.6 -0.7 -23.4
v -5.7 -0.8 -82.1
v 5.7 0.4 -81.9
v 5.6 1.5 -23.4
v 5.6 1.5 -21.2
v -5.6 -1.3 -52
v -5.6 1.8 -52
v 5.6 2 -52.2
v -5.6 1.4 -23.1
v 5.6 -0.6 -53.3
v -5.6 1.9 -22
v 5.6 -0.6 -51
v -5.6 1.4 -20.9
v 5.6 -1.2 -52.1
v 5.3 4.1 -22.4
v 4.1 6.6 -22.4
v 2.2 8.3 -22.1
v -0.9 8.6 -22.1
v -2.1 8.2 -22.1
v -4 6.5 -22.1
v -5.2 3.9 -22.1
v -5.2 -3.8 -22.1
v -4 -6.3 -22.1
v -2.1 -8.1 -22.1
v -0.9 -8.4 -22.1
v 1.1 -8.4 -22.1
v 2.3 -8.1 -22.1
v 4.1 -6.3 -22.4
v 5.2 -3.7 -22.4
v 1.1 8.6 -22.1
v 5.3 6.7 -52.8
v 4.1 8.5 -52.8
v 2.2 9.6 -52.6
v -0.9 9.8 -52.6
v -2.1 9.6 -52.6
v -4 8.4 -52.6
v -5.2 6.6 -52.6
v -5.2 -6.6 -52.6
v -4 -8.3 -52.6
v -2.1 -9.6 -52.6
v -0.9 -9.8 -52.6
v 1.1 -9.7 -52.6
v 2.2 -9.6 -52.6
v 4.1 -8.3 -52.8
v 5.2 -6.5 -52.8
v 1.1 9.8 -52.6
v 5.2 9.4 -83.3
v 4 10.4 -83.3
v 2.2 10.9 -83.1
v -0.9 11.1 -83.1
v -2.1 10.9 -83.1
v -4 10.3 -83.1
v -5.2 9.2 -83.1
v -5.2 -9.3 -83.1
v -4 -10.3 -83.1
v -2.1 -11 -83.1
v -0.9 -11.2 -83.1
v 1.1 -11.1 -83.1
v 2.2 -11 -83.1
v 4 -10.2 -83.3
v 5.2 -9.2 -83.3
v 1.1 11 -83.1
v 5.4 -8 -83.2
v 5.5 8.2 -83.4
v -5.7 -8 -83
v -5.7 7.9 -83.2
usemtl rgb(204,170,136)
f 15 16 9 8
f 17 15 8 10
f 18 17 10 11
f 63 18 11 64
f 19 68 67 12
f 20 19 12 13
f 21 20 13 14
f 16 21 14 9
f 22 23 16 15
f 24 22 15 17
f 25 24 17 18
f 62 25 18 63
f 26 69 68 19
f 27 26 19 20
f 28 27 20 21
f 23 28 21 16
f 29 30 23 22
f 31 29 22 24
f 32 31 24 25
f 61 32 25 62
f 33 70 69 26
f 34 33 26 27
f 35 34 27 28
f 30 35 28 23
f 117 116 30 29
f 118 117 29 31
f 119 118 31 32
f 120 119 32 61
f 122 121 70 33
f 123 122 33 34
f 124 123 34 35
f 111 103 37 42
f 43 44 37 36
f 45 43 36 38
f 46 45 38 39
f 59 46 39 60
f 47 72 71 40
f 48 47 40 41
f 49 48 41 42
f 44 49 42 37
f 50 51 44 43
f 52 50 43 45
f 53 52 45 46
f 58 53 46 59
f 54 65 72 47
f 55 54 47 48
f 56 55 48 49
f 51 56 49 44
f 2 1 51 50
f 3 2 50 52
f 4 3 52 53
f 57 4 53 58
f 5 66 65 54
f 6 5 54 55
f 7 6 55 56
f 1 7 56 51
f 74 73 57 58
f 75 74 58 59
f 76 75 59 60
f 125 120 61 77
f 78 77 61 62
f 79 78 62 63
f 80 79 63 64
f 82 81 65 66
f 84 83 67 68
f 85 84 68 69
f 86 85 69 70
f 113 108 71 87
f 88 87 71 72
f 188 187 3 4
f 189 188 4 57
f 190 187 6 7
f 192 191 14 13
f 193 192 13 12
f 195 194 80 64
f 195 193 12 67
f 278 277 74 75
f 279 278 75 76
f 281 280 125 77
f 282 281 77 78
f 283 282 78 79
f 285 284 84 85
f 286 285 85 86
f 289 288 113 87
f 88 72 65 81
f 196 189 57 73
f 291 290 88 81
f 290 289 87 88
f 104 36 37 103
f 105 38 36 104
f 106 39 38 105
f 107 60 39 106
f 109 40 71 108
f 110 41 40 109
f 111 42 41 110
f 112 76 60 107
f 292 279 76 112
f 124 35 30 116
f 126 86 70 121
f 287 286 86 126
f 188 5 6 187
f 189 66 5 188
f 190 2 3 187
f 192 10 8 191
f 193 11 10 192
f 195 67 83 194
f 195 64 11 193
f 196 82 66 189
f 190 1 2
f 190 7 1
f 191 9 14
f 191 8 9
f 99 208 220
f 211 91 223
f 91 211 235
f 243 208 99
f 210 230 228 234
f 242 230 210 231
f 209 216 233 205
f 226 233 216 240
f 224 232 225 215
f 204 224 215 207
f 213 212 227 201
f 239 217 213 201
f 246 93 92 245
f 247 94 93 246
f 249 95 127 248
f 250 96 95 249
f 251 97 96 250
f 253 100 98 252
f 254 101 100 253
f 257 102 115 256
f 259 89 90 258
f 258 90 102 257
f 260 114 94 247
f 255 128 101 254
f 262 246 245 261
f 263 247 246 262
f 265 249 248 264
f 266 250 249 265
f 267 251 250 266
f 269 253 252 268
f 270 254 253 269
f 273 257 256 272
f 275 259 258 274
f 274 258 257 273
f 276 260 247 263
f 271 255 254 270
f 278 262 261 277
f 279 263 262 278
f 281 265 264 280
f 282 266 265 281
f 283 267 266 282
f 285 269 268 284
f 286 270 269 285
f 289 273 272 288
f 291 275 274 290
f 290 274 273 289
f 292 276 263 279
f 287 271 270 286
f 275 291 293
f 277 261 294
f 206 203 73 294
f 82 222 200 293
f 293 291 81 82
f 294 73 74 277
f 82 196 221 222
f 284 268 295
f 267 283 296
f 83 84 284 295
f 283 79 80 296
f 80 199 214 296
f 202 219 83 295
f 218 194 83 219
f 199 80 194 218
f 196 73 203 221
f 229 234 245
f 231 197 259
f 244 242 275
f 242 231 259 275
f 240 244 275
f 238 209 261
f 234 228 261 245
f 228 238 261
f 200 226 293
f 226 240 275 293
f 209 205 294 261
f 205 206 294
f 197 223 259
f 223 91 89 259
f 92 91 235 245
f 235 229 245
f 214 204 296
f 232 202 295
f 236 225 268
f 225 232 295 268
f 204 207 267 296
f 207 237 267
f 212 236 268
f 237 217 267
f 198 227 252
f 227 212 268 252
f 217 239 251 267
f 239 241 251
f 99 220 252 98
f 220 198 252
f 241 243 251
f 243 99 97 251
usemtl rgb(204,204,204)
f 124 116 103 111
f 126 121 108 113
f 288 287 126 113
f 131 129 132
f 130 142 150
f 117 104 103 116
f 118 105 104 117
f 119 106 105 118
f 120 107 106 119
f 122 109 108 121
f 123 110 109 122
f 124 111 110 123
f 125 112 107 120
f 260 248 127 114
f 179 171 170 172
f 102 90 134
f 100 101 148
f 133 134 90
f 137 136 96
f 149 148 101
f 160 168 169
f 139 93 140
f 178 184 186
f 100 148 144
f 168 161 169
f 184 181 186
f 173 181 184 185
f 184 178 176 185
f 176 177 182 185
f 182 174 173 185
f 183 182 177 180
f 183 175 174 182
f 180 179 183
f 161 168 165 158
f 168 160 159 165
f 157 158 165 166
f 165 159 162 166
f 156 157 166 167
f 166 162 163 167
f 164 156 167
f 99 98 145 151
f 98 100 144 145
f 146 97 99 151
f 137 96 97 146
f 133 90 89 147
f 147 89 91 152
f 91 92 141 152
f 92 93 139 141
f 179 172 183
f 172 175 183
f 155 153 154 164
f 163 155 167
f 155 164 167
f 101 128 132 149
f 138 102 134
f 138 131 115 102
f 94 114 142 143
f 140 93 94 143
f 95 96 136 135
f 127 95 135 150
f 132 128 115 131
f 114 127 150 142
f 256 115 128 255
f 276 264 248 260
f 272 256 255 271
f 292 280 264 276
f 288 272 271 287
f 292 112 125 280
usemtl rgb(153,153,153)
f 211 223 197 231
f 211 234 229 235
f 211 231 210 234
f 230 242 244 240
f 209 230 240 216
f 209 238 228 230
f 233 226 200 222
f 203 233 222 221
f 203 206 205 233
f 227 198 220 208
f 243 241 239 208
f 239 201 227 208
f 236 212 213 225
f 207 213 217 237
f 215 225 213 207
f 219 202 232 224
f 204 214 199 224
f 199 218 219 224

View File

@@ -0,0 +1,33 @@
# cube.obj
#
g cube
v 0.0 0.0 0.0
v 0.0 0.0 1.0
v 0.0 1.0 0.0
v 0.0 1.0 1.0
v 1.0 0.0 0.0
v 1.0 0.0 1.0
v 1.0 1.0 0.0
v 1.0 1.0 1.0
vn 0.0 0.0 1.0
vn 0.0 0.0 -1.0
vn 0.0 1.0 0.0
vn 0.0 -1.0 0.0
vn 1.0 0.0 0.0
vn -1.0 0.0 0.0
f 1//2 7//2 5//2
f 1//2 3//2 7//2
f 1//6 4//6 3//6
f 1//6 2//6 4//6
f 3//3 8//3 7//3
f 3//3 4//3 8//3
f 5//5 7//5 8//5
f 5//5 8//5 6//5
f 1//4 5//4 6//4
f 1//4 6//4 2//4
f 2//1 6//1 8//1
f 2//1 8//1 4//1

View File

@@ -0,0 +1,20 @@
# diamond.obj
g Object001
v 0.000000E+00 0.000000E+00 78.0000
v 45.0000 45.0000 0.000000E+00
v 45.0000 -45.0000 0.000000E+00
v -45.0000 -45.0000 0.000000E+00
v -45.0000 45.0000 0.000000E+00
v 0.000000E+00 0.000000E+00 -78.0000
f 1 2 3
f 1 3 4
f 1 4 5
f 1 5 2
f 6 5 4
f 6 4 3
f 6 3 2
f 6 2 1
f 6 1 5

View File

@@ -0,0 +1,61 @@
# OBJ file created by ply_to_obj.c
#
g Object001
v -0.57735 -0.57735 0.57735
v 0.934172 0.356822 0
v 0.934172 -0.356822 0
v -0.934172 0.356822 0
v -0.934172 -0.356822 0
v 0 0.934172 0.356822
v 0 0.934172 -0.356822
v 0.356822 0 -0.934172
v -0.356822 0 -0.934172
v 0 -0.934172 -0.356822
v 0 -0.934172 0.356822
v 0.356822 0 0.934172
v -0.356822 0 0.934172
v 0.57735 0.57735 -0.57735
v 0.57735 0.57735 0.57735
v -0.57735 0.57735 -0.57735
v -0.57735 0.57735 0.57735
v 0.57735 -0.57735 -0.57735
v 0.57735 -0.57735 0.57735
v -0.57735 -0.57735 -0.57735
f 19 3 2
f 12 19 2
f 15 12 2
f 8 14 2
f 18 8 2
f 3 18 2
f 20 5 4
f 9 20 4
f 16 9 4
f 13 17 4
f 1 13 4
f 5 1 4
f 7 16 4
f 6 7 4
f 17 6 4
f 6 15 2
f 7 6 2
f 14 7 2
f 10 18 3
f 11 10 3
f 19 11 3
f 11 1 5
f 10 11 5
f 20 10 5
f 20 9 8
f 10 20 8
f 18 10 8
f 9 16 7
f 8 9 7
f 14 8 7
f 12 15 6
f 13 12 6
f 17 13 6
f 13 1 11
f 12 13 11
f 19 12 11

View File

@@ -0,0 +1,649 @@
v 1.5 -38.2 -15.1
v 1.6 -37.9 -17.3
v -0.9 -38 -17.3
v -22.4 -38 -17.2
v 22.1 -38 -17.1
v -22.4 -38.1 -15.2
v 22.2 -38 -15.1
v 3 -24.4 -12.9
v 2.9 -24.4 -12.2
v 2.9 -24.4 -13.7
v 2.6 -24.4 -11.5
v 2.6 -24.3 -14.3
v 2.2 -24.4 -10.9
v 2.2 -24.3 -14.9
v 1.6 -24.4 -10.4
v 1.6 -24.3 -15.4
v 0.9 -24.4 -10.2
v 0.9 -24.3 -15.7
v 0.2 -24.4 -10.1
v 0.2 -24.3 -15.8
v -0.6 -24.4 -10.2
v -0.6 -24.3 -15.7
v -1.3 -24.4 -10.4
v -1.3 -24.3 -15.4
v -1.9 -24.4 -10.9
v -1.9 -24.3 -14.9
v -2.3 -24.4 -11.5
v -2.3 -24.3 -14.3
v -2.6 -24.4 -12.2
v -2.6 -24.4 -13.7
v -2.7 -24.4 -12.9
v -3.3 -17.9 -12.1
v -3.2 -17.9 -11.3
v -2.9 -17.9 -10.4
v -2.3 -17.9 -9.7
v -1.6 -17.9 -9.2
v -0.8 -17.9 -8.9
v 0.1 -17.9 -8.7
v 1 -17.9 -8.9
v 1.8 -17.9 -9.2
v 2.5 -17.9 -9.7
v 3 -17.9 -10.4
v 3.3 -17.9 -11.3
v 3.5 -17.9 -12.1
v 3.4 -17.9 -13
v 3 -17.9 -13.8
v 2.5 -17.9 -14.5
v 1.8 -17.9 -15.1
v 1 -17.9 -15.4
v 0.1 -17.9 -15.5
v -0.8 -17.9 -15.4
v -1.6 -17.9 -15.1
v -2.3 -17.9 -14.6
v -2.9 -17.9 -13.8
v -3.2 -17.9 -13
v -1.1 -38.3 -15.2
v 3 97 -12.1
v 2.9 97 -11.4
v 2.9 97 -12.9
v 2.6 97 -10.7
v 2.6 97 -13.6
v 2.1 97 -10.1
v 2.1 97 -14.2
v 1.5 97 -9.6
v 1.5 97 -14.7
v 0.8 97 -9.3
v 0.8 97 -15
v 0.1 97 -9.2
v 0.1 97 -15.1
v -0.7 97 -9.3
v -0.7 97 -15
v -1.4 97 -9.6
v -1.4 97 -14.7
v -2 97 -10.1
v -2 97 -14.2
v -2.5 97 -10.7
v -2.5 97 -13.6
v -2.8 97 -11.4
v -2.8 97 -12.9
v -2.9 97 -12.1
v 14.2 94 -12.2
v 14.2 94.1 -11.4
v 14.2 94.1 -12.9
v 14.2 94.4 -10.7
v 14.2 94.4 -13.6
v 14.2 94.9 -10.1
v 14.2 94.9 -14.2
v 14.2 95.5 -9.6
v 14.2 95.5 -14.7
v 14.2 96.2 -9.3
v 14.2 96.2 -15
v 14.2 97 -9.2
v 14.2 97 -12.2
v 14.2 97 -15.1
v 14.2 97.8 -9.3
v 14.2 97.8 -15
v 14.2 98.5 -9.6
v 14.2 98.5 -14.7
v 14.2 99.1 -10.1
v 14.2 99.1 -14.2
v 14.2 99.6 -10.7
v 14.2 99.6 -13.6
v 14.2 99.9 -11.4
v 14.2 99.9 -12.9
v 14.2 100 -12.2
v -14.6 94 -12.2
v -14.6 94.1 -11.4
v -14.6 94.1 -12.9
v -14.6 94.4 -10.7
v -14.6 94.4 -13.6
v -14.6 94.9 -10.1
v -14.6 94.9 -14.2
v -14.6 95.5 -9.6
v -14.6 95.5 -14.7
v -14.6 96.2 -9.3
v -14.6 96.2 -15
v -14.6 97 -9.2
v -14.6 97 -15.1
v -14.6 97.8 -9.3
v -14.6 97.8 -15
v -14.6 98.5 -9.6
v -14.6 98.5 -14.7
v -14.6 99.1 -10.1
v -14.6 99.1 -14.2
v -14.6 99.6 -10.7
v -14.6 99.6 -13.6
v -14.6 99.9 -11.4
v -14.6 99.9 -12.9
v -14.6 100 -12.2
v 3.5 0.8 -12.1
v 3.3 0.7 -11.3
v 3.3 0.8 -13
v 3 0.7 -10.4
v 3 0.8 -13.8
v 2.5 0.7 -9.7
v 2.5 0.8 -14.5
v 1.8 0.7 -9.2
v 1.8 0.8 -15.1
v 0.9 0.7 -8.9
v 0.9 0.8 -15.4
v 0.1 0.7 -8.7
v 0.1 0.8 -15.5
v -0.8 0.7 -8.9
v -0.8 0.8 -15.4
v -1.6 0.7 -9.2
v -1.6 0.8 -15.1
v -2.3 0.7 -9.7
v -2.3 0.8 -14.5
v -2.9 0.7 -10.4
v -2.9 0.8 -13.8
v -3.2 0.7 -11.3
v -3.2 0.8 -13
v -3.3 0.8 -12.1
v 3 0.8 -12.1
v 2.9 0.8 -11.4
v 2.9 0.8 -12.9
v 2.6 0.8 -10.7
v 2.6 0.8 -13.6
v 2.1 0.8 -10.1
v 2.1 0.8 -14.2
v 1.5 0.8 -9.6
v 1.5 0.8 -14.7
v 0.8 0.8 -9.3
v 0.8 0.8 -15
v 0.1 0.8 -9.2
v 0.1 0.8 -15.1
v -0.7 0.8 -9.3
v -0.7 0.8 -15
v -1.4 0.8 -9.6
v -1.4 0.8 -14.7
v -2 0.8 -10.1
v -2 0.8 -14.2
v -2.5 0.8 -10.7
v -2.5 0.8 -13.6
v -2.8 0.8 -11.4
v -2.8 0.8 -12.9
v -2.9 0.8 -12.1
v -14.6 97.2 -12.2
v 0.7 -99.9 18.2
v 1.5 -71.6 -10.4
v 1.5 -66.1 -14.9
v 1.5 -61.4 -16.9
v 1.5 -70.5 -8.3
v 1.5 -65 -12.8
v 1.5 -60.5 -14.7
v 1.5 -54.2 -16
v 1.5 -54.8 -18.3
v -0.9 -71.6 -10.4
v -0.9 -66.1 -15
v -0.9 -61.4 -16.9
v -0.9 -54.2 -16
v -0.9 -54.8 -18.3
v -0.9 -70.5 -8.3
v -0.9 -65 -12.8
v -0.9 -60.5 -14.7
v -24.6 -40.2 -17.3
v 24.6 -40.3 -17.2
v -24.5 -40.6 -15.2
v 24.5 -40.4 -15.2
v -1.1 -40.4 -15.3
v 1.6 -40.4 -15.2
v -0.8 -40.3 -17.4
v 1.7 -40.1 -17.4
v -0.9 -90.5 11
v 1.5 -90.5 11
v 1.5 -92.1 9.4
v -0.9 -92.1 9.4
v 12.9 -100 18.3
v 13.7 -71.7 -10.3
v 13.7 -66.2 -14.8
v 13.7 -61.5 -16.8
v 13.7 -70.6 -8.2
v 13.7 -65.1 -12.7
v 13.7 -60.6 -14.6
v 13.7 -54.3 -15.9
v 13.7 -54.9 -18.2
v 11.3 -71.7 -10.3
v 11.3 -66.2 -14.9
v 11.3 -61.5 -16.8
v 11.3 -54.3 -15.9
v 11.3 -54.9 -18.2
v 11.3 -70.6 -8.2
v 11.3 -65.1 -12.7
v 11.3 -60.6 -14.6
v 11.3 -40.4 -17.3
v 11.3 -90.6 11.1
v 13.7 -90.6 11.1
v 13.7 -92.2 9.5
v 11.3 -92.2 9.5
v 23.8 -100 18.3
v 24.6 -71.8 -10.2
v 24.6 -66.3 -14.8
v 24.6 -61.6 -16.7
v 24.6 -70.6 -8.2
v 24.6 -65.1 -12.7
v 24.6 -60.6 -14.6
v 24.6 -54.3 -15.9
v 24.6 -55 -18.1
v 22.2 -71.8 -10.2
v 22.2 -66.3 -14.8
v 22.2 -61.6 -16.7
v 22.2 -54.3 -15.9
v 22.2 -55 -18.1
v 22.2 -70.6 -8.2
v 22.2 -65.1 -12.7
v 22.2 -60.6 -14.6
v 22.1 -40.4 -15.2
v 22.2 -90.6 11.1
v 24.6 -90.6 11.1
v 24.6 -92.3 9.6
v 22.2 -92.3 9.5
v -12.9 -100 18.3
v -13.7 -71.7 -10.3
v -13.7 -66.2 -14.8
v -13.7 -61.5 -16.8
v -13.7 -70.6 -8.2
v -13.7 -65.1 -12.7
v -13.7 -60.6 -14.6
v -13.7 -54.3 -15.9
v -13.7 -54.9 -18.2
v -11.2 -71.7 -10.3
v -11.2 -66.2 -14.9
v -11.2 -61.5 -16.8
v -11.3 -54.3 -15.9
v -11.2 -54.9 -18.2
v -11.3 -70.6 -8.2
v -11.3 -65.1 -12.7
v -11.3 -60.6 -14.6
v -11.3 -90.6 11.1
v -13.7 -90.6 11.1
v -13.7 -92.2 9.5
v -11.2 -92.2 9.5
v -23.8 -100 18.3
v -24.6 -71.8 -10.2
v -24.6 -66.3 -14.8
v -24.6 -61.6 -16.7
v -24.6 -70.6 -8.2
v -24.6 -65.1 -12.7
v -24.6 -60.6 -14.6
v -24.6 -54.3 -15.9
v -24.6 -55 -18.1
v -22.2 -71.8 -10.2
v -22.2 -66.3 -14.8
v -22.2 -61.6 -16.7
v -22.2 -54.3 -15.9
v -22.2 -55 -18.1
v -22.2 -70.6 -8.2
v -22.2 -65.1 -12.7
v -22.2 -60.6 -14.6
v -22.2 -90.6 11.1
v -24.6 -90.6 11.1
v -24.6 -92.3 9.6
v -22.2 -92.3 9.5
v 12.5 -38.1 -15.1
v 12.5 -38 -17.2
v -12.2 -38 -17.1
v -12.2 -38.1 -15.2
v 22.3 -40.2 -17.2
v 13.8 -40.4 -17.2
v -11.3 -40.2 -17.4
v -13.8 -40.3 -17.4
v -22.3 -40.2 -17.4
v -22.4 -40.3 -15.2
v -13.6 -40.3 -15.2
v -11 -40.4 -15.2
v 13.5 -40.5 -15.3
v 11.1 -40.4 -15.3
v 23.9 -38.7 -17.2
v 23.9 -38.6 -15.3
v -23.8 -38.8 -17.2
v -23.8 -38.8 -15.2
usemtl rgb(204,170,136)
f 78 80 177 175
f 76 78 175 173
f 74 76 173 171
f 72 74 171 169
f 70 72 169 167
f 68 70 167 165
f 66 68 165 163
f 64 66 163 161
f 62 64 161 159
f 60 62 159 157
f 58 60 157 155
f 57 58 155 154
f 59 57 154 156
f 61 59 156 158
f 63 61 158 160
f 65 63 160 162
f 67 65 162 164
f 69 67 164 166
f 71 69 166 168
f 73 71 168 170
f 75 73 170 172
f 77 75 172 174
f 79 77 174 176
f 80 79 176 177
f 96 94 118 120
f 98 96 120 122
f 100 98 122 124
f 102 100 124 126
f 104 102 126 128
f 105 104 128 129
f 103 105 129 127
f 101 103 127 125
f 99 101 125 123
f 97 99 123 121
f 95 97 121 119
f 92 95 119 117
f 90 92 117 115
f 88 90 115 113
f 86 88 113 111
f 84 86 111 109
f 82 84 109 107
f 81 82 107 106
f 83 81 106 108
f 85 83 108 110
f 87 85 110 112
f 89 87 112 114
f 91 89 114 116
f 94 91 116 118
f 93 94 96 98
f 93 98 100 102
f 93 102 104 105
f 93 105 103 101
f 93 101 99 97
f 93 97 95 92
f 93 92 90 88
f 93 88 86 84
f 93 84 82 81
f 93 81 83 85
f 93 85 87 89
f 93 89 91 94
f 118 116 178
f 116 114 178
f 114 112 178
f 112 110 178
f 110 108 178
f 108 106 178
f 106 107 178
f 107 109 178
f 109 111 178
f 111 113 178
f 113 115 178
f 115 117 178
f 117 119 178
f 119 121 178
f 121 123 178
f 123 125 178
f 125 127 178
f 127 129 178
f 129 128 178
f 128 126 178
f 126 124 178
f 124 122 178
f 122 120 178
f 120 118 178
usemtl rgb(204,204,204)
f 25 27 56
f 23 25 56
f 21 23 56
f 17 19 1
f 15 17 1
f 13 15 1
f 11 13 1
f 10 8 2
f 12 10 2
f 14 12 2
f 16 14 2
f 18 16 2
f 20 18 2
f 24 22 3
f 26 24 3
f 28 26 3
f 30 28 3
f 31 30 3
f 33 32 31 29
f 34 33 29 27
f 35 34 27 25
f 36 35 25 23
f 37 36 23 21
f 38 37 21 19
f 39 38 19 17
f 40 39 17 15
f 41 40 15 13
f 42 41 13 11
f 43 42 11 9
f 44 43 9 8
f 45 44 8 10
f 46 45 10 12
f 47 46 12 14
f 48 47 14 16
f 49 48 16 18
f 50 49 18 20
f 51 50 20 22
f 52 51 22 24
f 53 52 24 26
f 54 53 26 28
f 55 54 28 30
f 55 32 153 152
f 153 151 175 177
f 151 149 173 175
f 149 147 171 173
f 147 145 169 171
f 145 143 167 169
f 143 141 165 167
f 141 139 163 165
f 139 137 161 163
f 137 135 159 161
f 135 133 157 159
f 133 131 155 157
f 131 130 154 155
f 130 132 156 154
f 132 134 158 156
f 134 136 160 158
f 136 138 162 160
f 138 140 164 162
f 140 142 166 164
f 142 144 168 166
f 144 146 170 168
f 146 148 172 170
f 148 150 174 172
f 150 152 176 174
f 152 153 177 176
f 33 151 153 32
f 34 149 151 33
f 35 147 149 34
f 36 145 147 35
f 37 143 145 36
f 38 141 143 37
f 39 139 141 38
f 40 137 139 39
f 41 135 137 40
f 42 133 135 41
f 43 131 133 42
f 44 130 131 43
f 45 132 130 44
f 46 134 132 45
f 47 136 134 46
f 48 138 136 47
f 49 140 138 48
f 50 142 140 49
f 51 144 142 50
f 52 146 144 51
f 53 148 146 52
f 54 150 148 53
f 55 152 150 54
f 55 30 31 32
f 56 27 29
f 9 11 1
f 8 9 1 2
f 3 56 29 31
f 22 20 3
f 20 2 3
f 19 56 1
f 19 21 56
f 295 294 7 5
f 297 296 4 6
f 205 204 179
f 194 193 183 184
f 195 194 184 185
f 207 206 179
f 189 181 180 188
f 190 182 181 189
f 192 187 182 190
f 195 185 186 191
f 300 296 3 202
f 201 1 56 200
f 202 3 2 203
f 192 202 203 187
f 186 201 200 191
f 187 203 201 186
f 182 187 186 185
f 182 185 184 181
f 184 183 180 181
f 206 205 179
f 202 192 191 200
f 192 190 195 191
f 190 189 194 195
f 189 188 193 194
f 207 204 193 188
f 205 183 193 204
f 207 188 180 206
f 206 180 183 205
f 207 179 204
f 227 226 208
f 223 222 212 213
f 224 223 213 214
f 229 228 208
f 218 210 209 217
f 219 211 210 218
f 221 216 211 219
f 224 214 215 220
f 221 225 299 216
f 215 306 307 220
f 216 299 306 215
f 211 216 215 214
f 211 214 213 210
f 213 212 209 210
f 228 227 208
f 225 221 220 307
f 221 219 224 220
f 219 218 223 224
f 218 217 222 223
f 229 226 222 217
f 227 212 222 226
f 229 217 209 228
f 228 209 212 227
f 229 208 226
f 249 248 230
f 245 244 234 235
f 246 245 235 236
f 251 250 230
f 240 232 231 239
f 241 233 232 240
f 243 238 233 241
f 246 236 237 242
f 243 298 197 238
f 237 199 247 242
f 238 197 199 237
f 233 238 237 236
f 233 236 235 232
f 235 234 231 232
f 250 249 230
f 298 243 242 247
f 243 241 246 242
f 241 240 245 246
f 240 239 244 245
f 251 248 244 239
f 249 234 244 248
f 251 239 231 250
f 250 231 234 249
f 251 230 248
f 252 269 270
f 257 256 266 267
f 258 257 267 268
f 252 271 272
f 261 253 254 262
f 262 254 255 263
f 263 255 260 265
f 264 259 258 268
f 260 301 300 265
f 264 305 304 259
f 259 304 301 260
f 258 259 260 255
f 254 257 258 255
f 254 253 256 257
f 252 270 271
f 305 264 265 300
f 264 268 263 265
f 268 267 262 263
f 267 266 261 262
f 261 266 269 272
f 269 266 256 270
f 271 253 261 272
f 270 256 253 271
f 269 252 272
f 273 290 291
f 278 277 287 288
f 279 278 288 289
f 273 292 293
f 282 274 275 283
f 283 275 276 284
f 284 276 281 286
f 285 280 279 289
f 281 196 302 286
f 285 303 198 280
f 280 198 196 281
f 279 280 281 276
f 275 278 279 276
f 275 274 277 278
f 273 291 292
f 303 285 286 302
f 285 289 284 286
f 289 288 283 284
f 288 287 282 283
f 282 287 290 293
f 290 287 277 291
f 292 274 282 293
f 291 277 274 292
f 290 273 293
f 295 2 1 294
f 297 56 3 296
f 299 295 5 298
f 225 295 299
f 225 203 2 295
f 296 300 301
f 302 4 296 301
f 304 297 6 303
f 305 297 304
f 305 200 56 297
f 307 294 1 201
f 307 306 294
f 247 7 294 306
f 247 306 299 298
f 307 201 203 225
f 300 202 200 305
f 304 303 302 301
f 309 247 199
f 309 7 247
f 308 298 5
f 308 197 298
f 310 302 196
f 310 4 302
f 311 303 6
f 311 198 303
f 311 310 196 198
f 311 6 4 310
f 309 308 5 7
f 309 199 197 308

View File

@@ -0,0 +1,979 @@
v -0.23876920554499864 1.3103797270601687 0.13001260700009193
v -0.27582915374543276 1.2582563331865875 0.12364597630502337
v -0.2674888336016338 1.3474373225751202 0.15912747459742976
v -0.3128662756980407 1.222713216834852 0.14623565543301947
v -0.3018967864385568 1.3832552573955716 0.1992584345763206
v -0.3291084911674431 1.4015778151496097 0.23515159787549716
v -0.3393653203892503 1.1606446817887044 0.25033862660881895
v -0.32933702685159627 1.3872894114706185 0.30297184764306634
v -0.34413945029647036 1.1847846590886826 0.3161902839586921
v -0.32731404147036136 1.3472171185436952 0.33599708012099205
v -0.31993727304296354 1.2010232341929186 0.3533614819463716
v -0.30726711945847285 1.2956437760677335 0.3643485926629952
v -0.2877856463729185 1.2493470906219926 0.38230872912669633
v -0.21034318989786122 1.3531672444828033 0.1537169917653439
v -0.21145627080982005 1.3818523867813413 0.35175494063536605
v -0.2338628137428242 1.3442372246769223 0.37948021085512573
v -0.25614030179208813 1.2952633550210815 0.3911502328871025
v -0.596105380500693 -0.6768462432797441 -0.9120215121805894
v -0.10001338605742703 -0.9910441617396678 -0.7028175040329147
v -0.16086384627984987 -1.127277664194341 -0.7434844726798386
v -0.008083895898474806 -1.0921252683249256 -0.5243409146431066
v -0.07976516143635025 -1.276866970105867 -0.5252506365091272
v -0.020060506382965703 -1.2334385749192633 -0.301325040448603
v -0.07990779791476262 -1.3509036976740292 -0.341070036161337
v -0.10169053410627815 -1.2068870189299477 -0.04876722079973187
v -0.1519817903091755 -1.365510665871866 -0.15692439889429793
v -0.2601279041091756 -1.1885795093023326 0.10988970110975217
v -0.31729579292888604 -1.321268264156361 0.059441628673455316
v -0.848568870055825 -0.9383248633714683 0.23982837834317694
v -0.2841115740583825 -1.2078773490579697 -0.8036506322954367
v -0.22231836409372388 -1.3705711792653117 -0.6258835168322516
v -0.19808583052036852 -1.4522159317791117 -0.3886956275749503
v -0.31271194883273773 -1.4812229673897357 -0.1662599441498861
v -0.4468655428183257 -1.4081208865117936 0.030309816870830293
v -0.3988207279452833 -0.9783603900495396 -0.8833077012801736
v -0.4261847167822431 -1.2538563022802836 -0.832657802483938
v -0.38091428944031497 -1.4323612424714172 -0.6713096485927353
v -0.34392672880812863 -1.5296402016703727 -0.4359666117195356
v -0.47121275738702567 -1.5427481346322585 -0.212699971365956
v -0.5840335467653923 -1.4499471972736035 -0.01688965681846319
v -0.5965324664537639 -1.2310376567603918 0.15439728723762638
v -0.603970626930515 -0.9730496272867387 -0.9442929048887062
v -0.6584407430024051 -1.2331761333320834 -0.8746205623410716
v -0.709409821847784 -1.4659429722203778 -0.7154020228441985
v -0.6644813362834862 -1.5771682475681057 -0.51042113309235
v -0.7894059105187994 -1.5638233094298595 -0.3088200440614581
v -0.8162833445262949 -1.4310813233699453 -0.05752847701987319
v -0.8117676576018125 -1.234439602574674 0.13414076435148883
v -0.25834762010828993 -0.6951673252373165 -0.7923673206368221
v -0.06248973045542924 -0.7665910821077954 -0.6540399700991502
v 0.07611239708492351 -0.9156476836861951 -0.20536770047473785
v -0.031081271477573048 -0.8994758181564453 0.04312489218518984
v -0.2509457867081838 -0.9602191023294494 0.1949888000417654
v -0.5314775775236663 -0.9170871483914047 0.27604867586122167
v -0.698201286366758 -0.8975001213210745 -0.9599982435061234
v -0.8293665978692493 -1.11509528462743 -0.9146490325020323
v -0.9619048200796854 -1.343162090335404 -0.7880316555337348
v -1.0472124286277014 -1.4730438773829664 -0.5605464015223269
v -1.060765551847539 -1.4641134058825243 -0.2855663528073091
v -1.0004246660561544 -1.3283874042894974 -0.03361413042981279
v -0.9104906458141931 -1.1662066485845088 0.1470252534214227
v -0.9586855869711515 -0.6710831333901544 -0.9367557030770179
v -1.2445793305522892 -0.817542042890274 -0.8973407152418248
v -1.2659871743768685 -0.6801247466768301 -0.8490486738261083
v -1.4417357951365137 -0.892844113645334 -0.7517043712681761
v -1.476802737695221 -0.7360019859679737 -0.6685856347091148
v -1.5639841715332439 -0.9191614582919794 -0.5287575689432107
v -1.5681656901876435 -0.7927271011174322 -0.4991311239237613
v -1.5326259636093063 -1.0039824068887115 -0.28969248502613
v -1.5489494701267934 -0.8242411750516833 -0.3018251138498018
v -1.407890071989428 -1.018040171212245 -0.06605615148067337
v -1.4223317944946532 -0.8723090313725681 -0.05316658252587531
v -1.1652203387672957 -0.9337169196632413 0.1334184078263284
v -1.1255438855619244 -0.45287889159761474 -0.7915489789158711
v -1.3279205175383988 -0.42378587112767446 -0.6057450114372587
v -1.453237253290355 -0.5055549645946847 -0.40734951169873873
v -1.4148957872068073 -0.5304237767693063 -0.16308494761654216
v -1.289436358384456 -0.6584542134820716 0.049305709577394455
v -0.8874951265560681 -0.8248028576559522 -0.9565338521560323
v -1.1657720297488638 -0.9232322177159897 -0.9113461515493453
v -1.3737606650637482 -1.05988953884744 -0.7658589961519274
v -1.5010039128600727 -1.0931510893936602 -0.5582767873636508
v -1.4601034487302784 -1.1654443984569987 -0.3270400944072667
v -1.3300721765655639 -1.126145329626444 -0.07288783559541256
v -1.094027683771837 -1.084366608811451 0.10682087754556222
v -1.0875937948798378 -1.0722876078076398 -0.8950930575225976
v -1.2487802398372811 -1.199621201720314 -0.770810356893762
v -1.3871797127872325 -1.2453352818416719 -0.5725538075637561
v -1.3336683013633743 -1.303381182432141 -0.33953009810380114
v -1.2386603306792545 -1.2586899629846382 -0.12341526133552151
v -0.847389582770811 -0.478492980249323 -0.871016832402294
v -1.0629050406633582 -0.33601400374427853 -0.7258100434517166
v -1.2190735055805353 -0.29624060404360103 -0.5635619964306117
v -1.3517105212108151 -0.3476974272688013 -0.3492936473235696
v -1.3091051787212946 -0.40781276676789235 -0.10339425594585269
v -1.2168089660357586 -0.5274920225978963 0.06741335477163105
v -1.0511503152740245 -0.7416804143259951 0.2049141271815988
v -0.6820493320101108 -0.4073454070130155 -0.8362462682349809
v -0.8480346738093036 -0.22394454471293013 -0.6859356370420204
v -0.9382037144425833 -0.08920601913082365 -0.4560668167387506
v -1.0896315173661946 -0.13537742027486113 -0.24763788309746104
v -1.0177578267683933 -0.19112387317463178 7.070529650376467E-4
v -1.0348062333853838 -0.41038161623017794 0.1399093358829532
v -0.9396488481908281 -0.6321302849485207 0.24387425328076773
v -0.09560436290090499 1.339214093370152 0.1477579579447047
v -0.15273510877349308 1.2957419873888067 0.10995645328754174
v -0.062050527956707575 1.3692309912304754 0.1955267069140381
v -1.521773942288455E-4 1.3554620235219368 0.3227203242573578
v -0.10349110756088271 1.3137976974225336 0.4178816230110331
v -0.15085642703030017 1.2694959538207045 0.43225990586812474
v -0.21433174824491863 1.2202115319934645 0.42359844208844455
v -0.21917009134413754 1.249857125588988 0.0995416059368744
v -0.28246419070242684 1.2050401515702542 0.11644643644430475
v -0.3129756717999029 1.163166153030332 0.14503962345021287
v -0.32664932338661334 1.1471685974256742 0.3296679490818033
v -0.2751151389208091 1.178548147296377 0.38859847543695397
v -0.07117824697642426 1.2833923335104869 0.10155506218543657
v 0.01952628579214415 1.2268383174511577 0.08762970595474523
v -0.0533728492267706 1.1780899339795514 0.041486476961526436
v -0.12159853328026078 1.2160393526967515 0.06191305596390384
v -0.03216112253813483 1.3372853305457484 0.16511543805230214
v 0.0731556655610805 1.26540329490592 0.1618196085705
v -0.018012120440415495 1.3646669050570877 0.22983374254345476
v 0.10367094281488036 1.2843407275170273 0.25238198525389427
v 0.13140177353855467 1.2478160316648583 0.32763802931035096
v -0.056021811076326464 1.3299507664867958 0.39305267822379214
v 0.07522175402077194 1.2507143399891454 0.3956619662984644
v -0.08281234911568472 1.2703421796138938 0.4402240123229857
v 0.01795293748424096 1.1977292385399962 0.4495759996401428
v -0.140084567072329 1.1981313068931814 0.4549247925876616
v -0.055730483438343095 1.134204503245634 0.4743453892047482
v -0.195843423418774 1.1250804448063756 0.4395501060994016
v -0.13648241697035543 1.0762988502857962 0.4642071929538253
v -0.1320833582585817 1.118879626710536 0.03027101424435127
v -0.17789451123739403 1.1419876741742214 0.052250123394135074
v -0.20244412759751665 1.062628011979282 0.0508408807532532
v -0.23210941728461448 1.0796495973528117 0.07190570714367979
v -0.26030340316362355 1.0179148935053772 0.10527188614157675
v -0.29525684897940946 0.9675080117623716 0.1792173306975986
v -0.28826541284389207 0.9677050604055095 0.2798794723956473
v -0.2632513574265279 0.9931303693008816 0.3514136070432927
v -0.28646037093541493 1.0185581755171358 0.3282172719023405
v -0.2086964110925687 1.0259454248881235 0.4189416705014296
v -0.2467883757867712 1.0595447508107605 0.3933816015630798
v 0.17872313693801953 1.025246834722123 0.04349401870518004
v 0.06748632295477272 1.0328368970330073 -0.0012005056093327012
v 0.2561423061057405 1.0136281055295011 0.10835507124081907
v 0.300950261734067 0.9431608110206416 0.28643187767591677
v 0.18936841832020435 0.9319869673270735 0.44817741477373196
v 0.09325438236168647 0.9204810011470623 0.4786885904815903
v -0.026875929876898914 0.9171992918687374 0.4788032161574475
v -0.050991484084989845 1.030898509265369 -0.008079474184983611
v -0.16209114356370188 1.0159498925407309 0.024676756222088137
v -0.229159459612385 0.9354422138631637 0.36859933084343927
v -0.1391731970008425 0.9234519262530181 0.44119603386135564
v 0.17861510065239114 0.9029942588889944 -0.005193118717157615
v 0.20885071989207965 0.5755957905566027 -0.07667087792795438
v 0.07966628487324764 0.8444141445957631 -0.05571698567292751
v 0.10836530729913466 0.5997704001367645 -0.10999773301638337
v 0.267798986856911 0.9395661466021183 0.07867890346497927
v 0.2937291293341934 0.962459454773473 0.17552656684668122
v 0.3397881281649465 0.4568368997780585 0.1767550046536417
v 0.25272039926472245 0.9123418286838364 0.3839045766826548
v 0.1960131812497361 0.8515960540706153 0.4438518114132365
v 0.08617665401052353 0.7897714182096348 0.4648540365288201
v 0.11695626676834338 0.46301165363215435 0.39082411170929
v -0.018812474436488397 0.7237549378258146 0.44527487016595946
v 0.009515024453930019 0.47867577559453145 0.3928715296525722
v -0.012905137512460198 0.6217365064396034 -0.10774026933953917
v -0.020542415672755155 0.7766143499424125 -0.07025333721081264
v -0.11420333688264363 0.6301372081172665 -0.072320114787061
v -0.12027343756275882 0.7162053532704167 -0.04479408000218762
v -0.19469603733957327 0.6638012353563264 0.0019509816624666348
v -0.24865269735816442 0.5979937949414752 0.09451062907589113
v -0.23773508294912143 0.6112776440191625 0.21892825264540403
v -0.18634370550533172 0.5413926271476547 0.2949493622643064
v -0.1895051304036615 0.6312093666452024 0.3081881168248471
v -0.10427297470446559 0.5097569398714669 0.35705778790619097
v -0.11098916529176285 0.6655311694160618 0.39159830628358067
v 0.1876342069811111 0.5033061437989215 -0.10483268880194742
v 0.09809358624263935 0.17576055344835947 -0.22660111284413842
v 9.980600042878598E-4 0.2776940657404102 -0.23833721224985494
v 0.06202604473373216 0.5143367290533036 -0.14430238389579206
v 0.2601771625596767 0.5132495618693441 -0.0419826119632792
v 0.2267034323045877 -0.07934967297543495 0.02556359016082569
v 0.18248639872254088 0.4180673661872462 0.35325990274594876
v 0.09338059505857496 0.38783248945634874 0.3746744992397327
v -0.005211606777756715 0.04917999260227923 0.2990491470058861
v -0.03849106672839849 0.39120902770935095 0.367016939925659
v -0.10848056289935136 0.1435512953626317 0.31865722665290575
v -0.0932417226328324 0.3598705333665368 -0.2074025730478351
v -0.06719701000163651 0.5066450508624447 -0.1397429150410627
v -0.1804473794799147 0.41746664230742225 -0.1415871127280521
v -0.16404691441086264 0.5008696549815044 -0.09943713866384862
v -0.24991610243976733 0.46142536820852903 -0.04084433768174924
v -0.28761411639861034 0.44737779602280475 0.051054453447751835
v -0.28675863948263974 0.416295470137208 0.14635962931629456
v -0.254500590852495 0.32669003381612766 0.23531552878884276
v -0.231372001824006 0.41834268077179726 0.24280756749780402
v -0.19207899925896893 0.23874733244600602 0.29550374929060313
v -0.15628752178315608 0.3974920744082751 0.31353339526127444
v -0.018720751877417497 0.062427271517513046 -0.3423575873860938
v -0.05158961781091372 -0.2563933968214236 -0.49800580550559054
v -0.20088495830404476 -0.13126411196599852 -0.5453441726394352
v -0.18340769457458989 0.09825169285259472 -0.3943097123183823
v 0.12115365957039037 0.014420223788874923 -0.24037782041932212
v 0.056559451013174264 -0.36062459822625886 -0.40692266576968744
v 0.12212578753997294 -0.6050598321387264 -0.12437295900412774
v 0.025258295975196174 -0.10322945063945176 0.24768994532951785
v -0.06640266552744624 -0.5010310085837314 0.19723160290838115
v -0.145384934862913 -0.09303562620026448 0.3026990669448157
v -0.2080530513736607 -0.4402766255051616 0.27854398626511434
v -0.3201688747286834 -0.069472750700044 0.3021999728028007
v -0.3764229875624985 -0.3372841738879878 0.3196175137825808
v -0.37103840912195013 -0.018343714126245417 -0.5181695682676257
v -0.3624876398424141 0.11792333476126983 -0.3885156944272048
v -0.5369907859125455 0.05987335312325521 -0.420070558870981
v -0.49722492713673616 0.13410703737954682 -0.3286188877172944
v -0.6294317441594179 0.11556113739693963 -0.26391312063853545
v -0.74173498336992 0.08053780182128528 -0.12522747001774567
v -0.6901485280221654 0.042138462724677694 0.04298647182897286
v -0.6583061345706847 -0.08271666421665431 0.17909368084528765
v -0.5930778951386746 0.01940614282887867 0.15083850228675535
v -0.5336280893809849 -0.20845754472929892 0.2850729045500069
v -0.4863419744110133 -0.033084460741767234 0.24177778209818324
v -0.16421418750489497 -0.3009066302678531 -0.613469962903272
v -0.19121648139938338 -0.49736348828867183 -0.7024015487555098
v -0.3804429066794447 -0.3517580490090136 -0.7461890303461363
v -0.36911610223035285 -0.19924428750907905 -0.6606716953472738
v 0.00764144937164241 -0.41591976904898176 -0.48949143091766145
v -0.00703132676232705 -0.639152352439578 -0.5705632382430396
v 0.11082364953963271 -0.46984782407830805 -0.3169906454178008
v 0.07681783005303255 -0.7589168860036708 -0.4146953894835867
v 0.023932473668473467 -0.5670301759646578 0.09632170271937375
v -0.139698107729481 -0.5845442431079642 0.224328828951515
v -0.12909344686888494 -0.82452130403786 0.17197986976368612
v -0.35629678802794823 -0.5164555824199508 0.3146739763415395
v -0.3207143923909673 -0.7555247084101276 0.27546974969494803
v -0.5751666842740498 -0.42980212239695187 0.3247894461401142
v -0.5608819388605969 -0.6300128226097699 0.3256888806317336
v -0.6119993988065029 -0.2039436789589 -0.7058985888062624
v -0.5690995198999165 -0.12062867425850417 -0.6367858256444157
v -0.7745480379862542 -0.08299685419757988 -0.5533065828441973
v -0.9059965161698623 -0.27579432003345206 0.1565710587409764
v -0.7733491979650087 -0.48524750438686576 0.2900036375382926
v -0.7448096323038795 -0.3254807309936029 0.26563969024312495
v -0.1292811121767781 0.24541226127424362 -0.27813642684707096
v -0.012722182411993922 0.17872354694047157 -0.2856442543998048
v -0.2428141364892664 0.29395739556129535 -0.22349063319337525
v -0.3411247577494312 0.31901208295467953 -0.12724776419557868
v -0.3992091957752286 0.31073037338569687 -0.0036776738917693227
v -0.39029961638808786 0.25895363915674446 0.12264318016053902
v -0.3311242920511251 0.18560722865550605 0.22621753264795585
v -0.24091339429176825 0.1083564943253534 0.2905482642422535
v -0.12951005521262673 0.03536832888417705 0.30925230551932015
v 0.09116388438362256 0.10905454185092361 -0.24903014897171805
v 0.16893286792711723 0.09534659783694158 -0.17487528542655814
v 0.08621995597156243 -0.006153152546389401 0.24651124997927
v -0.013839682800429801 -0.01976756022956282 0.2857709647911246
v -0.14224466965791016 1.3831523327333446 0.30144101500423315
v -0.13605604833821014 1.393857595270661 0.2766140427570333
v -0.13002715466520928 1.3934280277792825 0.2520685743777088
v -0.12423922657418207 1.388769918728889 0.23066988277566788
v -0.19518443866089988 1.3928509577654855 0.20378772481501994
v -0.24148774025737788 1.3945399882729024 0.23016096348757714
v -0.25791021093344335 1.4037411161856639 0.24787129664381718
v -0.2620654518979459 1.3957442061286076 0.284527879789462
v -0.20139872286954744 1.389485467634939 0.32349211851139514
v -0.1488091510125688 1.3781207203872883 0.3200274224926117
v -0.13158193764344558 1.4250679750579258 0.2807314628260412
v -0.11595643515633988 1.4245682404098425 0.22163997660384924
v -0.20627424326148192 1.4124911965266467 0.18741680061016427
v -0.26445442393150115 1.400769211913228 0.22122294388061534
v -0.2872685557740087 1.406883382542881 0.2444293361608223
v -0.2899360821624794 1.3935839799698049 0.29084828102857163
v -0.21178559249014803 1.3994915112001476 0.34039022323541024
v -0.1429001429580068 1.3993976870289333 0.3353182110462305
v -0.2857648326576529 1.5187468359348737 0.3082338172397895
v -0.27727616014547757 1.530338168645061 0.2625549569640586
v -0.3334604957630521 1.4880341091190048 0.23308840213734724
v -0.36604087340725666 1.453055527215242 0.25713264595649266
v -0.3828999421792846 1.4454714177478138 0.2753297576919234
v -0.37751818239371726 1.4313472154601539 0.31006947817311087
v -0.32631523474701046 1.4631317857783432 0.35061576401157374
v -0.2807143588260308 1.4921408310497963 0.34796225284311
v -0.359718447897886 1.5667423492396997 0.3249332982344497
v -0.35604269069748223 1.5843518466712045 0.27844553809784006
v -0.3980451782163092 1.5262919573931168 0.24430381106553892
v -0.4181656377402749 1.4792909565111614 0.2664080870596363
v -0.43194785784379036 1.4648905070555227 0.2846242013341748
v -0.42130540631457 1.4501970581589543 0.31964088446057193
v -0.3805277869148768 1.4954324349453687 0.3644531272029499
v -0.34517821394105 1.5392865146237846 0.36417365388479916
v -0.525253166509216 1.5797756350730938 0.3618339573500447
v -0.5427781715907363 1.600035553232815 0.32113583567835097
v -0.5227646170883478 1.5418236240694803 0.27390553690397157
v -0.4933105257778895 1.4972331194307962 0.2843137977922944
v -0.48710328833367594 1.4754098821989285 0.2977991260001166
v -0.46547571828721857 1.4702527709605107 0.3292892793473014
v -0.474604834039762 1.518936744884534 0.3841417968234773
v -0.4907531253963674 1.570392934863122 0.3952265040148293
v -0.6190130970388793 1.5696558595459142 0.38003232814495125
v -0.6355019539055907 1.585899126949611 0.3462181836390502
v -0.6139504237029327 1.5398059391590697 0.3053658122107581
v -0.5784210799208646 1.4868135510777596 0.32414429004118506
v -0.5598034658588011 1.483728452273698 0.350505735413888
v -0.5714200313571158 1.5226275895992984 0.3975745784787094
v -0.5892615137516267 1.5640904735931778 0.40790221218885614
v -0.7207897200255293 1.5567789987446936 0.40116346301661054
v -0.7290467383099924 1.5726640148199242 0.3702920060376821
v -0.7270750137803762 1.525483825821082 0.33867446181335653
v -0.71560668386606 1.4727027815509461 0.3595899705139178
v -0.7013827394050692 1.4661328607881354 0.38307846161479897
v -0.6976434083183529 1.504754391368148 0.4208247199303316
v -0.6983812574358621 1.5446905536547915 0.42637673695906997
v -0.9070526524958897 1.4960808856355494 0.4172580276830761
v -0.8863039803791803 1.474513559264521 0.3901551190206042
v -0.8554404727488869 1.4489886081267185 0.39960983011290785
v -0.8436098200111913 1.4494922096871927 0.415802278250204
v -0.875124048994981 1.4891447909953186 0.4545401079578815
v -0.9884730850864034 1.4369108601544263 0.4354713488045925
v -1.0097509656761623 1.402303016901423 0.41539549299271056
v -1.0261663143967716 1.3653907886614334 0.43778258638601936
v -1.0193881127383304 1.3571557442500386 0.4576102108491951
v -0.9801045292318034 1.4108781558731749 0.4839256718868889
v -1.0646015617123321 1.3754696203441494 0.4676547749135673
f 1 2 3
f 4 5 3
f 4 3 2
f 9 10 7
f 10 8 7
f 11 12 9
f 12 10 9
f 12 11 13
f 1 3 14
f 10 16 15
f 10 15 8
f 12 17 16
f 12 16 10
f 17 12 13
f 21 22 20
f 21 20 19
f 23 24 22
f 23 22 21
f 25 26 23
f 26 24 23
f 27 28 25
f 28 26 25
f 22 31 20
f 31 30 20
f 24 32 22
f 32 31 22
f 26 33 32
f 26 32 24
f 28 34 33
f 28 33 26
f 31 37 30
f 37 36 30
f 32 38 31
f 38 37 31
f 33 39 38
f 33 38 32
f 34 40 39
f 34 39 33
f 18 35 42
f 36 43 35
f 43 42 35
f 37 44 36
f 44 43 36
f 38 45 37
f 45 44 37
f 39 46 45
f 39 45 38
f 40 47 46
f 40 46 39
f 41 48 47
f 41 47 40
f 48 41 29
f 51 23 21
f 52 25 51
f 25 23 51
f 53 27 52
f 27 25 52
f 18 42 55
f 43 56 42
f 56 55 42
f 44 57 43
f 57 56 43
f 45 58 44
f 58 57 44
f 46 59 58
f 46 58 45
f 47 60 59
f 47 59 46
f 48 61 60
f 48 60 47
f 61 48 29
f 63 64 62
f 65 66 64
f 65 64 63
f 67 68 66
f 67 66 65
f 69 70 67
f 70 68 67
f 71 72 69
f 72 70 69
f 73 72 71
f 64 74 62
f 66 75 64
f 75 74 64
f 68 76 66
f 76 75 66
f 70 77 76
f 70 76 68
f 72 78 77
f 72 77 70
f 73 78 72
f 81 65 63
f 81 63 80
f 82 67 65
f 82 65 81
f 83 69 82
f 69 67 82
f 84 71 83
f 71 69 83
f 86 80 79
f 87 81 80
f 87 80 86
f 88 82 81
f 88 81 87
f 89 83 88
f 83 82 88
f 90 84 89
f 84 83 89
f 85 84 90
f 57 87 86
f 57 86 56
f 58 88 87
f 58 87 57
f 59 89 58
f 89 88 58
f 60 90 59
f 90 89 59
f 75 93 74
f 93 92 74
f 76 94 75
f 94 93 75
f 77 95 94
f 77 94 76
f 78 96 95
f 78 95 77
f 18 91 98
f 92 99 91
f 99 98 91
f 93 100 92
f 100 99 92
f 94 101 93
f 101 100 93
f 95 102 101
f 95 101 94
f 96 103 102
f 96 102 95
f 97 104 103
f 97 103 96
f 104 97 29
f 14 105 106
f 14 106 1
f 16 109 15
f 17 110 16
f 110 109 16
f 13 111 17
f 111 110 17
f 112 2 1
f 112 1 106
f 113 4 2
f 113 2 112
f 114 4 113
f 116 11 115
f 11 9 115
f 111 13 116
f 13 11 116
f 117 118 119
f 117 119 120
f 121 122 118
f 121 118 117
f 123 124 122
f 123 122 121
f 108 125 124
f 108 124 123
f 126 127 108
f 127 125 108
f 128 129 126
f 129 127 126
f 130 131 128
f 131 129 128
f 132 133 130
f 133 131 130
f 134 135 120
f 134 120 119
f 136 137 135
f 136 135 134
f 143 144 141
f 144 142 141
f 133 132 143
f 132 144 143
f 118 145 146
f 118 146 119
f 122 147 145
f 122 145 118
f 124 147 122
f 129 149 127
f 131 150 129
f 150 149 129
f 133 151 131
f 151 150 131
f 152 134 119
f 152 119 146
f 153 136 134
f 153 134 152
f 155 143 154
f 143 141 154
f 151 133 155
f 133 143 155
f 156 157 158
f 157 159 158
f 148 162 161
f 163 162 148
f 167 168 166
f 167 166 165
f 169 170 159
f 170 158 159
f 171 172 169
f 172 170 169
f 173 172 171
f 176 177 175
f 178 179 177
f 178 177 176
f 168 167 179
f 168 179 178
f 180 181 182
f 180 182 183
f 184 181 180
f 187 188 186
f 189 190 187
f 190 188 187
f 191 192 183
f 191 183 182
f 193 194 192
f 193 192 191
f 200 201 198
f 201 199 198
f 190 189 200
f 189 201 200
f 202 203 204
f 202 204 205
f 206 207 203
f 206 203 202
f 211 212 209
f 212 210 209
f 213 214 211
f 214 212 211
f 215 216 205
f 215 205 204
f 217 218 216
f 217 216 215
f 224 225 222
f 225 223 222
f 214 213 224
f 213 225 224
f 226 227 228
f 226 228 229
f 230 231 227
f 230 227 226
f 232 233 231
f 232 231 230
f 208 51 233
f 208 233 232
f 235 236 234
f 237 238 235
f 238 236 235
f 239 240 237
f 240 238 237
f 241 242 229
f 241 229 228
f 240 239 245
f 239 246 245
f 242 215 229
f 215 204 229
f 243 217 242
f 217 215 242
f 246 224 222
f 246 222 244
f 239 214 224
f 239 224 246
f 203 226 204
f 226 229 204
f 207 230 203
f 230 226 203
f 232 230 207
f 210 235 234
f 212 237 235
f 212 235 210
f 214 239 237
f 214 237 212
f 216 247 205
f 247 248 205
f 218 249 216
f 249 247 216
f 219 250 218
f 250 249 218
f 220 251 219
f 251 250 219
f 221 252 251
f 221 251 220
f 223 253 252
f 223 252 221
f 225 254 253
f 225 253 223
f 213 255 254
f 213 254 225
f 256 202 248
f 202 205 248
f 257 206 256
f 206 202 256
f 259 211 209
f 259 209 258
f 255 213 211
f 255 211 259
f 247 191 182
f 247 182 248
f 249 193 191
f 249 191 247
f 250 193 249
f 253 198 252
f 254 200 253
f 200 198 253
f 255 190 254
f 190 200 254
f 181 256 248
f 181 248 182
f 190 255 188
f 255 259 188
f 192 169 183
f 169 159 183
f 194 171 192
f 171 169 192
f 196 174 195
f 197 174 196
f 201 178 176
f 201 176 199
f 189 168 178
f 189 178 201
f 157 180 159
f 180 183 159
f 184 180 157
f 166 187 186
f 168 189 187
f 168 187 166
f 170 152 158
f 152 146 158
f 172 153 170
f 153 152 170
f 174 139 173
f 175 139 174
f 179 155 154
f 179 154 177
f 167 151 155
f 167 155 179
f 145 156 146
f 156 158 146
f 147 160 145
f 160 156 145
f 161 160 147
f 149 164 163
f 150 165 164
f 150 164 149
f 151 167 165
f 151 165 150
f 135 112 120
f 112 106 120
f 137 113 135
f 113 112 135
f 138 114 137
f 114 113 137
f 144 116 115
f 144 115 142
f 132 111 116
f 132 116 144
f 105 117 106
f 117 120 106
f 107 121 105
f 121 117 105
f 123 121 107
f 109 128 126
f 110 130 128
f 110 128 109
f 111 132 130
f 111 130 110
f 29 240 245
f 29 245 104
f 241 98 99
f 228 18 98
f 228 98 241
f 236 53 52
f 238 54 53
f 238 53 236
f 240 29 54
f 240 54 238
f 50 231 233
f 49 227 231
f 49 231 50
f 18 228 227
f 18 227 49
f 8 6 7
f 7 6 5
f 114 7 4
f 7 114 138
f 139 7 138
f 140 7 139
f 7 5 4
f 18 49 35
f 20 30 35
f 30 36 35
f 19 20 35
f 50 19 35
f 50 35 49
f 41 34 28
f 41 40 34
f 41 54 29
f 41 27 53
f 41 28 27
f 54 41 53
f 18 79 62
f 80 63 62
f 80 62 79
f 73 71 84
f 73 85 29
f 85 73 84
f 18 55 79
f 56 86 79
f 56 79 55
f 85 90 60
f 85 61 29
f 61 85 60
f 18 62 91
f 74 91 62
f 74 92 91
f 73 97 78
f 97 73 29
f 97 96 78
f 115 9 7
f 142 115 7
f 142 7 140
f 138 137 136
f 141 142 140
f 173 171 194
f 174 173 195
f 195 173 194
f 197 175 174
f 199 176 175
f 199 175 197
f 195 194 193
f 250 195 193
f 251 196 195
f 251 195 250
f 197 196 251
f 198 199 197
f 198 197 252
f 252 197 251
f 219 218 217
f 219 217 243
f 222 223 221
f 244 222 221
f 243 242 241
f 241 99 243
f 243 99 100
f 245 246 244
f 104 245 244
f 104 244 103
f 185 208 232
f 234 208 185
f 184 257 181
f 257 256 181
f 188 258 186
f 188 259 258
f 160 184 156
f 184 157 156
f 165 186 164
f 165 166 186
f 124 161 147
f 125 161 124
f 125 148 161
f 127 163 125
f 149 163 127
f 163 148 125
f 109 126 15
f 234 52 208
f 236 52 234
f 52 51 208
f 233 21 19
f 51 21 233
f 233 19 50
f 138 136 153
f 138 153 172
f 139 138 173
f 173 138 172
f 175 140 139
f 154 141 140
f 177 154 140
f 177 140 175
f 100 219 243
f 101 220 100
f 220 219 100
f 102 220 101
f 103 244 102
f 244 221 102
f 102 221 220
f 269 260 277
f 270 277 260
f 260 261 270
f 261 262 270
f 271 270 262
f 262 263 271
f 263 264 271
f 272 271 264
f 264 265 272
f 273 272 265
f 265 266 273
f 274 273 266
f 266 267 274
f 275 274 267
f 276 275 267
f 267 268 276
f 268 269 276
f 277 276 269
f 277 270 285
f 278 285 270
f 270 271 279
f 279 278 270
f 271 272 279
f 280 279 272
f 272 273 280
f 281 280 273
f 273 274 281
f 282 281 274
f 274 275 282
f 283 282 275
f 275 276 284
f 284 283 275
f 276 277 285
f 285 284 276
f 285 278 293
f 286 293 278
f 278 279 287
f 287 286 278
f 279 280 287
f 288 287 280
f 280 281 288
f 289 288 281
f 281 282 289
f 290 289 282
f 282 283 291
f 291 290 282
f 283 284 292
f 292 291 283
f 284 285 293
f 293 292 284
f 293 286 301
f 294 301 286
f 286 287 295
f 295 294 286
f 287 288 296
f 296 295 287
f 288 289 297
f 297 296 288
f 289 290 297
f 298 297 290
f 290 291 299
f 299 298 290
f 291 292 299
f 300 299 292
f 292 293 300
f 301 300 293
f 301 294 308
f 302 308 294
f 294 295 302
f 303 302 295
f 295 296 304
f 304 303 295
f 297 298 305
f 298 299 306
f 306 305 298
f 299 300 306
f 307 306 300
f 300 301 307
f 308 307 301
f 308 302 315
f 309 315 302
f 302 303 309
f 310 309 303
f 303 304 311
f 311 310 303
f 305 306 313
f 313 312 305
f 306 307 313
f 314 313 307
f 307 308 314
f 315 314 308
f 315 309 320
f 309 310 316
f 310 311 317
f 317 316 310
f 312 313 319
f 319 318 312
f 313 314 319
f 316 317 321
f 322 321 317
f 318 319 324
f 324 323 318
f 321 322 326
f 323 324 326
f 108 261 260
f 260 126 108
f 123 262 261
f 261 108 123
f 123 107 263
f 262 123 263
f 5 6 266
f 265 5 266
f 6 8 267
f 266 6 267
f 15 268 267
f 267 8 15
f 268 15 269
f 126 260 269
f 15 126 269
f 185 206 257
f 185 207 206
f 185 232 207
f 162 257 184
f 162 184 160
f 162 185 257
f 161 162 160
f 186 258 162
f 164 186 162
f 164 162 163
f 258 185 162
f 258 209 185
f 210 234 185
f 209 210 185
f 5 264 3
f 264 5 265
f 264 14 3
f 264 105 14
f 264 107 105
f 263 107 264
f 296 297 305
f 305 304 296
f 304 305 312
f 312 311 304
f 316 320 309
f 320 316 321
f 311 312 317
f 318 317 312
f 320 319 314
f 314 315 320
f 321 325 320
f 325 321 326
f 323 322 317
f 322 323 326
f 317 318 323
f 319 320 325
f 325 324 319
f 324 325 326
#sl -0.2994557099206982 1.3807141495295285 0.1964113386009258 -0.302547238464886 1.373735680583609 0.19611437077175256 1
#sl -0.302547238464886 1.373735680583609 0.19611437077175256 -0.3179173731405764 1.2880726694675424 0.22109901809873245 393
#sl -0.3179173731405764 1.2880726694675424 0.22109901809873245 -0.33269387363748953 1.3173571057934743 0.24046038340901854 388
#sl -0.33269387363748953 1.3173571057934743 0.24046038340901854 -0.33188433558688585 1.3297490374664154 0.28937428962385114 387
#se 259 260 260 261 261 262 262 263 263 264 264 265 265 266 266 267 267 268 268 259

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,426 @@
v 48.8 -41.5 7.3
v 8.1 -52.8 -15.4
v 0 -51.2 7.3
v 48.8 -43.1 -20.3
v 14.6 -52.8 -23.6
v 29.3 -49.6 17.1
v 0 -54.5 -13.8
v 0 -44.7 30.1
v -14.6 -54.5 -23.6
v -48.8 -43.1 -20.3
v -8.1 -52.8 -15.4
v -48.8 -41.5 7.3
v -29.3 -49.6 17.1
v 47.2 -28.5 77.2
v 19.5 -46.3 38.2
v 0 -38.2 83.7
v 66.7 -8.9 15.4
v 0 -46.3 38.2
v -19.5 -46.3 38.2
v -47.2 -28.5 77.2
v -66.7 -8.9 15.4
v 19.5 -46.3 38.2
v 39 -57.7 23.6
v 0 -82.1 26.8
v 66.7 -8.9 15.4
v 0 -44.7 30.1
v 0 -46.3 38.2
v -39 -59.3 23.6
v -19.5 -46.3 38.2
v -66.7 -8.9 15.4
v -19.5 -46.3 38.2
v 0 -46.3 38.2
v 30.9 77.2 -44.7
v 63.4 39.8 -49.6
v 58.5 48 -26.8
v 0 77.2 -44.7
v 0 67.5 -61
v 14.6 78.9 -59.3
v 35.8 88.6 -65.9
v 39 57.7 -62.6
v 27.6 69.1 -77.2
v 0 51.2 -70.7
v 0 43.1 -75.6
v 39 57.7 -62.6
v 0 43.1 -75.6
v -58.5 48 -26.8
v -63.4 39.8 -49.6
v -30.9 77.2 -44.7
v -16.3 78.9 -59.3
v -39 57.7 -62.6
v -35.8 88.6 -65.9
v -27.6 69.1 -77.2
v -39 57.7 -62.6
v 0 -67.5 -12.2
v 19.5 -72.4 -20.3
v 0 -87 -12.2
v 19.5 -91.9 -20.3
v 22.8 -93.5 -38.2
v 22.8 -72.4 -38.2
v 19.5 -72.4 -52.8
v 19.5 -93.5 -52.8
v 0 -90.2 -64.2
v 0 -72.4 -64.2
v 0 -98.4 -23.6
v 0 -100 -46.3
v 8.1 -52.8 -15.4
v 14.6 -52.8 -23.6
v 21.1 -57.7 -36.6
v 16.3 -57.7 -52.8
v 0 -57.7 -61
v 0 -54.5 -13.8
v -17.9 -93.5 -20.3
v -17.9 -72.4 -20.3
v -22.8 -93.5 -38.2
v -22.8 -72.4 -38.2
v -19.5 -93.5 -52.8
v -19.5 -72.4 -52.8
v -14.6 -54.5 -23.6
v -8.1 -52.8 -15.4
v -21.1 -57.7 -36.6
v -16.3 -57.7 -52.8
v 65 20.3 -7.3
v 66.7 -8.9 15.4
v 73.2 17.1 39.8
v 47.2 -28.5 77.2
v 60.2 -18.7 -23.6
v 66.7 26.8 -33.3
v 61.8 10.6 -62.6
v 52 -18.7 -59.3
v 48.8 -41.5 7.3
v 53.7 -44.7 -26.8
v 37.4 -52.8 -59.3
v 0 -23.6 -85.4
v 48.8 -43.1 -20.3
v 76.4 28.5 -46.3
v 78 33.3 -22
v 63.4 39.8 -49.6
v 58.5 48 -26.8
v 0 -51.2 -69.1
v 14.6 -52.8 -23.6
v 21.1 -57.7 -36.6
v 30.9 -54.5 -43.1
v 16.3 -57.7 -52.8
v 0 -57.7 -61
v 29.3 -49.6 17.1
v 0 -44.7 30.1
v 30.9 98.4 -33.3
v 71.5 49.6 2.4
v 32.5 100 -5.7
v 30.9 70.7 20.3
v 43.9 43.1 41.5
v 21.1 12.2 85.4
v 0 -38.2 83.7
v 30.9 77.2 -44.7
v 0 43.1 -75.6
v 0 12.2 85.4
v 0 43.1 41.5
v 0 70.7 20.3
v 0 100 -5.7
v 0 98.4 -33.3
v 0 77.2 -44.7
v -73.2 15.4 39.8
v -66.7 -8.9 15.4
v -65 20.3 -7.3
v -47.2 -28.5 77.2
v -60.2 -18.7 -23.6
v -66.7 25.2 -33.3
v -63.4 10.6 -62.6
v -52 -18.7 -59.3
v -48.8 -41.5 7.3
v -53.7 -44.7 -26.8
v -37.4 -52.8 -59.3
v -48.8 -43.1 -20.3
v -76.4 28.5 -46.3
v -78 31.7 -22
v -63.4 39.8 -49.6
v -58.5 48 -26.8
v -21.1 -57.7 -36.6
v -14.6 -54.5 -23.6
v -30.9 -54.5 -43.1
v -16.3 -57.7 -52.8
v -29.3 -49.6 17.1
v -32.5 100 -5.7
v -71.5 49.6 2.4
v -32.5 98.4 -33.3
v -32.5 70.7 20.3
v -43.9 43.1 41.5
v -21.1 12.2 85.4
v -30.9 77.2 -44.7
v 6.5 -54.5 -75.6
v 0 -56.1 -72.4
v 0 -62.6 -61
v 13 -62.6 -59.3
v 13 -54.5 -75.6
v 21.1 -57.7 -72.4
v 26 -62.6 -54.5
v 27.6 -56.1 -72.4
v 34.1 -57.7 -70.7
v 37.4 -59.3 -64.2
v 45.5 -57.7 -59.3
v 30.9 -62.6 -46.3
v 50.4 -57.7 -49.6
v 48.8 -59.3 -41.5
v 35.8 -62.6 -35
v -6.5 -54.5 -75.6
v -13 -62.6 -59.3
v -13 -54.5 -75.6
v -21.1 -57.7 -72.4
v -27.6 -56.1 -72.4
v -26 -62.6 -54.5
v -34.1 -57.7 -70.7
v -37.4 -59.3 -64.2
v -45.5 -59.3 -59.3
v -30.9 -62.6 -46.3
v -50.4 -59.3 -49.6
v -48.8 -59.3 -41.5
v -34.1 -62.6 -35
usemtl rgb(0,0,0)
f 3 2 1
f 5 4 2
f 4 1 2
f 1 6 3
f 11 3 12
f 11 10 9
f 12 10 11
f 13 12 3
usemtl rgb(226,144,144)
f 7 2 3
f 8 3 6
f 3 11 7
f 13 3 8
usemtl rgb(255,0,0)
f 16 15 14
f 14 15 17
f 16 18 15
f 20 19 16
f 21 19 20
f 19 18 16
f 24 23 22
f 23 25 22
f 26 23 24
f 26 25 23
f 24 22 27
f 29 28 24
f 29 30 28
f 24 28 26
f 28 30 26
f 32 31 24
usemtl rgb(128,50,8)
f 35 34 33
f 33 37 36
f 38 37 33
f 33 40 39
f 39 40 41
f 41 38 39
f 37 38 41
f 41 42 37
f 34 40 33
f 41 43 42
f 43 41 44
f 34 45 40
f 38 33 39
f 48 47 46
f 36 37 48
f 48 37 49
f 51 50 48
f 52 50 51
f 51 49 52
f 52 49 37
f 37 42 52
f 48 50 47
f 42 43 52
f 53 52 43
f 50 45 47
f 51 48 49
usemtl rgb(226,144,144)
f 56 55 54
f 57 55 56
f 57 58 55
f 58 59 55
f 58 60 59
f 61 60 58
f 61 62 60
f 62 63 60
f 65 58 64
f 64 58 57
f 58 65 61
f 65 62 61
f 64 57 56
f 55 66 54
f 55 67 66
f 55 68 67
f 59 68 55
f 59 60 68
f 60 69 68
f 60 63 69
f 63 70 69
f 54 66 71
f 73 72 56
f 54 73 56
f 73 74 72
f 73 75 74
f 77 76 74
f 75 77 74
f 77 62 76
f 77 63 62
f 74 65 64
f 74 64 72
f 76 65 74
f 76 62 65
f 56 72 64
f 79 78 73
f 79 73 54
f 78 80 73
f 73 80 75
f 80 77 75
f 80 81 77
f 81 63 77
f 81 70 63
f 71 79 54
usemtl rgb(255,0,0)
f 84 83 82
f 85 83 84
usemtl rgb(226,144,144)
f 83 86 82
f 86 87 82
f 86 88 87
f 86 89 88
f 90 86 83
f 86 91 89
f 91 92 89
f 92 93 89
f 89 93 88
f 94 91 86
f 90 94 86
f 87 88 95
f 96 87 95
f 82 87 96
f 95 97 96
f 96 97 98
f 82 96 98
f 95 88 97
f 92 99 93
f 101 91 100
f 101 102 91
f 102 92 91
f 92 102 103
f 101 103 102
f 103 99 92
f 103 104 99
f 100 91 94
f 105 90 83
f 83 106 105
usemtl rgb(255,0,0)
f 109 108 107
f 109 110 108
f 111 84 108
f 110 111 108
f 111 112 84
f 113 85 112
f 85 84 112
f 108 82 98
f 108 84 82
f 98 114 107
f 108 98 107
usemtl rgb(226,144,144)
f 88 93 115
f 88 115 97
usemtl rgb(255,0,0)
f 112 116 113
f 112 117 116
f 112 111 117
f 111 118 117
f 111 110 118
f 110 109 118
f 109 119 118
f 109 120 119
f 109 107 120
f 114 121 107
f 121 120 107
f 124 123 122
f 122 123 125
usemtl rgb(226,144,144)
f 124 126 123
f 124 127 126
f 127 128 126
f 128 129 126
f 123 126 130
f 129 131 126
f 129 132 131
f 129 93 132
f 128 93 129
f 126 131 133
f 126 133 130
f 134 128 127
f 134 127 135
f 135 127 124
f 137 136 135
f 136 134 135
f 137 135 124
f 136 128 134
f 93 99 132
f 139 131 138
f 131 140 138
f 131 132 140
f 138 140 141
f 132 141 140
f 132 99 141
f 99 104 141
f 133 131 139
f 123 130 142
f 142 106 123
usemtl rgb(255,0,0)
f 145 144 143
f 144 146 143
f 144 147 146
f 122 147 144
f 122 148 147
f 148 125 113
f 148 122 125
f 137 124 144
f 124 122 144
f 145 137 144
f 149 137 145
usemtl rgb(226,144,144)
f 115 93 128
f 136 115 128
usemtl rgb(255,0,0)
f 113 116 148
f 116 117 148
f 117 147 148
f 117 118 147
f 118 146 147
f 118 143 146
f 118 119 143
f 119 120 143
f 120 145 143
f 145 121 149
f 145 120 121
usemtl rgb(128,50,8)
f 152 151 150
f 150 153 152
f 150 154 153
f 154 155 153
f 157 156 153
f 153 155 157
f 157 158 156
f 158 159 156
f 159 160 156
f 160 161 156
f 160 162 161
f 162 163 161
f 163 164 161
f 165 151 152
f 152 166 165
f 166 167 165
f 166 168 167
f 166 170 169
f 169 168 166
f 170 171 169
f 170 172 171
f 170 173 172
f 170 174 173
f 174 175 173
f 174 176 175
f 174 177 176

View File

@@ -0,0 +1,655 @@
v 3.6 97 -12.4
v 3.5 97 -11.7
v 3.5 97 -13.2
v 3.2 97 -11
v 3.2 97 -13.9
v 2.8 97 -10.4
v 2.8 97 -14.5
v 2.1 97 -9.9
v 2.1 97 -15
v 1.4 97 -9.6
v 1.4 97 -15.3
v 0.7 97 -9.5
v 0.7 97 -15.4
v -0.1 97 -9.6
v -0.1 97 -15.3
v -0.8 97 -9.9
v -0.8 97 -15
v -1.4 97 -10.4
v -1.4 97 -14.5
v -1.9 97 -11
v -1.9 97 -13.9
v -2.2 97 -11.7
v -2.2 97 -13.2
v -2.3 97 -12.4
v 3.6 0.2 -12.4
v 3.5 0.2 -11.7
v 3.5 0.2 -13.2
v 3.2 0.2 -11
v 3.2 0.2 -13.9
v 2.8 0.2 -10.4
v 2.8 0.2 -14.5
v 2.1 0.2 -9.9
v 2.1 0.2 -15
v 1.4 0.2 -9.6
v 1.4 0.2 -15.3
v 0.7 0.2 -9.5
v 0.7 0.2 -15.4
v -0.1 0.2 -9.6
v -0.1 0.2 -15.3
v -0.8 0.2 -9.9
v -0.8 0.2 -15
v -1.4 0.2 -10.4
v -1.4 0.2 -14.5
v -1.9 0.2 -11
v -1.9 0.2 -13.9
v -2.2 0.2 -11.7
v -2.2 0.2 -13.2
v -2.3 0.2 -12.4
v 14.9 94 -12.5
v 14.9 94.1 -11.7
v 14.9 94.1 -13.2
v 14.9 94.4 -11
v 14.9 94.4 -13.9
v 14.9 94.8 -10.4
v 14.9 94.8 -14.6
v 14.9 95.5 -9.9
v 14.9 95.5 -15
v 14.9 96.2 -9.6
v 14.9 96.2 -15.3
v 14.9 97 -9.5
v 14.9 97 -15.4
v 14.9 97.8 -9.6
v 14.9 97.8 -15.3
v 14.9 98.5 -9.9
v 14.9 98.5 -15
v 14.9 99.1 -10.4
v 14.9 99.1 -14.6
v 14.9 99.6 -11
v 14.9 99.6 -13.9
v 14.9 99.9 -11.7
v 14.9 99.9 -13.2
v 14.9 100 -12.5
v -14.1 94 -12.5
v -14.1 94.1 -11.7
v -14.1 94.1 -13.2
v -14.1 94.4 -11
v -14.1 94.4 -13.9
v -14.1 94.8 -10.4
v -14.1 94.8 -14.6
v -14.1 95.5 -9.9
v -14.1 95.5 -15
v -14.1 96.2 -9.6
v -14.1 96.2 -15.3
v -14.1 97 -9.5
v -14.1 97 -15.4
v -14.1 97.8 -9.6
v -14.1 97.8 -15.3
v -14.1 98.5 -9.9
v -14.1 98.5 -15
v -14.1 99.1 -10.4
v -14.1 99.1 -14.6
v -14.1 99.6 -11
v -14.1 99.6 -13.9
v -14.1 99.9 -11.7
v -14.1 99.9 -13.2
v -14.1 100 -12.5
v 14.9 94 -12.5
v 14.9 94.1 -11.7
v 14.9 94.1 -13.2
v 14.9 94.4 -11
v 14.9 94.4 -13.9
v 14.9 94.8 -10.4
v 14.9 94.8 -14.6
v 14.9 95.5 -9.9
v 14.9 95.5 -15
v 14.9 96.2 -9.6
v 14.9 96.2 -15.3
v 14.9 97 -9.5
v 14.9 97 -12.5
v 14.9 97 -15.4
v 14.9 97.8 -9.6
v 14.9 97.8 -15.3
v 14.9 98.5 -9.9
v 14.9 98.5 -15
v 14.9 99.1 -10.4
v 14.9 99.1 -14.6
v 14.9 99.6 -11
v 14.9 99.6 -13.9
v 14.9 99.9 -11.7
v 14.9 99.9 -13.2
v 14.9 100 -12.5
v -14.1 94 -12.5
v -14.1 94.1 -11.7
v -14.1 94.1 -13.2
v -14.1 94.4 -11
v -14.1 94.4 -13.9
v -14.1 94.8 -10.4
v -14.1 94.8 -14.6
v -14.1 95.5 -9.9
v -14.1 95.5 -15
v -14.1 96.2 -9.6
v -14.1 96.2 -15.3
v -14.1 97 -9.5
v -14.1 97 -15.4
v -14.1 97.8 -9.6
v -14.1 97.8 -15.3
v -14.1 98.5 -9.9
v -14.1 98.5 -15
v -14.1 99.1 -10.4
v -14.1 99.1 -14.6
v -14.1 99.6 -11
v -14.1 99.6 -13.9
v -14.1 99.9 -11.7
v -14.1 99.9 -13.2
v -14.1 100 -12.5
v -14.1 97.2 -12.5
v 20.9 -38.2 -12.7
v 22.5 -99.9 17.8
v -22.4 -100 17.7
v -20.4 -38.4 -12.7
v -18.2 -38.8 -16
v 18.7 -38.7 -16
v -14.8 -70 -6.9
v -13.6 -71 -8.4
v -12.3 -71.7 -9.5
v 13.1 -71.7 -9.5
v 14.7 -70.8 -8.5
v 15.3 -70.1 -6.6
v -14.2 -54.2 -15.1
v -12.6 -54.7 -16.4
v -10.4 -55.3 -17.3
v 11.8 -55.3 -17.2
v 13.2 -54.8 -16.3
v 14.7 -53.9 -14.5
v -14 -64.7 -11.3
v -12.4 -65.7 -12.8
v -10.4 -66.2 -14.1
v 11.6 -66.2 -13.9
v 13.3 -65.6 -12.9
v 14.7 -64.6 -11.1
v -13.6 -60.3 -13.4
v -11.9 -61.3 -15.3
v -9.9 -61.6 -15.9
v 11.2 -61.6 -16
v 12.9 -61.2 -15.3
v 14.2 -60.1 -13.1
v 22.5 -99.9 17.8
v -22.4 -100 17.7
v 22.5 -99.9 18.8
v -22.5 -99.9 18.7
v -20.4 -38.4 -12.7
v -18.2 -38.8 -16
v -20.4 -38.2 -11.7
v -18.2 -38.7 -15
v -1.9 -38.9 -16.2
v -1.7 -38.8 -15.1
v 3.3 -38.8 -16.2
v 20.9 -38.2 -12.7
v 18.7 -38.7 -16
v 18.7 -38.5 -15.1
v 20.9 -38 -11.8
v 3.1 -38.8 -15.2
v 22.5 -99.9 18.8
v -22.5 -99.9 18.7
v -20.4 -38.2 -11.7
v -18.2 -38.7 -15
v 18.7 -38.5 -15.1
v -14.8 -69.9 -5.9
v -13.6 -70.8 -7.5
v -12.3 -71.5 -8.6
v 13.1 -71.5 -8.6
v 14.7 -70.6 -7.6
v 15.3 -70 -5.7
v -14.2 -54 -14.1
v -12.6 -54.5 -15.4
v -10.4 -55.2 -16.3
v 11.8 -55.1 -16.3
v 13.2 -54.6 -15.3
v 14.7 -53.7 -13.6
v -14 -64.6 -10.4
v -12.4 -65.5 -11.9
v -10.4 -66 -13.1
v 11.6 -66 -13
v 13.3 -65.4 -11.9
v 14.7 -64.5 -10.2
v -13.6 -60.1 -12.5
v -11.9 -61.1 -14.3
v -9.9 -61.4 -14.9
v 11.2 -61.4 -15
v 12.9 -61.1 -14.3
v 14.2 -59.9 -12.2
v 20.9 -38 -11.8
v 3.3 -38.8 -16.2
v 3.2 -38.8 -16.8
v 2.9 -38.8 -17.5
v 2.5 -38.9 -14.3
v 2.5 -38.8 -18
v 2 -38.9 -13.9
v 2 -38.8 -18.4
v 1.3 -38.9 -13.7
v 1.3 -38.8 -18.7
v 0.7 -38.9 -13.6
v 0.7 -38.8 -18.8
v 0 -38.9 -13.7
v 0 -38.8 -18.7
v -0.6 -38.9 -13.9
v -0.6 -38.8 -18.4
v -1.2 -38.9 -14.3
v -1.2 -38.8 -18
v -1.6 -38.8 -17.5
v -1.8 -38.8 -16.8
v 3.7 -25.1 -13.2
v 3.6 -25.1 -12.5
v 3.6 -25.1 -14
v 3.3 -25.1 -11.8
v 3.3 -25.1 -14.7
v 2.8 -25.2 -11.2
v 2.8 -25.1 -15.2
v 2.2 -25.2 -10.7
v 2.2 -25.1 -15.7
v 1.5 -25.2 -10.4
v 1.5 -25.1 -16
v 0.8 -25.2 -10.3
v 0.8 -25.1 -16.1
v 0 -25.2 -10.4
v 0 -25.1 -16
v -0.7 -25.2 -10.7
v -0.7 -25.1 -15.7
v -1.3 -25.2 -11.2
v -1.3 -25.1 -15.2
v -1.7 -25.1 -11.8
v -1.7 -25.1 -14.7
v -2 -25.1 -12.5
v -2 -25.1 -14
v -2.1 -25.1 -13.2
v -2.7 -18.6 -12.4
v -2.6 -18.6 -11.6
v -2.3 -18.6 -10.7
v -1.7 -18.6 -10
v -1 -18.6 -9.4
v -0.2 -18.6 -9.1
v 0.7 -18.6 -9
v 1.6 -18.6 -9.2
v 2.4 -18.6 -9.5
v 3.1 -18.6 -10
v 3.7 -18.6 -10.7
v 4 -18.6 -11.6
v 4.1 -18.6 -12.4
v 4 -18.6 -13.3
v 3.6 -18.6 -14.1
v 3.1 -18.6 -14.8
v 2.4 -18.6 -15.4
v 1.6 -18.6 -15.7
v 0.7 -18.6 -15.8
v -0.2 -18.6 -15.7
v -1 -18.6 -15.4
v -1.7 -18.6 -14.9
v -2.3 -18.6 -14.1
v -2.6 -18.6 -13.3
v 0.9 -55.1 -17.3
v 0.8 -55.1 -16.3
v -1.9 -38.9 -16.2
v -1.7 -38.8 -15.1
v 3.1 -38.8 -15.2
v 4.1 0.2 -12.4
v 4 0.2 -11.6
v 4 0.2 -13.3
v 3.6 0.1 -10.7
v 3.6 0.2 -14.1
v 3.1 0.1 -10
v 3.1 0.2 -14.9
v 2.4 0.1 -9.5
v 2.4 0.2 -15.4
v 1.6 0.1 -9.1
v 1.6 0.3 -15.7
v 0.7 0.1 -9
v 0.7 0.3 -15.9
v -0.2 0.1 -9.1
v -0.2 0.3 -15.7
v -1 0.1 -9.5
v -1 0.2 -15.4
v -1.7 0.1 -10
v -1.7 0.2 -14.9
v -2.3 0.1 -10.7
v -2.3 0.2 -14.1
v -2.6 0.2 -11.6
v -2.6 0.2 -13.3
v -2.8 0.2 -12.4
v 4.1 0.2 -12.4
v 4 0.2 -11.6
v 4 0.2 -13.3
v 3.6 0.1 -10.7
v 3.6 0.2 -14.1
v 3.1 0.1 -10
v 3.1 0.2 -14.9
v 2.4 0.1 -9.5
v 2.4 0.2 -15.4
v 1.6 0.1 -9.1
v 1.6 0.3 -15.7
v 0.7 0.1 -9
v 0.7 0.3 -15.9
v -0.2 0.1 -9.1
v -0.2 0.3 -15.7
v -1 0.1 -9.5
v -1 0.2 -15.4
v -1.7 0.1 -10
v -1.7 0.2 -14.9
v -2.3 0.1 -10.7
v -2.3 0.2 -14.1
v -2.6 0.2 -11.6
v -2.6 0.2 -13.3
v -2.8 0.2 -12.4
v 3.6 0.2 -12.4
v 3.5 0.2 -11.7
v 3.5 0.2 -13.2
v 3.2 0.2 -11
v 3.2 0.2 -13.9
v 2.8 0.2 -10.4
v 2.8 0.2 -14.5
v 2.1 0.2 -9.9
v 2.1 0.2 -15
v 1.4 0.2 -9.6
v 1.4 0.2 -15.3
v 0.7 0.2 -9.5
v 0.7 0.2 -15.4
v -0.1 0.2 -9.6
v -0.1 0.2 -15.3
v -0.8 0.2 -9.9
v -0.8 0.2 -15
v -1.4 0.2 -10.4
v -1.4 0.2 -14.5
v -1.9 0.2 -11
v -1.9 0.2 -13.9
v -2.2 0.2 -11.7
v -2.2 0.2 -13.2
v -2.3 0.2 -12.4
usemtl rgb(204,170,136)
f 22 24 48 46
f 20 22 46 44
f 18 20 44 42
f 16 18 42 40
f 14 16 40 38
f 12 14 38 36
f 10 12 36 34
f 8 10 34 32
f 6 8 32 30
f 4 6 30 28
f 2 4 28 26
f 1 2 26 25
f 3 1 25 27
f 5 3 27 29
f 7 5 29 31
f 9 7 31 33
f 11 9 33 35
f 13 11 35 37
f 15 13 37 39
f 17 15 39 41
f 19 17 41 43
f 21 19 43 45
f 23 21 45 47
f 24 23 47 48
f 63 61 85 87
f 65 63 87 89
f 67 65 89 91
f 69 67 91 93
f 71 69 93 95
f 72 71 95 96
f 70 72 96 94
f 68 70 94 92
f 66 68 92 90
f 64 66 90 88
f 62 64 88 86
f 60 62 86 84
f 58 60 84 82
f 56 58 82 80
f 54 56 80 78
f 52 54 78 76
f 50 52 76 74
f 49 50 74 73
f 51 49 73 75
f 53 51 75 77
f 55 53 77 79
f 57 55 79 81
f 59 57 81 83
f 61 59 83 85
f 109 110 112 114
f 109 114 116 118
f 109 118 120 121
f 109 121 119 117
f 109 117 115 113
f 109 113 111 108
f 109 108 106 104
f 109 104 102 100
f 109 100 98 97
f 109 97 99 101
f 109 101 103 105
f 109 105 107 110
f 134 132 146
f 132 130 146
f 130 128 146
f 128 126 146
f 126 124 146
f 124 122 146
f 122 123 146
f 123 125 146
f 125 127 146
f 127 129 146
f 129 131 146
f 131 133 146
f 133 135 146
f 135 137 146
f 137 139 146
f 139 141 146
f 141 143 146
f 143 145 146
f 145 144 146
f 144 142 146
f 142 140 146
f 140 138 146
f 138 136 146
f 136 134 146
usemtl rgb(204,204,204)
f 160 159 151
f 161 160 151
f 163 162 152
f 165 153 151
f 153 149 151
f 158 148 157
f 164 163 152
f 170 158 157 169
f 156 148 149 155
f 166 154 153 165
f 154 149 153
f 168 156 155 167
f 167 155 154 166
f 155 149 154
f 151 149 150
f 169 157 156 168
f 157 148 156
f 152 158 170
f 152 148 158
f 152 147 148
f 159 171 151
f 171 165 151
f 160 172 171 159
f 172 166 165 171
f 161 173 172 160
f 173 167 166 172
f 174 168 167 173
f 163 175 174 162
f 175 169 168 174
f 164 176 175 163
f 176 170 169 175
f 152 176 164
f 152 170 176
f 195 150 149 194
f 177 179 180 178
f 182 181 183 184
f 148 147 222 193
f 191 188 189 190
f 196 204 205
f 196 205 206
f 197 207 208
f 196 198 210
f 202 193 203
f 197 208 209
f 214 202 203 215
f 200 194 193 201
f 210 198 199 211
f 198 194 199
f 212 200 201 213
f 211 199 200 212
f 199 194 200
f 213 201 202 214
f 201 193 202
f 215 203 197
f 203 193 197
f 193 222 197
f 196 216 204
f 196 210 216
f 204 216 217 205
f 216 210 211 217
f 205 217 218 206
f 217 211 212 218
f 218 212 213 219
f 207 219 220 208
f 219 213 214 220
f 208 220 221 209
f 220 214 215 221
f 209 221 197
f 221 215 197
f 161 151 292
f 196 206 293
f 206 291 293
f 294 207 197
f 294 291 207
f 223 162 290
f 223 152 162
f 290 162 174
f 290 173 161
f 290 174 173
f 291 219 207
f 291 218 219
f 291 206 218
f 192 190 189 187
f 185 182 184 186
f 292 290 161
f 292 241 290
f 194 196 195
f 194 198 196
f 238 293 291
f 236 238 291
f 234 236 291
f 232 234 291
f 230 232 291
f 228 230 291
f 226 228 291
f 294 226 291
f 225 224 290
f 227 225 290
f 229 227 290
f 231 229 290
f 233 231 290
f 235 233 290
f 237 235 290
f 239 237 290
f 240 239 290
f 241 240 290
f 259 261 293 238
f 257 259 238 236
f 255 257 236 234
f 253 255 234 232
f 251 253 232 230
f 249 251 230 228
f 247 249 228 226
f 245 247 226 294
f 244 242 223 224
f 246 244 224 225
f 248 246 225 227
f 250 248 227 229
f 252 250 229 231
f 254 252 231 233
f 256 254 233 235
f 258 256 235 237
f 260 258 237 239
f 262 260 239 240
f 264 262 240 241
f 265 264 241 292
f 267 266 265 263
f 268 267 263 261
f 269 268 261 259
f 270 269 259 257
f 271 270 257 255
f 272 271 255 253
f 273 272 253 251
f 274 273 251 249
f 275 274 249 247
f 276 275 247 245
f 277 276 245 243
f 278 277 243 242
f 279 278 242 244
f 280 279 244 246
f 281 280 246 248
f 282 281 248 250
f 283 282 250 252
f 284 283 252 254
f 285 284 254 256
f 286 285 256 258
f 287 286 258 260
f 288 287 260 262
f 289 288 262 264
f 289 266 318 317
f 342 340 364 366
f 340 338 362 364
f 338 336 360 362
f 336 334 358 360
f 334 332 356 358
f 332 330 354 356
f 330 328 352 354
f 328 326 350 352
f 326 324 348 350
f 324 322 346 348
f 322 320 344 346
f 320 319 343 344
f 319 321 345 343
f 321 323 347 345
f 323 325 349 347
f 325 327 351 349
f 327 329 353 351
f 329 331 355 353
f 331 333 357 355
f 333 335 359 357
f 335 337 361 359
f 337 339 363 361
f 339 341 365 363
f 341 342 366 365
f 267 316 318 266
f 268 314 316 267
f 269 312 314 268
f 270 310 312 269
f 271 308 310 270
f 272 306 308 271
f 273 304 306 272
f 274 302 304 273
f 275 300 302 274
f 276 298 300 275
f 277 296 298 276
f 278 295 296 277
f 279 297 295 278
f 280 299 297 279
f 281 301 299 280
f 282 303 301 281
f 283 305 303 282
f 284 307 305 283
f 285 309 307 284
f 286 311 309 285
f 287 313 311 286
f 288 315 313 287
f 289 317 315 288
f 289 264 265 266
f 293 261 263
f 290 224 223
f 243 245 294
f 242 243 294 223
f 292 293 263 265

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,744 @@
# Viewpoint Datalabs International, Inc. Copyright 1996
mtllib ./vp.mtl
g
v 3.070224 -0.119728 0.996443
v 5.942016 -0.012019 4.157199
v 6.614015 -0.063428 4.157199
v 5.759114 0.000000 1.664500
v 3.070224 -0.449143 0.929434
v 5.000295 -0.539011 1.315104
v 3.070224 -0.604752 0.872464
v 3.070224 -0.866525 0.730690
v 3.070224 -0.959007 0.650256
v 3.070224 -1.053631 0.163277
v 2.983248 -1.080021 -0.880639
v 6.130317 -1.100022 -1.106943
v 3.739287 -4.334102 -0.876958
v 4.400283 -4.682100 -0.952940
v 3.038248 -4.334102 -0.811319
v 3.180259 -4.550090 -0.921939
v 2.700250 -4.334102 -0.947940
v 0.840214 -2.480049 -1.050312
v 1.208789 -1.060728 0.203820
v 1.208789 -1.054148 0.411073
v 1.208789 -0.958092 0.610367
v 1.208789 -0.875165 0.685964
v 1.208789 -0.621528 0.854704
v 1.208789 -0.467365 0.922276
v -4.649089 -1.039587 0.209476
v -4.649345 -0.922345 0.432259
v -4.649708 -0.652575 0.753550
v -4.999902 -1.012545 0.094530
v -4.999240 -0.870266 0.347384
v -4.999321 -0.802315 0.416133
v -4.906714 -0.620194 0.686502
v -4.999759 -0.491153 0.805206
v -5.568033 -0.119200 0.568687
v -5.349121 -0.814175 0.247113
v -5.348800 -0.938377 -0.030175
v -6.499984 -0.676000 -0.433500
v -6.499984 -0.610000 -0.164800
v -6.499984 -0.240000 0.109600
v -7.649984 0.000000 -0.620000
v 1.209237 -1.080021 -1.321617
v 3.070224 0.119728 0.996443
v 3.093016 0.040804 1.276300
v 6.614015 0.063428 4.157199
v 3.070224 0.449143 0.929434
v 5.000295 0.539011 1.315104
v 3.070224 0.604752 0.872464
v 3.070224 0.866525 0.730690
v 5.000295 1.149023 1.260104
v 3.070224 0.959007 0.650256
v 3.070224 1.053627 0.449897
v 5.000295 1.428028 0.442095
v 3.070224 1.053631 0.163277
v 2.983248 1.080021 -0.880639
v 5.000295 1.302926 -1.259946
v 3.739287 4.334102 -0.876958
v 4.400283 4.682100 -0.952940
v 3.038248 4.334102 -0.811319
v 3.180259 4.550090 -0.921939
v 1.209237 1.080021 -0.636414
v 2.700250 4.334102 -0.947940
v 0.169216 1.990039 -1.063281
v 1.208789 1.060728 0.203820
v 1.208789 1.054148 0.411073
v 1.208789 0.958092 0.610367
v 1.208789 0.875165 0.685964
v 1.208789 0.621528 0.854704
v 1.208789 0.467365 0.922276
v -4.649089 1.039587 0.209476
v -4.649345 0.922345 0.432259
v -4.649708 0.652575 0.753550
v -4.649856 0.514670 0.885149
v -4.649964 0.160748 0.994500
v -4.999902 1.012545 0.094530
v -4.999240 0.870266 0.347384
v -4.999321 0.802315 0.416133
v -4.999759 0.491153 0.805206
v -4.999948 0.160720 0.980689
v -5.299752 0.147914 0.811038
v -5.349121 0.814175 0.247113
v -5.348800 0.938377 -0.030175
v -6.499984 0.676000 -0.433500
v -6.499931 0.693962 -0.748535
v -6.499984 0.610000 -0.164800
v -6.499984 0.523000 -0.048800
v -6.499984 0.240000 0.109600
v 1.209237 1.080021 -1.321617
v -5.568033 0.119200 0.568687
v -5.299752 -0.147914 0.811038
v -4.999948 -0.160720 0.980689
v -4.649964 -0.160748 0.994500
v 1.208789 -0.130179 0.996071
v 1.208789 0.130179 0.996071
v 3.093016 -0.040804 1.276300
v 5.942016 0.012019 4.157199
v 7.043714 0.000000 4.157199
v 4.998233 -0.130896 1.193100
v 5.171283 -1.310384 -1.055942
v 6.130317 1.100022 -1.106943
v 2.983248 -1.080021 -1.351649
v 2.983248 1.080021 -1.351649
v -6.499931 -0.693962 -0.748535
v -4.999902 -1.000020 -0.943979
v 0.169216 -1.990039 -1.063281
v 5.000295 -1.510030 0.750093
v 5.000295 -0.874017 1.399122
v 5.000295 -1.149023 1.260104
v 5.000295 0.874017 1.399122
v -7.074984 -0.304058 -0.264426
v -7.074984 0.139529 -0.169387
v -7.074984 0.304058 -0.264426
v -7.074957 0.403450 -0.684268
v -7.074984 0.393008 -0.495246
v -7.074984 0.354637 -0.334026
v -7.074984 0.057454 -0.155083
v -7.074984 -0.354637 -0.334026
v -7.074984 -0.393008 -0.495246
v -7.074957 -0.403450 -0.684268
v -7.074984 -0.139529 -0.169387
v -7.074984 -0.057454 -0.155083
v 5.257180 -0.244260 -0.448877
v 5.275361 -0.389797 -0.446328
v 5.534085 -0.255527 -0.410058
v 5.858724 -0.171973 -0.364548
v 6.246687 -0.127423 -0.310161
v 6.245811 -0.209802 -0.310283
v 5.957494 -0.242908 -0.350702
v 5.684797 -0.367023 -0.388930
v 5.030259 -0.310424 -0.039389
v 5.218888 -0.403501 -0.175729
v 5.254566 -0.476272 -0.297997
v 5.497149 -0.409135 -0.146573
v 5.811742 -0.367356 -0.029404
v 6.194348 -0.345081 0.063191
v 6.203377 -0.386271 -0.007583
v 5.919040 -0.402825 -0.076394
v 5.661265 -0.464884 -0.221067
v 5.030257 -0.815056 -0.039376
v 5.218887 -0.721987 -0.175721
v 5.254566 -0.649223 -0.297993
v 5.497147 -0.716354 -0.146565
v 5.811740 -0.758129 -0.029394
v 6.194347 -0.780403 0.063202
v 6.203376 -0.739216 -0.007574
v 5.919039 -0.722663 -0.076386
v 5.661264 -0.660610 -0.221062
v 5.533661 -0.562752 -0.410117
v 5.257178 -0.881243 -0.448860
v 5.275359 -0.735706 -0.446319
v 5.534083 -0.869976 -0.410042
v 5.858722 -0.953530 -0.364528
v 6.246684 -0.998080 -0.310138
v 6.245809 -0.915701 -0.310265
v 5.957492 -0.882595 -0.350685
v 5.684796 -0.758480 -0.388920
v 5.151601 -0.815102 -0.904963
v 5.295470 -0.722016 -0.722016
v 5.296154 -0.649239 -0.594654
v 5.571022 -0.716382 -0.673535
v 5.905705 -0.758165 -0.699682
v 6.299025 -0.780442 -0.683500
v 6.288245 -0.739248 -0.612975
v 5.995947 -0.722692 -0.625000
v 5.708329 -0.660628 -0.556788
v 5.295474 -0.403530 -0.722041
v 5.296155 -0.476288 -0.594668
v 5.571025 -0.409163 -0.673559
v 5.905710 -0.367392 -0.699712
v 6.299029 -0.345120 -0.683534
v 6.288249 -0.386303 -0.613002
v 5.995951 -0.402854 -0.625025
v 5.708331 -0.464902 -0.556803
v 5.218888 0.403501 -0.175729
v 5.257180 0.244260 -0.448877
v 5.254566 0.476272 -0.297997
v 5.275361 0.389797 -0.446328
v 5.497149 0.409135 -0.146573
v 5.534085 0.255527 -0.410058
v 5.811742 0.367356 -0.029404
v 5.858724 0.171973 -0.364548
v 6.194348 0.345081 0.063191
v 6.246687 0.127423 -0.310161
v 6.203377 0.386271 -0.007583
v 6.245811 0.209802 -0.310283
v 5.919040 0.402825 -0.076394
v 5.957494 0.242908 -0.350702
v 5.661265 0.464884 -0.221067
v 5.684797 0.367023 -0.388930
v 5.218887 0.721987 -0.175721
v 5.254566 0.649223 -0.297993
v 5.497147 0.716354 -0.146565
v 5.811740 0.758129 -0.029394
v 6.194347 0.780403 0.063202
v 6.203376 0.739216 -0.007574
v 5.919039 0.722663 -0.076386
v 5.661264 0.660610 -0.221062
v 5.257178 0.881243 -0.448860
v 5.275359 0.735706 -0.446319
v 5.534083 0.869976 -0.410042
v 5.858722 0.953530 -0.364528
v 6.246684 0.998080 -0.310138
v 6.245809 0.915701 -0.310265
v 5.957492 0.882595 -0.350685
v 5.684796 0.758480 -0.388920
v 5.533661 0.562752 -0.410117
v 5.295470 0.722016 -0.722016
v 5.296154 0.649239 -0.594654
v 5.571022 0.716382 -0.673535
v 5.905705 0.758165 -0.699682
v 6.299025 0.780442 -0.683500
v 6.288245 0.739248 -0.612975
v 5.995947 0.722692 -0.625000
v 5.708329 0.660628 -0.556788
v 5.295474 0.403530 -0.722041
v 5.296155 0.476288 -0.594668
v 5.571025 0.409163 -0.673559
v 5.905710 0.367392 -0.699712
v 6.299029 0.345120 -0.683534
v 6.288249 0.386303 -0.613002
v 5.995951 0.402854 -0.625025
v 5.708331 0.464902 -0.556803
v 5.165639 -0.318491 0.637328
v 5.166101 -0.159250 0.913146
v 4.998497 -0.252327 1.074635
v 5.183997 -0.172954 0.637297
v 5.184248 -0.086480 0.787078
v 5.445252 -0.307224 0.636859
v 5.445698 -0.153617 0.902920
v 5.773065 -0.390779 0.636310
v 5.773632 -0.195395 0.974730
v 6.164821 -0.435329 0.635652
v 6.165453 -0.217671 1.012654
v 6.163937 -0.352950 0.635654
v 6.164450 -0.176480 0.941314
v 5.872800 -0.319843 0.636142
v 5.873264 -0.159926 0.913131
v 5.597437 -0.195729 0.636604
v 5.597722 -0.097867 0.806108
v 5.444824 0.000000 0.636860
v 5.166102 0.159236 0.913155
v 5.184248 0.086472 0.787083
v 5.445698 0.153603 0.902928
v 5.773632 0.195378 0.974740
v 6.165453 0.217651 1.012665
v 6.164450 0.176464 0.941323
v 5.873265 0.159912 0.913140
v 5.597722 0.097858 0.806113
v 5.165639 0.318491 0.637345
v 4.997765 0.504639 0.637636
v 5.183997 0.172954 0.637307
v 5.445252 0.307224 0.636875
v 5.773065 0.390779 0.636330
v 6.164821 0.435329 0.635675
v 6.163937 0.352950 0.635673
v 5.872800 0.319843 0.636159
v 5.597437 0.195729 0.636614
v 5.165176 0.159265 0.361518
v 4.997031 0.252350 0.200598
v 5.183746 0.086488 0.487521
v 5.444806 0.153631 0.370806
v 5.772497 0.195413 0.297899
v 6.164188 0.217691 0.258662
v 6.163424 0.176496 0.330003
v 5.872335 0.159941 0.359162
v 5.597153 0.097876 0.467105
v 5.165176 -0.159221 0.361493
v 4.997031 -0.252281 0.200558
v 5.183746 -0.086464 0.487507
v 5.444806 -0.153589 0.370782
v 5.772497 -0.195360 0.297868
v 6.164188 -0.217631 0.258628
v 6.163424 -0.176448 0.329975
v 5.872335 -0.159897 0.359136
v 5.597153 -0.097850 0.467090
v 5.090927 -1.067391 -0.472156
v 5.171283 1.310384 -1.055942
v 5.151606 0.310470 -0.905003
v 5.151606 -0.310470 -0.905003
v 5.030257 0.815056 -0.039376
v 5.030259 0.310424 -0.039389
v 5.090930 -0.058113 -0.472183
v 5.090930 0.058113 -0.472183
v 5.000295 -1.210004 0.173074
v 5.000295 1.210004 0.173074
v 5.000295 -1.428028 0.442095
v 4.997764 -0.504639 0.637610
v 4.998497 0.252304 1.074648
v 4.998233 0.130896 1.193100
v 5.000295 1.510030 0.750093
v 5.151601 0.815102 -0.904963
v 5.090927 1.067391 -0.472156
v 3.070224 -1.053627 0.449897
v -5.349205 0.737229 0.323968
v -5.349205 -0.737229 0.323968
v -5.349476 -0.470935 0.566062
v -6.499984 -0.098825 0.133439
v -6.499984 0.098825 0.133439
v -6.499984 -0.523000 -0.048800
v -5.349476 0.470935 0.566062
v -4.999902 1.000020 -0.943979
v 0.840214 2.480049 -1.050312
v 1.209237 -1.080021 -0.636414
v 3.804262 4.682100 -0.938960
v 5.000295 -1.302926 -1.259946
v 3.804262 -4.682100 -0.938960
v -4.649856 -0.514670 0.885149
v -4.999492 0.681710 0.569242
v -4.649417 0.860391 0.497003
v -4.906714 0.620194 0.686502
v -4.649417 -0.860391 0.497003
v -4.999492 -0.681710 0.569242
# 310 vertices
# 0 vertex parms
# 0 texture vertices
# 0 normals
g windows
usemtl glass
s 1
f 310 32 294
f 76 308 306
f 294 88 33
f 310 31 32
f 88 294 32
f 87 33 88 78
f 87 78 298
f 298 76 306
f 298 78 76
g tail
usemtl bone
s 4
f 95 3 96 4
f 4 287 43 95
f 94 2 3 43
f 3 2 93 96
f 41 1 93 42
f 41 42 287
f 43 3 95
f 287 42 94 43
f 42 93 2 94
f 96 93 1
g rearbody
s 6
f 275 98 54
f 96 223 286 287
f 97 277 155
f 276 281 280 277
f 276 275 289
f 283 282 128 279
f 283 290 275
f 257 51 248
f 282 303 97
f 96 6 106
f 303 12 97
f 104 285 223
f 97 155 274
f 284 282 266
f 286 288 287
f 137 128 282
f 283 279 278
f 248 288 286
f 6 105 106
f 275 54 283
f 284 266 285
f 96 287 4
f 284 285 104
f 248 51 288
f 283 278 290
f 274 137 282
f 289 275 290
f 97 12 98 275
f 48 107 45
f 96 106 104
f 282 283 257 266
f 97 275 276 277
f 104 223 96
f 257 283 51
f 97 274 282
f 128 280 281 279
f 287 288 48
f 287 48 45
g body
s 7
f 309 31 310
f 294 33 295
f 108 118 39
f 80 79 74 73
f 49 47 48
f 5 1 91 24
f 10 291 20 19
f 294 295 38
f 78 77 76
f 81 82 111 112
f 65 66 46 47
f 30 309 310
f 5 105 6
f 30 29 26 309
f 68 62 59 299
f 78 88 89 77
f 118 38 295 119
f 83 81 112 113
f 64 65 47 49
f 35 37 36
f 23 8 7
f 24 91 90 305
f 62 52 53 59
f 296 85 109 114
f 79 292 75 74
f 50 49 288
f 22 23 27
f 282 10 11 303
f 293 294 297
f 71 72 92 67
f 112 39 113
f 310 294 293
f 305 90 89
f 308 70 307
f 296 87 298
f 114 39 119
f 71 77 72
f 45 107 44
f 8 23 22
f 7 5 24 23
f 287 44 41
f 307 69 74 75
f 92 91 1 41
f 63 62 68
f 28 29 34 35
f 105 7 8 106
f 32 89 88
f 49 48 288
f 82 81 299
f 115 37 297 108
f 113 39 110
f 73 74 69 68
f 29 30 293 34
f 291 104 9
f 22 27 309
f 54 53 52 283
f 83 79 80
f 83 80 81
f 48 47 46 107
f 25 20 21 26
f 301 11 10 19
f 39 115 108
f 306 307 75
f 110 39 109
f 292 298 306
f 306 308 307
f 70 66 65
f 294 38 297
f 5 6 96
f 85 84 110 109
f 62 63 50 52
f 102 25 28
f 9 106 8
f 310 293 30
f 70 71 66
f 77 89 90 72
f 66 71 67
f 297 37 34 293
f 106 9 104
f 25 19 20
f 44 107 46
f 85 296 298
f 117 101 36 116
f 111 39 112
f 307 70 65
f 35 34 37
f 23 305 27
f 102 301 19 25
f 50 288 51
f 80 73 299
f 84 298 292
f 49 50 63 64
f 32 305 89
f 1 5 96
f 32 31 27 305
f 66 67 44 46
f 296 295 33 87
f 291 10 282
f 81 80 299
f 309 27 31
f 84 85 298
f 116 36 37 115
f 292 79 83 84
f 283 52 51
f 309 26 21 22
f 284 291 282
f 102 36 101
f 65 64 69 307
f 295 296 114 119
f 73 68 299
f 39 116 115
f 105 5 7
f 23 24 305
f 39 117 116
f 77 71 76
f 109 39 114
f 297 38 118 108
f 75 292 306
f 39 118 119
f 21 20 291 9
f 9 8 22 21
f 287 45 44
f 71 70 308 76
f 84 83 113 110
f 67 92 41 44
f 25 26 29 28
f 104 291 284
f 102 28 35
f 69 64 63 68
f 72 90 91 92
f 52 50 51
f 102 35 36
g wings
s 5
f 16 15 17
f 304 15 16
f 300 57 60
f 14 13 304
f 59 53 55 57
f 60 57 58
f 18 301 103
f 300 59 57
f 304 13 15
f 56 55 53 54
f 15 13 11 301
f 61 59 300
f 57 55 302
f 103 301 102
f 17 15 301
f 303 11 13 14
f 58 57 302
f 302 55 56
f 17 301 18
f 299 59 61
g tiles
usemtl fldkdkgrey
s 3
f 302 56 54
f 18 103 40
f 16 17 99
f 86 61 300
f 99 304 16
f 303 14 304
f 99 303 304
f 17 18 99
f 302 54 100
f 58 302 100
f 100 86 300
f 18 40 99
f 100 60 58
f 100 300 60
f 101 117 111 82
f 102 101 82 299
f 117 39 111
f 99 100 54 303
f 303 54 98 12
f 86 100 99 40
f 40 103 61 86
f 299 61 103 102
g enginside
usemtl redbrick
s 9
f 238 255 246
f 194 202 201 193
f 153 162 163 154
f 144 153 154 145
f 184 194 193 182
f 238 246 237
f 272 234 232 271
f 236 237 235 234
f 204 195 186
f 134 143 144 135
f 143 152 153 144
f 204 203 195
f 237 246 245 235
f 273 236 234 272
f 238 237 236
f 185 184 182 183
f 135 144 145 136
f 154 163 146
f 195 203 202 194
f 235 245 244 233
f 264 273 272 263
f 219 185 183 218
f 187 186 184 185
f 136 145 146
f 161 169 170 162
f 204 220 212
f 255 264 263 254
f 234 235 233 232
f 186 195 194 184
f 145 154 146
f 152 161 162 153
f 204 212 203
f 246 255 254 245
f 238 236 273
f 204 187 220
f 169 125 126 170
f 126 135 136 127
f 163 171 146
f 203 212 211 202
f 245 254 253 244
f 238 273 264
f 211 219 218 210
f 170 126 127 171
f 127 136 146
f 162 170 171 163
f 202 211 210 201
f 238 264 255
f 254 263 262 253
f 212 220 219 211
f 171 127 146
f 125 134 135 126
f 204 186 187
f 220 187 185 219
f 263 272 271 262
g engout
usemtl black
f 251 260 259 250
f 209 217 216 208
f 157 165 166 158
f 132 141 142 133
f 179 178 176 177
f 215 177 175 214
f 270 230 228 269
f 227 241 240 225
f 191 199 198 190
f 150 159 160 151
f 131 140 141 132
f 177 176 174 175
f 230 231 229 228
f 269 228 226 268
f 229 242 241 227
f 192 200 199 191
f 139 148 149 140
f 130 139 140 131
f 180 192 191 178
f 228 229 227 226
f 268 226 224 267
f 231 243 242 229
f 176 190 189 174
f 140 149 150 141
f 149 158 159 150
f 190 198 197 189
f 243 252 251 242
f 259 268 267 258
f 216 179 177 215
f 181 180 178 179
f 121 130 131 122
f 167 123 124 168
f 208 216 215 207
f 250 259 258 249
f 252 261 260 251
f 198 207 206 197
f 158 166 167 159
f 123 132 133 124
f 166 122 123 167
f 207 215 214 206
f 261 270 269 260
f 241 250 249 240
f 199 208 207 198
f 159 167 168 160
f 122 131 132 123
f 165 121 122 166
f 217 181 179 216
f 260 269 268 259
f 242 251 250 241
f 200 209 208 199
f 148 157 158 149
f 141 150 151 142
f 178 191 190 176
f 226 227 225 224
g engmount
usemtl brass
s 11
f 225 240 239 222
f 164 120 121 165
f 128 137 138 129
f 196 205 289 290
f 265 221 285 266
f 206 214 213 205
f 138 147 148 139
f 174 189 188 172
f 249 258 256 247
f 221 222 223 285
f 155 277 164 156
f 274 155 156 147
f 213 173 281 276
f 258 267 265 256
f 189 197 196 188
f 120 129 130 121
f 173 172 279 281
f 239 247 248 286
f 205 213 276 289
f 137 274 147 138
f 156 164 165 157
f 224 225 222 221
f 247 256 257 248
f 172 188 278 279
f 280 128 129 120
f 188 196 290 278
f 256 265 266 257
f 214 175 173 213
f 147 156 157 148
f 175 174 172 173
f 240 249 247 239
f 222 239 286 223
f 277 280 120 164
f 129 138 139 130
f 197 206 205 196
f 267 224 221 265
g engrim
usemtl dkdkgrey
s off
f 233 244 243 231
f 124 133 134 125
f 262 271 270 261
f 142 151 152 143
f 253 262 261 252
f 151 160 161 152
f 244 253 252 243
f 160 168 169 161
f 201 210 209 200
f 271 232 230 270
f 133 142 143 134
f 232 233 231 230
f 183 182 180 181
f 218 183 181 217
f 182 193 192 180
f 210 218 217 209
f 193 201 200 192
f 168 124 125 169
# 393 elements

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,76 @@
unit ubgrasamples;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Controls, Graphics,
BGRABitmapTypes, BGRABitmap, BGRAGradients;
{ Drawings }
procedure DrawFlashPlayerBody(ABitmap: TBGRABitmap);
procedure DrawFlashPlayerButtonPanel(ABitmap: TBGRABitmap);
procedure DrawWin7ToolBar(ABitmap: TBGRABitmap; ADir: TAlign);
implementation
{ Drawings }
procedure DrawFlashPlayerBody(ABitmap: TBGRABitmap);
begin
with ABitmap do begin
GradientFill(0,0,Width,Height,BGRA(203,19,23,255),BGRA(110,3,20,255),
gtLinear,PointF(0,0),PointF(0,Height),dmSet);
Rectangle(0,0,Width,Height+1,BGRA(0,0,0,215),dmDrawWithTransparency);
end;
end;
procedure DrawFlashPlayerButtonPanel(ABitmap: TBGRABitmap);
begin
with ABitmap do begin
DrawHorizLine(0,0,Width,BGRA(30,30,30,255));
DrawHorizLine(0,Height-1,Width,BGRA(62,62,62,255));
Rectangle(0,1,Width,Height-1,BGRA(91,91,91,255),BGRA(76,76,76,255),dmSet);
end;
end;
procedure DrawWin7ToolBar(ABitmap: TBGRABitmap; ADir: TAlign);
var
tempBmp: TBGRABitmap;
begin
tempBmp := DoubleGradientAlphaFill(Rect(0,0,ABitmap.Width,ABitmap.Height),
BGRA(245,250,255,255),BGRA(230,240,250,255),
BGRA(220,230,244,255),BGRA(221,233,247,255),
gdVertical,gdVertical,gdVertical,0.50);
ABitmap.PutImage(0,0,tempBmp,dmSet);
tempBmp.Free;
case ADir of
alLeft : with ABitmap do begin
Rectangle(0,0,Width-2,Height,BGRA(255,255,255,100),dmDrawWithTransparency);
SetVertLine(Width-1,0,Height-1,BGRA(160,175,195,255));
SetVertLine(Width-2,0,Height-1,BGRA(205,218,234,255));
end;
alTop : with ABitmap do begin
Rectangle(0,0,Width,Height-2,BGRA(255,255,255,100),dmDrawWithTransparency);
SetHorizLine(0,Height-1,Width-1,BGRA(160,175,195,255));
SetHorizLine(0,Height-2,Width-1,BGRA(205,218,234,255));
end;
alRight : with ABitmap do begin
Rectangle(2,0,Width,Height,BGRA(255,255,255,100),dmDrawWithTransparency);
SetVertLine(0,0,Height,BGRA(160,175,195,255));
SetVertLine(1,0,Height,BGRA(205,218,234,255));
end;
alBottom : with ABitmap do begin
Rectangle(0,2,Width,Height,BGRA(255,255,255,100),dmDrawWithTransparency);
SetHorizLine(0,0,Width-1,BGRA(160,175,195,255));
SetHorizLine(0,1,Width-1,BGRA(205,218,234,255));
end;
alClient, alCustom, alNone : with ABitmap do begin
Rectangle(0,0,Width,Height,BGRA(255,255,255,100),dmDrawWithTransparency);
end;
end;
end;
end.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,486 @@
unit umain;
{$mode objfpc}{$H+}
interface
{ This unit provides a user interface for showing the scenes, create the
scene objects with different parameters, and handle mouse interaction.
It also show information about rendering counters and speed.
Scene 5 is handled differently in BGRASurfaceMouseMove because it is
a first-person view, whereas in other scenes, it is the viewed object
that gets rotated. }
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
Spin, StdCtrls, BGRAVirtualScreen, BCButton, BCPanel, BGRABitmap, BGRAScene3D,
EpikTimer{$IFNDEF NO_OPENGL_SURFACE}, BGLVirtualScreen, BGRAOpenGL, BGRAOpenGL3D{$ENDIF};
type
{ TForm1 }
TForm1 = class(TForm)
BCButton1: TBCButton;
BCButton10: TBCButton;
BCButton2: TBCButton;
BCButton3: TBCButton;
BCButton4: TBCButton;
BCButton5: TBCButton;
BCButton6: TBCButton;
BCButton7: TBCButton;
BCButton8: TBCButton;
BCButton9: TBCButton;
BGRASurface: TBGRAVirtualScreen;
ComboBox_Render: TComboBox;
Label1: TLabel;
SpinEdit_AA: TSpinEdit;
Timer1: TTimer;
vsToolbar: TBCPanel;
procedure BCButton10Click(Sender: TObject);
procedure BCButton1Click(Sender: TObject);
procedure BCButton2Click(Sender: TObject);
procedure BCButton3Click(Sender: TObject);
procedure BCButton4Click(Sender: TObject);
procedure BCButton5Click(Sender: TObject);
procedure BCButton6Click(Sender: TObject);
procedure BCButton7Click(Sender: TObject);
procedure BCButton8Click(Sender: TObject);
procedure BCButton9Click(Sender: TObject);
{$IFNDEF NO_OPENGL_SURFACE}
procedure BGLSurfaceMouseEnter(Sender: TObject);
procedure BGLSurfaceRedraw(Sender: TObject; BGLContext: TBGLContext);
{$ENDIF}
procedure SurfaceMouseDown(Sender: TObject; Button: TMouseButton;
{%H-}Shift: TShiftState; X, Y: Integer);
procedure BGRASurfaceMouseEnter(Sender: TObject);
procedure SurfaceMouseMove(Sender: TObject; {%H-}Shift: TShiftState; X,
Y: Integer);
procedure SurfaceMouseUp(Sender: TObject; Button: TMouseButton;
{%H-}Shift: TShiftState; {%H-}X, {%H-}Y: Integer);
procedure BGRASurfaceRedraw(Sender: TObject; Bitmap: TBGRABitmap);
procedure ComboBox_RenderChange(Sender: TObject);
procedure FormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: char);
procedure FormResize(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure SpinEdit_AAChange(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure vsToolbarMouseEnter(Sender: TObject);
procedure vsToolbarRedraw(Sender: TObject; Bitmap: TBGRABitmap);
private
{ private declarations }
public
{ public declarations }
{$IFNDEF NO_OPENGL_SURFACE}
BGLSurface: TBGLVirtualScreen;
glFont: IBGLFont;
scene: TBGLScene3D;
{$ELSE}
scene: TBGRAScene3D;
{$ENDIF}
moving: boolean;
moveOrigin: TPoint;
timer: TEpikTimer;
procedure AdjustSceneSize;
procedure RedrawScene;
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
uses ubgrasamples, ex1, ex2, ex3, ex4, ex5, BGRABitmapTypes;
{ TForm1 }
procedure TForm1.vsToolbarRedraw(Sender: TObject; Bitmap: TBGRABitmap);
begin
DrawWin7ToolBar(Bitmap,vsToolBar.Align);
end;
procedure TForm1.AdjustSceneSize;
begin
{$IFNDEF NO_OPENGL_SURFACE}
if ComboBox_Render.Text = 'BGRA' then
begin
if BGLSurface.Visible then
begin
BGRASurface.Visible := false;
BGLSurface.Visible := false;
BGRASurface.Visible := true;
BGRASurface.Align := alClient;
end;
end else
if ComboBox_Render.Text = 'OpenGL' then
begin
if BGRASurface.Visible then
begin
BGRASurface.Visible := false;
BGLSurface.Visible := false;
BGLSurface.Visible := true;
BGLSurface.Align := alClient;
end;
end else //BGRA&OpenGL
begin
if not BGRASurface.Visible or not BGLSurface.Visible then
begin
BGRASurface.Visible := false;
BGLSurface.Visible := false;
BGRASurface.Visible := true;
BGLSurface.Visible := true;
BGRASurface.Align := alLeft;
BGLSurface.Align := alClient;
end;
BGRASurface.Width := ClientWidth div 2;
end;
{$ENDIF}
end;
procedure TForm1.RedrawScene;
begin
if BGRASurface.Visible then BGRASurface.DiscardBitmap;
{$IFNDEF NO_OPENGL_SURFACE}
if Assigned(BGLSurface) and BGLSurface.Visible then BGLSurface.Invalidate;
{$ENDIF}
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
scene := nil;
timer := TEpikTimer.Create(nil);
timer.TimebaseSource := HardwareTimebase;
{$IFNDEF NO_OPENGL_SURFACE}
BGLSurface := TBGLVirtualScreen.Create(self);
BGLSurface.Color := clGray;
BGLSurface.OnMouseEnter:= @BGLSurfaceMouseEnter;
BGLSurface.OnMouseDown:= @SurfaceMouseDown;
BGLSurface.OnMouseMove:= @SurfaceMouseMove;
BGLSurface.OnMouseUp:= @SurfaceMouseUp;
BGLSurface.OnRedraw:= @BGLSurfaceRedraw;
BGLSurface.Align := alClient;
BGLSurface.Parent := self;
{$ELSE}
BGRASurface.Align := alClient;
ComboBox_Render.Items.Clear;
ComboBox_Render.Items.Add('BGRA');
ComboBox_Render.ItemIndex := 0;
{$ENDIF}
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
FreeAndNil(scene);
timer.Free;
end;
procedure TForm1.FormKeyPress(Sender: TObject; var Key: char);
begin
if Key = '+' then
begin
if scene <> nil then
begin
scene.Zoom := scene.Zoom*1.5;
Key := #0;
end;
end;
if Key = '-' then
begin
if scene <> nil then
begin
scene.Zoom := scene.Zoom*(1/1.5);
Key := #0;
end;
end;
end;
procedure TForm1.FormResize(Sender: TObject);
begin
AdjustSceneSize;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
AdjustSceneSize;
end;
procedure TForm1.SpinEdit_AAChange(Sender: TObject);
begin
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Timer1.Enabled := false;
if assigned(scene) and (scene is TExample2) then
TExample2(scene).Elapse else
if assigned(scene) and (scene is TExample4) then
TExample4(scene).Elapse;
RedrawScene;
end;
procedure TForm1.vsToolbarMouseEnter(Sender: TObject);
begin
SpinEdit_AA.Enabled := true;
end;
procedure TForm1.BGRASurfaceRedraw(Sender: TObject; Bitmap: TBGRABitmap);
var h,cury: integer;
procedure TextLine(str: string);
var
c: TBGRAPixel;
begin
c := Bitmap.GetPixel(0,cury+h div 2);
if GetLightness(GammaExpansion(c)) > 32768 then
c := BGRABlack else c := BGRAWhite;
Bitmap.TextOut(0,cury,str,c);
cury += h;
end;
begin
if scene <> nil then
begin
timer.Clear;
timer.Start;
scene.RenderingOptions.AntialiasingMode := am3dResample;
scene.RenderingOptions.AntialiasingResampleLevel := SpinEdit_AA.Value;
scene.RenderingOptions.MinZ := 1;
scene.Surface := Bitmap;
scene.Render;
scene.Surface := nil;
timer.Stop;
Bitmap.FontFullHeight := 20;
Bitmap.FontQuality := fqSystemClearType;
h := Bitmap.FontFullHeight;
cury := 0;
TextLine(inttostr(round(timer.Elapsed*1000)) + ' ms');
TextLine(inttostr(scene.Object3DCount) + ' object(s)');
TextLine(inttostr(scene.VertexCount) + ' vertices');
TextLine(inttostr(scene.FaceCount) + ' faces');
TextLine(inttostr(scene.RenderedFaceCount) + ' rendered');
TextLine(inttostr(scene.LightCount) + ' light(s)');
Timer1.Enabled := true;
end;
end;
procedure TForm1.ComboBox_RenderChange(Sender: TObject);
begin
AdjustSceneSize;
end;
procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
{$IFNDEF NO_OPENGL_SURFACE}
if Assigned(BGLSurface) then BGLSurface.UnloadTextures;
{$ENDIF}
end;
procedure TForm1.BCButton1Click(Sender: TObject);
begin
FreeAndNil(scene);
scene := TExample1.Create;
RedrawScene;
end;
procedure TForm1.BCButton10Click(Sender: TObject);
begin
if not (scene is TExample4) then
begin
FreeAndNil(scene);
scene := TExample4.Create;
RedrawScene;
end;
TExample4(scene).NextModel;
end;
procedure TForm1.BCButton2Click(Sender: TObject);
begin
if scene is TExample2 then
TExample2(scene).Lighting := e2lNone
else
begin
FreeAndNil(scene);
scene := TExample2.Create(e2lNone);
end;
RedrawScene;
end;
procedure TForm1.BCButton3Click(Sender: TObject);
begin
if scene is TExample2 then
TExample2(scene).Lighting := e2lLightness
else
begin
FreeAndNil(scene);
scene := TExample2.Create(e2lLightness);
end;
RedrawScene;
end;
procedure TForm1.BCButton4Click(Sender: TObject);
begin
if scene is TExample2 then
TExample2(scene).Lighting := e2lColored
else
begin
FreeAndNil(scene);
scene := TExample2.Create(e2lColored);
end;
RedrawScene;
end;
procedure TForm1.BCButton5Click(Sender: TObject);
begin
FreeAndNil(scene);
scene := TExample3.Create;
scene.DefaultLightingNormal := lnFace;
scene.RenderingOptions.LightingInterpolation := liLowQuality;
scene.RenderingOptions.AntialiasingMode := am3dMultishape;
RedrawScene;
end;
procedure TForm1.BCButton6Click(Sender: TObject);
begin
FreeAndNil(scene);
scene := TExample3.Create;
scene.DefaultLightingNormal := lnFaceVertexMix;
scene.RenderingOptions.LightingInterpolation := liLowQuality;
scene.RenderingOptions.AntialiasingMode := am3dResample;
RedrawScene;
end;
procedure TForm1.BCButton7Click(Sender: TObject);
begin
FreeAndNil(scene);
scene := TExample3.Create;
scene.DefaultLightingNormal := lnVertex;
scene.RenderingOptions.LightingInterpolation := liSpecularHighQuality;
RedrawScene;
end;
procedure TForm1.BCButton8Click(Sender: TObject);
begin
if not (scene is TExample4) then
begin
FreeAndNil(scene);
scene := TExample4.Create;
RedrawScene;
end;
end;
procedure TForm1.BCButton9Click(Sender: TObject);
begin
FreeAndNil(scene);
scene := TExample5.Create;
RedrawScene;
end;
{$IFNDEF NO_OPENGL_SURFACE}
procedure TForm1.BGLSurfaceMouseEnter(Sender: TObject);
begin
SpinEdit_AA.Enabled := false;
end;
procedure TForm1.BGLSurfaceRedraw(Sender: TObject; BGLContext: TBGLContext);
var h,cury: integer;
procedure TextLine(str: string);
var
c: TBGRAPixel;
begin
{c := Bitmap.GetPixel(0,cury+h div 2);
if GetLightness(GammaExpansion(c)) > 32768 then
c := BGRABlack else }c := BGRAWhite;
glFont.TextOut(0,cury,str,c);
cury += h;
end;
begin
if scene <> nil then
begin
timer.Clear;
timer.Start;
scene.RenderingOptions.AntialiasingMode := am3dResample;
scene.RenderingOptions.AntialiasingResampleLevel := SpinEdit_AA.Value;
scene.RenderingOptions.MinZ := 1;
scene.RenderGL(BGLContext.Canvas);
BGLContext.Canvas.WaitForGPU(wfgFinishAllCommands);
timer.Stop;
h := 20;
if glFont = nil then
glFont := BGLFont('Arial',-h);
cury := 0;
TextLine(inttostr(round(timer.Elapsed*1000)) + ' ms');
TextLine(inttostr(scene.Object3DCount) + ' object(s)');
TextLine(inttostr(scene.VertexCount) + ' vertices');
TextLine(inttostr(scene.FaceCount) + ' faces');
TextLine(inttostr(scene.RenderedFaceCount) + ' rendered');
TextLine(inttostr(scene.LightCount) + ' light(s)');
Timer1.Enabled := true;
end;
end;
{$ENDIF}
procedure TForm1.SurfaceMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if (button = mbLeft) and (scene <> nil) then
begin
moving := true;
moveOrigin := point(x,y);
end;
end;
procedure TForm1.BGRASurfaceMouseEnter(Sender: TObject);
begin
SpinEdit_AA.Enabled := false;
end;
procedure TForm1.SurfaceMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if moving then
begin
if scene is TExample5 then
begin
scene.LookRight(X-moveOrigin.X);
scene.LookDown(Y-moveOrigin.Y);
end else
if scene.Object3DCount > 0 then
begin
scene.Object3D[0].MainPart.RotateYDeg(-(X-moveOrigin.X),False);
scene.Object3D[0].MainPart.RotateXDeg(Y-moveOrigin.Y,False);
end;
RedrawScene;
moveOrigin := point(x,y);
end;
end;
procedure TForm1.SurfaceMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if button = mbLeft then moving := false;
end;
end.

View File

@@ -0,0 +1,133 @@
unit utexture;
{$mode objfpc}{$H+}
interface
{ This unit creates textures. It is mainly based on Perlin noise maps,
which are random maps that have a natural look. Then a color is applied
by linear interpolation. The water texture is achieved by using
a Phong lighting based on the Perlin noise map. }
uses
Classes, SysUtils, BGRABitmap, BGRABitmapTypes;
function CreateGrassTexture(tx,ty: integer): TBGRABitmap;
function CreateVerticalWoodTexture(tx, ty: integer): TBGRABitmap;
function CreateWoodTexture(tx,ty: integer): TBGRABitmap;
function CreateWaterTexture(tx,ty: integer): TBGRABitmap;
implementation
uses {$IFNDEF NO_OPENGL_SURFACE}BGRAOpenGL, {$ENDIF}BGRAGradients;
function Interp256(value1,value2,position: integer): integer; inline;
begin
result := (value1*(256-position)+value2*position) shr 8;
end;
function Interp256(color1,color2: TBGRAPixel; position: integer): TBGRAPixel; inline;
begin
result.red := Interp256(color1.red,color2.red,position);
result.green := Interp256(color1.green,color2.green,position);
result.blue := Interp256(color1.blue,color2.blue,position);
result.alpha := Interp256(color1.alpha,color2.alpha,position);
end;
function CreateWoodTexture(tx,ty: integer): TBGRABitmap;
var
colorOscillation, globalColorVariation: integer;
p: PBGRAPixel;
i: Integer;
begin
result := CreateCyclicPerlinNoiseMap(tx,ty,1.5,1.5,1,rfBestQuality);
p := result.Data;
for i := 0 to result.NbPixels-1 do
begin
colorOscillation := round(sqrt((sin(p^.red*Pi/16)+1)/2)*256);
globalColorVariation := p^.red;
p^:= Interp256( Interp256(BGRA(247,188,120),BGRA(255,218,170),colorOscillation),
Interp256(BGRA(157,97,60),BGRA(202,145,112),colorOscillation), globalColorVariation);
inc(p);
end;
{$IFNDEF NO_OPENGL_SURFACE}
BGRAReplace(result, TBGLBitmap.Create(result));
{$ENDIF}
end;
function CreateVerticalWoodTexture(tx, ty: integer): TBGRABitmap;
var
globalPos: single;
colorOscillation, globalColorVariation: integer;
p: PBGRAPixel;
i: Integer;
x,nbVertical: integer;
begin
result := CreateCyclicPerlinNoiseMap(tx,ty,1,1,1,rfBestQuality);
p := result.Data;
x := 0;
nbVertical := tx div 128;
if nbVertical = 0 then nbVertical := 1;
for i := 0 to result.NbPixels-1 do
begin
globalPos := p^.red*Pi/32 + nbVertical*x*2*Pi/tx*8;
colorOscillation := round(sqrt((sin(globalPos)+1)/2)*256);
globalColorVariation := p^.red; //round(sin(globalPos/8)*128+128);
p^:= Interp256( Interp256(BGRA(247,188,120),BGRA(255,218,170),colorOscillation),
Interp256(BGRA(157,97,60),BGRA(202,145,112),colorOscillation), globalColorVariation);
inc(p);
inc(x);
if x = tx then x := 0;
end;
{$IFNDEF NO_OPENGL_SURFACE}
BGRAReplace(result, TBGLBitmap.Create(result));
{$ENDIF}
end;
function CreateGrassTexture(tx,ty: integer): TBGRABitmap;
var
p: PBGRAPixel;
i: Integer;
begin
result := CreateCyclicPerlinNoiseMap(tx,ty,1,1,1,rfBestQuality);
p := result.Data;
for i := 0 to result.NbPixels-1 do
begin
p^ := Interp256( BGRA(0,128,0), BGRA(192,255,0), p^.red );
inc(p);
end;
{$IFNDEF NO_OPENGL_SURFACE}
BGRAReplace(result, TBGLBitmap.Create(result));
{$ENDIF}
end;
function CreateWaterTexture(tx,ty: integer): TBGRABitmap;
const blurSize = 5;
var
map: TBGRABitmap;
phong: TPhongShading;
begin
result := TBGRABitmap.Create(tx,ty);
map := CreateCyclicPerlinNoiseMap(tx,ty,1,1,1.2,rfBestQuality);
BGRAReplace(map,map.GetPart(rect(-blurSize,-blurSize,tx+blurSize,ty+blurSize)));
BGRAReplace(map,map.FilterBlurRadial(blurSize,rbFast));
phong := TPhongShading.Create;
phong.LightSourceDistanceFactor := 0;
phong.LightDestFactor := 0;
phong.LightSourceIntensity := 150;
phong.LightPositionZ := 80;
phong.LightColor := BGRA(105,233,240);
phong.NegativeDiffusionFactor := 0.3;
phong.SpecularIndex := 20;
phong.AmbientFactor := 0.4;
phong.Draw(result,map,20,-blurSize,-blurSize,BGRA(28,139,166));
phong.Free;
map.Free;
{$IFNDEF NO_OPENGL_SURFACE}
BGRAReplace(result, TBGLBitmap.Create(result));
{$ENDIF}
end;
end.

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View File

@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="10"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="ColorsDemo"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
</General>
<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="3">
<Unit0>
<Filename Value="ColorsDemo.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="colorsdemounit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ColorsDemoUnit"/>
</Unit1>
<Unit2>
<Filename Value="bgracolorex.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="BGRAColorEx"/>
</Unit2>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="ColorsDemo"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
</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,21 @@
program ColorsDemo;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, ColorsDemoUnit, BGRAColorEx
{ you can add units after this };
{$R *.res}
begin
RequireDerivedFormResource:=True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View File

@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="12"/>
<General>
<Flags>
<CompatibilityMode Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<Title Value="HorseShoe"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<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="3">
<Item1>
<PackageName Value="bgracontrols"/>
</Item1>
<Item2>
<PackageName Value="BGRABitmapPack"/>
</Item2>
<Item3>
<PackageName Value="LCL"/>
</Item3>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="HorseShoe.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="uhorseshoe.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="HorseShoe"/>
</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>

View File

@@ -0,0 +1,21 @@
program HorseShoe;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, uhorseshoe
{ you can add units after this };
{$R *.res}
begin
RequireDerivedFormResource:=True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@@ -0,0 +1,949 @@
unit BGRAColorEx;
{$mode objfpc}{$H+}
{$MODESWITCH ADVANCEDRECORDS}
interface
uses
Classes, SysUtils, FPimage, BGRAGraphics, BGRABitmapTypes;
type
{ TColorEx }
TColorEx = object
private
FColorspace: TColorspaceAny;
FValue: array[0..31] of byte;
private
function GetAlpha: byte;
function GetAlphaPercent: single;
function GetBlack: single;
function GetBlackPercent: single;
function GetBlue: byte;
function GetBluePercent: single;
function GetCyan: single;
function GetCyanPercent: single;
function GetGreen: byte;
function GetGreenPercent: single;
function GetIsOpaque: boolean;
function GetIsTransparent: boolean;
function GetLightness: single;
function GetLightnessPercent: single;
function GetRed: byte;
function GetRedPercent: single;
function GetSaturation: single;
function GetSaturationPercent: single;
function GetYellow: single;
function GetYellowPercent: single;
function GetHue: single;
function GetHuePercent: single;
function GetMagenta: single;
function GetMagentaPercent: single;
procedure SetYellow(AValue: single);
procedure SetYellowPercent(AValue: single);
procedure SetAlpha(AValue: byte);
procedure SetAlphaPercent(AValue: single);
procedure SetBlack(AValue: single);
procedure SetBlackPercent(AValue: single);
procedure SetBlue(AValue: byte);
procedure SetBluePercent(AValue: single);
procedure SetCyan(AValue: single);
procedure SetCyanPercent(AValue: single);
procedure SetGreen(AValue: byte);
procedure SetGreenPercent(AValue: single);
procedure SetLightness(AValue: single);
procedure SetLightnessPercent(AValue: single);
procedure SetRed(AValue: byte);
procedure SetRedPercent(AValue: single);
procedure SetSaturation(AValue: single);
procedure SetSaturationPercent(AValue: single);
procedure SetHue(AValue: single);
procedure SetHuePercent(AValue: single);
procedure SetMagenta(AValue: single);
procedure SetMagentaPercent(AValue: single);
public
class function New: TColorEx; overload; static;
class function New(const AValue: TColorEx): TColorEx; overload; static;
class function New(const AValue: string): TColorEx; overload; static;
class function New(const AValue: TColor): TColorEx; overload; static;
class function New(const AValue: TBGRAPixel): TColorEx; overload; static;
class function New(const AValue: TExpandedPixel): TColorEx; overload; static;
class function New(const AValue: TStdRGBA): TColorEx; overload; static;
class function New(const AValue: TLinearRGBA): TColorEx; overload; static;
class function New(const AValue: TXYZA): TColorEx; overload; static;
class function New(const AValue: TLabA): TColorEx; overload; static;
class function New(const AValue: TStdHSLA): TColorEx; overload; static;
class function New(const AValue: TStdHSVA): TColorEx; overload; static;
class function New(const AValue: TStdCMYK): TColorEx; overload; static;
class function New(const AValue: TLChA): TColorEx; overload; static;
class function New(const ARed, AGreen, ABlue: byte; const AAlpha: byte = 255): TColorEx; overload; static;
procedure SetValue(const AValue; AColorspace: TColorspaceAny);
procedure GetValue(out AValue; AColorspace: TColorspaceAny);
public
function ToBGRAPixel: TBGRAPixel;
function ToColor: TColor;
function ToDecimal: integer;
function ToGrayscale: TColorEx;
function ToHex: string;
function ToStdRGBA: TStdRGBA;
function ToStdHSLA: TStdHSLA;
function ToStdHSVA: TStdHSVA;
function ToStdCMYK: TStdCMYK;
function ToExpandedPixel: TExpandedPixel;
function ToLinearRGBA: TLinearRGBA;
function ToAdobeRGBA: TAdobeRGBA;
function ToHSLAPixel: THSLAPixel;
function ToGSBAPixel: TGSBAPixel;
function ToXYZA: TXYZA;
function ToLabA: TLabA;
function ToLChA: TLChA;
function ToName: string;
function ToString: string;
function ToInvert: TColorEx;
procedure FromBGRAPixel(AValue: TBGRAPixel);
procedure FromColor(AValue: TColor);
procedure FromDecimal(AValue: integer);
procedure FromHex(AValue: string);
procedure FromStdRGBA(const AValue: TStdRGBA);
procedure FromStdHSLA(const AValue: TStdHSLA);
procedure FromStdHSVA(const AValue: TStdHSVA);
procedure FromStdCMYK(const AValue: TStdCMYK);
procedure FromExpandedPixel(const AValue: TExpandedPixel);
procedure FromLinearRGBA(const AValue: TLinearRGBA);
procedure FromAdobeRGBA(const AValue: TAdobeRGBA);
procedure FromHSLAPixel(const AValue: THSLAPixel);
procedure FromGSBAPixel(const AValue: TGSBAPixel);
procedure FromXYZA(AValue: TXYZA);
procedure FromLabA(AValue: TLabA);
procedure FromLChA(AValue: TLChA);
procedure FromName(AValue: string);
procedure FromString(AValue: string);
public
function Fade(APercent: single): TColorEx;
function Darken(APercent: single): TColorEx;
function Lighten(APercent: single): TColorEx;
function Premultiply: TColorEx;
public
property Colorspace: TColorspaceAny read FColorspace;
property Red: byte read GetRed write SetRed;
property Green: byte read GetGreen write SetGreen;
property Blue: byte read GetBlue write SetBlue;
property Alpha: byte read GetAlpha write SetAlpha;
property Hue: single read GetHue write SetHue;
property Saturation: single read GetSaturation write SetSaturation;
property Lightness: single read GetLightness write SetLightness;
property Cyan: single read GetCyan write SetCyan;
property Magenta: single read GetMagenta write SetMagenta;
property Yellow: single read GetYellow write SetYellow;
property Black: single read GetBlack write SetBlack;
property RedPercent: single read GetRedPercent write SetRedPercent;
property GreenPercent: single read GetGreenPercent write SetGreenPercent;
property BluePercent: single read GetBluePercent write SetBluePercent;
property AlphaPercent: single read GetAlphaPercent write SetAlphaPercent;
property HuePercent: single read GetHuePercent write SetHuePercent;
property SaturationPercent: single read GetSaturationPercent write SetSaturationPercent;
property LightnessPercent: single read GetLightnessPercent write SetLightnessPercent;
property CyanPercent: single read GetCyanPercent write SetCyanPercent;
property MagentaPercent: single read GetMagentaPercent write SetMagentaPercent;
property YellowPercent: single read GetYellowPercent write SetYellowPercent;
property BlackPercent: single read GetBlackPercent write SetBlackPercent;
property Name: string read ToName write FromName;
property AsHex: string read ToHex write FromHex;
property AsDecimal: integer read ToDecimal write FromDecimal;
property AsString: string read ToString write FromString;
property AsColor: TColor read ToColor write FromColor;
property AsBGRAPixel: TBGRAPixel read ToBGRAPixel write FromBGRAPixel;
property AsStdRGBA: TStdRGBA read ToStdRGBA write FromStdRGBA;
property AsStdHSLA: TStdHSLA read ToStdHSLA write FromStdHSLA;
property AsStdHSVA: TStdHSVA read ToStdHSVA write FromStdHSVA;
property AsStdCMYK: TStdCMYK read ToStdCMYK write FromStdCMYK;
property AsExpandedPixel: TExpandedPixel read ToExpandedPixel write FromExpandedPixel;
property AsLinearRGBA: TLinearRGBA read ToLinearRGBA write FromLinearRGBA;
property AsAdobeRGBA: TAdobeRGBA read ToAdobeRGBA write FromAdobeRGBA;
property AsHSLAPixel: THSLAPixel read ToHSLAPixel write FromHSLAPixel;
property AsGSBAPixel: TGSBAPixel read ToGSBAPixel write FromGSBAPixel;
property AsXYZA: TXYZA read ToXYZA write FromXYZA;
property AsLabA: TLabA read ToLabA write FromLabA;
property AsLChA: TLChA read ToLChA write FromLChA;
property AsGrayscale: TColorEx read ToGrayscale;
property AsInvert: TColorEx read ToInvert;
property IsTransparent: boolean read GetIsTransparent;
property IsOpaque: boolean read GetIsOpaque;
end;
function ColorEx(const ARed, AGreen, ABlue: byte; const AAlpha: byte = 255): TColorEx;
function ColorEx(const AValue: string): TColorEx;
function ColorEx(const AValue: string; const AAlpha: single): TColorEx;
function clRandom: TColorEx;
operator := (const AValue: TColorEx): string;
operator := (const AValue: TColorEx): TColor;
operator := (const AValue: TColorEx): TBGRAPixel;
operator := (const AValue: TColorEx): TExpandedPixel;
operator := (const AValue: TColorEx): TStdRGBA;
operator := (const AValue: TColorEx): TLinearRGBA;
operator := (const AValue: TColorEx): TXYZA;
operator := (const AValue: TColorEx): TLabA;
operator := (const AValue: TColorEx): TStdHSLA;
operator := (const AValue: TColorEx): TStdHSVA;
operator := (const AValue: TColorEx): TStdCMYK;
operator := (const AValue: TColorEx): TLChA;
operator := (const AValue: string): TColorEx;
operator := (const AValue: TColor): TColorEx;
operator := (const AValue: TBGRAPixel): TColorEx;
operator := (const AValue: TExpandedPixel): TColorEx;
operator := (const AValue: TStdRGBA): TColorEx;
operator := (const AValue: TLinearRGBA): TColorEx;
operator := (const AValue: TXYZA): TColorEx;
operator := (const AValue: TLabA): TColorEx;
operator := (const AValue: TStdHSLA): TColorEx;
operator := (const AValue: TStdHSVA): TColorEx;
operator := (const AValue: TStdCMYK): TColorEx;
operator := (const AValue: TLChA): TColorEx;
implementation
function ColorEx(const ARed, AGreen, ABlue: byte; const AAlpha: byte): TColorEx;
begin
Result := TColorEx.New(ARed, AGreen, ABlue, AAlpha);
end;
function ColorEx(const AValue: string): TColorEx;
begin
Result := TColorEx.New(AValue);
end;
function ColorEx(const AValue: string; const AAlpha: single): TColorEx;
begin
Result := TColorEx.New(AValue);
Result.AlphaPercent := AAlpha;
end;
function clRandom: TColorEx;
begin
Result := TStdHSLA.New(Random(360), 0.5, 0.5);
end;
operator := (const AValue: TColorEx): string;
begin
Result := AValue.AsString;
end;
operator := (const AValue: TColorEx): TColor;
begin
Result := AValue.AsColor;
end;
operator := (const AValue: TColorEx): TBGRAPixel;
begin
Result := AValue.AsBGRAPixel;
end;
operator := (const AValue: TColorEx): TExpandedPixel;
begin
Result := AValue.AsExpandedPixel;
end;
operator := (const AValue: TColorEx): TStdRGBA;
begin
Result := AValue.AsStdRGBA;
end;
operator := (const AValue: TColorEx): TLinearRGBA;
begin
Result := AValue.AsLinearRGBA;
end;
operator := (const AValue: TColorEx): TXYZA;
begin
Result := AValue.AsXYZA;
end;
operator := (const AValue: TColorEx): TLabA;
begin
Result := AValue.AsLabA;
end;
operator := (const AValue: TColorEx): TStdHSLA;
begin
Result := AValue.AsStdHSLA;
end;
operator := (const AValue: TColorEx): TStdHSVA;
begin
Result := AValue.AsStdHSVA;
end;
operator := (const AValue: TColorEx): TStdCMYK;
begin
Result := AValue.AsStdCMYK;
end;
operator := (const AValue: TColorEx): TLChA;
begin
Result := AValue.AsLChA;
end;
operator := (const AValue: string): TColorEx;
begin
Result.AsString := AValue;
end;
operator := (const AValue: TColor): TColorEx;
begin
Result.AsColor := AValue;
end;
operator := (const AValue: TBGRAPixel): TColorEx;
begin
Result.AsBGRAPixel := AValue;
end;
operator := (const AValue: TExpandedPixel): TColorEx;
begin
Result.AsExpandedPixel := AValue;
end;
operator := (const AValue: TStdRGBA): TColorEx;
begin
Result.AsStdRGBA := AValue;
end;
operator := (const AValue: TLinearRGBA): TColorEx;
begin
Result.AsLinearRGBA := AValue;
end;
operator := (const AValue: TXYZA): TColorEx;
begin
Result.AsXYZA := AValue;
end;
operator := (const AValue: TLabA): TColorEx;
begin
Result.AsLabA := AValue;
end;
operator := (const AValue: TStdHSLA): TColorEx;
begin
Result.AsStdHSLA := AValue;
end;
operator := (const AValue: TStdHSVA): TColorEx;
begin
Result.AsStdHSVA := AValue;
end;
operator := (const AValue: TStdCMYK): TColorEx;
begin
Result.AsStdCMYK := AValue;
end;
operator := (const AValue: TLChA): TColorEx;
begin
Result.AsLChA := AValue;
end;
{ TColorEx }
function TColorEx.GetAlpha: byte;
begin
Result := round(AsStdRGBA.alpha * 255);
end;
function TColorEx.GetAlphaPercent: single;
begin
Result := AsStdRGBA.alpha * 100;
end;
function TColorEx.ToBGRAPixel: TBGRAPixel;
begin
GetValue(result, result.Colorspace);
end;
function TColorEx.GetBlack: single;
begin
Result := AsStdCMYK.K;
end;
function TColorEx.GetBlackPercent: single;
begin
Result := Black * 100;
end;
function TColorEx.GetBlue: byte;
begin
Result := round(AsStdRGBA.blue * 255);
end;
function TColorEx.GetBluePercent: single;
begin
Result := AsStdRGBA.blue * 100;
end;
function TColorEx.ToStdCMYK: TStdCMYK;
begin
GetValue(result, result.Colorspace);
end;
function TColorEx.ToColor: TColor;
begin
GetValue(result, TColorColorspace);
end;
function TColorEx.GetCyan: single;
begin
Result := AsStdCMYK.C;
end;
function TColorEx.GetCyanPercent: single;
begin
Result := Cyan * 100;
end;
function TColorEx.ToDecimal: integer;
begin
with AsBGRAPixel do
Result := (red shl 16) or (green shl 8) or blue;
end;
function TColorEx.ToExpandedPixel: TExpandedPixel;
begin
GetValue(result, result.Colorspace);
end;
function TColorEx.ToGrayscale: TColorEx;
begin
Result.AsStdRGBA := AsBGRAPixel.ToGrayscale(True);
end;
function TColorEx.GetGreen: byte;
begin
Result := round(AsStdRGBA.green * 255);
end;
function TColorEx.GetGreenPercent: single;
begin
Result := AsStdRGBA.green * 100;
end;
function TColorEx.GetIsOpaque: boolean;
begin
Result := AlphaPercent >= 100;
end;
function TColorEx.GetIsTransparent: boolean;
begin
Result := AlphaPercent <= 0;
end;
function TColorEx.ToHex: string;
begin
with AsBGRAPixel do
begin
Result := '#' + IntToHex(red, 2) + IntToHex(green, 2) + IntToHex(blue, 2);
if alpha <> 255 then
Result += IntToHex(alpha, 2);
end;
end;
function TColorEx.ToStdHSLA: TStdHSLA;
begin
GetValue(result, result.Colorspace);
end;
function TColorEx.ToStdHSVA: TStdHSVA;
begin
GetValue(result, result.Colorspace);
end;
function TColorEx.GetHue: single;
begin
Result := AsStdHSLA.hue * 100;
end;
function TColorEx.GetHuePercent: single;
begin
Result := Hue / 3.6;
end;
function TColorEx.ToInvert: TColorEx;
begin
with AsStdRGBA do
begin
Result.AsStdRGBA := TStdRGBA.New(1 - red, 1 - green, 1 - blue, alpha);
end;
end;
function TColorEx.ToLabA: TLabA;
begin
GetValue(result, result.Colorspace);
end;
function TColorEx.ToLChA: TLChA;
begin
GetValue(result, result.Colorspace);
end;
function TColorEx.GetLightness: single;
begin
Result := AsStdHSLA.lightness;
end;
function TColorEx.GetLightnessPercent: single;
begin
Result := Lightness * 100;
end;
function TColorEx.ToLinearRGBA: TLinearRGBA;
begin
GetValue(result, result.Colorspace);
end;
function TColorEx.ToAdobeRGBA: TAdobeRGBA;
begin
GetValue(result, result.Colorspace);
end;
function TColorEx.ToHSLAPixel: THSLAPixel;
begin
GetValue(result, result.Colorspace);
end;
function TColorEx.ToGSBAPixel: TGSBAPixel;
begin
GetValue(result, result.Colorspace);
end;
function TColorEx.GetMagenta: single;
begin
Result := AsStdCMYK.M;
end;
function TColorEx.GetMagentaPercent: single;
begin
Result := Magenta * 100;
end;
function TColorEx.ToName: string;
var
idx: integer;
c: TBGRAPixel;
begin
Result := '';
c := AsBGRAPixel;
if Assigned(CSSColors) then
begin
idx := CSSColors.IndexOfColor(c, 1000);
if idx <> -1 then
begin
Result := CSSColors.Name[idx];
exit;
end;
end;
end;
function TColorEx.GetRed: byte;
begin
Result := round(AsStdRGBA.red * 255);
end;
function TColorEx.GetRedPercent: single;
begin
Result := AsStdRGBA.red * 100;
end;
function TColorEx.GetSaturation: single;
begin
Result := AsStdHSLA.saturation;
end;
function TColorEx.GetSaturationPercent: single;
begin
Result := Saturation * 100;
end;
function TColorEx.ToStdRGBA: TStdRGBA;
begin
GetValue(result, result.Colorspace);
end;
function TColorEx.ToString: string;
begin
Result := BGRAToStr(AsBGRAPixel);
end;
function TColorEx.ToXYZA: TXYZA;
begin
GetValue(result, result.Colorspace);
end;
function TColorEx.GetYellow: single;
begin
Result := AsStdCMYK.Y;
end;
function TColorEx.GetYellowPercent: single;
begin
Result := Yellow * 100;
end;
procedure TColorEx.SetAlpha(AValue: byte);
begin
with AsStdRGBA do
Self.AsStdRGBA := TStdRGBA.New(red, green, blue, AValue / 255);
end;
procedure TColorEx.SetAlphaPercent(AValue: single);
begin
with AsStdRGBA do
Self.AsStdRGBA := TStdRGBA.New(red, green, blue, AValue / 100);
end;
procedure TColorEx.FromBGRAPixel(AValue: TBGRAPixel);
begin
SetValue(AValue, AValue.Colorspace);
end;
procedure TColorEx.SetBlack(AValue: single);
begin
with AsStdCMYK do
Self.AsStdCMYK := TStdCMYK.New(C, M, Y, AValue);
end;
procedure TColorEx.SetBlackPercent(AValue: single);
begin
with AsStdCMYK do
Self.AsStdCMYK := TStdCMYK.New(C, M, Y, AValue / 100);
end;
procedure TColorEx.SetBlue(AValue: byte);
begin
with AsStdRGBA do
Self.AsStdRGBA := TStdRGBA.New(red, green, AValue / 255, alpha);
end;
procedure TColorEx.SetBluePercent(AValue: single);
begin
with AsStdRGBA do
Self.AsStdRGBA := TStdRGBA.New(red, green, AValue / 100, alpha);
end;
procedure TColorEx.FromStdCMYK(const AValue: TStdCMYK);
begin
SetValue(AValue, AValue.Colorspace);
end;
procedure TColorEx.FromColor(AValue: TColor);
begin
SetValue(AValue, AValue.Colorspace);
end;
procedure TColorEx.SetCyan(AValue: single);
begin
with AsStdCMYK do
Self.AsStdCMYK:= TStdCMYK.New(AValue, M, Y, K);
end;
procedure TColorEx.SetCyanPercent(AValue: single);
begin
with AsStdCMYK do
Self.AsStdCMYK := TStdCMYK.New(AValue / 100, M, Y, K);
end;
procedure TColorEx.FromDecimal(AValue: integer);
var
r, g, b: byte;
begin
r := (AValue shr 16) and $000000ff;
g := (AValue shr 8) and $000000ff;
b := AValue and $000000ff;
AsBGRAPixel := TBGRAPixel.New(r, g, b);
end;
procedure TColorEx.FromExpandedPixel(const AValue: TExpandedPixel);
begin
SetValue(AValue, AValue.Colorspace);
end;
procedure TColorEx.SetGreen(AValue: byte);
begin
with AsStdRGBA do
Self.AsStdRGBA := TStdRGBA.New(red, AValue / 255, blue, alpha);
end;
procedure TColorEx.SetGreenPercent(AValue: single);
begin
with AsStdRGBA do
Self.AsStdRGBA := TStdRGBA.New(red, AValue / 100, blue, alpha);
end;
procedure TColorEx.FromHex(AValue: string);
var
missingValues, error: boolean;
c: TBGRAPixel;
begin
c := BGRAPixelTransparent;
TryStrToBGRA(AValue, c, missingValues, error);
if not (missingValues or error) then
AsBGRAPixel := c;
end;
procedure TColorEx.FromStdHSLA(const AValue: TStdHSLA);
begin
SetValue(AValue, AValue.Colorspace);
end;
procedure TColorEx.FromStdHSVA(const AValue: TStdHSVA);
begin
SetValue(AValue, AValue.Colorspace);
end;
procedure TColorEx.FromHSLAPixel(const AValue: THSLAPixel);
begin
SetValue(AValue, AValue.Colorspace);
end;
procedure TColorEx.FromGSBAPixel(const AValue: TGSBAPixel);
begin
SetValue(AValue, AValue.Colorspace);
end;
procedure TColorEx.SetHue(AValue: single);
begin
with AsStdHSLA do
Self.AsStdHSLA := TStdHSLA.New(AValue, saturation, lightness, alpha);
end;
procedure TColorEx.SetHuePercent(AValue: single);
begin
with AsStdHSLA do
Self.AsStdHSLA := TStdHSLA.New(AValue / 3.6, saturation, lightness, alpha);
end;
procedure TColorEx.FromLabA(AValue: TLabA);
begin
SetValue(AValue, AValue.Colorspace);
end;
procedure TColorEx.FromLChA(AValue: TLChA);
begin
SetValue(AValue, AValue.Colorspace);
end;
procedure TColorEx.SetLightness(AValue: single);
begin
with AsStdHSLA do
Self.AsStdHSLA := TStdHSLA.New(hue, saturation, AValue, alpha);
end;
procedure TColorEx.SetLightnessPercent(AValue: single);
begin
with AsStdHSLA do
Self.AsStdHSLA := TStdHSLA.New(hue, saturation, AValue / 100, alpha);
end;
procedure TColorEx.FromLinearRGBA(const AValue: TLinearRGBA);
begin
SetValue(AValue, AValue.Colorspace);
end;
procedure TColorEx.FromAdobeRGBA(const AValue: TAdobeRGBA);
begin
SetValue(AValue, AValue.Colorspace);
end;
procedure TColorEx.SetMagenta(AValue: single);
begin
with AsStdCMYK do
Self.AsStdCMYK := TStdCMYK.New(C, AValue, Y, K);
end;
procedure TColorEx.SetMagentaPercent(AValue: single);
begin
with AsStdCMYK do
Self.AsStdCMYK := TStdCMYK.New(C, AValue / 100, Y, K);
end;
class function TColorEx.New: TColorEx;
begin
Result := BGRAPixelTransparent;
end;
procedure TColorEx.FromName(AValue: string);
var
missingValues, error: boolean;
c: TBGRAPixel;
begin
c := BGRAPixelTransparent;
TryStrToBGRA(AValue, c, missingValues, error);
if not (missingValues or error) then
AsBGRAPixel := c;
end;
procedure TColorEx.SetRed(AValue: byte);
begin
with AsStdRGBA do
Self.AsStdRGBA := TStdRGBA.New(AValue / 255, green, blue, alpha);
end;
procedure TColorEx.SetRedPercent(AValue: single);
begin
with AsStdRGBA do
Self.AsStdRGBA := TStdRGBA.New(AValue / 100, green, blue, alpha);
end;
procedure TColorEx.SetSaturation(AValue: single);
begin
with AsStdHSLA do
Self.AsStdHSLA := TStdHSLA.New(hue, AValue, lightness, alpha);
end;
procedure TColorEx.SetSaturationPercent(AValue: single);
begin
with AsStdHSLA do
Self.AsStdHSLA := TStdHSLA.New(hue, AValue / 100, lightness, alpha);
end;
procedure TColorEx.FromStdRGBA(const AValue: TStdRGBA);
begin
SetValue(AValue, AValue.Colorspace);
end;
procedure TColorEx.FromString(AValue: string);
begin
AsBGRAPixel := StrToBGRA(AValue);
end;
procedure TColorEx.FromXYZA(AValue: TXYZA);
begin
SetValue(AValue, AValue.Colorspace);
end;
function TColorEx.Fade(APercent: single): TColorEx;
begin
Result := Self;
if APercent = 1 then
Exit;
Result.AlphaPercent := Result.AlphaPercent * APercent;
end;
function TColorEx.Darken(APercent: single): TColorEx;
begin
Result := Self;
Result.LightnessPercent := Result.LightnessPercent - APercent;
end;
function TColorEx.Lighten(APercent: single): TColorEx;
begin
Result := Self;
Result.LightnessPercent := Result.LightnessPercent + APercent;
end;
function TColorEx.Premultiply: TColorEx;
begin
with AsStdRGBA do
Self.AsStdRGBA:= TStdRGBA.New(red*alpha,green*alpha,blue*alpha,alpha);
Result:=Self;
end;
procedure TColorEx.SetYellow(AValue: single);
begin
with AsStdCMYK do
Self.AsStdCMYK := TStdCMYK.New(C, M, AValue, K);
end;
procedure TColorEx.SetYellowPercent(AValue: single);
begin
with AsStdCMYK do
Self.AsStdCMYK := TStdCMYK.New(C, M, AValue / 100, K);
end;
class function TColorEx.New(const AValue: TColorEx): TColorEx;
begin
Result := AValue;
end;
class function TColorEx.New(const AValue: string): TColorEx;
begin
Result := AValue;
end;
class function TColorEx.New(const AValue: TColor): TColorEx;
begin
Result := AValue;
end;
class function TColorEx.New(const AValue: TBGRAPixel): TColorEx;
begin
Result := AValue;
end;
class function TColorEx.New(const AValue: TExpandedPixel): TColorEx;
begin
Result := AValue;
end;
class function TColorEx.New(const AValue: TStdRGBA): TColorEx;
begin
Result := AValue;
end;
class function TColorEx.New(const AValue: TLinearRGBA): TColorEx;
begin
Result := AValue;
end;
class function TColorEx.New(const AValue: TXYZA): TColorEx;
begin
Result := AValue;
end;
class function TColorEx.New(const AValue: TLabA): TColorEx;
begin
Result := AValue;
end;
class function TColorEx.New(const AValue: TStdHSLA): TColorEx;
begin
Result := AValue;
end;
class function TColorEx.New(const AValue: TStdHSVA): TColorEx;
begin
Result := AValue;
end;
class function TColorEx.New(const AValue: TStdCMYK): TColorEx;
begin
Result := AValue;
end;
class function TColorEx.New(const AValue: TLChA): TColorEx;
begin
Result := AValue;
end;
class function TColorEx.New(const ARed, AGreen, ABlue: byte; const AAlpha: byte): TColorEx;
begin
Result := TStdRGBA.New(ARed / 255, AGreen / 255, ABlue / 255, AAlpha / 255);
end;
procedure TColorEx.SetValue(const AValue; AColorspace: TColorspaceAny);
begin
FColorspace:= AColorspace;
move(AValue, FValue, AColorspace.GetSize);
end;
procedure TColorEx.GetValue(out AValue; AColorspace: TColorspaceAny);
begin
if Assigned(FColorspace) then
FColorspace.Convert(FValue, AValue, AColorspace)
else
TBGRAPixelColorspace.Convert(BGRAPixelTransparent, AValue, AColorspace)
end;
end.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,468 @@
unit ColorsDemoUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls, StdCtrls, Spin, ExtCtrls,
BGRABitmap, BGRABitmapTypes, BGRAColorEx;
type
{ TForm1 }
TForm1 = class(TForm)
A_se: TFloatSpinEdit;
lambda1_se: TFloatSpinEdit;
A_tb: TTrackBar;
lambda1_tb: TTrackBar;
B2_se: TFloatSpinEdit;
lambda2_se: TFloatSpinEdit;
B2_tb: TTrackBar;
lambda2_tb: TTrackBar;
Dec_edt: TEdit;
Alpha_se: TFloatSpinEdit;
Alpha_tb: TTrackBar;
reflectance_se: TFloatSpinEdit;
reflectance_tb: TTrackBar;
Label47: TLabel;
Label48: TLabel;
Label49: TLabel;
Label50: TLabel;
Label51: TLabel;
Label52: TLabel;
Label53: TLabel;
Label54: TLabel;
Label55: TLabel;
LIsReal: TLabel;
lB_se1: TFloatSpinEdit;
lB_tb1: TTrackBar;
lG_se1: TFloatSpinEdit;
lG_tb1: TTrackBar;
lH2_se: TFloatSpinEdit;
lH2_tb: TTrackBar;
Label43: TLabel;
Label44: TLabel;
Label45: TLabel;
Label46: TLabel;
lH_se: TFloatSpinEdit;
lH_tb: TTrackBar;
Label31: TLabel;
Label32: TLabel;
Label33: TLabel;
Label34: TLabel;
Label35: TLabel;
Label36: TLabel;
Label37: TLabel;
Label38: TLabel;
Label39: TLabel;
Label40: TLabel;
Label41: TLabel;
Label42: TLabel;
lB_se: TFloatSpinEdit;
Label30: TLabel;
Grayscale_pnl: TPanel;
Invert_pnl: TPanel;
lL_se: TFloatSpinEdit;
lL_tb: TTrackBar;
lR_se1: TFloatSpinEdit;
lR_tb1: TTrackBar;
lS2_se: TFloatSpinEdit;
lS2_tb: TTrackBar;
sB_se: TFloatSpinEdit;
lB_tb: TTrackBar;
sB_tb: TTrackBar;
C2_se: TFloatSpinEdit;
C2_tb: TTrackBar;
C_se: TFloatSpinEdit;
C_tb: TTrackBar;
lG_se: TFloatSpinEdit;
sG_se: TFloatSpinEdit;
lG_tb: TTrackBar;
sG_tb: TTrackBar;
H2_se: TFloatSpinEdit;
H2_tb: TTrackBar;
H3_se: TFloatSpinEdit;
H3_tb: TTrackBar;
Hex_edt: TEdit;
H_se: TFloatSpinEdit;
H_tb: TTrackBar;
K_se: TFloatSpinEdit;
K_tb: TTrackBar;
L2_se: TFloatSpinEdit;
L2_tb: TTrackBar;
L3_se: TFloatSpinEdit;
L3_tb: TTrackBar;
Label1: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label19: TLabel;
Label2: TLabel;
Label20: TLabel;
Label21: TLabel;
Label22: TLabel;
Label23: TLabel;
Label24: TLabel;
Label25: TLabel;
Label26: TLabel;
Label27: TLabel;
Label28: TLabel;
Label29: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
L_se: TFloatSpinEdit;
L_tb: TTrackBar;
M_se: TFloatSpinEdit;
M_tb: TTrackBar;
Name_edt: TEdit;
Color_pnl: TPanel;
lR_se: TFloatSpinEdit;
sR_se: TFloatSpinEdit;
lR_tb: TTrackBar;
sR_tb: TTrackBar;
S2_se: TFloatSpinEdit;
S2_tb: TTrackBar;
S_se: TFloatSpinEdit;
lS_se: TFloatSpinEdit;
S_tb: TTrackBar;
gamma_tb: TTrackBar;
lS_tb: TTrackBar;
V_se: TFloatSpinEdit;
gamma_se: TFloatSpinEdit;
lL2_se: TFloatSpinEdit;
V_tb: TTrackBar;
lL2_tb: TTrackBar;
X_se: TFloatSpinEdit;
X_tb: TTrackBar;
Y2_se: TFloatSpinEdit;
Y2_tb: TTrackBar;
Y_se: TFloatSpinEdit;
Y_tb: TTrackBar;
Z_se: TFloatSpinEdit;
Z_tb: TTrackBar;
procedure FormCreate(Sender: TObject);
procedure gamma_seChange(Sender: TObject);
procedure gamma_tbChange(Sender: TObject);
private
col: TColorEx;
ChangingColors: boolean;
procedure InitControls;
procedure UserInputChange(Sender: TObject);
procedure UpdateColorControls(SourceTag: integer);
function FindComponentByTag(ATag: integer; AClassName: string): TComponent;
public
end;
var
Form1: TForm1;
implementation
uses XYZABitmap;
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
BGRASetGamma(2.2);
XYZToRGBOverflowMax:= xroPreserveHue;
XYZToRGBOverflowMin:= xroPreserveHue;
InitControls;
end;
procedure TForm1.gamma_seChange(Sender: TObject);
begin
if ChangingColors then
exit;
ChangingColors := True;
BGRASetGamma(gamma_se.Value);
gamma_tb.Position := round(gamma_se.Value * 100);
UpdateColorControls(-1);
ChangingColors := False;
end;
procedure TForm1.gamma_tbChange(Sender: TObject);
begin
if ChangingColors then
exit;
ChangingColors := True;
gamma_se.Value := gamma_tb.Position / 100;
BGRASetGamma(gamma_se.Value);
UpdateColorControls(-1);
ChangingColors := False;
end;
procedure TForm1.InitControls;
var
i: integer;
tb: TTrackBar;
fse: TFloatSpinEdit;
procedure SetControlsValues(ca: array of TTrackBar; Mi, Mx, Fr: integer);
var
i: integer;
begin
for i := 0 to Length(ca) - 1 do
begin
with ca[i] do
begin
Max := Mx;
Min := Mi;
Frequency := Fr;
end;
end;
end;
begin
ChangingColors := True;
SetControlsValues([lR_tb, lG_tb, lB_tb], 0, 100, 10);
SetControlsValues([sR_tb, sG_tb, sB_tb], 0, 255, 10);
SetControlsValues([lR_tb1, lG_tb1, lB_tb1], 0, 255, 10);
SetControlsValues([H_tb], 0, 360, 10);
SetControlsValues([S_tb, L_tb], 0, 100, 10);
SetControlsValues([H2_tb], 0, 360, 10);
SetControlsValues([S2_tb, V_tb], 0, 100, 10);
SetControlsValues([Y2_tb], 0, 100, 10);
SetControlsValues([X_tb, Z_tb], 0, 120, 10);
SetControlsValues([L2_tb], 0, 100, 10);
SetControlsValues([A_tb], -160, 160, 10);
SetControlsValues([B2_tb], -140, 140, 10);
SetControlsValues([C_tb, M_tb, Y_tb, K_tb], 0, 100, 10);
SetControlsValues([L3_tb], 0, 100, 10);
SetControlsValues([C2_tb], 0, round(TLChAColorspace.GetMaxValue(1)), 10);
SetControlsValues([H3_tb], 0, 360, 10);
SetControlsValues([Alpha_tb], 0, 100, 10);
SetControlsValues([lH_tb, lH2_tb], 0, 360, 10);
SetControlsValues([lS_tb, lL_tb, lS2_tb, lL2_tb], 0, 100, 10);
SetControlsValues([reflectance_tb], 0, 100, 10);
SetControlsValues([lambda1_tb,lambda2_tb], 360, 830, 10);
for i := 0 to ComponentCount - 1 do
begin
if Components[i] is TTrackBar then
begin
if Components[i].Tag <> 0 then
begin
tb := TTrackBar(Components[i]);
tb.OnChange := @UserInputChange;
fse := TFloatSpinEdit(FindComponentByTag(Components[i].Tag, 'TFloatSpinEdit'));
if (fse <> nil) then
begin
fse.MinValue := tb.Min;
fse.MaxValue := tb.Max;
fse.OnChange := @UserInputChange;
end;
end;
end;
end;
Hex_edt.OnChange := @UserInputChange;
Dec_edt.OnChange := @UserInputChange;
Name_edt.OnChange := @UserInputChange;
gamma_se.Value := BGRAGetGamma;
gamma_tb.Position := round(gamma_se.Value * 100);
col.AsBGRAPixel := BGRABlack;
UpdateColorControls(-1);
ChangingColors := False;
end;
procedure TForm1.UserInputChange(Sender: TObject);
var
t: integer;
v: single;
begin
if ChangingColors then
Exit;
ChangingColors := True;
t := TComponent(Sender).Tag;
if Sender is TFloatSpinEdit then
begin
if not TryStrToFloat(TFloatSpinEdit(Sender).Text, v) then
v := 0;
TTrackBar(FindComponentByTag(t, 'TTrackBar')).Position := round(v);
end;
if Sender is TTrackBar then
TFloatSpinEdit(FindComponentByTag(t, 'TFloatSpinEdit')).Text := IntToStr(TTrackBar(Sender).Position);
UpdateColorControls(t);
ChangingColors := False;
end;
procedure TForm1.UpdateColorControls(SourceTag: integer);
var
i,decVal,errPos: integer;
tb: TTrackBar;
fse: TFloatSpinEdit;
viewBmp: TBGRABitmap;
begin
case SourceTag of
1, 2, 3: col.AsLinearRGBA := TLinearRGBA.New(lR_se.Value / 100, lG_se.Value / 100, lB_se.Value / 100, Alpha_se.Value / 100);
4, 5, 6: col.AsStdHSLA := TStdHSLA.New(H_se.Value, S_se.Value / 100, L_se.Value / 100, Alpha_se.Value / 100);
7, 8, 9: col.AsStdHSVA := TStdHSVA.New(H2_se.Value, S2_se.Value / 100, V_se.Value / 100, Alpha_se.Value / 100);
17, 18, 19: col.AsXYZA := TXYZA.New(X_se.Value / 100, Y2_se.Value / 100, Z_se.Value / 100, Alpha_se.Value / 100);
10, 11, 12: col.AsLabA := TLabA.New(L2_se.Value, A_se.Value, B2_se.Value, Alpha_se.Value / 100);
13, 14, 15, 16: col.AsStdCMYK := TStdCMYK.New(C_se.Value / 100, M_se.Value / 100, Y_se.Value / 100, K_se.Value / 100);
20, 21, 22: col.AsLChA := TLChA.New(L3_se.Value, C2_se.Value, H3_se.Value, Alpha_se.Value / 100);
23: col.AsHex := Hex_edt.Text;
24: begin
val(Dec_edt.Text, decVal, errPos);
if (errPos = 0) and (decVal>=0) then
col.AsDecimal := decVal;
end;
25, 26, 27: col.AsStdRGBA := TStdRGBA.New(sR_se.Value / 255, sG_se.Value / 255, sB_se.Value / 255, Alpha_se.Value / 100);
28: col.Name := Name_edt.Text;
29: col.AlphaPercent := Alpha_se.Value;
50, 51, 52: col.AsHSLAPixel := THSLAPixel.New(round(lH_se.Value/360*65536) and $ffff, round(lS_se.Value / 100*65535), round(lL_se.Value / 100*65535), round(Alpha_se.Value / 100*65535));
53, 54, 55: col.AsGSBAPixel := TGSBAPixel.New(round(lH2_se.Value/360*65536) and $ffff, round(lS2_se.Value / 100*65535), round(lL2_se.Value / 100*65535), round(Alpha_se.Value / 100*65535));
60, 61, 62: col.AsAdobeRGBA := TAdobeRGBA.New(round(lR_se1.Value), round(lG_se1.Value), round(lB_se1.Value), round(Alpha_se.Value / 100 * 255));
70, 71, 72: col.AsXYZA := SpectrumRangeReflectToXYZA(reflectance_se.Value / 100, lambda1_se.Value, lambda2_se.Value, Alpha_se.Value / 100);
end;
if not (SourceTag in [1, 2, 3]) then
with col.AsLinearRGBA do
begin
lR_se.Value := red * 100;
lG_se.Value := green * 100;
lB_se.Value := blue * 100;
end;
if not (SourceTag in [4, 5, 6]) then
with col.AsStdHSLA do
begin
H_se.Value := hue;
S_se.Value := saturation * 100;
L_se.Value := lightness * 100;
end;
if not (SourceTag in [7, 8, 9]) then
with col.AsStdHSVA do
begin
H2_se.Value := hue;
S2_se.Value := saturation * 100;
V_se.Value := value * 100;
end;
if not (SourceTag in [17, 18, 19]) then
with col.AsXYZA do
begin
X_se.Value := X * 100;
Y2_se.Value := Y * 100;
Z_se.Value := Z * 100;
end;
if not (SourceTag in [10, 11, 12]) then
with col.AsLabA do
begin
L2_se.Value := L;
A_se.Value := a;
B2_se.Value := b;
end;
if not (SourceTag in [25, 26, 27]) then
with col.AsStdRGBA do
begin
sR_se.Value := red * 255;
sG_se.Value := green * 255;
sB_se.Value := blue * 255;
end;
if not (SourceTag in [13, 14, 15, 16]) then
with col.AsStdCMYK do
begin
C_se.Value := C * 100;
M_se.Value := M * 100;
Y_se.Value := Y * 100;
K_se.Value := K * 100;
end;
if not (SourceTag in [20, 21, 22]) then
with col.AsLchA do
begin
L3_se.Value := L;
C2_se.Value := c;
H3_se.Value := h;
end;
if SourceTag <> 23 then
Hex_edt.Text := col.AsHex;
if SourceTag <> 24 then
Dec_edt.Text := IntToStr(col.AsDecimal);
if SourceTag <> 28 then
Name_edt.Text := col.Name;
if SourceTag <> 29 then
Alpha_se.Value := col.AlphaPercent;
if not (SourceTag in [50,51,52]) then
with col.AsHSLAPixel do
begin
lH_se.Value := hue/65536 * 360;
lS_se.Value := saturation/65535 * 100;
lL_se.Value := lightness/65535 * 100;
end;
if not (SourceTag in [53,54,55]) then
with col.AsGSBAPixel do
begin
lH2_se.Value := hue/65536 * 360;
lS2_se.Value := saturation/65535 * 100;
lL2_se.Value := lightness/65535 * 100;
end;
if not (SourceTag in [60,61,62]) then
with col.AsAdobeRGBA do
begin
lR_se1.Value := red;
lG_se1.Value := green;
lB_se1.Value := blue;
end;
for i := 0 to ComponentCount - 1 do
begin
if Components[i] is TTrackBar then
begin
if Components[i].Tag <> 0 then
begin
tb := TTrackBar(Components[i]);
tb.OnChange := @UserInputChange;
fse := TFloatSpinEdit(FindComponentByTag(Components[i].Tag, 'TFloatSpinEdit'));
if (fse <> nil) then
tb.Position := round(fse.Value);
end;
end;
end;
viewBmp := TBGRABitmap.Create(3,1, clBtnFace);
viewBmp.DrawPixel(0,0, col.AsBGRAPixel, dmDrawWithTransparency);
viewBmp.DrawPixel(1,0, col.AsGrayscale.AsBGRAPixel, dmDrawWithTransparency);
viewBmp.DrawPixel(2,0, col.AsInvert.AsBGRAPixel, dmDrawWithTransparency);
Color_pnl.Color := viewBmp.GetPixel(0,0);
Grayscale_pnl.Color := viewBmp.GetPixel(1,0);
Invert_pnl.Color := viewBmp.GetPixel(2,0);
viewBmp.Free;
if IsRealColor(col.AsXYZA) then
LIsReal.Caption := 'Real color'
else
LIsReal.Caption := 'Imaginary color';
end;
function TForm1.FindComponentByTag(ATag: integer; AClassName: string): TComponent;
var
i: integer;
begin
Result := nil;
for i := 0 to ComponentCount - 1 do
if (Components[i].Tag = ATag) and (Components[i].ClassName = AClassName) then
Result := Components[i];
end;
end.

View File

@@ -0,0 +1,235 @@
object Form1: TForm1
Left = 257
Height = 622
Top = 140
Width = 1239
Caption = 'XYZ horseshoe'
ClientHeight = 622
ClientWidth = 1239
DesignTimePPI = 144
Font.Height = -20
OnCreate = FormCreate
LCLVersion = '2.1.0.0'
object Panel1: TPanel
Left = 0
Height = 622
Top = 0
Width = 620
Align = alLeft
ClientHeight = 622
ClientWidth = 620
TabOrder = 0
object cbYAxis: TComboBox
Left = 6
Height = 36
Top = 6
Width = 150
ItemHeight = 0
OnChange = cbYAxisChange
TabOrder = 1
Text = 'cbYAxis'
end
object vsGradient: TBGRAVirtualScreen
Left = 6
Height = 408
Top = 48
Width = 602
OnRedraw = vsGradientRedraw
Alignment = taLeftJustify
Anchors = [akTop, akLeft, akRight, akBottom]
Color = clWhite
ParentColor = False
TabOrder = 2
end
object cbXAxis: TComboBox
Left = 458
Height = 36
Top = 462
Width = 150
Anchors = [akRight, akBottom]
ItemHeight = 0
OnChange = cbXAxisChange
TabOrder = 0
Text = 'cbXAxis'
end
object cbColorspace: TComboBox
Left = 452
Height = 36
Top = 6
Width = 160
Anchors = [akTop, akRight]
ItemHeight = 0
OnChange = cbColorspaceChange
TabOrder = 3
Text = 'cbColorspace'
end
object Label1: TLabel
Left = 334
Height = 24
Top = 12
Width = 110
Anchors = [akTop, akRight]
Caption = 'Colorspace'
ParentColor = False
end
object lblMaxY: TLabel
Left = 160
Height = 24
Top = 12
Width = 53
Caption = 'MaxY'
ParentColor = False
end
object lblMaxX: TLabel
Left = 389
Height = 24
Top = 468
Width = 55
Alignment = taRightJustify
Anchors = [akRight, akBottom]
Caption = 'MaxX'
ParentColor = False
end
object lblMin: TLabel
Left = 6
Height = 24
Top = 468
Width = 117
Anchors = [akLeft, akBottom]
Caption = 'MinY / MinX'
ParentColor = False
end
object tbZ: TTrackBar
Left = 120
Height = 68
Top = 491
Width = 488
OnChange = tbZChange
Position = 0
Anchors = [akRight, akBottom]
TabOrder = 4
end
object lblZ: TLabel
Left = 12
Height = 24
Top = 517
Width = 97
Anchors = [akLeft, akBottom]
Caption = 'ChannelZ'
ParentColor = False
end
object lblZ2: TLabel
Left = 12
Height = 24
Top = 577
Width = 110
Anchors = [akLeft, akBottom]
Caption = 'ChannelZ2'
ParentColor = False
end
object tbZ2: TTrackBar
Left = 124
Height = 68
Top = 551
Width = 484
OnChange = tbZChange
Position = 0
Anchors = [akRight, akBottom]
TabOrder = 5
end
object cbFluorescent: TCheckBox
Left = 227
Height = 28
Hint = 'Include fluorescent colors or light sources'
Top = 10
Width = 90
Anchors = [akTop, akLeft, akRight]
Caption = 'Fluo'
OnClick = cbFluorescentClick
ParentFont = False
ParentShowHint = False
ShowHint = True
TabOrder = 6
end
end
object Splitter1: TSplitter
Left = 620
Height = 622
Top = 0
Width = 8
end
object Panel2: TPanel
Left = 628
Height = 622
Top = 0
Width = 611
Align = alClient
ClientHeight = 622
ClientWidth = 611
TabOrder = 2
object vsHorseshoe: TBGRAVirtualScreen
Left = 1
Height = 572
Top = 49
Width = 609
OnRedraw = vsHorseshoeRedraw
Align = alClient
Alignment = taLeftJustify
Color = clWhite
ParentColor = False
TabOrder = 0
end
object Panel3: TPanel
Left = 1
Height = 48
Top = 1
Width = 609
Align = alTop
BevelOuter = bvNone
ClientHeight = 48
ClientWidth = 609
TabOrder = 1
object Label2: TLabel
Left = 8
Height = 24
Top = 9
Width = 98
Caption = 'Ref. white'
ParentColor = False
end
object cbReferenceWhite: TComboBox
Left = 120
Height = 36
Top = 4
Width = 136
ItemHeight = 0
OnChange = cbReferenceWhiteChange
TabOrder = 0
Text = 'cbReferenceWhite'
end
object Label3: TLabel
Left = 264
Height = 24
Top = 9
Width = 89
Caption = 'Overflow'
ParentColor = False
end
object cbOverflow: TComboBox
Left = 360
Height = 34
Top = 4
Width = 240
ItemHeight = 0
Items.Strings = (
'Clip to RGB display'
'Saturate per channel'
'Preserve hue'
)
OnChange = cbOverflowChange
Style = csDropDownList
TabOrder = 1
end
end
end
end

View File

@@ -0,0 +1,793 @@
unit uhorseshoe;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
ExtCtrls, ComCtrls, BGRAVirtualScreen, BGRABitmap, BGRABitmapTypes,
BGRAGradientScanner;
type
{ TForm1 }
TForm1 = class(TForm)
cbColorspace: TComboBox;
cbReferenceWhite: TComboBox;
cbOverflow: TComboBox;
cbFluorescent: TCheckBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
lblZ: TLabel;
lblZ2: TLabel;
lblMaxY: TLabel;
lblMaxX: TLabel;
lblMin: TLabel;
Panel2: TPanel;
Panel3: TPanel;
tbZ: TTrackBar;
tbZ2: TTrackBar;
vsGradient: TBGRAVirtualScreen;
cbYAxis: TComboBox;
cbXAxis: TComboBox;
Panel1: TPanel;
Splitter1: TSplitter;
vsHorseshoe: TBGRAVirtualScreen;
procedure cbColorspaceChange(Sender: TObject);
procedure cbFluorescentClick(Sender: TObject);
procedure cbOverflowChange(Sender: TObject);
procedure cbReferenceWhiteChange(Sender: TObject);
procedure cbXAxisChange(Sender: TObject);
procedure cbYAxisChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure tbZChange(Sender: TObject);
procedure vsGradientRedraw(Sender: TObject; Bitmap: TBGRABitmap);
procedure vsHorseshoeRedraw(Sender: TObject; Bitmap: TBGRABitmap);
procedure UpdateSelectedAxis;
procedure UpdateSelectedColorspace;
procedure UpdateRGBOverlow;
private
ZName, Z2Name: string;
ZFactor, Z2Factor: single;
function SelectedColorspace: TColorspaceAny;
procedure UpdateReferenceWhiteFromCombo;
public
end;
{ THorseShoeScanner }
THorseShoeScanner = class(TBGRACustomScanner)
protected
FOrigin: TPointF;
FWidth,FHeight,FXStep,FYStep: single;
FXYZ: TXYZA;
FHorseShoeGrayAmount,FHorseShoeGrayLevel: single;
public
constructor Create(AOrigin: TPointF; AWidth,AHeight: single;
AHorseShoeGrayAmount,AHorseShoeGrayLevel: single);
procedure AdaptColorToRGBDisplay(var xyz: TXYZA);
function ScanAtXYZ(X,Y: Single): TXYZA;
function ScanAt(X,Y: Single): TBGRAPixel; override;
procedure ScanMoveTo(X,Y: Integer); override;
function ScanNextPixel: TBGRAPixel; override;
end;
var
Form1: TForm1;
implementation
uses XYZABitmap;
const
OptimalReflectStep = 250;
OptimalReflectArraySize = OptimalReflectStep;
OptimalReflectBorderStep = OptimalReflectStep div 10;
var
OptimalReflectXYZ: array[0..OptimalReflectArraySize,0..OptimalReflectArraySize] of record
min,max: single;
end;
{ optimalXYZMin,optimalXYZMax: TXYZA; }
{ labMin,labMax: TLabA;
lchMin,lchMax: TLChA;}
function IsOptimalReflect(xyz: TXYZA): boolean;
begin
with GetReferenceWhite do
begin
xyz.X /= X;
xyz.Y /= Y;
xyz.Z /= Z;
end;
if (xyz.Y >= 0) and (xyz.Y <= 1) and
(xyz.X >= 0) and (xyz.X <= 1) and
(xyz.Z >= 0) and (xyz.Z <= 1) then
begin
xyz.X := sqrt(xyz.X);
xyz.Z := sqrt(xyz.Z);
with OptimalReflectXYZ[round(xyz.X*OptimalReflectStep),round(xyz.Z*OptimalReflectStep)] do
if (min <> EmptySingle) and (xyz.Y >= min) and (xyz.Y <= max) then exit(true);
end;
result := false;
end;
procedure AddOptimalReflect(xyz: TXYZA);
{var
lab: TLabA;
lch: TLChA; }
begin
{ if xyz.X < optimalXYZMin.X then optimalXYZMin.X := xyz.X;
if xyz.Y < optimalXYZMin.Y then optimalXYZMin.Y := xyz.Y;
if xyz.Z < optimalXYZMin.Z then optimalXYZMin.Z := xyz.Z;
if xyz.X > optimalXYZMax.X then optimalXYZMax.X := xyz.X;
if xyz.Y > optimalXYZMax.Y then optimalXYZMax.Y := xyz.Y;
if xyz.Z > optimalXYZMax.Z then optimalXYZMax.Z := xyz.Z; }
{ lab := xyz.ToLabA(ReferenceWhite2E);
if lab.L < labMin.L then labMin.L := lab.L;
if lab.a < labMin.a then labMin.a := lab.a;
if lab.b < labMin.b then labMin.b := lab.b;
if lab.L > labMax.L then labMax.L := lab.L;
if lab.a > labMax.a then labMax.a := lab.a;
if lab.b > labMax.b then labMax.b := lab.b;
lch := lab.ToLChA;
if lch.L < lchMin.L then lchMin.L := lch.L;
if lch.C < lchMin.C then lchMin.C := lch.C;
if lch.h < lchMin.h then lchMin.h := lch.h;
if lch.L > lchMax.L then lchMax.L := lch.L;
if lch.C > lchMax.C then lchMax.C := lch.C;
if lch.h > lchMax.h then lchMax.h := lch.h; }
if (xyz.Y >= 0) and (xyz.Y <= 1) and
(xyz.X >= 0) and (xyz.X <= 1) and
(xyz.Z >= 0) and (xyz.Z <= 1) then
begin
xyz.X := sqrt(xyz.X);
xyz.Z := sqrt(xyz.Z);
with OptimalReflectXYZ[round(xyz.X*OptimalReflectStep),
round(xyz.Z*OptimalReflectStep)] do
begin
if min = EmptySingle then
begin
min := xyz.Y;
max := xyz.Y;
end else
begin
if xyz.Y < min then min := xyz.Y;
if xyz.Y > max then max := xyz.Y;
end;
end;
end;
end;
{$R *.lfm}
{ THorseShoeScanner }
constructor THorseShoeScanner.Create(AOrigin: TPointF; AWidth, AHeight: single;
AHorseShoeGrayAmount,AHorseShoeGrayLevel: single);
begin
FOrigin := AOrigin;
FWidth:= AWidth;
FHeight:= AHeight;
FHorseShoeGrayAmount:= AHorseShoeGrayAmount;
FHorseShoeGrayLevel:= AHorseShoeGrayLevel;
FXStep := 1/FWidth*(1-FHorseShoeGrayAmount);
FYStep := 1/FHeight*(1-FHorseShoeGrayAmount);
end;
procedure THorseShoeScanner.AdaptColorToRGBDisplay(var xyz:TXYZA);
begin
xyz.X := xyz.X*(1-FHorseShoeGrayAmount) + FHorseShoeGrayLevel*FHorseShoeGrayAmount;
xyz.Y := xyz.Y*(1-FHorseShoeGrayAmount) + FHorseShoeGrayLevel*FHorseShoeGrayAmount;
xyz.Z := xyz.Z*(1-FHorseShoeGrayAmount) + FHorseShoeGrayLevel*FHorseShoeGrayAmount;
end;
function THorseShoeScanner.ScanAtXYZ(X, Y: Single): TXYZA;
begin
result := TXYZA.New((X-FOrigin.X)/FWidth,(Y-FOrigin.Y)/FHeight,0);
result.Z := 1-(result.X+result.Y);
AdaptColorToRGBDisplay(result);
end;
function THorseShoeScanner.ScanAt(X, Y: Single): TBGRAPixel;
begin
result := ScanAtXYZ(X,Y).ToBGRAPixel;
end;
procedure THorseShoeScanner.ScanMoveTo(X, Y: Integer);
begin
FXYZ := ScanAtXYZ(X,Y);
end;
function THorseShoeScanner.ScanNextPixel: TBGRAPixel;
begin
result := FXYZ.ToBGRAPixel;
FXYZ.X += FXStep;
FXYZ.Z -= FXStep;
end;
{ TForm1 }
procedure TForm1.vsHorseshoeRedraw(Sender: TObject; Bitmap: TBGRABitmap);
var
squareWidth,squareHeight: single;
squareOrigin: TPointF;
function xyzToPointF(xyz: TXYZA): TPointF;
var
n: single;
begin
n := xyz.X+xyz.Y+xyz.Z;
if (n <= 0) or (xyz.X < 0) or (xyz.Y < 0) or (xyz.Z < 0) then
result := EmptyPointF
else
result := PointF(squareOrigin.x+xyz.X/n*squareWidth,squareOrigin.y+xyz.Y/n*squareHeight);
end;
procedure DrawHorseShoe;
const HorseShoeMargin = 0.02;
var
i,j: Integer;
xyz: TXYZA;
pts: array of TPointF;
scan: THorseShoeScanner;
min,max: TPointF;
marginX,marginY: single;
prevRefWhite: TXYZReferenceWhite;
begin
squareOrigin := PointF(0,0);
squareWidth:= 1;
squareHeight:= 1;
setlength(pts, length(SpectralLocus));
xyz.alpha := 1;
j := 0;
for i := low(SpectralLocus) to high(SpectralLocus) do
begin
xyz.X := SpectralLocus[i].X;
xyz.Y := SpectralLocus[i].Y;
xyz.Z := SpectralLocus[i].Z;
pts[j] := xyzToPointF(xyz);
if i = low(SpectralLocus) then
begin
min := pts[j];
max := pts[j];
end else
begin
if pts[j].x < min.x then min.x := pts[j].x
else if pts[j].x > max.x then max.x := pts[j].x;
if pts[j].y < min.y then min.y := pts[j].y
else if pts[j].y > max.y then max.y := pts[j].y;
end;
inc(j);
end;
marginX := Bitmap.Width * HorseShoeMargin;
marginY := Bitmap.Height * HorseShoeMargin;
squareWidth:= (Bitmap.Width-1-2*marginX)/max.x;
squareHeight := -(Bitmap.Height-1-2*marginY)/max.y;
squareOrigin := PointF(marginX,Bitmap.Height-1-marginY);
for j := 0 to high(pts) do
pts[j] := squareOrigin + PointF(pts[j].x*squareWidth,pts[j].y*squareHeight);
// spectral locus is normalized for equal illuminant
prevRefWhite := GetReferenceWhite;
SetReferenceWhite(2, 'E');
if XYZToRGBOverflowMin = xroClipToTarget then
scan := THorseShoeScanner.Create(squareOrigin, squareWidth, squareHeight, 0.36, 0)
else
scan := THorseShoeScanner.Create(squareOrigin, squareWidth, squareHeight, 0.5, 0.25);
pts := Bitmap.ComputeOpenedSpline(pts, ssCrossingWithEnds);
Bitmap.FillPolyAntialias(pts,scan);
Bitmap.DrawPolygonAntialias(pts,BGRABlack, (Bitmap.Width+Bitmap.Height)/600);
scan.Free;
SetReferenceWhite(prevRefWhite);
end;
procedure DrawColorspace;
const bitsPerChannel = 3;
maxPerChannel = (1 shl bitsPerChannel)-1;
var
xyz: TXYZA;
i,j, channelCount, bitCount: Integer;
colorspace: TColorspaceAny;
colorValue: pointer;
dotSize: single;
pt: TPointF;
min,max: array of single;
begin
dotSize := (Bitmap.Width+Bitmap.Height)/400;
colorspace := SelectedColorspace;
getmem(colorValue, colorspace.GetSize);
channelCount:= colorspace.GetChannelCount;
setlength(min, channelCount);
setlength(max, channelCount);
for j := 0 to channelCount-1 do
begin
min[j] := colorspace.GetMinValue(j);
max[j] := colorspace.GetMaxValue(j);
end;
if colorspace.IndexOfAlphaChannel = channelCount-1 then
begin
colorspace.SetChannel(colorValue, channelCount-1, max[channelCount-1]);
dec(channelCount);
end;
bitCount := channelCount*bitsPerChannel;
for i := 0 to (1 shl bitCount) - 1 do
begin
for j := 0 to channelCount-1 do
colorspace.SetChannel(colorValue, j, min[j] + (max[j]-min[j]) * ((i shr (j*bitsPerChannel)) and maxPerChannel)/maxPerChannel);
colorspace.Convert(colorValue^, xyz, TXYZAColorspace);
pt := xyzToPointF(xyz);
if not isEmptyPointF(pt) then
Bitmap.FillEllipseAntialias(pt.x,pt.y, dotSize,dotSize, BGRA(0,0,0,128));
end;
freemem(colorValue);
end;
begin
Bitmap.Fill(CSSGray);
DrawHorseShoe;
DrawColorspace;
end;
procedure TForm1.UpdateSelectedAxis;
var
colorspace: TColorspaceAny;
procedure UpdateZCombo(zIndex: integer; var ZName: string; var zFactor: single; lblZ: TLabel; tbZ: TTrackBar);
begin
if zIndex = -1 then
begin
lblZ.Caption := '';
tbZ.Enabled := false;
end else
begin
ZName := colorspace.GetChannelName(zIndex);
lblZ.Caption := ZName;
tbZ.Enabled := true;
if colorspace.GetMaxValue(zIndex)-colorspace.GetMinValue(zIndex) < 10 then
zFactor:= 100
else
zFactor := 1;
tbZ.Min := round(colorspace.GetMinValue(zIndex)*zFactor);
tbZ.Max := round(colorspace.GetMaxValue(zIndex)*zFactor);
if ZName = 'Alpha' then
tbZ.Position := tbZ.Max
else
tbZ.Position := (tbZ.Max+tbZ.Min) div 2;
end;
end;
var
i,j: Integer;
zIndex,z2Index: integer;
begin
colorspace := SelectedColorspace;
j := 0;
zIndex := -1;
z2Index:= -1;
for i := 0 to colorspace.GetChannelCount-1 do
begin
if (colorspace.GetChannelName(i) <> cbXAxis.Text) and
(colorspace.GetChannelName(i) <> cbYAxis.Text) then
begin
case j of
0: zIndex := i;
1: z2Index:= i;
end;
inc(j);
end;
end;
UpdateZCombo(zIndex, ZName, zFactor, lblZ, tbZ);
UpdateZCombo(z2Index, Z2Name, z2Factor, lblZ2, tbZ2);
vsGradient.DiscardBitmap;
end;
procedure TForm1.UpdateSelectedColorspace;
var
colorspace: TColorspaceAny;
i: Integer;
begin
colorspace := SelectedColorspace;
cbXAxis.Items.Clear;
cbXAxis.Style := csDropDownList;
for i := 0 to colorspace.GetChannelCount-1 do
cbXAxis.Items.Add(colorspace.GetChannelName(i));
cbYAxis.Items.Clear;
cbYAxis.Style := csDropDownList;
for i := 0 to colorspace.GetChannelCount-1 do
cbYAxis.Items.Add(colorspace.GetChannelName(i));
if (colorspace = TXYZAColorspace) or (colorspace = TWordXYZAColorspace) then
begin
cbXAxis.ItemIndex:= colorspace.IndexOfChannel('X');
cbYAxis.ItemIndex:= colorspace.IndexOfChannel('Z');
end else
if (colorspace = TYCbCr601Colorspace) or (colorspace = TYCbCr601JPEGColorspace) or
(colorspace = TYCbCr709Colorspace) or (colorspace = TYCbCr709JPEGColorspace) then
begin
cbXAxis.ItemIndex:= colorspace.IndexOfChannel('BlueDiff');
cbYAxis.ItemIndex:= colorspace.IndexOfChannel('RedDiff');
end else
if colorspace = TLabAColorspace then
begin
cbXAxis.ItemIndex:= colorspace.IndexOfChannel('a');
cbYAxis.ItemIndex:= colorspace.IndexOfChannel('b');
end else
if colorspace = TLChAColorspace then
begin
cbXAxis.ItemIndex:= colorspace.IndexOfChannel('Hue');
cbYAxis.ItemIndex:= colorspace.IndexOfChannel('Chroma');
end else
begin
cbXAxis.ItemIndex:= 0;
if colorspace.GetChannelCount> 1 then
cbYAxis.ItemIndex:= 1
else
cbYAxis.ItemIndex:= 0;
end;
cbReferenceWhite.Enabled := cfReferenceWhiteIndependent in colorspace.GetFlags;
if (colorspace = TXYZAColorspace) or (colorspace = TWordXYZAColorspace) then SetReferenceWhite(2, 'E')
else UpdateReferenceWhiteFromCombo;
UpdateSelectedAxis;
vsHorseshoe.DiscardBitmap;
end;
procedure TForm1.UpdateRGBOverlow;
begin
XYZToRGBOverflowMin:= TColorspaceOverflow(cbOverflow.ItemIndex);
XYZToRGBOverflowMax:= TColorspaceOverflow(cbOverflow.ItemIndex);
end;
function TForm1.SelectedColorspace: TColorspaceAny;
var
i: Integer;
begin
for i := 0 to ColorspaceCollection.GetCount-1 do
if ColorspaceCollection.GetItem(i).GetName = cbColorspace.Text then
exit(ColorspaceCollection.GetItem(i));
result := TBGRAPixelColorspace;
end;
procedure TForm1.UpdateReferenceWhiteFromCombo;
begin
if cbReferenceWhite.ItemIndex <> -1 then
begin
SetReferenceWhite(GetReferenceWhiteByIndex(cbReferenceWhite.ItemIndex));
vsGradient.DiscardBitmap;
vsHorseshoe.DiscardBitmap;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
i: Integer;
csName: String;
begin
cbColorspace.Items.Clear;
cbColorspace.Style := csDropDownList;
for i := 0 to ColorspaceCollection.GetCount-1 do
begin
csName := ColorspaceCollection.GetItem(i).GetName;
if (csName <> 'Color') and (csName <> 'BGRAPixel') and (csName <> 'ExpandedPixel')
and (csName <> 'FPColor') then
cbColorspace.Items.Add(csName);
end;
cbColorspace.ItemIndex := 0;
cbReferenceWhite.Items.Clear;
cbReferenceWhite.Style := csDropDownList;
for i := 0 to GetReferenceWhiteCount-1 do
with GetReferenceWhiteByIndex(i) do
begin
cbReferenceWhite.Items.Add(inttostr(ObserverAngle)+'° '+Illuminant);
if (ObserverAngle = GetReferenceWhite.ObserverAngle) and (Illuminant = GetReferenceWhite.Illuminant) then
cbReferenceWhite.ItemIndex := cbReferenceWhite.Items.Count-1;
end;
UpdateSelectedColorspace;
cbOverflow.ItemIndex:= ord(xroPreserveHue);
UpdateRGBOverlow;
end;
procedure TForm1.tbZChange(Sender: TObject);
begin
vsGradient.DiscardBitmap;
end;
procedure TForm1.cbColorspaceChange(Sender: TObject);
begin
UpdateSelectedColorspace;
end;
procedure TForm1.cbFluorescentClick(Sender: TObject);
begin
vsGradient.DiscardBitmap;
end;
procedure TForm1.cbOverflowChange(Sender: TObject);
begin
vsGradient.DiscardBitmap;
vsHorseshoe.DiscardBitmap;
UpdateRGBOverlow;
end;
procedure TForm1.cbReferenceWhiteChange(Sender: TObject);
begin
UpdateReferenceWhiteFromCombo;
end;
procedure TForm1.cbXAxisChange(Sender: TObject);
begin
UpdateSelectedAxis;
end;
procedure TForm1.cbYAxisChange(Sender: TObject);
begin
UpdateSelectedAxis;
end;
procedure TForm1.vsGradientRedraw(Sender: TObject; Bitmap: TBGRABitmap);
var
colorspace: TColorspaceAny;
rowData, p: PByte;
valueSize, rowDataSize, y, x: integer;
idxAlpha, idxChX, idxChY, idxZ: integer;
maxAlpha, zValue, minChX, minChY, maxChX, maxChY, valX, valXStep, valY: single;
s: string;
temp: TBGRABitmap;
xyzaBuf: array of TXYZA;
begin
colorspace := SelectedColorspace;
valueSize := colorspace.GetSize;
rowDataSize := Bitmap.Width * valueSize;
getmem(rowData, rowDataSize);
fillchar(rowData^, rowDataSize, 0);
idxAlpha := colorspace.IndexOfAlphaChannel;
if idxAlpha <> -1 then
begin
maxAlpha := colorspace.GetMaxValue(idxAlpha);
p := rowData;
for x := 0 to Bitmap.Width-1 do
begin
colorspace.SetChannel(p, idxAlpha, maxAlpha);
inc(p, valueSize);
end;
end;
idxZ := colorspace.IndexOfChannel(ZName);
if idxZ <> -1 then
begin
zValue := tbZ.Position/ZFactor;
p := rowData;
for x := 0 to Bitmap.Width-1 do
begin
colorspace.SetChannel(p, idxZ, zValue);
inc(p, valueSize);
end;
end;
idxZ := colorspace.IndexOfChannel(Z2Name);
if idxZ <> -1 then
begin
zValue := tbZ2.Position/Z2Factor;
p := rowData;
for x := 0 to Bitmap.Width-1 do
begin
colorspace.SetChannel(p, idxZ, zValue);
inc(p, valueSize);
end;
end;
idxChX := cbXAxis.ItemIndex;
minChX := colorspace.GetMinValue(idxChX);
maxChX := colorspace.GetMaxValue(idxChX);
idxChY := cbYAxis.ItemIndex;
if idxChY = -1 then
begin
minChY := 0;
maxChY := 1;
end else
begin
minChY := colorspace.GetMinValue(idxChY);
maxChY := colorspace.GetMaxValue(idxChY);
end;
WriteStr(s, minChY:0:2, '\', minChX:0:2);
lblMin.Caption := s;
if maxChX > 250 then
WriteStr(s, maxChX:0:0)
else
WriteStr(s, maxChX:0:2);
lblMaxX.Caption := s;
if maxChY > 250 then
WriteStr(s, maxChY:0:0)
else
WriteStr(s, maxChY:0:2);
lblMaxY.Caption := s;
temp := TBGRABitmap.Create(Bitmap.Width,Bitmap.Height);
for y := 0 to Bitmap.Height-1 do
begin
valY := (1-y/(Bitmap.Height-1))*(maxChY-minChY) + minChY;
p := rowData;
for x := 0 to Bitmap.Width-1 do
begin
colorspace.SetChannel(p, idxChY, valY);
inc(p, valueSize);
end;
valX := minChX;
valXStep := 1/(Bitmap.Width-1)*(maxChX-minChX);
p := rowData;
for x := 0 to Bitmap.Width-1 do
begin
colorspace.SetChannel(p, idxChX, valX);
valX += valXStep;
if valX>maxChX then valX := maxChX;
inc(p, valueSize);
end;
if (cfHasImaginaryColors in colorspace.GetFlags) and (XYZToRGBOverflowMin <> xroClipToTarget) then
begin
setlength(xyzaBuf, Bitmap.Width);
colorspace.Convert(rowData^, xyzaBuf[0], TXYZAColorspace, Bitmap.Width);
if cbFluorescent.Checked then
begin
for x := 0 to Bitmap.Width-1 do
begin
if not IsRealColor(xyzaBuf[x]) then
xyzaBuf[x] := XYZATransparent;
end;
end else
begin
for x := 0 to Bitmap.Width-1 do
begin
if not IsOptimalReflect(xyzaBuf[x]) then
xyzaBuf[x] := XYZATransparent;
end;
end;
TXYZAColorspace.Convert(xyzaBuf[0], temp.ScanLine[y]^, TBGRAPixelColorspace, Bitmap.Width, @ReferenceWhite2D65);
end else
if (not cbFluorescent.Checked) and ((cfHasImaginaryColors in colorspace.GetFlags) or (colorspace = TAdobeRGBAColorspace)) then
begin
setlength(xyzaBuf, Bitmap.Width);
colorspace.Convert(rowData^, xyzaBuf[0], TXYZAColorspace, Bitmap.Width);
for x := 0 to Bitmap.Width-1 do
begin
if not IsOptimalReflect(xyzaBuf[x]) then
xyzaBuf[x] := XYZATransparent;
end;
TXYZAColorspace.Convert(xyzaBuf[0], temp.ScanLine[y]^, TBGRAPixelColorspace, Bitmap.Width);
end else
colorspace.Convert(rowData^, temp.ScanLine[y]^, TBGRAPixelColorspace, Bitmap.Width);
end;
Bitmap.DrawCheckers(Bitmap.ClipRect, CSSGray, CSSSilver);
Bitmap.PutImage(0,0, temp, dmDrawWithTransparency);
temp.Free;
freemem(rowData, rowDataSize);
end;
var i,j,k,l,m,jMod: integer;
xyz, xyzMax, xyzMain: TXYZA;
spectralLocusNormalizedSum: array[low(SpectralLocus)..high(SpectralLocus)] of TXYZA;
initialization
//writeln('Computing reflective color bounds...');
for i := 0 to OptimalReflectArraySize do
for j := 0 to OptimalReflectArraySize do
OptimalReflectXYZ[i,j].min := EmptySingle;
xyzMax.X := 0;
xyzMax.Y := 0;
xyzMax.Z := 0;
for i := 0 to high(SpectralLocus) do
begin
xyzMax.X += SpectralLocus[i].X;
xyzMax.Y += SpectralLocus[i].Y;
xyzMax.Z += SpectralLocus[i].Z;
end;
for i := 0 to high(SpectralLocus) do
spectralLocusNormalizedSum[i] := TXYZA.New(SpectralLocus[i].X/xyzMax.X/OptimalReflectBorderStep,
SpectralLocus[i].Y/xyzMax.Y/OptimalReflectBorderStep,
SpectralLocus[i].Z/xyzMax.Z/OptimalReflectBorderStep);
{optimalXYZMin := CSSSilver;
optimalXYZMax := CSSSilver;}
{labMin := CSSSilver;
labMax := CSSSilver;
lchMin := CSSSilver;
lchMax := CSSSilver;}
AddOptimalReflect(BGRABlack);
for i := 0 to high(SpectralLocus) do
begin
xyzMain.X := 0;
xyzMain.Y := 0;
xyzMain.Z := 0;
jMod := i;
for k := 1 to length(SpectralLocus) do
begin
if k = 1 then
begin
xyz := xyzMain;
for l := 1 to OptimalReflectBorderStep*8 do
begin
with spectralLocusNormalizedSum[i] do
begin
xyz.X += X*0.125;
xyz.Y += Y*0.125;
xyz.Z += Z*0.125;
end;
AddOptimalReflect(xyz);
end;
end else
for l := 1 to OptimalReflectBorderStep do
begin
xyz := xyzMain;
with spectralLocusNormalizedSum[i] do
begin
xyz.X += l*X;
xyz.Y += l*Y;
xyz.Z += l*Z;
end;
for m := 1 to OptimalReflectBorderStep do
begin
with spectralLocusNormalizedSum[jMod] do
begin
xyz.X += X;
xyz.Y += Y;
xyz.Z += Z;
end;
AddOptimalReflect(xyz);
end;
end;
if k >= 2 then
begin
with spectralLocusNormalizedSum[jMod] do
begin
xyzMain.X += X*OptimalReflectBorderStep;
xyzMain.Y += Y*OptimalReflectBorderStep;
xyzMain.Z += Z*OptimalReflectBorderStep;
end;
end;
inc(jMod);
if jMod = length(SpectralLocus) then jMod := 0;
end;
end;
//writeln('xyz min ',optimalXYZMin.x,', ',optimalXYZMin.y,', ',optimalXYZMin.z);
//writeln('xyz max ',optimalXYZMax.x,', ',optimalXYZMax.y,', ',optimalXYZMax.z);
{writeln('Lab min ',labMin.L,', ',labMin.a,', ',labMin.b);
writeln('Lab max ',labMax.L,', ',labMax.a,', ',labMax.b);
writeln('LCh min ',lChMin.L,', ',lChMin.C,', ',lChMin.h);
writeln('LCh max ',lChMax.L,', ',lChMax.C,', ',lChMax.h);}
end.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="createbitmap"/>
<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="1">
<Item1>
<PackageName Value="LCL"/>
</Item1>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="createbitmap.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="umain.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="FMain"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="createbitmap"/>
</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>

View File

@@ -0,0 +1,21 @@
program createbitmap;
{$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.

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Some files were not shown because too many files have changed in this diff Show More