postscript example, new form resources and fix postscript ClipRect test on different resolutions

git-svn-id: trunk@27351 -
This commit is contained in:
jesus 2010-09-13 19:41:17 +00:00
parent 64a78a2f30
commit 73949a5ee4
5 changed files with 29 additions and 42 deletions

1
.gitattributes vendored
View File

@ -3373,7 +3373,6 @@ examples/postscript/samplepostscriptcanvas.lpi svneol=native#text/plain
examples/postscript/samplepostscriptcanvas.lpr svneol=native#text/pascal
examples/postscript/small.png -text
examples/postscript/usamplepostscriptcanvas.lfm svneol=native#text/plain
examples/postscript/usamplepostscriptcanvas.lrs svneol=native#text/pascal
examples/postscript/usamplepostscriptcanvas.pas svneol=native#text/pascal
examples/progressbar.lpi svneol=native#text/plain
examples/progressbar.pp svneol=native#text/pascal

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<Version Value="7"/>
<Version Value="9"/>
<General>
<Flags>
<SaveClosedFiles Value="False"/>
@ -10,7 +10,6 @@
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<TargetFileExt Value=""/>
<Title Value="samplepostscriptcanvas"/>
</General>
<PublishOptions>
@ -46,10 +45,15 @@
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="8"/>
<Version Value="9"/>
<SearchPaths>
<SrcPath Value="$(LazarusDir)/lcl/;$(LazarusDir)/lcl/interfaces/$(LCLWidgetType)/"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
<Linking>
<Options>
<Win32>

View File

@ -1,19 +1,19 @@
object Form1: TForm1
Left = 310
Left = 420
Height = 118
Top = 163
Top = 276
Width = 486
ActiveControl = Button1
Caption = 'Form1'
ClientHeight = 118
ClientWidth = 486
OnCreate = FormCreate
LCLVersion = '0.9.27'
LCLVersion = '0.9.29'
object Label1: TLabel
Left = 108
Height = 16
Top = 8
Width = 106
Width = 112
Caption = 'Select Paper Size'
ParentColor = False
end
@ -21,7 +21,7 @@ object Form1: TForm1
Left = 8
Height = 16
Top = 8
Width = 73
Width = 78
Caption = 'Resolution X'
ParentColor = False
end
@ -29,7 +29,7 @@ object Form1: TForm1
Left = 8
Height = 16
Top = 64
Width = 75
Width = 77
Caption = 'Resolution Y'
ParentColor = False
end
@ -67,7 +67,7 @@ object Form1: TForm1
end
object txtResX: TEdit
Left = 8
Height = 23
Height = 21
Top = 28
Width = 80
TabOrder = 3
@ -75,7 +75,7 @@ object Form1: TForm1
end
object txtResY: TEdit
Left = 8
Height = 23
Height = 21
Top = 84
Width = 80
TabOrder = 4

View File

@ -1,25 +0,0 @@
{ Este es un archivo de recurso de Lazarus generado automáticamente }
LazarusResources.Add('TForm1','FORMDATA',[
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'6'#1#6'Height'#2'v'#3'Top'#3#163#0#5'Widt'
+'h'#3#230#1#13'ActiveControl'#7#7'Button1'#7'Caption'#6#5'Form1'#12'ClientHe'
+'ight'#2'v'#11'ClientWidth'#3#230#1#8'OnCreate'#7#10'FormCreate'#10'LCLVersi'
+'on'#6#6'0.9.27'#0#6'TLabel'#6'Label1'#4'Left'#2'l'#6'Height'#2#16#3'Top'#2#8
+#5'Width'#2'j'#7'Caption'#6#17'Select Paper Size'#11'ParentColor'#8#0#0#6'TL'
+'abel'#6'Label2'#4'Left'#2#8#6'Height'#2#16#3'Top'#2#8#5'Width'#2'I'#7'Capti'
+'on'#6#12'Resolution X'#11'ParentColor'#8#0#0#6'TLabel'#6'Label3'#4'Left'#2#8
+#6'Height'#2#16#3'Top'#2'@'#5'Width'#2'K'#7'Caption'#6#12'Resolution Y'#11'P'
+'arentColor'#8#0#0#7'TButton'#7'Button1'#4'Left'#3#8#1#6'Height'#2#25#3'Top'
+#2#8#5'Width'#3#212#0#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#26'Gene'
+'rate a PostScript file'#7'OnClick'#7#12'Button1Click'#8'TabOrder'#2#0#0#0#7
+'TButton'#7'Button2'#4'Left'#3#8#1#6'Height'#2#25#3'Top'#2'('#5'Width'#3#212
+#0#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#27'Show this file (kghostv'
+'iew)'#7'OnClick'#7#12'Button2Click'#8'TabOrder'#2#1#0#0#8'TListBox'#8'ListB'
+'ox1'#4'Left'#2'h'#6'Height'#2'O'#3'Top'#2#28#5'Width'#2'|'#13'Items.Strings'
+#1#6#2'A4'#6#6'Letter'#0#10'ItemHeight'#2#21#8'TabOrder'#2#2#0#0#5'TEdit'#7
+'txtResX'#4'Left'#2#8#6'Height'#2#23#3'Top'#2#28#5'Width'#2'P'#8'TabOrder'#2
+#3#4'Text'#6#2'72'#0#0#5'TEdit'#7'txtResY'#4'Left'#2#8#6'Height'#2#23#3'Top'
+#2'T'#5'Width'#2'P'#8'TabOrder'#2#4#4'Text'#6#2'72'#0#0#7'TButton'#7'Button3'
+#4'Left'#3#8#1#6'Height'#2#25#3'Top'#2'P'#5'Width'#3#211#0#7'Caption'#6#22'T'
+'est Transparent Image'#7'OnClick'#7#12'Button3Click'#8'TabOrder'#2#5#0#0#0
]);

View File

@ -43,6 +43,8 @@ var
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
@ -54,6 +56,7 @@ var
png : TPortableNetworkGraphic;
x,y,tmp : Integer;
PsCanvas: TPostscriptCanvas;
R : TRect;
function Sx(AX: Integer): Integer;
begin
@ -73,6 +76,12 @@ var
Result.Y:= Sy(Ay);
end;
function RectS(Ax1,Ay1,Ax2,AY2: Integer): TRect;
begin
Result.TopLeft := PointS(AX1,AY1);
Result.BottomRight := PointS(AX2,AY2);
end;
function Pt2Pix(Pt: Integer): Integer;
begin
result := round(PSCanvas.YDPI/72*Pt);
@ -259,10 +268,13 @@ begin
BrushSamples(Sx(100),Sy(100));
R := RectS(100,500,200,520);
PSCanvas.Brush.Style:=bsSolid;
PSCanvas.Brush.Color:=clWhite;
PSCanvas.Rectangle(Rect(100,500,200,520));
PSCanvas.TextRect(Rect(100,500,200,520),100,500, 'Testing clip rect on TextRect');
PSCanvas.Rectangle(R.Left, R.Top, R.Right, R.Bottom);
PSCanvas.ClipRect := R;
PSCanvas.TextRect(R, R.Left, R.Top, 'Testing clip rect on TextRect', PSCanvas.TextStyle);
PSCanvas.ClipRect := Rect(0,0,0,0);
EndDoc;
SaveToFile('test1.ps');
@ -321,8 +333,5 @@ begin
ListBox1.ItemIndex:=0;
end;
initialization
{$I usamplepostscriptcanvas.lrs}
end.