[webkit-dev] ImageLoader class

Sergiy Byelozyorov rryk.ua at gmail.com
Sat Jul 9 09:30:19 PDT 2011


Hello,

It took me long before I have figured these things on my own. May be this
will be useful for someone.

>
>    1. How do I know that the image was loaded already? Can I set up
>    callback somehow?
>
> ImageLoader::imageChanged is called whenever new piece of data is decoded
(even if this is only part of the whole image).

>
>    1. What should functions sourceURI() and dispatchLoadEvent() do?
>
> sourceURI should return actual URI while being passed an attribute that
contains. dispatchLoadEvent dispatches load event to the DOM. I use
implementation similar to HTMLImageLoader for these two methods.

>
>    1. What is pixel format
>    for m_imageLoader.image()->image()->data()->data()? Is this the right way to
>    access loaded image raw pixel data?
>
> The right way to get an image is the following:

Image* image = m_imageLoader.image()->image();

Then depending on the rendering engine one should use different classes. I
have only implemented it for SKIA as following:

const NativeImageSkia* skiaImage = image->nativeImageForCurrentFrame();
SkBitmap::Config config = skiaImage->config(); // this contains pixel format

>
>    1. How can I handle animations (e.g. GIF files)? How do I know when the
>    next image in the animation suquence is ready? Another callback?
>
> ImageLoader::imageChanged is also called for animated images.

>
>    1. Which image formats are supported? Can I add my own, like HDR?
>
> This one I do not know yet :).


> Thank you.
>
> Sergiy
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20110709/42435099/attachment.html>


More information about the webkit-dev mailing list