Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions Demo/SvgViewer/FrameViewer.pas
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ TFrameView = class(TFrame)
function GetApplyFixedColorToRootOnly: Boolean;
procedure SetApplyFixedColorToRootOnly(const AValue: Boolean);
procedure SetKeepAspectRatio(const AValue: Boolean);
procedure SetFlipHorizontal(const Value: Boolean);
procedure SetFlipVertically(const Value: Boolean);
function GetApplyDrawFullPathsInCenter: Boolean;
procedure SetApplyDrawFullPathsInCenter(const Value: Boolean);
function GetFlipHorizontal: Boolean;
function GetFlipVertically: Boolean;
public
procedure InitViewer(const ATitle: string; const SVGFactory : ISVGFactory);
procedure DrawFile(const AFileName: string);
Expand All @@ -33,6 +39,10 @@ TFrameView = class(TFrame)
property FixedColor: TColor read GetFixedColor write SetFixedColor;
property ApplyFixedColorToRootOnly: Boolean read GetApplyFixedColorToRootOnly write SetApplyFixedColorToRootOnly;
property KeepAspectRatio: Boolean read FKeeAspectRatio write SetKeepAspectRatio;
property DrawFullPathsInCenter: Boolean read GetApplyDrawFullPathsInCenter write SetApplyDrawFullPathsInCenter;
property FlipHorizontal: Boolean read GetFlipHorizontal write SetFlipHorizontal;
property FlipVertically: Boolean read GetFlipVertically write SetFlipVertically;
property SVG: ISVG read FSVG;
end;

implementation
Expand Down Expand Up @@ -61,11 +71,26 @@ function TFrameView.GetApplyFixedColorToRootOnly: Boolean;
Result := FSVG.ApplyFixedColorToRootOnly;
end;

function TFrameView.GetApplyDrawFullPathsInCenter: Boolean;
begin
Result := FSVG.ApplyDrawFullPathsInCenter;
end;

function TFrameView.GetFixedColor: TColor;
begin
Result := FSVG.FixedColor;
end;

function TFrameView.GetFlipHorizontal: Boolean;
begin
Result := FSVG.FlipHorizontal;
end;

function TFrameView.GetFlipVertically: Boolean;
begin
Result := FSVG.FlipVertically;
end;

function TFrameView.GetGrayScale: Boolean;
begin
Result := FSVG.GrayScale;
Expand Down Expand Up @@ -93,12 +118,30 @@ procedure TFrameView.SetApplyFixedColorToRootOnly(const AValue: Boolean);
SVGPaintBox.invalidate;
end;

procedure TFrameView.SetApplyDrawFullPathsInCenter(const Value: Boolean);
begin
FSVG.ApplyDrawFullPathsInCenter := Value;
SVGPaintBox.invalidate;
end;

procedure TFrameView.SetFixedColor(const AValue: TColor);
begin
FSVG.FixedColor := AValue;
SVGPaintBox.invalidate;
end;

procedure TFrameView.SetFlipHorizontal(const Value: Boolean);
begin
FSVG.FlipHorizontal := Value;
SVGPaintBox.invalidate;
end;

procedure TFrameView.SetFlipVertically(const Value: Boolean);
begin
FSVG.FlipVertically := Value;
SVGPaintBox.invalidate;
end;

procedure TFrameView.SetGrayScale(const AValue: Boolean);
begin
FSVG.GrayScale := AValue;
Expand Down
133 changes: 113 additions & 20 deletions Demo/SvgViewer/SvgViewerUnit.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ object SVGViewerForm: TSVGViewerForm
Left = 0
Top = 0
Caption = 'SVG Preview & Engine Comparison'
ClientHeight = 600
ClientWidth = 800
ClientHeight = 785
ClientWidth = 1072
Color = clWhite
DoubleBuffered = True
Font.Charset = DEFAULT_CHARSET
Expand All @@ -18,14 +18,14 @@ object SVGViewerForm: TSVGViewerForm
Left = 0
Top = 0
Width = 200
Height = 600
Height = 785
Align = alLeft
TabOrder = 0
object ListBox: TListBox
Left = 1
Top = 42
Width = 198
Height = 557
Height = 742
Align = alClient
ItemHeight = 13
TabOrder = 0
Expand Down Expand Up @@ -60,26 +60,38 @@ object SVGViewerForm: TSVGViewerForm
end
end
object RightPanel: TPanel
Left = 500
Left = 772
Top = 0
Width = 300
Height = 600
Height = 785
Align = alRight
BevelOuter = bvNone
TabOrder = 1
inline FrameViewSkia: TFrameView
Left = 0
Top = 300
Top = 433
Width = 300
Height = 300
Height = 352
Align = alClient
TabOrder = 0
ExplicitTop = 300
ExplicitHeight = 485
inherited ClientPanel: TPanel
Height = 352
StyleElements = [seFont, seClient, seBorder]
ExplicitHeight = 485
inherited SVGPaintBox: TPaintBox
Height = 327
ExplicitTop = 88
ExplicitHeight = 396
end
end
end
object ControlPanel: TPanel
Left = 0
Top = 0
Width = 300
Height = 300
Height = 433
Align = alTop
BevelOuter = bvNone
Ctl3D = True
Expand Down Expand Up @@ -121,7 +133,7 @@ object SVGViewerForm: TSVGViewerForm
Left = 3
Top = 105
Width = 294
Height = 57
Height = 88
Align = alTop
Caption = 'Aspect'
TabOrder = 1
Expand All @@ -145,16 +157,47 @@ object SVGViewerForm: TSVGViewerForm
TabOrder = 1
OnClick = GrayScaleCheckBoxClick
end
object ChkDrawFullPathsInCenter: TCheckBox
Left = 124
Top = 16
Width = 157
Height = 17
Hint = 'Delphi Image32 engine only currently.'
Caption = 'Draw FullPaths In Center'
ParentShowHint = False
ShowHint = True
TabOrder = 2
OnClick = ChkDrawFullPathsInCenterClick
end
object ChkFlipV: TCheckBox
Left = 196
Top = 34
Width = 99
Height = 17
Caption = 'Flip Vertically'
TabOrder = 3
OnClick = ChkFlipVClick
end
object ChkFlipH: TCheckBox
Left = 91
Top = 34
Width = 102
Height = 17
Caption = 'Flip Horizontal'
TabOrder = 4
OnClick = ChkFlipHClick
end
end
object OpacityGroupBox: TGroupBox
AlignWithMargins = True
Left = 3
Top = 168
Top = 199
Width = 294
Height = 57
Align = alTop
Caption = 'Opacity:'
TabOrder = 2
ExplicitTop = 168
object OpacityTrackBar: TTrackBar
Left = 2
Top = 16
Expand Down Expand Up @@ -193,31 +236,81 @@ object SVGViewerForm: TSVGViewerForm
TabOrder = 3
StyleElements = [seBorder]
end
object MemoSVG: TMemo
Left = 0
Top = 259
Width = 300
Height = 174
Align = alClient
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 4
end
end
end
object ClientPanel: TPanel
Left = 200
Top = 0
Width = 300
Height = 600
Width = 572
Height = 785
Align = alClient
BevelOuter = bvNone
TabOrder = 2
inline FrameViewerD2D: TFrameView
Left = 0
Top = 300
Width = 300
Height = 300
Align = alClient
Top = 464
Width = 572
Height = 321
Align = alBottom
TabOrder = 0
ExplicitTop = 464
ExplicitWidth = 572
ExplicitHeight = 321
inherited ClientPanel: TPanel
Width = 572
Height = 321
StyleElements = [seFont, seClient, seBorder]
ExplicitWidth = 572
ExplicitHeight = 321
inherited SVGPaintBox: TPaintBox
Width = 570
Height = 296
ExplicitTop = 96
ExplicitWidth = 571
ExplicitHeight = 388
end
inherited TitlePanel: TPanel
Width = 570
ExplicitWidth = 570
end
end
end
inline FrameViewImage32: TFrameView
Left = 0
Top = 0
Width = 300
Height = 300
Align = alTop
Width = 572
Height = 464
Align = alClient
TabOrder = 1
ExplicitWidth = 572
ExplicitHeight = 464
inherited ClientPanel: TPanel
Width = 572
Height = 464
StyleElements = [seFont, seClient, seBorder]
ExplicitWidth = 572
ExplicitHeight = 464
inherited SVGPaintBox: TPaintBox
Width = 570
Height = 439
ExplicitWidth = 614
ExplicitHeight = 271
end
inherited TitlePanel: TPanel
Width = 570
ExplicitWidth = 570
end
end
end
end
object OpenDialog1: TOpenDialog
Expand Down
Loading