Name
hw_GetARGBBrush -- get raw brush pixels (V5.2)
Synopsis
ULONG *rgb = hw_GetARGBBrush(lua_ID *id, struct hwTagList *tags);
Function
This function can be used to get a copy of the specified brush's pixels. In contrast to hw_LockBrush() hw_GetARGBBrush() will convert the pixels to the 32-bit ARGB format automatically and it will also mix any potential alpha channel or monochrome transparency mask into the pixel map. All this is of course overhead which makes hw_GetARGBBrush() slower than hw_LockBrush(). You have to pass the object identifier of the brush whose pixels you want to obtain. The object identifier must be passed as a lua_ID. See Object identifiers for details.

Additionally, you can specify a taglist in the second parameter. The following tags are currently recognized:

HWGAB_WIDTH:
If you specify this tag, you must set its pData member to a pointer to an int. hw_GetARGBBrush() will then write the brush's width in pixels to this int.

HWGAB_HEIGHT:
If you specify this tag, you must set its pData member to a pointer to an int. hw_GetARGBBrush() will then write the brush's height in pixels to this int.

HWGAB_OPAQUE:
If you specify this tag, you must set its pData member to a pointer to an int. hw_GetARGBBrush() will then write True to this int if the brush doesn't have a mask or an alpha channel, or False otherwise.

HWGAB_FLAGS:
This tag allows you to specify some flags for hw_GetARGBBrush(). The iData member of this tag must be set to a ULONG containing one or more of the following flags:

HWGABFLAGS_SCALE:
If this flag is set, the brush will automatically be scaled by the current monitor's scaling coefficient. This can be useful for supporting high DPI systems.

HWGABFLAGS_INTERPOLATE:
If hw_GetARGBBrush() scales the brush pixels because HWGABFLAGS_SCALE is set, you can activate bilinear interpolation by setting this flag.

(V8.0)

Note that currently you always have to pass a taglist to this function as it does not check against NULL. So just pass an empty taglist if you don't need to use any of the tags above.

Please note that alpha byte will always be set, even if the brush doesn't have any transparency information. In that case the alpha byte for every pixel will be set to 255, i.e. fully opaque.

The memory buffer that is returned by this function must be freed by using the hw_FreeARGBBrush() function. See hw_FreeARGBBrush for details.

Note that hw_GetARGBBrush() can only be used with software brushes. It is not possible to get the raw pixels of hardware brushes.

Designer compatibility
Unsupported

Inputs
id
object identifier of brush whose pixels you want to get
tags
pointer to a taglist specifying additional options (see above); this must not be NULL
Results
rgb
raw 32-bit ARGB pixel buffer or NULL on error

Show TOC