mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-06 09:59:36 +01:00
CairoCanvas, updated test
git-svn-id: trunk@40727 -
This commit is contained in:
parent
0c8ce4df71
commit
b6b3685433
@ -65,13 +65,6 @@
|
|||||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||||
</SearchPaths>
|
</SearchPaths>
|
||||||
<Linking>
|
|
||||||
<Options>
|
|
||||||
<Win32>
|
|
||||||
<GraphicApplication Value="True"/>
|
|
||||||
</Win32>
|
|
||||||
</Options>
|
|
||||||
</Linking>
|
|
||||||
<Other>
|
<Other>
|
||||||
<CompilerMessages>
|
<CompilerMessages>
|
||||||
<MsgFileName Value=""/>
|
<MsgFileName Value=""/>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
object Form1: TForm1
|
object Form1: TForm1
|
||||||
Left = 245
|
Left = 226
|
||||||
Height = 552
|
Height = 552
|
||||||
Top = 98
|
Top = 148
|
||||||
Width = 628
|
Width = 628
|
||||||
Caption = 'Form1'
|
Caption = 'Form1'
|
||||||
ClientHeight = 552
|
ClientHeight = 552
|
||||||
@ -50,7 +50,7 @@ object Form1: TForm1
|
|||||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||||
ChildSizing.ControlsPerLine = 1
|
ChildSizing.ControlsPerLine = 1
|
||||||
ClientHeight = 63
|
ClientHeight = 62
|
||||||
ClientWidth = 93
|
ClientWidth = 93
|
||||||
Items.Strings = (
|
Items.Strings = (
|
||||||
'24217'
|
'24217'
|
||||||
@ -80,6 +80,64 @@ object Form1: TForm1
|
|||||||
OnClick = btnOtherClick
|
OnClick = btnOtherClick
|
||||||
TabOrder = 5
|
TabOrder = 5
|
||||||
end
|
end
|
||||||
|
object radOtherAlign: TRadioGroup
|
||||||
|
Left = 544
|
||||||
|
Height = 76
|
||||||
|
Top = 272
|
||||||
|
Width = 68
|
||||||
|
AutoFill = True
|
||||||
|
Caption = 'radOtherAlign'
|
||||||
|
ChildSizing.LeftRightSpacing = 6
|
||||||
|
ChildSizing.TopBottomSpacing = 6
|
||||||
|
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||||
|
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||||
|
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||||
|
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||||
|
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||||
|
ChildSizing.ControlsPerLine = 3
|
||||||
|
ClientHeight = 58
|
||||||
|
ClientWidth = 64
|
||||||
|
Columns = 3
|
||||||
|
ItemIndex = 0
|
||||||
|
Items.Strings = (
|
||||||
|
' '
|
||||||
|
' '
|
||||||
|
' '
|
||||||
|
' '
|
||||||
|
' '
|
||||||
|
' '
|
||||||
|
' '
|
||||||
|
' '
|
||||||
|
' '
|
||||||
|
)
|
||||||
|
TabOrder = 6
|
||||||
|
end
|
||||||
|
object radOtherAngle: TRadioGroup
|
||||||
|
Left = 544
|
||||||
|
Height = 100
|
||||||
|
Top = 352
|
||||||
|
Width = 68
|
||||||
|
AutoFill = True
|
||||||
|
Caption = 'radOtherAngle'
|
||||||
|
ChildSizing.LeftRightSpacing = 6
|
||||||
|
ChildSizing.TopBottomSpacing = 6
|
||||||
|
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||||
|
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||||
|
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||||
|
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||||
|
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||||
|
ChildSizing.ControlsPerLine = 1
|
||||||
|
ClientHeight = 82
|
||||||
|
ClientWidth = 64
|
||||||
|
ItemIndex = 0
|
||||||
|
Items.Strings = (
|
||||||
|
'0'
|
||||||
|
'90'
|
||||||
|
'180'
|
||||||
|
'270'
|
||||||
|
)
|
||||||
|
TabOrder = 7
|
||||||
|
end
|
||||||
object PrintDialog1: TPrintDialog
|
object PrintDialog1: TPrintDialog
|
||||||
left = 129
|
left = 129
|
||||||
top = 28
|
top = 28
|
||||||
|
|||||||
@ -20,6 +20,8 @@ type
|
|||||||
btnOther: TButton;
|
btnOther: TButton;
|
||||||
chkTests: TCheckGroup;
|
chkTests: TCheckGroup;
|
||||||
PrintDialog1: TPrintDialog;
|
PrintDialog1: TPrintDialog;
|
||||||
|
radOtherAlign: TRadioGroup;
|
||||||
|
radOtherAngle: TRadioGroup;
|
||||||
procedure btn19435Click(Sender: TObject);
|
procedure btn19435Click(Sender: TObject);
|
||||||
procedure btnOtherClick(Sender: TObject);
|
procedure btnOtherClick(Sender: TObject);
|
||||||
procedure Button1Click(Sender: TObject);
|
procedure Button1Click(Sender: TObject);
|
||||||
@ -167,6 +169,7 @@ var
|
|||||||
kx,ky:double;
|
kx,ky:double;
|
||||||
begin
|
begin
|
||||||
|
|
||||||
|
cnv.Font.Name:='Sans';
|
||||||
cnv.Font.Color := clDefault;
|
cnv.Font.Color := clDefault;
|
||||||
cnv.Pen.Color := clBlack;
|
cnv.Pen.Color := clBlack;
|
||||||
cnv.Font.Size:=24;
|
cnv.Font.Size:=24;
|
||||||
@ -188,6 +191,7 @@ begin
|
|||||||
r.Right:=r.left+sz.cx;
|
r.Right:=r.left+sz.cx;
|
||||||
r.Bottom:=r.Top+sz.cy;
|
r.Bottom:=r.Top+sz.cy;
|
||||||
cnv.Rectangle(r);
|
cnv.Rectangle(r);
|
||||||
|
cnv.Font.Color := clBlue;
|
||||||
cnv.TextRect(R,r.left,r.top,sTextRect);
|
cnv.TextRect(R,r.left,r.top,sTextRect);
|
||||||
|
|
||||||
// rotated text
|
// rotated text
|
||||||
@ -200,6 +204,7 @@ begin
|
|||||||
r.Right:=r.left+sz.cy;
|
r.Right:=r.left+sz.cy;
|
||||||
r.Bottom:=r.Top+sz.cx;
|
r.Bottom:=r.Top+sz.cx;
|
||||||
cnv.Rectangle(r);
|
cnv.Rectangle(r);
|
||||||
|
cnv.font.color := clDefault;
|
||||||
cnv.TextOut(r.left,r.bottom,sTextOut);
|
cnv.TextOut(r.left,r.bottom,sTextOut);
|
||||||
|
|
||||||
inc(r.Left,round(XDPI*0.5));
|
inc(r.Left,round(XDPI*0.5));
|
||||||
@ -211,6 +216,7 @@ begin
|
|||||||
// thsi works
|
// thsi works
|
||||||
//cnv.TextOut(r.left,r.bottom,sTextOut);
|
//cnv.TextOut(r.left,r.bottom,sTextOut);
|
||||||
// thsi does not work
|
// thsi does not work
|
||||||
|
cnv.Font.Color := clRed;
|
||||||
cnv.TextRect(r,r.left,r.bottom,sTextRect);
|
cnv.TextRect(r,r.left,r.bottom,sTextRect);
|
||||||
|
|
||||||
|
|
||||||
@ -225,7 +231,8 @@ begin
|
|||||||
cnv.LineTo(r.left+round(kx*i),r.Bottom-round(ky*2000*exp(-sqr(i-500)/500)));
|
cnv.LineTo(r.left+round(kx*i),r.Bottom-round(ky*2000*exp(-sqr(i-500)/500)));
|
||||||
end;
|
end;
|
||||||
cnv.font.Orientation:=0;
|
cnv.font.Orientation:=0;
|
||||||
cnv.TextOut((XDPI*2),(YDPI*5),'Clipping doesn''t work for text!');
|
cnv.font.Color := clGreen;
|
||||||
|
cnv.TextOut((XDPI*2),(YDPI*5),'Clipping does work for text!');
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -242,6 +249,7 @@ const
|
|||||||
'1.0' + LineEnding+
|
'1.0' + LineEnding+
|
||||||
'.01';
|
'.01';
|
||||||
var
|
var
|
||||||
|
x,y: Integer;
|
||||||
R: TRect;
|
R: TRect;
|
||||||
sz: TSize;
|
sz: TSize;
|
||||||
style: TTextStyle;
|
style: TTextStyle;
|
||||||
@ -272,15 +280,66 @@ begin
|
|||||||
|
|
||||||
R := Rect(XDPI*4, YDPI*2, Round(XDPI*6), round(YDPI*6));
|
R := Rect(XDPI*4, YDPI*2, Round(XDPI*6), round(YDPI*6));
|
||||||
cnv.Font.Name := 'Sans';
|
cnv.Font.Name := 'Sans';
|
||||||
cnv.Font.Size := 40;
|
cnv.Font.Size := 20;
|
||||||
cnv.Font.Color := clGreen;
|
cnv.Font.Color := clGreen;
|
||||||
|
cnv.Font.Orientation:=1800;
|
||||||
cnv.Brush.Style := bsClear;
|
cnv.Brush.Style := bsClear;
|
||||||
cnv.Pen.Color := clSilver;
|
cnv.Pen.Color := clSilver;
|
||||||
style := cnv.TextStyle;
|
style := cnv.TextStyle;
|
||||||
style.SingleLine := false;
|
style.SingleLine := false;
|
||||||
style.Alignment := taRightJustify;
|
style.Alignment := taRightJustify;
|
||||||
cnv.TextStyle := style;
|
cnv.TextStyle := style;
|
||||||
cnv.TextRect(R, R.Left, R.Top, Par);
|
//cnv.TextRect(R, R.Left, R.Top, Par);
|
||||||
|
cnv.TextRect(R, R.Right, R.Bottom, Par);
|
||||||
|
cnv.Rectangle(R);
|
||||||
|
|
||||||
|
R := Rect(XDPI, YDPI*7, XDPI*7, YDPI*9);
|
||||||
|
cnv.Font.Size := 30;
|
||||||
|
cnv.Font.Color := clFuchsia;
|
||||||
|
cnv.Pen.Color := clSilver;
|
||||||
|
// style
|
||||||
|
style := cnv.TextStyle;
|
||||||
|
style.SingleLine := false;
|
||||||
|
with style do begin
|
||||||
|
case radOtherAlign.ItemIndex of
|
||||||
|
0,3,6: Alignment := taLeftJustify;
|
||||||
|
1,4,7: Alignment := taCenter;
|
||||||
|
else Alignment := taRightJustify;
|
||||||
|
end;
|
||||||
|
case radOtherAlign.ItemIndex of
|
||||||
|
0,1,2: Layout := tlTop;
|
||||||
|
3,4,5: Layout := tlCenter;
|
||||||
|
else Layout := tlBottom;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
cnv.TextStyle := style;
|
||||||
|
// orientation
|
||||||
|
cnv.Font.Orientation := radOtherAngle.ItemIndex * 90 * 10;
|
||||||
|
x := r.Left;
|
||||||
|
y := r.Top;
|
||||||
|
case cnv.Font.Orientation of
|
||||||
|
0:
|
||||||
|
begin
|
||||||
|
x := r.Left;
|
||||||
|
y := r.Top;
|
||||||
|
end;
|
||||||
|
900:
|
||||||
|
begin
|
||||||
|
x := r.Left;
|
||||||
|
y := r.Bottom;
|
||||||
|
end;
|
||||||
|
1800:
|
||||||
|
begin
|
||||||
|
x := r.Right;
|
||||||
|
y := r.Bottom;
|
||||||
|
end;
|
||||||
|
2700:
|
||||||
|
begin
|
||||||
|
x := r.right;
|
||||||
|
y := r.Top;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
cnv.TextRect(R, x, y, Par);
|
||||||
cnv.Rectangle(R);
|
cnv.Rectangle(R);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user