int ok = hw_SaveImage(STRPTR file, APTR data, int width, int height,
ULONG fmt, ULONG flags, struct hwTagList *tags);
data to the file specified by
filename. You also need to pass the image dimensions in pixels to hw_SaveImage().
The array passed in data can either be a 32-bit or an 8-bit pixel array. If it
is an 8-bit pixel array, the pixels are interpreted as CLUT data so you also have
to pass the color palette in the HWSVIMGTAG_PALETTE tag (see below).
The fmt argument must be set to an image format provided by a plugin or to one of
the following inbuilt image savers:
HWIMGFMT_BMP:
HWIMGFMT_PNG:
HWIMGFMT_JPEG:HWSVIMGTAG_QUALITY tag (see below).
HWIMGFMT_GIF:
HWIMGFMT_ILBM:
Furthermore, hw_SaveImage() accepts a tag list which can be used to configure
the following options:
HWSVIMGTAG_QUALITY:HWIMGFMT_JPEG, you can use this tag
to set the desired compression level (an integer between 0 and 100).
By default, a quality of 90 is used.
HWSVIMGTAG_DEPTH:data parameter.
This can be 24 for RGB data without alpha channel, 32 for RGB data with
alpha channel and 8 for CLUT data. Note that even if you set this tag
to 24, the pixel data must still be passed as 32-bit ULONG pixels.
Defaults to 32.
HWSVIMGTAG_PALETTE:hw_SaveImage(), you need to set this tag to
a palette containing the pen colors. The palette must be passed as an
array of 256 ULONG. Note that even if the image uses less than 256
colors, you still need to set HWSVIMGTAG_DEPTH to 8 and the array you
pass here still needs to contain 256 entries.
HWSVIMGTAG_TRANSPEN:hw_SaveImage(), you can set this tag to a
pen that should be made transparent. Defaults to HWPEN_NONE which
means no pen shall be transparent.
True or False to indicate success or failure