17.1 Overview

Plugins that have the capability flag HWPLUG_CAPS_IMAGE set will be called whenever Hollywood has to load an image. The plugin can check then whether the image is in a format that the plugin recognizes and if it is, it can open the image and return the raw pixel data to Hollywood. This makes it possible to load custom image formats with Hollywood.

Image plugins can support two different image types: Raster and vector images. If your plugin supports vector images, Hollywood will always call your plugin whenever it needs to transform the image. Your plugin can then do the lossless vector image transformation on its own and return the new pixel data to Hollywood. For raster images, image transformation is always done by Hollywood and your plugin doesn't have to do anything.

By default, image plugins are automatically activated when Hollywood loads them. Starting with Hollywood 6.0 this behaviour can be changed by setting the HWEXT_IMAGE_NOAUTOINIT extension bit. If this bit is set, Hollywood will not automatically activate your plugin at load time. Instead, you will have to manually call hw_AddLoaderAdapter() to activate your plugin. For example, you could call hw_AddLoaderAdapter() from your RequirePlugin() implementation. In that case, the image plugin would only be activated if the user called @REQUIRE on it. If you do not call hw_AddLoaderAdapter() on a plugin that has auto-initialization disabled, it will only be available if the user addresses it directly through the Loader tag. See Extension plugins to learn how to use plugin extension bits.

Note that image plugins need not implement all functions offered by the image plugin API. Some functions are optional and need only be implemented in specific cases. Here's a list of optional functions:

GetImageFormat()
Only used if you set the HWEXT_IMAGE_FORMAT extension flag. See Extension plugins to learn how to use plugin extension bits.

The SDK distribution comes with an example image plugin which contains a loader for the PCX image format. Feel free to study this example code to learn how image plugins are written in practice.


Show TOC