[Newbies] Re: printing graphics in squeak
alain rastoul
alr.dev at free.fr
Tue Sep 18 20:43:53 UTC 2007
Hi
If you want to print a morph, get its form (imageForm message) and use the
primitive primPrintHScale of Form class
primPrintHScale: hScale vScale: vScale landscape: aBoolean
"On platforms that support it, this primitive prints the receiver, assumed
to be a Form, to the default printer."
"(Form extent: 10 at 10) primPrintHScale: 1.0 vScale: 1.0 landscape: true"
exemple:
| cont m length |
cont := Morph new.
cont color: Color lightBlue.
cont layoutPolicy: TableLayout new ;
listDirection: #topToBottom ; cellPositioning: #topLeft ;
hResizing: #shrinkWrap ; vResizing: #shrinkWrap.
#( 'Label A' 'Label B' 'Label C' 'Label D')
do: [ :label |
m:= Morph new.
m layoutPolicy: TableLayout new ;
listDirection: #leftToRight ; height: 25.
m cellInset: 4.
m color: Color random twiceLighter.
length := m width + 200 atRandom.
m width: length.
m addMorphBack: (StringMorph contents: label) .
m addMorphBack: (StringMorph contents: length asString).
cont addMorph: m.
].
cont cellInset: 4.
cont openInWorld.
cont imageForm primPrintHScale: 1.0 vScale: 1.0 landscape: true.
"(I think it was printh: 96.0 v: 96.0 landScape: false. on an older
version)"
See also the TextPrinter class (sender of primPrintHScale)
hope it helps
regards
alain
"Ching de la Serna" <ching.dls at gmail.com> a écrit dans le message de news:
29b6524b0709171847r486f73fm17c1d44e1874f1a1 at mail.gmail.com...
Hi,
I would like to print graphics in Squeak. What classes do I need to do this?
Many thanks in advance.
Ching
_______________________________________________
Beginners mailing list
Beginners at lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
More information about the Beginners
mailing list