|
ResourceCreate
Creates an image resource based on a data set. There are two variants of the function:
Creating a resource based on a file
bool ResourceCreate(
|
Creating a resource based on the array of pixels
bool ResourceCreate(
|
Parameters
resource_name
[in] Resource name.
data[][]
[in] A one-dimensional or two-dimensional array for creating a complete image.
img_width
[in] The width of the rectangular image area in pixels to be placed in the resource in the form of an image. It cannot be greater than the data_width value.
img_height
[in] The height of the rectangular image area in pixels to be placed in the resource in the form of an image.
data_xoffset
[in] The horizontal rightward offset of the rectangular area of the image.
data_yoffset
[in] The vertical downward offset of the rectangular area of the image.
data_width
[in] Required only for one-dimensional arrays. It denotes the full width of the image from the data set. If data_width=0, it is assumed to be equal to img_width. For two-dimensional arrays the parameter is ignored and is assumed to be equal to the second dimension of the data[] array.
color_format
[in] Color processing method, from a value from the ENUM_COLOR_FORMAT enumeration.
Return Value
Returns true if successful, otherwise false. To get information about the error call the GetLastError() function. The following errors may occur:
Note
If the second version of the function is called for creating the same resource with different width, height and shift parameters, it does not create a new resource, but simply updates the existing one.
The first version of the function is used for uploading images and sounds from files, and the second version is used only for the dynamic creation of images.
Images must be in the BMP format with a color depth of 24 or 32 bits. Sounds can only be in the WAV format. The size of the resource should not exceed 16 Mb.
Identifier |
Description |
---|---|
COLOR_FORMAT_XRGB_NOALPHA |
The component of the alpha channel is ignored |
COLOR_FORMAT_ARGB_RAW |
Color components are not handled by the terminal (must be correctly set by the user) |
COLOR_FORMAT_ARGB_NORMALIZE |
Color components are handled by the terminal |
Example:
//+------------------------------------------------------------------+
|
See also
Resources, ObjectCreate(), ObjectSetString(), OBJPROP_BMPFILE