[Newbies] Re: printing graphics in squeak

Ching de la Serna ching.dls at gmail.com
Wed Sep 19 00:32:01 UTC 2007


Hi Chris, Bert, Alain. Your info is really appreciated. And Alain's code
really makes it easy to understand and use the classes. Thanks a lot, guys.

Ching

On 9/19/07, alain rastoul <alr.dev at free.fr> wrote:
>
> 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
>
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20070919/d254f24f/attachment.htm


More information about the Beginners mailing list