Changing the extent of an ImageMorph

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

Changing the extent of an ImageMorph

Jan Teske
Hey,

I'm currently developing a small game with Squeak. Part of it is a bunch
of menus which should have background images. Therefore I have realized
them as ImageMorphs with the respective images.
Now, there are menus which sizes are determined dynamically during the
runtime of the game. That means I have to change the size of the menus.
Since I cannot do this by manipulating 'menu extent: ...' directly, the
only way I found until now is to manipulate the image form 'menu image:
menu image scaledToSize: ...'. That works pretty well except for one
thing: I cannot change the aspect ration of the original image with
scaledToSize:. Since I do not know the extends of my menus before the
game starts, I cannot say anything about the needed image ratio. Since
my menus should be as applicable as possible I need to be able to resize
also in a way which destroys the original scales.

Is there any easy workaround for my problem or a recommended way for
creating resizable Morphs with background images?

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

Re: Changing the extent of an ImageMorph

Karl Ramberg
A SketchMorph lets you set the extent directly

Karl

On Wed, Jan 4, 2012 at 4:44 PM, Jan Teske <[hidden email]> wrote:
Hey,

I'm currently developing a small game with Squeak. Part of it is a bunch of menus which should have background images. Therefore I have realized them as ImageMorphs with the respective images.
Now, there are menus which sizes are determined dynamically during the runtime of the game. That means I have to change the size of the menus. Since I cannot do this by manipulating 'menu extent: ...' directly, the only way I found until now is to manipulate the image form 'menu image: menu image scaledToSize: ...'. That works pretty well except for one thing: I cannot change the aspect ration of the original image with scaledToSize:. Since I do not know the extends of my menus before the game starts, I cannot say anything about the needed image ratio. Since my menus should be as applicable as possible I need to be able to resize also in a way which destroys the original scales.

Is there any easy workaround for my problem or a recommended way for creating resizable Morphs with background images?

Thanks in advance!
_______________________________________________
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: Changing the extent of an ImageMorph

LEnglish
A sketchmorph is horribly complicated, too.

ImageMorph was designated as the successor to SketchMorph and then abandoned. By implication, SketchMorph was abandoned before ImageMorph.

Far better to figure out a way to resize ImageMorph, IMHO.


L.



On 1/4/12 8:59 AM, karl ramberg wrote:
A SketchMorph lets you set the extent directly

Karl

On Wed, Jan 4, 2012 at 4:44 PM, Jan Teske <[hidden email]> wrote:
Hey,

I'm currently developing a small game with Squeak. Part of it is a bunch of menus which should have background images. Therefore I have realized them as ImageMorphs with the respective images.
Now, there are menus which sizes are determined dynamically during the runtime of the game. That means I have to change the size of the menus. Since I cannot do this by manipulating 'menu extent: ...' directly, the only way I found until now is to manipulate the image form 'menu image: menu image scaledToSize: ...'. That works pretty well except for one thing: I cannot change the aspect ration of the original image with scaledToSize:. Since I do not know the extends of my menus before the game starts, I cannot say anything about the needed image ratio. Since my menus should be as applicable as possible I need to be able to resize also in a way which destroys the original scales.

Is there any easy workaround for my problem or a recommended way for creating resizable Morphs with background images?

Thanks in advance!
_______________________________________________
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: Changing the extent of an ImageMorph

Karl Ramberg
I see your point but I don't think it's worth the hassle unless one wanted to bring ImageMorph futrher on by implementing the needed methods.

KarlĀ 

On Wed, Jan 4, 2012 at 8:25 PM, Lawson English <[hidden email]> wrote:
A sketchmorph is horribly complicated, too.

ImageMorph was designated as the successor to SketchMorph and then abandoned. By implication, SketchMorph was abandoned before ImageMorph.

Far better to figure out a way to resize ImageMorph, IMHO.


L.




On 1/4/12 8:59 AM, karl ramberg wrote:
A SketchMorph lets you set the extent directly

Karl

On Wed, Jan 4, 2012 at 4:44 PM, Jan Teske <[hidden email]> wrote:
Hey,

I'm currently developing a small game with Squeak. Part of it is a bunch of menus which should have background images. Therefore I have realized them as ImageMorphs with the respective images.
Now, there are menus which sizes are determined dynamically during the runtime of the game. That means I have to change the size of the menus. Since I cannot do this by manipulating 'menu extent: ...' directly, the only way I found until now is to manipulate the image form 'menu image: menu image scaledToSize: ...'. That works pretty well except for one thing: I cannot change the aspect ration of the original image with scaledToSize:. Since I do not know the extends of my menus before the game starts, I cannot say anything about the needed image ratio. Since my menus should be as applicable as possible I need to be able to resize also in a way which destroys the original scales.

Is there any easy workaround for my problem or a recommended way for creating resizable Morphs with background images?

Thanks in advance!
_______________________________________________
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



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

Re: Changing the extent of an ImageMorph

Bert Freudenberg
In reply to this post by Jan Teske

On 04.01.2012, at 16:44, Jan Teske wrote:

> Hey,
>
> I'm currently developing a small game with Squeak. Part of it is a bunch of menus which should have background images. Therefore I have realized them as ImageMorphs with the respective images.
> Now, there are menus which sizes are determined dynamically during the runtime of the game. That means I have to change the size of the menus. Since I cannot do this by manipulating 'menu extent: ...' directly, the only way I found until now is to manipulate the image form 'menu image: menu image scaledToSize: ...'. That works pretty well except for one thing: I cannot change the aspect ration of the original image with scaledToSize:. Since I do not know the extends of my menus before the game starts, I cannot say anything about the needed image ratio. Since my menus should be as applicable as possible I need to be able to resize also in a way which destroys the original scales.
>
> Is there any easy workaround for my problem or a recommended way for creating resizable Morphs with background images?


Wouldn't it be simplest to just use a regular MenuMorph and give it a BitmapFillStyle?

        MenuMorph example
                fillStyle: (BitmapFillStyle fromForm: ScriptingSystem squeakyMouseForm);
                openCenteredInWorld

- Bert -


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