Documentation / Marblecore Imaging / Methods / Create
Create method
Creates a new image with the specified width and height. By default a new 32-bit image will be created which supports alpha transparency. You can disable transparency to create a 24-bit image. When you want to save a 32-bit image to a format which not supports 32-bit images (like JPEG or GIF) the library will automatically convert your image to a 24-bit image. The specified background color will be used for the conversion.
Syntax
Boolean Create(nWidth As Number, nHeight As Number, bTransparency As Boolean, nBackgroundColor As Number, nBackgroundOpacity As Number, nFormat As Format)
Return value
Returns true if the function succeeded.
Parameters
Parameter | Type | Required | Description |
nWidth | Number | Yes | Width of the new image. |
nHeight | Number | Yes | Height of the new image. |
bTransparency | Boolean | No | Optional parameter which enables or disables transparency. Transparency is enabled by default. |
nBackgroundColor | Number | No | Optional background color for the image. |
nBackgroundOpacity | Number | No | Optional background opacity for the image (only available for transparent images). |
nFormat | Format (Enumeration) | No | Optional parameter containing the format for the new image. |
Example
The example below shows how to use the method. If you take a look at the example code, assume there is a reference to the Marblecore Imaging object with the name 'MarblecoreImaging'. Transparent parts of the image are displayed using a checkerboard pattern.
1
2 MarblecoreImaging.Create(150, 150, true);
3
4
5 MarblecoreImaging.SaveToFile("example-create.jpg");
Category
Basic operations
See also
Deserialize |
LoadFromBase64 |
LoadFromFile |
LoadFromSerializedStream |
LoadFromStream |
LoadFromURL |
Reset |
SaveToBase64 |
SaveToFile |
SaveToHBitmap |
SaveToHBitmapPreMultiplied |
SaveToStream |
Serialize