|
ResourceCreateCreates an image resource based on a data set. There are two variants of the function:
Creating a resource based on the array of pixels
Parameters resource_name [in] Resource name. path [in] Relative path to the file, containing the resource data. If the path is started from "\" (written as "\\"), it is assumed that file path is relative to terminal_data_folder\MQL4\, otherwise it is assumed that file is specified relative to .EX4 program folder. 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.
See also Resources, ObjectCreate(), ObjectSetString(), OBJPROP_BMPFILE |