display image in full screen canvas

Hi frndz

I have an Image, which either bigger in size of a canvas or small

I want to give an option of a full screen view

So its a kind of zoomIn/ zoomOut function in one method

how can I convert such small/big images into full screen canvas size

thanks

alpesh

[303 byte] By [alpesha] at [2007-10-3 9:54:31]
# 1

This question has been asked already several times here: http://onesearch.sun.com/search/onesearch/index.jsp?qt=resizing+image&subCat=siteforumid%3Ajava76&site=dev&dftab=siteforumid%3Ajava76&chooseCat=javaall&col=developer-forums

There is no method in MIDP which rescales a picture for you, so you have to write it on your on (or use existing code). But usually this would be pretty slow. Mostly it is better to offer different versions of your application for different devices (screen resolutions) where the images have already the appropriate size within your jar-file.

JoachimRohdea at 2007-7-15 5:12:17 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2

actually image is downloaded from the server

so i cant handle for each individual phone..

it must be dynamic

what I am thinking is:

1) get the width and height of the canavs

2) create an image of above height and width from downloaded image

so either it compresses or stratches the existing ( big question...how ? )

3) display on canvas

solution is :

Image resizedImage = originalImage.getScaledInstance(canvas width, canvas height, Image.SCALE_DEFAULT);

but this is not a method defined by class Image

any help

alpesh

alpesha at 2007-7-15 5:12:17 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 3

If you get it from the server why don't you post the screen-dimension to the server and scale the image on the server (which is quite simple with PHP or Java)?

As I mentioned before: MIDP is not providing any method for scaling. Browse here in the forum for sample-code how to implement it on your own.

JoachimRohdea at 2007-7-15 5:12:17 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 4

> If you get it from the server why don't you post the

> screen-dimension to the server and scale the image on

> the server (which is quite simple with PHP or Java)?

> As I mentioned before: MIDP is not providing any

> method for scaling. Browse here in the forum for

> sample-code how to implement it on your own.

why we people always think in one direction?

this will really help me

thanks JoachimRohde

alpesha at 2007-7-15 5:12:17 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 5

> why we people always think in one direction?

> this will really help me

> thanks JoachimRohde

You're welcome ;-)

I know it was a rhetorical question but I've learned that the third law of computing proofed to be way too often to be true (http://www.csd.uwo.ca/~magi/personal/humour/Computer_Audience/The%20Laws%20of%20Computing.html)

:-)

JoachimRohdea at 2007-7-15 5:12:17 > top of Java-index,Java Mobility Forums,Java ME Technologies...