SaveImage -- save image to disk (V5.0)
int ok = SaveImage(STRPTR filename, struct SaveImageCtrl *ctrl);
This function must save the image provided by the pointer in the second parameter to the filename specified in the first parameter. Hollywood passes a pointer to a struct SaveImageCtrl to this function. This structure looks like this:

struct SaveImageCtrl
    APTR Data;        // [in]
    ULONG *Palette;   // [in]
    int Width;        // [in]
    int Height;       // [in]
    int Modulo;       // [in]
    int Format;       // [in]
    int Quality;      // [in]
    int Colors;       // [in]
    ULONG TransIndex; // [in]
    ULONG Flags;      // [in]
    ULONG FormatID;   // [in] -- V5.3

In this structure Hollywood passes the following information to your SaveImage() function:

The pixel data to save to the file. The actual format of this data depends on the Format member.

Width of the image in pixels.

Height of the image in pixels.

Number of bytes used by a single row of pixel data. This may be larger than the specified width because there may be some padding involved.

This specifies the pixel format of the source data passed in Data. May be one of the following constants:

Data is a 32-bit array consisting of ARGB pixels.

Data contains 8-bit indices into a color look-up table. This color look-up table is passed in Palette below.

You will only have to handle those formats here that you have explicitly declared as supported when Hollywood called your RegisterImageSaver() function.

This contains a value between 0 and 100 indicating the desired quality for the output file. Image formats that use lossy compression can use this member to determine compression settings for the image. Image formats that don't use any compression or offer lossless compression can ignore this member.

This contains the number of colors in the color look-up table passed in the Palette member. This member is only used if Format is HWSAVEIMGFMT_CLUT.

Contains the look-up table that you need to convert the CLUT pixel values to RGB color values. This table consists of as many 32-bit ARGB values as has been set in the Colors member. Note that Palette is only used if Format is HWSAVEIMGFMT_CLUT.

If Format is HWSAVEIMGFMT_CLUT this member specifies the index of the color that should appear transparent in the image. The value specified here is only valid if the HWSAVEIMGFLAGS_TRANSINDEX flag has been set (see below).

Contains a combination of flags specifying further options:

Pixel data contains alpha channel transparency values.

The TransIndex member contains the index of a palette entry that should be made transparent in the output image.

This member contains the identifier of the image format the file should be saved in. You only need to look at this member if your plugin supports more than one output image format. But be careful, you are only allowed to look at this member if the user is running at least Hollywood 5.3. Otherwise, you must not access this member because older versions of Hollywood don't support it. (V5.3)

This function has to return True if the image has been successfully saved or False in case of an error.

path to a destination file
pointer to a struct SaveImageCtrl containing the image to be saved
True or False indicating success or failure

Show TOC