mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 05:59:28 +02:00
Examples, updated postscript sample
git-svn-id: trunk@20880 -
This commit is contained in:
parent
8523cdef61
commit
b89ef02ac6
@ -1,12 +1,12 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<PathDelim Value="/"/>
|
||||
<Version Value="6"/>
|
||||
<Version Value="7"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<SaveClosedFiles Value="False"/>
|
||||
<SaveOnlyProjectUnits Value="True"/>
|
||||
<LRSInOutputDirectory Value="False"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
@ -38,10 +38,9 @@
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="usamplepostscriptcanvas.pas"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<ResourceFilename Value="usamplepostscriptcanvas.lrs"/>
|
||||
<UnitName Value="uSamplePostScriptCanvas"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
|
@ -1,137 +1,93 @@
|
||||
object Form1: TForm1
|
||||
Left = 310
|
||||
Height = 97
|
||||
Height = 118
|
||||
Top = 163
|
||||
Width = 400
|
||||
HelpContext = 0
|
||||
Width = 486
|
||||
ActiveControl = Button1
|
||||
Align = alNone
|
||||
AllowDropFiles = False
|
||||
AutoScroll = True
|
||||
AutoSize = False
|
||||
BorderIcons = [biSystemMenu, biMinimize, biMaximize]
|
||||
BorderStyle = bsSizeable
|
||||
Caption = 'Form1'
|
||||
ClientHeight = 97
|
||||
ClientWidth = 400
|
||||
DockSite = False
|
||||
DragKind = dkDrag
|
||||
DragMode = dmManual
|
||||
Enabled = True
|
||||
Font.Height = 0
|
||||
Font.Style = []
|
||||
FormStyle = fsNormal
|
||||
ClientHeight = 118
|
||||
ClientWidth = 486
|
||||
OnCreate = FormCreate
|
||||
ParentBiDiMode = True
|
||||
ParentFont = False
|
||||
Position = poDesigned
|
||||
ShowInTaskBar = stDefault
|
||||
UseDockManager = False
|
||||
LCLVersion = '0.9.27'
|
||||
WindowState = wsNormal
|
||||
object Label1: TLabel
|
||||
Left = 256
|
||||
Height = 13
|
||||
Top = 23
|
||||
Width = 101
|
||||
HelpContext = 0
|
||||
Align = alNone
|
||||
Alignment = taLeftJustify
|
||||
AutoSize = True
|
||||
Left = 108
|
||||
Height = 16
|
||||
Top = 8
|
||||
Width = 106
|
||||
Caption = 'Select Paper Size'
|
||||
DragCursor = crDrag
|
||||
DragMode = dmManual
|
||||
Enabled = True
|
||||
Layout = tlTop
|
||||
ParentBidiMode = True
|
||||
ParentColor = False
|
||||
ParentFont = True
|
||||
ParentShowHint = True
|
||||
ShowAccelChar = True
|
||||
Transparent = True
|
||||
Visible = True
|
||||
WordWrap = False
|
||||
OptimalFill = False
|
||||
end
|
||||
object Label2: TLabel
|
||||
Left = 8
|
||||
Height = 16
|
||||
Top = 8
|
||||
Width = 73
|
||||
Caption = 'Resolution X'
|
||||
ParentColor = False
|
||||
end
|
||||
object Label3: TLabel
|
||||
Left = 8
|
||||
Height = 16
|
||||
Top = 64
|
||||
Width = 75
|
||||
Caption = 'Resolution Y'
|
||||
ParentColor = False
|
||||
end
|
||||
object Button1: TButton
|
||||
Left = 24
|
||||
Left = 264
|
||||
Height = 25
|
||||
Top = 23
|
||||
Top = 8
|
||||
Width = 212
|
||||
HelpContext = 0
|
||||
Align = alNone
|
||||
AutoSize = False
|
||||
BorderSpacing.InnerBorder = 4
|
||||
Cancel = False
|
||||
Caption = 'Generate a PostScript file'
|
||||
Default = False
|
||||
DragCursor = crDrag
|
||||
DragMode = dmManual
|
||||
Enabled = True
|
||||
ParentBidiMode = True
|
||||
ModalResult = 0
|
||||
OnClick = Button1Click
|
||||
ParentFont = True
|
||||
ParentShowHint = True
|
||||
TabOrder = 0
|
||||
TabStop = True
|
||||
Visible = True
|
||||
end
|
||||
object Button2: TButton
|
||||
Left = 24
|
||||
Left = 264
|
||||
Height = 25
|
||||
Top = 56
|
||||
Top = 40
|
||||
Width = 212
|
||||
HelpContext = 0
|
||||
Align = alNone
|
||||
AutoSize = False
|
||||
BorderSpacing.InnerBorder = 4
|
||||
Cancel = False
|
||||
Caption = 'Show this file (kghostview)'
|
||||
Default = False
|
||||
DragCursor = crDrag
|
||||
DragMode = dmManual
|
||||
Enabled = True
|
||||
ParentBidiMode = True
|
||||
ModalResult = 0
|
||||
OnClick = Button2Click
|
||||
ParentFont = True
|
||||
ParentShowHint = True
|
||||
TabOrder = 1
|
||||
TabStop = True
|
||||
Visible = True
|
||||
end
|
||||
object ListBox1: TListBox
|
||||
Left = 252
|
||||
Height = 38
|
||||
Top = 43
|
||||
Left = 104
|
||||
Height = 79
|
||||
Top = 28
|
||||
Width = 124
|
||||
HelpContext = 0
|
||||
Align = alNone
|
||||
BorderStyle = bsSingle
|
||||
ClickOnSelChange = True
|
||||
Columns = 0
|
||||
DragCursor = crDrag
|
||||
DragKind = dkDrag
|
||||
DragMode = dmManual
|
||||
ExtendedSelect = True
|
||||
Enabled = True
|
||||
IntegralHeight = False
|
||||
Items.Strings = (
|
||||
'A4'
|
||||
'Letter'
|
||||
)
|
||||
ItemHeight = 16
|
||||
MultiSelect = False
|
||||
ParentBidiMode = True
|
||||
ParentColor = False
|
||||
ParentShowHint = True
|
||||
ParentFont = True
|
||||
Sorted = False
|
||||
Style = lbStandard
|
||||
ItemHeight = 21
|
||||
TabOrder = 2
|
||||
TabStop = True
|
||||
TopIndex = 0
|
||||
Visible = True
|
||||
end
|
||||
object txtResX: TEdit
|
||||
Left = 8
|
||||
Height = 23
|
||||
Top = 28
|
||||
Width = 80
|
||||
TabOrder = 3
|
||||
Text = '72'
|
||||
end
|
||||
object txtResY: TEdit
|
||||
Left = 8
|
||||
Height = 23
|
||||
Top = 84
|
||||
Width = 80
|
||||
TabOrder = 4
|
||||
Text = '72'
|
||||
end
|
||||
object Button3: TButton
|
||||
Left = 328
|
||||
Height = 25
|
||||
Top = 84
|
||||
Width = 75
|
||||
Caption = 'Button3'
|
||||
OnClick = Button3Click
|
||||
TabOrder = 5
|
||||
end
|
||||
end
|
||||
|
@ -1,40 +1,25 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
{ 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'a'#3'Top'#3#163#0#5'Widt'
|
||||
+'h'#3#144#1#11'HelpContext'#2#0#13'ActiveControl'#7#7'Button1'#5'Align'#7#6
|
||||
+'alNone'#14'AllowDropFiles'#8#10'AutoScroll'#9#8'AutoSize'#8#11'BorderIcons'
|
||||
+#11#12'biSystemMenu'#10'biMinimize'#10'biMaximize'#0#11'BorderStyle'#7#10'bs'
|
||||
+'Sizeable'#7'Caption'#6#5'Form1'#12'ClientHeight'#2'a'#11'ClientWidth'#3#144
|
||||
+#1#8'DockSite'#8#8'DragKind'#7#6'dkDrag'#8'DragMode'#7#8'dmManual'#7'Enabled'
|
||||
+#9#11'Font.Height'#2#0#10'Font.Style'#11#0#9'FormStyle'#7#8'fsNormal'#8'OnCr'
|
||||
+'eate'#7#10'FormCreate'#14'ParentBiDiMode'#9#10'ParentFont'#8#8'Position'#7
|
||||
+#10'poDesigned'#13'ShowInTaskBar'#7#9'stDefault'#14'UseDockManager'#8#10'LCL'
|
||||
+'Version'#6#6'0.9.27'#11'WindowState'#7#8'wsNormal'#0#6'TLabel'#6'Label1'#4
|
||||
+'Left'#3#0#1#6'Height'#2#13#3'Top'#2#23#5'Width'#2'e'#11'HelpContext'#2#0#5
|
||||
+'Align'#7#6'alNone'#9'Alignment'#7#13'taLeftJustify'#8'AutoSize'#9#7'Caption'
|
||||
+#6#17'Select Paper Size'#10'DragCursor'#7#6'crDrag'#8'DragMode'#7#8'dmManual'
|
||||
+#7'Enabled'#9#6'Layout'#7#5'tlTop'#14'ParentBidiMode'#9#11'ParentColor'#8#10
|
||||
+'ParentFont'#9#14'ParentShowHint'#9#13'ShowAccelChar'#9#11'Transparent'#9#7
|
||||
+'Visible'#9#8'WordWrap'#8#11'OptimalFill'#8#0#0#7'TButton'#7'Button1'#4'Left'
|
||||
+#2#24#6'Height'#2#25#3'Top'#2#23#5'Width'#3#212#0#11'HelpContext'#2#0#5'Alig'
|
||||
+'n'#7#6'alNone'#8'AutoSize'#8#25'BorderSpacing.InnerBorder'#2#4#6'Cancel'#8#7
|
||||
+'Caption'#6#26'Generate a PostScript file'#7'Default'#8#10'DragCursor'#7#6'c'
|
||||
+'rDrag'#8'DragMode'#7#8'dmManual'#7'Enabled'#9#14'ParentBidiMode'#9#11'Modal'
|
||||
+'Result'#2#0#7'OnClick'#7#12'Button1Click'#10'ParentFont'#9#14'ParentShowHin'
|
||||
+'t'#9#8'TabOrder'#2#0#7'TabStop'#9#7'Visible'#9#0#0#7'TButton'#7'Button2'#4
|
||||
+'Left'#2#24#6'Height'#2#25#3'Top'#2'8'#5'Width'#3#212#0#11'HelpContext'#2#0#5
|
||||
+'Align'#7#6'alNone'#8'AutoSize'#8#25'BorderSpacing.InnerBorder'#2#4#6'Cancel'
|
||||
+#8#7'Caption'#6#27'Show this file (kghostview)'#7'Default'#8#10'DragCursor'#7
|
||||
+#6'crDrag'#8'DragMode'#7#8'dmManual'#7'Enabled'#9#14'ParentBidiMode'#9#11'Mo'
|
||||
+'dalResult'#2#0#7'OnClick'#7#12'Button2Click'#10'ParentFont'#9#14'ParentShow'
|
||||
+'Hint'#9#8'TabOrder'#2#1#7'TabStop'#9#7'Visible'#9#0#0#8'TListBox'#8'ListBox'
|
||||
+'1'#4'Left'#3#252#0#6'Height'#2'&'#3'Top'#2'+'#5'Width'#2'|'#11'HelpContext'
|
||||
+#2#0#5'Align'#7#6'alNone'#11'BorderStyle'#7#8'bsSingle'#16'ClickOnSelChange'
|
||||
+#9#7'Columns'#2#0#10'DragCursor'#7#6'crDrag'#8'DragKind'#7#6'dkDrag'#8'DragM'
|
||||
+'ode'#7#8'dmManual'#14'ExtendedSelect'#9#7'Enabled'#9#14'IntegralHeight'#8#13
|
||||
+'Items.Strings'#1#6#2'A4'#6#6'Letter'#0#10'ItemHeight'#2#16#11'MultiSelect'#8
|
||||
+#14'ParentBidiMode'#9#11'ParentColor'#8#14'ParentShowHint'#9#10'ParentFont'#9
|
||||
+#6'Sorted'#8#5'Style'#7#10'lbStandard'#8'TabOrder'#2#2#7'TabStop'#9#8'TopInd'
|
||||
+'ex'#2#0#7'Visible'#9#0#0#0
|
||||
'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'H'#1#6'Height'#2#25#3'Top'#2'T'#5'Width'#2'K'#7'Caption'#6#7'Butt'
|
||||
+'on3'#7'OnClick'#7#12'Button3Click'#8'TabOrder'#2#5#0#0#0
|
||||
]);
|
||||
|
@ -21,10 +21,16 @@ type
|
||||
TForm1 = class(TForm)
|
||||
Button1: TButton;
|
||||
Button2: TButton;
|
||||
Button3: TButton;
|
||||
txtResX: TEdit;
|
||||
txtResY: TEdit;
|
||||
Label1: TLabel;
|
||||
Label2: TLabel;
|
||||
Label3: TLabel;
|
||||
ListBox1: TListBox;
|
||||
procedure Button1Click(Sender: TObject);
|
||||
procedure Button2Click(Sender: TObject);
|
||||
procedure Button3Click(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
@ -49,25 +55,49 @@ var
|
||||
x,y,tmp : Integer;
|
||||
PsCanvas: TPostscriptCanvas;
|
||||
|
||||
function Sx(AX: Integer): Integer;
|
||||
begin
|
||||
// all values were based on 72 dpi
|
||||
result := round(PsCanvas.XDPI/72*Ax);
|
||||
end;
|
||||
|
||||
function Sy(AY: Integer): Integer;
|
||||
begin
|
||||
// all values were based on 72 dpi
|
||||
result := round(PsCanvas.YDPI/72*Ay);
|
||||
end;
|
||||
|
||||
function PointS(Ax,Ay:Integer): TPoint;
|
||||
begin
|
||||
Result.X:= Sx(Ax);
|
||||
Result.Y:= Sy(Ay);
|
||||
end;
|
||||
|
||||
function Pt2Pix(Pt: Integer): Integer;
|
||||
begin
|
||||
result := round(PSCanvas.YDPI/72*Pt);
|
||||
end;
|
||||
|
||||
procedure LineSample(txt:string);
|
||||
begin
|
||||
tmp := PsCanvas.Font.Size div 2;
|
||||
PsCanvas.Line(x+170,y+tmp,x+170+100,y+tmp);
|
||||
tmp := Pt2Pix(PsCanvas.Font.Size) div 2;
|
||||
//WriteLn('LineSample: Y=',Y,' FontSize=', PsCanvas.Font.Size,' Pix=',tmp*2,' Spc= ',tmp,' Sy=',Sy(Tmp));
|
||||
PsCanvas.Line(x+Sx(170),y+tmp,x+Sx(170+100),y+tmp);
|
||||
PsCanvas.TextOut(x,y,txt);
|
||||
inc(y,tmp*3);
|
||||
end;
|
||||
|
||||
procedure BrushSample(txt:string);
|
||||
begin
|
||||
PsCanvas.Rectangle(x,y,x+50,y+40);
|
||||
PsCanvas.TextOut(x+55,y+40-PsCanvas.Font.Size,txt);
|
||||
inc(y,50);
|
||||
PsCanvas.Rectangle(x,y,x+Sx(50),y+Sy(40));
|
||||
PsCanvas.TextOut(x+Sx(55),y+SY(40)-Pt2Pix(PsCanvas.Font.Size),txt);
|
||||
inc(y,Sy(50));
|
||||
end;
|
||||
|
||||
procedure FontSample(txt:string);
|
||||
begin
|
||||
PsCanvas.TextOut(x,y,txt);
|
||||
inc(y,PsCanvas.Font.Size+4);
|
||||
inc(y,Pt2Pix(PsCanvas.Font.Size)+Sy(4));
|
||||
end;
|
||||
|
||||
procedure LineSamples(AX,AY:Integer);
|
||||
@ -128,78 +158,78 @@ var
|
||||
begin
|
||||
if Sender=nil then ;
|
||||
PsCanvas := TPostscriptCanvas.Create;
|
||||
PsCanvas.XDPI:=72;
|
||||
PsCanvas.YDPI:=72;
|
||||
psCanvas.XDPI := StrToIntDef(txtResX.Text,300);
|
||||
psCanvas.YDPI := StrToIntDef(txtResY.Text,300);
|
||||
With PsCanvas do
|
||||
try
|
||||
if ListBox1.ItemIndex=1 then begin
|
||||
PageHeight:=792;
|
||||
PageWidth:=612;
|
||||
PaperHeight:=Sx(792);
|
||||
PaperWidth:=Sy(612);
|
||||
end else begin
|
||||
PageHeight:=842;
|
||||
PageWidth:=595;
|
||||
PaperHeight:=Sy(842);
|
||||
PaperWidth:=Sx(595);
|
||||
end;
|
||||
TopMargin:=40;
|
||||
LeftMargin:=20;
|
||||
TopMargin:=Sy(40);
|
||||
LeftMargin:=Sx(20);
|
||||
|
||||
BeginDoc;
|
||||
|
||||
// title
|
||||
Font.Size:=24;
|
||||
Font.Style:=[fsBold,fsItalic,fsUnderline];
|
||||
TextOut(100,-10,'PostScript Canvas Lazarus sample');
|
||||
TextOut(Sx(100),Sy(10),'PostScript Canvas Lazarus sample');
|
||||
|
||||
Font.Size:=12;
|
||||
Brush.Color:=clRed;
|
||||
Pen.Width:=1;
|
||||
RoundRect(10,60,60,110,8,8);
|
||||
RoundRect(Sx(10),Sy(60),Sx(60),Sy(110),Sx(8),Sy(8));
|
||||
Brush.Color:=clMaroon;
|
||||
Rectangle(70,60,170,110);
|
||||
Rectangle(Sx(70),Sy(60),Sx(170),Sy(110));
|
||||
|
||||
FontSamples(200, 60);
|
||||
FontSamples(Sx(200), Sy(60));
|
||||
|
||||
// green ellipse
|
||||
Pen.Style:=psSolid;
|
||||
Brush.Color:=clGreen;
|
||||
Ellipse(10,260,60,310);
|
||||
Ellipse(Sx(10),Sy(260),Sx(60),Sy(310));
|
||||
|
||||
// pie
|
||||
Brush.Color:=clTeal;
|
||||
Brush.Style:=bsSolid;
|
||||
RadialPie(10,360,90,440,0,60*16);
|
||||
RadialPie(Sx(10),Sy(360),Sx(90),Sy(440),0,60*16);
|
||||
|
||||
// polygon: triangle
|
||||
Pen.Style:=psSolid;
|
||||
Brush.Color:=clGray;
|
||||
Pt[0]:=Point(10,140);
|
||||
Pt[1]:=Point(10,240);
|
||||
Pt[2]:=Point(140,140);
|
||||
Pt[0]:=PointS(10,140);
|
||||
Pt[1]:=PointS(10,240);
|
||||
Pt[2]:=PointS(140,140);
|
||||
Polygon(@Pt,3,True);
|
||||
|
||||
// polyline: angle
|
||||
Pen.Style:=psDot;
|
||||
Pt1[0]:=Point(10,400);
|
||||
Pt1[1]:=Point(50,390);
|
||||
Pt1[2]:=Point(120,410);
|
||||
Pt1[3]:=Point(180,425);
|
||||
Pt1[0]:=PointS(10,400);
|
||||
Pt1[1]:=PointS(50,390);
|
||||
Pt1[2]:=PointS(120,410);
|
||||
Pt1[3]:=PointS(180,425);
|
||||
Polyline(@Pt1,4);
|
||||
|
||||
// bezier
|
||||
Brush.Color:=clAqua;
|
||||
Pen.Style:=psSolid;
|
||||
Pt1[0]:=Point(10,430);
|
||||
Pt1[0]:=PointS(10,430);
|
||||
PolyBezier(@Pt1,4,true,True);
|
||||
|
||||
// line samples
|
||||
|
||||
LineSamples(200,165);
|
||||
LineSamples(Sx(200),Sy(165));
|
||||
|
||||
BrushSamples(240,280);
|
||||
BrushSamples(Sx(240),Sy(280));
|
||||
|
||||
Bmp:=TBitMap.Create;
|
||||
try
|
||||
Bmp.LoadFromFile(ExpandFileNameUTF8('../../images/LazarusForm.bmp'));
|
||||
DRaw(10,450,BMP);
|
||||
DRaw(Sx(10),SY(450),BMP);
|
||||
finally
|
||||
Bmp.Free;
|
||||
end;
|
||||
@ -207,7 +237,7 @@ begin
|
||||
xpm:=TPixMap.Create;
|
||||
try
|
||||
xpm.LoadFromFile(ExpandFileNameUTF8('../../images/vase_trans.xpm'));
|
||||
StretchDraw(bounds(10, 590, round(xpm.Width*0.60),round(xpm.height*0.60)),xpm);
|
||||
StretchDraw(bounds(Sx(10), Sy(590), Sx(round(xpm.Width*0.60)),Sy(round(xpm.height*0.60))),xpm);
|
||||
finally
|
||||
xpm.Free;
|
||||
end;
|
||||
@ -215,7 +245,7 @@ begin
|
||||
png := TPortableNetworkGraphic.Create;
|
||||
try
|
||||
png.LoadFromFile('../../images/splash_logo.png');
|
||||
StretchDraw(bounds(190, 590, round(png.Width*0.60),round(png.height*0.60)),png);
|
||||
StretchDraw(bounds(Sx(190), Sy(590), Sx(round(png.Width*0.60)),Sy(round(png.height*0.60))),png);
|
||||
finally
|
||||
png.Free;
|
||||
end;
|
||||
@ -225,9 +255,9 @@ begin
|
||||
Pen.Color:=clBlack;
|
||||
Brush.Color:=clTeal;
|
||||
Brush.Style:=bsSolid;
|
||||
Chord(10,360,90,440,0,60*16);
|
||||
Chord(Sx(10),Sy(360),Sx(90),Sy(440),0,60*16);
|
||||
|
||||
BrushSamples(100,100);
|
||||
BrushSamples(Sx(100),Sy(100));
|
||||
|
||||
EndDoc;
|
||||
SaveToFile('test1.ps');
|
||||
@ -248,11 +278,39 @@ begin
|
||||
ShellExecute(Handle, 'open', PChar(FName), nil, nil, SW_SHOWNORMAL)
|
||||
{$ENDIF}
|
||||
{$IFDEF UNIX}
|
||||
Shell(format('kghostview %s',[ExpandFileNameUTF8('./test1.ps')]));
|
||||
Shell(format('gv %s',[ExpandFileNameUTF8('./test1.ps')]));
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.Button3Click(Sender: TObject);
|
||||
var
|
||||
png : TPortableNetworkGraphic;
|
||||
x,y,tmp : Integer;
|
||||
PsCanvas: TPostscriptCanvas;
|
||||
begin
|
||||
psCanvas := TPostscriptCanvas.Create;
|
||||
psCanvas.XDPI := 72;
|
||||
psCanvas.YDPI := 72;
|
||||
psCanvas.PaperHeight:=842;
|
||||
psCanvas.PaperWidth:=595;
|
||||
psCanvas.TopMargin:=40;
|
||||
psCanvas.LeftMargin:=20;
|
||||
psCanvas.BeginDoc;
|
||||
|
||||
png := TPortableNetworkGraphic.Create;
|
||||
try
|
||||
png.LoadFromFile('small.png');
|
||||
psCanvas.StretchDraw(Bounds(50,500,50,50),png);
|
||||
finally
|
||||
png.Free;
|
||||
end;
|
||||
|
||||
psCanvas.EndDoc;
|
||||
psCanvas.SaveToFile('small.ps');
|
||||
psCanvas.Free;
|
||||
end;
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
begin
|
||||
ListBox1.ItemIndex:=0;
|
||||
|
Loading…
Reference in New Issue
Block a user