Spec: scaling imageModels

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

Spec: scaling imageModels

Pharo Smalltalk Users mailing list
Dears,
        I'm experimenting with Spec, more specifically with a ImageModel.


        I'm tring to scale the image accordingly to the window size, but I
can't find a simple way to do that.

        Does windows resizing trigger a "when..." message?

        Should I try a different solution?

Thanks,
Matteo


View this message in context: Spec: scaling imageModels
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Spec: scaling imageModels

stepharo
Hi matteo


Spec does not expose the complete API. Now if you need you can propose
some extensions.

Stef

Reply | Threaded
Open this post in threaded view
|

Re: Spec: scaling imageModels

matteob8
Hi Stef,
        I think that an automatic scaled behaviour is very useful for ImageModel, especially if you need to generate list of images, that automatically adapts to their container (i.e. Thumbnails).

        Playing with AlpahImageMorph I found that the desired behaviour can be obtained setting the "layout" state to the "#scaledAspect" symbol.

        So I've added the "ImageModel>>switchScaledLayout" method, that will simply call its MorphicAdapter, through the command "self changed: #switchScaledLayout with: {}".
        Then I've created the "MorphicImageAdapter>>switchScaledLayout" method, that switchs among the "#center" and "#scaledAspect" morph layouts (note: "#center" is the default for the Spec's "MorpdicImageAdapter").
        Below the code the code I used:
       

MorphicImageAdapter>>switchScaledLayout
        "Switch between scaled and fixed representation"

        self
                widgetDo: [ :w |
                        | oldLayout |
                        oldLayout := w layout.
                        oldLayout = #scaledAspect
                                ifTrue: [ w layout: #center ]
                                ifFalse: [ w layout: #scaledAspect ] ].




Please let me know if you have any advice,

Thanks,
Matteo
Reply | Threaded
Open this post in threaded view
|

Re: Spec: scaling imageModels

Pharo Smalltalk Users mailing list
In reply to this post by stepharo
Hi Stef,
        I think that an automatic scaled behaviour is very useful for ImageModel,
especially if you need to generate list of images, that automatically adapts
to their container (i.e. Thumbnails).

        Playing with AlpahImageMorph I found that the desired behaviour can be
obtained setting the "layout" state to the "#scaledAspect" symbol.

        So I've added the "ImageModel>>switchScaledLayout" method, that will simply
call its MorphicAdapter, through the command "self changed:
#switchScaledLayout with: {}".
        Then I've created the "MorphicImageAdapter>>switchScaledLayout" method,
that switchs among the "#center" and "#scaledAspect" morph layouts (note:
"#center" is the default for the Spec's "MorpdicImageAdapter").
        Below the code the code I used:
       

MorphicImageAdapter>>switchScaledLayout
        "Switch between scaled and fixed representation"

        self
                widgetDo: [ :w |
                        | oldLayout |
                        oldLayout := w layout.
                        oldLayout = #scaledAspect
                                ifTrue: [ w layout: #center ]
                                ifFalse: [ w layout: #scaledAspect ] ].




Please let me know if you have any advice,

Thanks,
Matteo



--
View this message in context: http://forum.world.st/Spec-scaling-imageModels-tp4918440p4919199.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: Spec: scaling imageModels

stepharo
Hi matteo

Please open a bug entry and submit a fix and there is a good chance that
your enhancements

will be added to Pharo.

We cannot crawl the mails and do that in addition to all the rest. :)

Stef

Reply | Threaded
Open this post in threaded view
|

Re: Spec: scaling imageModels

Pharo Smalltalk Users mailing list
Hi Stef,
sorry, I didn't get it from your first mail!

Have I to submit the bug entry, and the fix, thorugh "fogbugz" or GitHub?

thanks,
Matteo 


Il Giovedì 20 Ottobre 2016 9:12, stepharo <[hidden email]> ha scritto:


Hi matteo

Please open a bug entry and submit a fix and there is a good chance that
your enhancements

will be added to Pharo.

We cannot crawl the mails and do that in addition to all the rest. :)


Stef



Reply | Threaded
Open this post in threaded view
|

Re: Spec: scaling imageModels

Nicolai Hess-3-2

Fogbugz!


Am 22.10.2016 3:08 nachm. schrieb "Matteo Bellotto via Pharo-users" <[hidden email]>:


---------- Weitergeleitete Nachricht ----------
From: Matteo Bellotto <[hidden email]>
To: Any question about pharo is welcome <[hidden email]>
Cc: 
Date: Sat, 22 Oct 2016 13:07:21 +0000 (UTC)
Subject: Re: [Pharo-users] Spec: scaling imageModels
Hi Stef,
sorry, I didn't get it from your first mail!

Have I to submit the bug entry, and the fix, thorugh "fogbugz" or GitHub?

thanks,
Matteo 


Il Giovedì 20 Ottobre 2016 9:12, stepharo <[hidden email]> ha scritto:


Hi matteo

Please open a bug entry and submit a fix and there is a good chance that
your enhancements

will be added to Pharo.

We cannot crawl the mails and do that in addition to all the rest. :)


Stef




Reply | Threaded
Open this post in threaded view
|

Re: Spec: scaling imageModels

stepharo
In reply to this post by Pharo Smalltalk Users mailing list
Hi matteo

Please open a bug entry and submit a fix and there is a good chance that
your enhancements

will be added to Pharo.

We cannot crawl the mails and do that in addition to all the rest. :)

Stef