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