[]
Initializes an empty instance of the GcBitmap class.
public GcBitmap()
Initializes a new instance of the GcBitmap class and creates the image.
The image content is not initialized and can contain any random data.
If subsequent rendering is going to cover the whole surface of the bitmap, or if CreateGraphics(Color?) will be called on the bitmap with a non-null background color, clearing it (which is a lengthy operation for large bitmaps) is not needed. If some areas of the bitmap are going to be left untouched, they must be cleared to avoid the possibility of random artifacts showing.
public GcBitmap(int pixelWidth, int pixelHeight, bool opaque, float dpiX = 96, float dpiY = 96, bool storeInTempFile = false)
| Type | Name | Description |
|---|---|---|
| int | pixelWidth | The width of the image, in pixels. |
| int | pixelHeight | The height of the image, in pixels. |
| bool | opaque | Indicates whether the alpha channel should be ignored. |
| float | dpiX | The horizontal dpi of the image. |
| float | dpiY | The vertical dpi of the image. |
| bool | storeInTempFile | Indicates whether pixel data should be dynamically mapped to a temporary file rather than kept fully in memory. |
Initializes a new instance of the GcBitmap class and sets the existing pixel data to be read/modified in-place.
public GcBitmap(uint[] pixelData, int pixelWidth, int pixelHeight, bool opaque, bool premultiplied = false, float dpiX = 96, float dpiY = 96)
| Type | Name | Description |
|---|---|---|
| uint[] | pixelData | The pixel data to be attached to a GcBitmap. |
| int | pixelWidth | The width of the image, in pixels. |
| int | pixelHeight | The height of the image, in pixels. |
| bool | opaque | Indicates whether the alpha channel should be ignored. |
| bool | premultiplied | Indicates whether the color channels are premultiplied by the alpha channel. |
| float | dpiX | The horizontal dpi of the image. |
| float | dpiY | The vertical dpi of the image. |
Initializes a new instance of the GcBitmap class and sets the existing pixel data to be read/modified in-place.
public GcBitmap(IntPtr pixelData, int pixelWidth, int pixelHeight, bool opaque, bool premultiplied = false, float dpiX = 96, float dpiY = 96)
| Type | Name | Description |
|---|---|---|
| IntPtr | pixelData | The pixel data to be attached to a GcBitmap. |
| int | pixelWidth | The width of the image, in pixels. |
| int | pixelHeight | The height of the image, in pixels. |
| bool | opaque | Indicates whether the alpha channel should be ignored. |
| bool | premultiplied | Indicates if the color channels are premultiplied by the alpha channel. |
| float | dpiX | The horizontal dpi of the image. |
| float | dpiY | The vertical dpi of the image. |
Initializes a new instance of the GcBitmap class.
public GcBitmap(Stream stream, int frameIndex = 0, Rectangle? imageRect = null, bool storeInTempFile = false)
| Type | Name | Description |
|---|---|---|
| Stream | stream | The source stream. JPEG, PNG, WEBP, GIF, BMP, TIFF, ICO, JPEG 2000 formats are supported. |
| int | frameIndex | Index of an image frame to read, pass 0 for image formats not supporting multiple frames. |
| Rectangle? | imageRect | Clipping rectangle of the image to be loaded. |
| bool | storeInTempFile | Indicates whether pixel data should be dynamically mapped to a temporary file rather than kept fully in memory. |
Initializes a new instance of the GcBitmap class.
public GcBitmap(string path, int frameIndex = 0, Rectangle? imageRect = null, bool storeInTempFile = false)
| Type | Name | Description |
|---|---|---|
| string | path | The file path to the image. JPEG, PNG, WEBP, GIF, BMP, TIFF, ICO, JPEG 2000 formats are supported. |
| int | frameIndex | Index of an image frame to read, pass 0 for image formats not supporting multiple frames. |
| Rectangle? | imageRect | Clipping rectangle of the image to be loaded. |
| bool | storeInTempFile | Indicates whether pixel data should be dynamically mapped to a temporary file rather than kept fully in memory. |
Initializes a new instance of the GcBitmap class.
public GcBitmap(byte[] bytes, int frameIndex = 0, Rectangle? imageRect = null, bool storeInTempFile = false)
| Type | Name | Description |
|---|---|---|
| byte[] | bytes | The image data. JPEG, PNG, WEBP, GIF, BMP, TIFF, ICO, JPEG 2000 formats are supported. |
| int | frameIndex | Index of an image frame to read, pass 0 for image formats not supporting multiple frames. |
| Rectangle? | imageRect | Clipping rectangle of the image to be loaded. |
| bool | storeInTempFile | Indicates whether pixel data should be dynamically mapped to a temporary file rather than kept fully in memory. |
Initializes a new instance of the GcBitmap class.
public GcBitmap(Image image, Rectangle? imageRect = null, bool storeInTempFile = false)
| Type | Name | Description |
|---|---|---|
| Image | image | Image used as the source of image data. |
| Rectangle? | imageRect | Clipping rectangle of the image to be loaded. |
| bool | storeInTempFile | Indicates whether pixel data should be dynamically mapped to a temporary file rather than kept fully in memory. |