Стартовый пул
This commit is contained in:
450
bgrabitmap/test/vectorize/umain.lfm
Normal file
450
bgrabitmap/test/vectorize/umain.lfm
Normal file
@@ -0,0 +1,450 @@
|
||||
object FMain: TFMain
|
||||
Left = 403
|
||||
Height = 447
|
||||
Top = 145
|
||||
Width = 545
|
||||
Caption = 'Vectorize'
|
||||
ClientHeight = 447
|
||||
ClientWidth = 545
|
||||
OnCreate = FormCreate
|
||||
LCLVersion = '2.0.0.4'
|
||||
object BCPanel1: TBCPanel
|
||||
Left = 0
|
||||
Height = 38
|
||||
Top = 0
|
||||
Width = 545
|
||||
Align = alTop
|
||||
Background.Color = clBtnFace
|
||||
Background.ColorOpacity = 255
|
||||
Background.Gradient1.StartColor = clBtnFace
|
||||
Background.Gradient1.StartColorOpacity = 255
|
||||
Background.Gradient1.DrawMode = dmSet
|
||||
Background.Gradient1.EndColor = clBtnHighlight
|
||||
Background.Gradient1.EndColorOpacity = 255
|
||||
Background.Gradient1.ColorCorrection = True
|
||||
Background.Gradient1.GradientType = gtLinear
|
||||
Background.Gradient1.Point1XPercent = 0
|
||||
Background.Gradient1.Point1YPercent = 0
|
||||
Background.Gradient1.Point2XPercent = 0
|
||||
Background.Gradient1.Point2YPercent = 100
|
||||
Background.Gradient1.Sinus = False
|
||||
Background.Gradient2.StartColor = clBtnHighlight
|
||||
Background.Gradient2.StartColorOpacity = 255
|
||||
Background.Gradient2.DrawMode = dmSet
|
||||
Background.Gradient2.EndColor = clBtnShadow
|
||||
Background.Gradient2.EndColorOpacity = 255
|
||||
Background.Gradient2.ColorCorrection = True
|
||||
Background.Gradient2.GradientType = gtLinear
|
||||
Background.Gradient2.Point1XPercent = 0
|
||||
Background.Gradient2.Point1YPercent = 0
|
||||
Background.Gradient2.Point2XPercent = 0
|
||||
Background.Gradient2.Point2YPercent = 100
|
||||
Background.Gradient2.Sinus = False
|
||||
Background.Gradient1EndPercent = 35
|
||||
Background.Style = bbsGradient
|
||||
BevelInner = bvNone
|
||||
BevelOuter = bvRaised
|
||||
BevelWidth = 1
|
||||
Border.Color = clBlack
|
||||
Border.ColorOpacity = 255
|
||||
Border.LightColor = clWhite
|
||||
Border.LightOpacity = 255
|
||||
Border.LightWidth = 0
|
||||
Border.Style = bboNone
|
||||
Border.Width = 1
|
||||
FontEx.Color = clDefault
|
||||
FontEx.EndEllipsis = False
|
||||
FontEx.FontQuality = fqFineAntialiasing
|
||||
FontEx.Height = 0
|
||||
FontEx.SingleLine = True
|
||||
FontEx.Shadow = False
|
||||
FontEx.ShadowColor = clBlack
|
||||
FontEx.ShadowColorOpacity = 255
|
||||
FontEx.ShadowRadius = 5
|
||||
FontEx.ShadowOffsetX = 5
|
||||
FontEx.ShadowOffsetY = 5
|
||||
FontEx.Style = []
|
||||
FontEx.TextAlignment = bcaCenter
|
||||
FontEx.WordBreak = False
|
||||
Rounding.RoundX = 1
|
||||
Rounding.RoundY = 1
|
||||
Rounding.RoundOptions = []
|
||||
TabOrder = 0
|
||||
object BCLabel1: TBCLabel
|
||||
Left = 8
|
||||
Height = 17
|
||||
Top = 8
|
||||
Width = 33
|
||||
Background.Color = clBlack
|
||||
Background.ColorOpacity = 255
|
||||
Background.Gradient1.StartColor = clWhite
|
||||
Background.Gradient1.StartColorOpacity = 255
|
||||
Background.Gradient1.DrawMode = dmSet
|
||||
Background.Gradient1.EndColor = clBlack
|
||||
Background.Gradient1.EndColorOpacity = 255
|
||||
Background.Gradient1.ColorCorrection = True
|
||||
Background.Gradient1.GradientType = gtLinear
|
||||
Background.Gradient1.Point1XPercent = 0
|
||||
Background.Gradient1.Point1YPercent = 0
|
||||
Background.Gradient1.Point2XPercent = 0
|
||||
Background.Gradient1.Point2YPercent = 100
|
||||
Background.Gradient1.Sinus = False
|
||||
Background.Gradient2.StartColor = clWhite
|
||||
Background.Gradient2.StartColorOpacity = 255
|
||||
Background.Gradient2.DrawMode = dmSet
|
||||
Background.Gradient2.EndColor = clBlack
|
||||
Background.Gradient2.EndColorOpacity = 255
|
||||
Background.Gradient2.ColorCorrection = True
|
||||
Background.Gradient2.GradientType = gtLinear
|
||||
Background.Gradient2.Point1XPercent = 0
|
||||
Background.Gradient2.Point1YPercent = 0
|
||||
Background.Gradient2.Point2XPercent = 0
|
||||
Background.Gradient2.Point2YPercent = 100
|
||||
Background.Gradient2.Sinus = False
|
||||
Background.Gradient1EndPercent = 35
|
||||
Background.Style = bbsClear
|
||||
Border.Color = clBlack
|
||||
Border.ColorOpacity = 255
|
||||
Border.LightColor = clWhite
|
||||
Border.LightOpacity = 255
|
||||
Border.LightWidth = 0
|
||||
Border.Style = bboNone
|
||||
Border.Width = 1
|
||||
Caption = 'Zoom'
|
||||
FontEx.Color = clDefault
|
||||
FontEx.EndEllipsis = False
|
||||
FontEx.FontQuality = fqFineAntialiasing
|
||||
FontEx.Height = 0
|
||||
FontEx.SingleLine = True
|
||||
FontEx.Shadow = False
|
||||
FontEx.ShadowColor = clBlack
|
||||
FontEx.ShadowColorOpacity = 255
|
||||
FontEx.ShadowRadius = 5
|
||||
FontEx.ShadowOffsetX = 5
|
||||
FontEx.ShadowOffsetY = 5
|
||||
FontEx.Style = []
|
||||
FontEx.TextAlignment = bcaCenter
|
||||
FontEx.WordBreak = False
|
||||
InnerMargin = 0
|
||||
Rounding.RoundX = 1
|
||||
Rounding.RoundY = 1
|
||||
Rounding.RoundOptions = []
|
||||
end
|
||||
object BCTrackbarZoom: TBCTrackbarUpdown
|
||||
Left = 48
|
||||
Height = 26
|
||||
Top = 5
|
||||
Width = 48
|
||||
BarExponent = 1
|
||||
Increment = 1
|
||||
LongTimeInterval = 400
|
||||
MinValue = 1
|
||||
MaxValue = 32
|
||||
OnChange = BCTrackbarChange
|
||||
Value = 8
|
||||
ShortTimeInterval = 100
|
||||
Background.Color = clWindow
|
||||
Background.ColorOpacity = 255
|
||||
Background.Gradient1.StartColor = clWhite
|
||||
Background.Gradient1.StartColorOpacity = 255
|
||||
Background.Gradient1.DrawMode = dmSet
|
||||
Background.Gradient1.EndColor = clBlack
|
||||
Background.Gradient1.EndColorOpacity = 255
|
||||
Background.Gradient1.ColorCorrection = True
|
||||
Background.Gradient1.GradientType = gtLinear
|
||||
Background.Gradient1.Point1XPercent = 0
|
||||
Background.Gradient1.Point1YPercent = 0
|
||||
Background.Gradient1.Point2XPercent = 0
|
||||
Background.Gradient1.Point2YPercent = 100
|
||||
Background.Gradient1.Sinus = False
|
||||
Background.Gradient2.StartColor = clWhite
|
||||
Background.Gradient2.StartColorOpacity = 255
|
||||
Background.Gradient2.DrawMode = dmSet
|
||||
Background.Gradient2.EndColor = clBlack
|
||||
Background.Gradient2.EndColorOpacity = 255
|
||||
Background.Gradient2.ColorCorrection = True
|
||||
Background.Gradient2.GradientType = gtLinear
|
||||
Background.Gradient2.Point1XPercent = 0
|
||||
Background.Gradient2.Point1YPercent = 0
|
||||
Background.Gradient2.Point2XPercent = 0
|
||||
Background.Gradient2.Point2YPercent = 100
|
||||
Background.Gradient2.Sinus = False
|
||||
Background.Gradient1EndPercent = 35
|
||||
Background.Style = bbsColor
|
||||
ButtonBackground.Color = clBlack
|
||||
ButtonBackground.ColorOpacity = 255
|
||||
ButtonBackground.Gradient1.StartColor = clBtnShadow
|
||||
ButtonBackground.Gradient1.StartColorOpacity = 255
|
||||
ButtonBackground.Gradient1.DrawMode = dmSet
|
||||
ButtonBackground.Gradient1.EndColor = clBtnFace
|
||||
ButtonBackground.Gradient1.EndColorOpacity = 255
|
||||
ButtonBackground.Gradient1.ColorCorrection = True
|
||||
ButtonBackground.Gradient1.GradientType = gtLinear
|
||||
ButtonBackground.Gradient1.Point1XPercent = 0
|
||||
ButtonBackground.Gradient1.Point1YPercent = -50
|
||||
ButtonBackground.Gradient1.Point2XPercent = 0
|
||||
ButtonBackground.Gradient1.Point2YPercent = 50
|
||||
ButtonBackground.Gradient1.Sinus = False
|
||||
ButtonBackground.Gradient2.StartColor = clBtnFace
|
||||
ButtonBackground.Gradient2.StartColorOpacity = 255
|
||||
ButtonBackground.Gradient2.DrawMode = dmSet
|
||||
ButtonBackground.Gradient2.EndColor = clBtnShadow
|
||||
ButtonBackground.Gradient2.EndColorOpacity = 255
|
||||
ButtonBackground.Gradient2.ColorCorrection = True
|
||||
ButtonBackground.Gradient2.GradientType = gtLinear
|
||||
ButtonBackground.Gradient2.Point1XPercent = 0
|
||||
ButtonBackground.Gradient2.Point1YPercent = 50
|
||||
ButtonBackground.Gradient2.Point2XPercent = 0
|
||||
ButtonBackground.Gradient2.Point2YPercent = 150
|
||||
ButtonBackground.Gradient2.Sinus = False
|
||||
ButtonBackground.Gradient1EndPercent = 50
|
||||
ButtonBackground.Style = bbsGradient
|
||||
ButtonDownBackground.Color = clBtnShadow
|
||||
ButtonDownBackground.ColorOpacity = 255
|
||||
ButtonDownBackground.Gradient1.StartColor = clWhite
|
||||
ButtonDownBackground.Gradient1.StartColorOpacity = 255
|
||||
ButtonDownBackground.Gradient1.DrawMode = dmSet
|
||||
ButtonDownBackground.Gradient1.EndColor = clBlack
|
||||
ButtonDownBackground.Gradient1.EndColorOpacity = 255
|
||||
ButtonDownBackground.Gradient1.ColorCorrection = True
|
||||
ButtonDownBackground.Gradient1.GradientType = gtLinear
|
||||
ButtonDownBackground.Gradient1.Point1XPercent = 0
|
||||
ButtonDownBackground.Gradient1.Point1YPercent = 0
|
||||
ButtonDownBackground.Gradient1.Point2XPercent = 0
|
||||
ButtonDownBackground.Gradient1.Point2YPercent = 100
|
||||
ButtonDownBackground.Gradient1.Sinus = False
|
||||
ButtonDownBackground.Gradient2.StartColor = clWhite
|
||||
ButtonDownBackground.Gradient2.StartColorOpacity = 255
|
||||
ButtonDownBackground.Gradient2.DrawMode = dmSet
|
||||
ButtonDownBackground.Gradient2.EndColor = clBlack
|
||||
ButtonDownBackground.Gradient2.EndColorOpacity = 255
|
||||
ButtonDownBackground.Gradient2.ColorCorrection = True
|
||||
ButtonDownBackground.Gradient2.GradientType = gtLinear
|
||||
ButtonDownBackground.Gradient2.Point1XPercent = 0
|
||||
ButtonDownBackground.Gradient2.Point1YPercent = 0
|
||||
ButtonDownBackground.Gradient2.Point2XPercent = 0
|
||||
ButtonDownBackground.Gradient2.Point2YPercent = 100
|
||||
ButtonDownBackground.Gradient2.Sinus = False
|
||||
ButtonDownBackground.Gradient1EndPercent = 35
|
||||
ButtonDownBackground.Style = bbsColor
|
||||
Border.Color = clWindowText
|
||||
Border.ColorOpacity = 255
|
||||
Border.LightColor = clWhite
|
||||
Border.LightOpacity = 255
|
||||
Border.LightWidth = 0
|
||||
Border.Style = bboSolid
|
||||
Border.Width = 1
|
||||
Rounding.RoundX = 1
|
||||
Rounding.RoundY = 1
|
||||
Rounding.RoundOptions = []
|
||||
Font.Color = clWindowText
|
||||
Font.Name = 'Arial'
|
||||
HasTrackBar = True
|
||||
ArrowColor = clBtnText
|
||||
TabOrder = 0
|
||||
TabStop = True
|
||||
UseDockManager = False
|
||||
end
|
||||
object BCLabel2: TBCLabel
|
||||
Left = 112
|
||||
Height = 17
|
||||
Top = 8
|
||||
Width = 80
|
||||
Background.Color = clBlack
|
||||
Background.ColorOpacity = 255
|
||||
Background.Gradient1.StartColor = clWhite
|
||||
Background.Gradient1.StartColorOpacity = 255
|
||||
Background.Gradient1.DrawMode = dmSet
|
||||
Background.Gradient1.EndColor = clBlack
|
||||
Background.Gradient1.EndColorOpacity = 255
|
||||
Background.Gradient1.ColorCorrection = True
|
||||
Background.Gradient1.GradientType = gtLinear
|
||||
Background.Gradient1.Point1XPercent = 0
|
||||
Background.Gradient1.Point1YPercent = 0
|
||||
Background.Gradient1.Point2XPercent = 0
|
||||
Background.Gradient1.Point2YPercent = 100
|
||||
Background.Gradient1.Sinus = False
|
||||
Background.Gradient2.StartColor = clWhite
|
||||
Background.Gradient2.StartColorOpacity = 255
|
||||
Background.Gradient2.DrawMode = dmSet
|
||||
Background.Gradient2.EndColor = clBlack
|
||||
Background.Gradient2.EndColorOpacity = 255
|
||||
Background.Gradient2.ColorCorrection = True
|
||||
Background.Gradient2.GradientType = gtLinear
|
||||
Background.Gradient2.Point1XPercent = 0
|
||||
Background.Gradient2.Point1YPercent = 0
|
||||
Background.Gradient2.Point2XPercent = 0
|
||||
Background.Gradient2.Point2YPercent = 100
|
||||
Background.Gradient2.Sinus = False
|
||||
Background.Gradient1EndPercent = 35
|
||||
Background.Style = bbsClear
|
||||
Border.Color = clBlack
|
||||
Border.ColorOpacity = 255
|
||||
Border.LightColor = clWhite
|
||||
Border.LightOpacity = 255
|
||||
Border.LightWidth = 0
|
||||
Border.Style = bboNone
|
||||
Border.Width = 1
|
||||
Caption = 'Diagonal fill %'
|
||||
FontEx.Color = clDefault
|
||||
FontEx.EndEllipsis = False
|
||||
FontEx.FontQuality = fqFineAntialiasing
|
||||
FontEx.Height = 0
|
||||
FontEx.SingleLine = True
|
||||
FontEx.Shadow = False
|
||||
FontEx.ShadowColor = clBlack
|
||||
FontEx.ShadowColorOpacity = 255
|
||||
FontEx.ShadowRadius = 5
|
||||
FontEx.ShadowOffsetX = 5
|
||||
FontEx.ShadowOffsetY = 5
|
||||
FontEx.Style = []
|
||||
FontEx.TextAlignment = bcaCenter
|
||||
FontEx.WordBreak = False
|
||||
InnerMargin = 0
|
||||
Rounding.RoundX = 1
|
||||
Rounding.RoundY = 1
|
||||
Rounding.RoundOptions = []
|
||||
end
|
||||
object BCTrackbarDiagonal: TBCTrackbarUpdown
|
||||
Left = 200
|
||||
Height = 26
|
||||
Top = 5
|
||||
Width = 48
|
||||
BarExponent = 1
|
||||
Increment = 1
|
||||
LongTimeInterval = 400
|
||||
MinValue = 10
|
||||
MaxValue = 90
|
||||
OnChange = BCTrackbarChange
|
||||
Value = 70
|
||||
ShortTimeInterval = 100
|
||||
Background.Color = clWindow
|
||||
Background.ColorOpacity = 255
|
||||
Background.Gradient1.StartColor = clWhite
|
||||
Background.Gradient1.StartColorOpacity = 255
|
||||
Background.Gradient1.DrawMode = dmSet
|
||||
Background.Gradient1.EndColor = clBlack
|
||||
Background.Gradient1.EndColorOpacity = 255
|
||||
Background.Gradient1.ColorCorrection = True
|
||||
Background.Gradient1.GradientType = gtLinear
|
||||
Background.Gradient1.Point1XPercent = 0
|
||||
Background.Gradient1.Point1YPercent = 0
|
||||
Background.Gradient1.Point2XPercent = 0
|
||||
Background.Gradient1.Point2YPercent = 100
|
||||
Background.Gradient1.Sinus = False
|
||||
Background.Gradient2.StartColor = clWhite
|
||||
Background.Gradient2.StartColorOpacity = 255
|
||||
Background.Gradient2.DrawMode = dmSet
|
||||
Background.Gradient2.EndColor = clBlack
|
||||
Background.Gradient2.EndColorOpacity = 255
|
||||
Background.Gradient2.ColorCorrection = True
|
||||
Background.Gradient2.GradientType = gtLinear
|
||||
Background.Gradient2.Point1XPercent = 0
|
||||
Background.Gradient2.Point1YPercent = 0
|
||||
Background.Gradient2.Point2XPercent = 0
|
||||
Background.Gradient2.Point2YPercent = 100
|
||||
Background.Gradient2.Sinus = False
|
||||
Background.Gradient1EndPercent = 35
|
||||
Background.Style = bbsColor
|
||||
ButtonBackground.Color = clBlack
|
||||
ButtonBackground.ColorOpacity = 255
|
||||
ButtonBackground.Gradient1.StartColor = clBtnShadow
|
||||
ButtonBackground.Gradient1.StartColorOpacity = 255
|
||||
ButtonBackground.Gradient1.DrawMode = dmSet
|
||||
ButtonBackground.Gradient1.EndColor = clBtnFace
|
||||
ButtonBackground.Gradient1.EndColorOpacity = 255
|
||||
ButtonBackground.Gradient1.ColorCorrection = True
|
||||
ButtonBackground.Gradient1.GradientType = gtLinear
|
||||
ButtonBackground.Gradient1.Point1XPercent = 0
|
||||
ButtonBackground.Gradient1.Point1YPercent = -50
|
||||
ButtonBackground.Gradient1.Point2XPercent = 0
|
||||
ButtonBackground.Gradient1.Point2YPercent = 50
|
||||
ButtonBackground.Gradient1.Sinus = False
|
||||
ButtonBackground.Gradient2.StartColor = clBtnFace
|
||||
ButtonBackground.Gradient2.StartColorOpacity = 255
|
||||
ButtonBackground.Gradient2.DrawMode = dmSet
|
||||
ButtonBackground.Gradient2.EndColor = clBtnShadow
|
||||
ButtonBackground.Gradient2.EndColorOpacity = 255
|
||||
ButtonBackground.Gradient2.ColorCorrection = True
|
||||
ButtonBackground.Gradient2.GradientType = gtLinear
|
||||
ButtonBackground.Gradient2.Point1XPercent = 0
|
||||
ButtonBackground.Gradient2.Point1YPercent = 50
|
||||
ButtonBackground.Gradient2.Point2XPercent = 0
|
||||
ButtonBackground.Gradient2.Point2YPercent = 150
|
||||
ButtonBackground.Gradient2.Sinus = False
|
||||
ButtonBackground.Gradient1EndPercent = 50
|
||||
ButtonBackground.Style = bbsGradient
|
||||
ButtonDownBackground.Color = clBtnShadow
|
||||
ButtonDownBackground.ColorOpacity = 255
|
||||
ButtonDownBackground.Gradient1.StartColor = clWhite
|
||||
ButtonDownBackground.Gradient1.StartColorOpacity = 255
|
||||
ButtonDownBackground.Gradient1.DrawMode = dmSet
|
||||
ButtonDownBackground.Gradient1.EndColor = clBlack
|
||||
ButtonDownBackground.Gradient1.EndColorOpacity = 255
|
||||
ButtonDownBackground.Gradient1.ColorCorrection = True
|
||||
ButtonDownBackground.Gradient1.GradientType = gtLinear
|
||||
ButtonDownBackground.Gradient1.Point1XPercent = 0
|
||||
ButtonDownBackground.Gradient1.Point1YPercent = 0
|
||||
ButtonDownBackground.Gradient1.Point2XPercent = 0
|
||||
ButtonDownBackground.Gradient1.Point2YPercent = 100
|
||||
ButtonDownBackground.Gradient1.Sinus = False
|
||||
ButtonDownBackground.Gradient2.StartColor = clWhite
|
||||
ButtonDownBackground.Gradient2.StartColorOpacity = 255
|
||||
ButtonDownBackground.Gradient2.DrawMode = dmSet
|
||||
ButtonDownBackground.Gradient2.EndColor = clBlack
|
||||
ButtonDownBackground.Gradient2.EndColorOpacity = 255
|
||||
ButtonDownBackground.Gradient2.ColorCorrection = True
|
||||
ButtonDownBackground.Gradient2.GradientType = gtLinear
|
||||
ButtonDownBackground.Gradient2.Point1XPercent = 0
|
||||
ButtonDownBackground.Gradient2.Point1YPercent = 0
|
||||
ButtonDownBackground.Gradient2.Point2XPercent = 0
|
||||
ButtonDownBackground.Gradient2.Point2YPercent = 100
|
||||
ButtonDownBackground.Gradient2.Sinus = False
|
||||
ButtonDownBackground.Gradient1EndPercent = 35
|
||||
ButtonDownBackground.Style = bbsColor
|
||||
Border.Color = clWindowText
|
||||
Border.ColorOpacity = 255
|
||||
Border.LightColor = clWhite
|
||||
Border.LightOpacity = 255
|
||||
Border.LightWidth = 0
|
||||
Border.Style = bboSolid
|
||||
Border.Width = 1
|
||||
Rounding.RoundX = 1
|
||||
Rounding.RoundY = 1
|
||||
Rounding.RoundOptions = []
|
||||
Font.Color = clWindowText
|
||||
Font.Name = 'Arial'
|
||||
HasTrackBar = True
|
||||
ArrowColor = clBtnText
|
||||
TabOrder = 1
|
||||
TabStop = True
|
||||
UseDockManager = False
|
||||
end
|
||||
object CheckBoxIntermediate: TCheckBox
|
||||
Left = 257
|
||||
Height = 22
|
||||
Top = 6
|
||||
Width = 97
|
||||
Caption = 'Intermediate'
|
||||
Checked = True
|
||||
OnChange = CheckBoxIntermediateChange
|
||||
State = cbChecked
|
||||
TabOrder = 2
|
||||
end
|
||||
end
|
||||
object BGRAVirtualScreen1: TBGRAVirtualScreen
|
||||
Left = 0
|
||||
Height = 409
|
||||
Top = 38
|
||||
Width = 545
|
||||
OnRedraw = BGRAVirtualScreen1Redraw
|
||||
Align = alClient
|
||||
Alignment = taLeftJustify
|
||||
Color = clGray
|
||||
ParentColor = False
|
||||
TabOrder = 1
|
||||
OnMouseDown = BGRAVirtualScreen1MouseDown
|
||||
OnMouseMove = BGRAVirtualScreen1MouseMove
|
||||
OnMouseUp = BGRAVirtualScreen1MouseUp
|
||||
end
|
||||
end
|
192
bgrabitmap/test/vectorize/umain.pas
Normal file
192
bgrabitmap/test/vectorize/umain.pas
Normal file
@@ -0,0 +1,192 @@
|
||||
unit umain;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
|
||||
BCPanel, BCLabel, BCTrackbarUpdown, BGRAVirtualScreen, BGRABitmap,
|
||||
BGRABitmapTypes;
|
||||
|
||||
type
|
||||
|
||||
{ TFMain }
|
||||
|
||||
TFMain = class(TForm)
|
||||
BCLabel1: TBCLabel;
|
||||
BCLabel2: TBCLabel;
|
||||
BCPanel1: TBCPanel;
|
||||
BCTrackbarZoom: TBCTrackbarUpdown;
|
||||
BCTrackbarDiagonal: TBCTrackbarUpdown;
|
||||
BGRAVirtualScreen1: TBGRAVirtualScreen;
|
||||
CheckBoxIntermediate: TCheckBox;
|
||||
procedure BCTrackbarChange(Sender: TObject; AByUser: boolean);
|
||||
procedure BGRAVirtualScreen1MouseDown(Sender: TObject;
|
||||
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
procedure BGRAVirtualScreen1MouseMove(Sender: TObject; Shift: TShiftState;
|
||||
X, Y: Integer);
|
||||
procedure BGRAVirtualScreen1MouseUp(Sender: TObject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
procedure BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);
|
||||
procedure CheckBoxIntermediateChange(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
private
|
||||
|
||||
function GetRawBitmap: TBGRABitmap;
|
||||
function GetPosAt(X,Y: Integer): integer;
|
||||
public
|
||||
pos: array of TPoint;
|
||||
pointMoving: integer;
|
||||
pointMoveMouseStart, pointMoveCoordStart: TPoint;
|
||||
end;
|
||||
|
||||
var
|
||||
FMain: TFMain;
|
||||
|
||||
implementation
|
||||
|
||||
uses BGRAVectorize, BGRATransform;
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TFMain }
|
||||
|
||||
procedure TFMain.BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);
|
||||
var
|
||||
bmp: TBGRABitmap;
|
||||
pts: ArrayOfTPointF;
|
||||
zoom, i: Integer;
|
||||
radius: single;
|
||||
m: TAffineMatrix;
|
||||
begin
|
||||
bmp := GetRawBitmap;
|
||||
zoom := BCTrackbarZoom.Value;
|
||||
Bitmap.StretchPutImage(rect(0,0,bmp.Width*zoom,bmp.Height*zoom), bmp, dmSet);
|
||||
if zoom >= 4 then
|
||||
begin
|
||||
for i := 1 to bmp.Height-1 do
|
||||
Bitmap.HorizLine(0,i*zoom-1,bmp.Width*zoom-1,BGRA(144,144,144,128), dmDrawWithTransparency);
|
||||
for i := 1 to bmp.Width-1 do
|
||||
Bitmap.VertLine(i*zoom-1,0,bmp.Height*zoom-1,BGRA(144,144,144,128), dmDrawWithTransparency);
|
||||
end;
|
||||
pts := VectorizeMonochrome(bmp, 1, true, true, BCTrackbarDiagonal.Value, CheckBoxIntermediate.Checked);
|
||||
|
||||
bmp.FillTransparent;
|
||||
bmp.FillPolyAntialias(pts, BGRA(0,128,0,128));
|
||||
Bitmap.StretchPutImage(rect(0,0,bmp.Width*zoom,bmp.Height*zoom), bmp, dmDrawWithTransparency);
|
||||
|
||||
m := AffineMatrixTranslation(-0.5,-0.5)*AffineMatrixScale(zoom,zoom)*AffineMatrixTranslation(0.5,0.5);
|
||||
for i := 0 to high(pts) do pts[i] := m * pts[i];
|
||||
|
||||
Bitmap.DrawPolygonAntialias(pts, CSSRed, 2);
|
||||
if zoom > 6 then
|
||||
begin
|
||||
radius := zoom/6;
|
||||
if radius < 2.5 then radius := 2.5;
|
||||
for i := 0 to high(pts) do
|
||||
Bitmap.EllipseAntialias(pts[i].x,pts[i].y, radius,radius, BGRA(0,0,0,192),1,CSSOrange);
|
||||
end;
|
||||
for i := 0 to high(pos) do
|
||||
begin
|
||||
Bitmap.EllipseAntialias(pos[i].x*zoom,pos[i].y*zoom,8,8,BGRABlack,4);
|
||||
Bitmap.EllipseAntialias(pos[i].x*zoom,pos[i].y*zoom,8,8,BGRAWhite,2);
|
||||
end;
|
||||
bmp.Free;
|
||||
end;
|
||||
|
||||
procedure TFMain.CheckBoxIntermediateChange(Sender: TObject);
|
||||
begin
|
||||
BGRAVirtualScreen1.DiscardBitmap;
|
||||
end;
|
||||
|
||||
procedure TFMain.FormCreate(Sender: TObject);
|
||||
begin
|
||||
setlength(pos, 4);
|
||||
pos[0] := Point(10,10);
|
||||
pos[1] := Point(60,10);
|
||||
pos[2] := Point(10,20);
|
||||
pos[3] := Point(60,60);
|
||||
pointMoving := -1;
|
||||
end;
|
||||
|
||||
procedure TFMain.BCTrackbarChange(Sender: TObject; AByUser: boolean);
|
||||
begin
|
||||
if AByUser then BGRAVirtualScreen1.DiscardBitmap;
|
||||
end;
|
||||
|
||||
procedure TFMain.BGRAVirtualScreen1MouseDown(Sender: TObject;
|
||||
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
var
|
||||
idx: Integer;
|
||||
begin
|
||||
if Button = mbLeft then
|
||||
begin
|
||||
idx := GetPosAt(X,Y);
|
||||
pointMoving := idx;
|
||||
pointMoveMouseStart := Point(X,Y);
|
||||
pointMoveCoordStart := pos[idx];
|
||||
BGRAVirtualScreen1.Cursor := crHandPoint;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
procedure TFMain.BGRAVirtualScreen1MouseMove(Sender: TObject;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
var
|
||||
idx, zoom: Integer;
|
||||
newPos: TPoint;
|
||||
begin
|
||||
if pointMoving <> -1 then
|
||||
begin
|
||||
zoom := BCTrackbarZoom.Value;
|
||||
newPos := Point(pointMoveCoordStart.x + round((X-pointMoveMouseStart.x)/zoom),
|
||||
pointMoveCoordStart.y + round((Y-pointMoveMouseStart.y)/zoom));
|
||||
if (newPos.X <> pos[pointMoving].x) or (newPos.Y <> pos[pointMoving].y) then
|
||||
begin
|
||||
pos[pointMoving] := newPos;
|
||||
BGRAVirtualScreen1.DiscardBitmap;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
idx := GetPosAt(X,Y);
|
||||
if idx <> -1 then BGRAVirtualScreen1.Cursor := crHandPoint else BGRAVirtualScreen1.Cursor := crDefault;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TFMain.BGRAVirtualScreen1MouseUp(Sender: TObject;
|
||||
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
begin
|
||||
if Button = mbLeft then pointMoving:= -1;
|
||||
end;
|
||||
|
||||
function TFMain.GetRawBitmap: TBGRABitmap;
|
||||
var
|
||||
zoom: Integer;
|
||||
begin
|
||||
zoom := BCTrackbarZoom.Value;
|
||||
result := TBGRABitmap.Create(BGRAVirtualScreen1.Width div zoom,BGRAVirtualScreen1.Height div zoom, BGRAWhite);
|
||||
result.FillEllipseInRect(rect(pos[2].x,pos[2].y,pos[3].x,pos[3].y), BGRABlack, dmSet);
|
||||
result.DrawLine(pos[0].x,pos[0].y,pos[1].x,pos[1].y, BGRABlack, true);
|
||||
end;
|
||||
|
||||
function TFMain.GetPosAt(X, Y: Integer): integer;
|
||||
var
|
||||
minDist,dist, i, zoom: integer;
|
||||
begin
|
||||
minDist := sqr(8);
|
||||
result := -1;
|
||||
zoom := BCTrackbarZoom.Value;
|
||||
for i := 0 to high(pos) do
|
||||
begin
|
||||
dist := sqr(X-pos[i].X*zoom)+sqr(Y-pos[i].Y*zoom);
|
||||
if dist < minDist then
|
||||
begin
|
||||
minDist := dist;
|
||||
result := i;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
BIN
bgrabitmap/test/vectorize/vectorize.ico
Normal file
BIN
bgrabitmap/test/vectorize/vectorize.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 134 KiB |
91
bgrabitmap/test/vectorize/vectorize.lpi
Normal file
91
bgrabitmap/test/vectorize/vectorize.lpi
Normal file
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="11"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="vectorize"/>
|
||||
<Scaled Value="True"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<XPManifest>
|
||||
<DpiAware Value="True"/>
|
||||
</XPManifest>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<UseFileFilters Value="True"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes Count="0"/>
|
||||
</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="vectorize.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="vectorize"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<CodeGeneration>
|
||||
<Optimizations>
|
||||
<OptimizationLevel Value="0"/>
|
||||
</Optimizations>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<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>
|
22
bgrabitmap/test/vectorize/vectorize.lpr
Normal file
22
bgrabitmap/test/vectorize/vectorize.lpr
Normal file
@@ -0,0 +1,22 @@
|
||||
program vectorize;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, umain
|
||||
{ you can add units after this };
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
RequireDerivedFormResource:=True;
|
||||
Application.Scaled:=True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TFMain, FMain);
|
||||
Application.Run;
|
||||
end.
|
||||
|
Reference in New Issue
Block a user