- 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).
- 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.
- 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
- 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.
- Which image formats are supported? Can I add my own, like HDR?
This one I do not know yet :).