You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by junguo pu <po...@gmail.com> on 2007/12/03 15:22:21 UTC

A problem, when load the picture

Hi, all:

I'm glad to see the progress you make everyday, although problems are
unaviodable.

In our opinion, the gap between harmony and sun is not the functions whether
full-scale but the functions' haleness and stableness.

For example, the picture load mechanism. When we start to load a .png, there
are two main threads: EventDispatchThread and ImageLoadThread. Here we can
see harmony use a single interface to insure the asynchronous picture
loading problem. A single interface  means that EventDispatchThread
communicating with the ImageLoadThread by using BufferedImage.getWidth()
method. But without a management, how can you assure that whether
ImageLoadThread loaded the picture has done, when it return the image
instance.

Maybe if we compounding our modules under harmony imaging rules cover some
problems, but you never know the users will do under which order.

Picture loding is the typical problem of such kind. So we hope that harmony
will consider more cases than just implementing the functions' interface
independently.

More problems we meet will be submit.
Regards.

Jorcco Poo
3-Dec-2007

Re: A problem, when load the picture

Posted by Igor Stolyarov <ig...@gmail.com>.
>
> Here we take Toolkit.getDefaultToolkit().createCustomCursor(Image, Point,
> String) for example. If we load the custom cursor image asynchronously,
> and
> pass it to the method. Harmony throw the "invalid hotspot" exception,
> while
> the same test case with sun jre it runs okey. Here we can see harmony it
> just use the image directly, it does not care about whether the image
> loaded
> fully. If you want to compatible with sun, so the appearance should be the
> same to sun according to the same test case.


Hi, as I understood from your example, you have issue in createCustomCursor
method. Why do you think what issue in image loading? I can to suppose what
issue in createCustomCursor method. But it anyway is issue and it demands
investigation. You can create issue in our JIRA and we are solving it ASAP.

Igor

Re: A problem, when load the picture

Posted by junguo pu <po...@gmail.com>.
Yes.

Here we take Toolkit.getDefaultToolkit().createCustomCursor(Image, Point,
String) for example. If we load the custom cursor image asynchronously, and
pass it to the method. Harmony throw the "invalid hotspot" exception, while
the same test case with sun jre it runs okey. Here we can see harmony it
just use the image directly, it does not care about whether the image loaded
fully. If you want to compatible with sun, so the appearance should be the
same to sun according to the same test case.

And we debug EIOffice with Harmony,  harmony crashed exactly the same words,
although successfully with other little demos.

Regards.
J.

Re: A problem, when load the picture

Posted by Igor Stolyarov <ig...@gmail.com>.
> For example, the picture load mechanism. When we start to load a .png,
> there
> are two main threads: EventDispatchThread and ImageLoadThread. Here we can
>
> see harmony use a single interface to insure the asynchronous picture
> loading problem. A single interface  means that EventDispatchThread
> communicating with the ImageLoadThread by using BufferedImage.getWidth()
> method. But without a management, how can you assure that whether
> ImageLoadThread loaded the picture has done, when it return the image
> instance.


Hi, Jorcco,

Regarding management of image loading. There is interface ImageObserver (
java.awt.ImageObserver). That interface is an asynchronous update interface
for receiving notifications about Image information as the Image is
constructed. When you created Image instance, for example:
Image img = Toolkit.getDefaultToolkit().createImage("image.png");

You haven't yet any image data until you whether ask image size or start
draw image, for example:

int width = img.getWidth(ImageObserver instance);

or

Graphics.drawImage(Image, x, y, ImageObserver);

After that image loading process starts and ImageObserver interface allows
you traking all image loading stages.
Also there are two useful Toolkit methods prepareImage and checkImage. First
method starts image loading process and returns true if image fully loaded,
second one allows recieved image loading states.

If you have else questions, wellcome.

Thanks,
Igor