printing graphics in squeak

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

printing graphics in squeak

ching
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
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: printing graphics in squeak

David Mitchell-10
Do you mean charts and graphs? If so, check out PlotMorph.

http://wiki.squeak.org/squeak/2626

On 9/17/07, Ching de la Serna <[hidden email]> wrote:

> 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
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: printing graphics in squeak

ching
Thanks David, I think I need to look at Morphs a little more closely for what I need to do which is to create some graphics (shapes, etc.) and send them to a printer.

Ching

On 9/18/07, David Mitchell <[hidden email]> wrote:
Do you mean charts and graphs? If so, check out PlotMorph.

http://wiki.squeak.org/squeak/2626

On 9/17/07, Ching de la Serna <[hidden email]> wrote:

> 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
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: printing graphics in squeak

Michael van der Gulik-2
Hi Ching.

Morphs draw themselves on Canvases - look at the Canvas class. Typically, these would be FormCanvas which draws to the screen. I think there is a Postscript-capable Canvas subclass. I'm not sure what it's called ("PostscriptCanvas"?). Google for Ghostscript for info on how to print postscript files if you don't have a postscript-capable printer (or if you aren't running Linux).

Also try reverse-engineering the print command in the... menus? This will be a good exercise for you. Find the "print" command in a menu somewhere in squeak (probably in a halo menu for a Morph?), and open the halo on the menu itself, select "explore" or "inspect" and poke around to see if you can find where the code for the print command is.

Sorry I can't give you specifics; I don't have squeak available right now.

Michael.

On 9/18/07, Ching de la Serna <[hidden email]> wrote:
Thanks David, I think I need to look at Morphs a little more closely for what I need to do which is to create some graphics (shapes, etc.) and send them to a printer.

Ching


On 9/18/07, David Mitchell <[hidden email]> wrote:
Do you mean charts and graphs? If so, check out PlotMorph.

<a href="http://wiki.squeak.org/squeak/2626" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://wiki.squeak.org/squeak/2626

On 9/17/07, Ching de la Serna <[hidden email]> wrote:

> 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
> [hidden email]
> <a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
_______________________________________________
Beginners mailing list
[hidden email]
<a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank">http://lists.squeakfoundation.org/mailman/listinfo/beginners



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: printing graphics in squeak

ching
Hi Michael,

Thanks for the info. Squeak can be intimidating with its wealth of capabilities if you don't know where to look. I will sure be busy checking out your suggestions.

Ching

On 9/18/07, Michael van der Gulik <[hidden email]> wrote:
Hi Ching.

Morphs draw themselves on Canvases - look at the Canvas class. Typically, these would be FormCanvas which draws to the screen. I think there is a Postscript-capable Canvas subclass. I'm not sure what it's called ("PostscriptCanvas"?). Google for Ghostscript for info on how to print postscript files if you don't have a postscript-capable printer (or if you aren't running Linux).

Also try reverse-engineering the print command in the... menus? This will be a good exercise for you. Find the "print" command in a menu somewhere in squeak (probably in a halo menu for a Morph?), and open the halo on the menu itself, select "explore" or "inspect" and poke around to see if you can find where the code for the print command is.

Sorry I can't give you specifics; I don't have squeak available right now.

Michael.

On 9/18/07, Ching de la Serna <[hidden email]> wrote:
Thanks David, I think I need to look at Morphs a little more closely for what I need to do which is to create some graphics (shapes, etc.) and send them to a printer.

Ching


On 9/18/07, David Mitchell <[hidden email]> wrote:
Do you mean charts and graphs? If so, check out PlotMorph.

<a href="http://wiki.squeak.org/squeak/2626" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://wiki.squeak.org/squeak/2626

On 9/17/07, Ching de la Serna <[hidden email]> wrote:

> 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
> [hidden email]
> <a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
_______________________________________________
Beginners mailing list
[hidden email]
<a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
<a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://lists.squeakfoundation.org/mailman/listinfo/beginners



_______________________________________________
Beginners mailing list
[hidden email]
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank">http://lists.squeakfoundation.org/mailman/listinfo/beginners



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: printing graphics in squeak

Michael van der Gulik-2
Squeak isn't intimidating. It's cute and fluffy :-P.

Michael.

On 9/18/07, Ching de la Serna <[hidden email]> wrote:
Hi Michael,

Thanks for the info. Squeak can be intimidating with its wealth of capabilities if you don't know where to look. I will sure be busy checking out your suggestions.

Ching



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: printing graphics in squeak

ching
Cute, fluffy, true. And powerful.

On 9/18/07, Michael van der Gulik <[hidden email]> wrote:
Squeak isn't intimidating. It's cute and fluffy :-P.

Michael.

On 9/18/07, Ching de la Serna < [hidden email]> wrote:
Hi Michael,

Thanks for the info. Squeak can be intimidating with its wealth of capabilities if you don't know where to look. I will sure be busy checking out your suggestions.

Ching



_______________________________________________
Beginners mailing list
[hidden email]
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank">http://lists.squeakfoundation.org/mailman/listinfo/beginners



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: printing graphics in squeak

John Foster-3
In reply to this post by ching
Hi Ching!

I've been saving the form to a graphic file and then printing that.  That
way I can use Paint Shop Pro to add all sorts of eye candy before
printing.  This is in the context of maths problems for remedial teaching
- I have a set of classes that create a form and populate it with maths
problems, where difficulty and kinds of problems are parameters.  Saves me
hours each week.

Hope this applies in some way,

John

> 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
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: printing graphics in squeak

ching
HI John,

That's a neat idea. Thanks a lot.

Ching

On 9/18/07, [hidden email] <[hidden email]> wrote:
Hi Ching!

I've been saving the form to a graphic file and then printing that.  That
way I can use Paint Shop Pro to add all sorts of eye candy before
printing.  This is in the context of maths problems for remedial teaching
- I have a set of classes that create a form and populate it with maths
problems, where difficulty and kinds of problems are parameters.  Saves me
hours each week.

Hope this applies in some way,

John

> 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
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
cbc
Reply | Threaded
Open this post in threaded view
|

Re: printing graphics in squeak

cbc
If you want to print directly out of Squeak, at least on Windows platforms, I've found the class TextPrinter to be very useful.  It is obvoiusly designed to print text reports, but all of the plumbing is there to print out a page of whatever content you want too.  However, there will be digging involved.
 
Chris

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: printing graphics in squeak

Bert Freudenberg
On Sep 18, 2007, at 22:32 , Chris Cunningham wrote:

> If you want to print directly out of Squeak, at least on Windows  
> platforms, I've found the class TextPrinter to be very useful.  It  
> is obvoiusly designed to print text reports, but all of the  
> plumbing is there to print out a page of whatever content you want  
> too.  However, there will be digging involved.

Also, for "end-user friendly" printing take a look at Sophie which  
implements platform printing including proper dialogs on Mac and Win.

- Bert -


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: printing graphics in squeak

Alain rastoul
In reply to this post by ching
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@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" <[hidden email]> a écrit dans le message de news:
[hidden email]...
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
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners 



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Re: printing graphics in squeak

ching
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 <[hidden email]> 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@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" <[hidden email]> a écrit dans le message de news:
[hidden email] ...
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
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners