struct hwIconEntry *icon = hw_GetIconForDensity(lua_ID *id, double
*density, ULONG flags, struct hwTagList *tags);
density parameter. Note that this parameter is a pointer to a
double, not a double. If the density parameter is NULL, the current monitor's
default density is used. You also have to pass the object identifier of the icon
whose images should be scanned to find an image that fits best for the requested
density. The object identifier must be passed as a lua_ID. See Object identifiers for details.
The flags parameter can be used to configure how hw_GetIconForDensity() should
behave when scanning the icon for images. The following flags are currently
defined:
HWGIFDFLAGS_SELECTED:hw_GetIconForDensity() to return the selected image
instead of the normal image. If this flag is set and there is no selected image,
hw_GetIconForDensity() will fail.
HWGIFDFLAGS_NOSCALE:hw_GetIconForDensity() will scale images if they don't exactly fit
the required density. If you don't want this behaviour, you can set HWGIFDFLAGS_NOSCALE
to prevent hw_GetIconForDensity() from scaling images. Note, however, that in this
case the image returned by hw_GetIconForDensity() might not be an exact match for
the specified density.
HWGIFDFLAGS_INTERPOLATE:hw_GetIconForDensity() will scale images if they don't exactly fit
the required density. If you set this flag, interpolation will be used when scaling
images. It is recommended to set this tag because images typically look much better
with interpolated scaling.
HWGIFDFLAGS_MUSTMATCH:hw_GetIconForDensity() should only accept images which match the
specified density exactly. If there is no exact match, hw_GetIconForDensity() will
return NULL.
hw_GetIconForDensity() will return a pointer to a struct hwIconEntry which looks
like this:
struct hwIconEntry
{
APTR Data;
int Width;
int Height;
ULONG Flags;
ULONG *Palette; // V9.0
ULONG TransPen; // V9.0
int Depth; // V9.0
};
|
Here is a description of the structure members of struct hwIconEntry:
Data:width * height * 4. No row padding will be used. The pixel
buffer pointer will be valid until you call hw_FreeIcon().
Width:
Height:
Flags:
HWICONFLAGS_DEFAULT:
HWICONFLAGS_SELECTED:
HWICONFLAGS_OPAQUE:
HWICONFLAGS_EXTENDED:struct hwIconEntry has the structure extensions
introduced in Hollywood 9.0. Before you access any of those extensions, e.g.
the Palette or Depth members, you must either check if this flag is set or
if the Hollywood version that opened your plugin is at least 9.0. (V9.0)
Palette:NULL because hw_GetIconForDensity() currently won't return palette images. (V9.0)
TransPen:HWPEN_NONE because hw_GetIconForDensity() currently won't return palette
images. (V9.0)
Depth:hw_GetIconForDensity() currently won't return palette images. (V9.0)
The image that is returned by this function must be freed using the hw_FreeIcon() function. See hw_FreeIcon for details.
double containing the desired density or NULL to use
the current monitor's default densityhw_GetIconForDensity() should behave (see above)NULLNULL on error