Class ImageData
ImageData solves the problem of handling bitmaps in fusee by offering functions of bitmap manipulation.
Inheritance
Implements
Inherited Members
Namespace: Fusee.Base.Core
Assembly: Fusee.Base.Core.dll
Syntax
public class ImageData : IImageData
Constructors
ImageData(ColorFormat, Int32, Int32)
Creates a new instance of type ImageData.
Declaration
public ImageData(ColorFormat format, int width = 2048, int height = 2048)
Parameters
Type | Name | Description |
---|---|---|
ColorFormat | format | The ColorFormat. |
System.Int32 | width | Width in px. |
System.Int32 | height | Height in px. |
ImageData(Byte[], Int32, Int32, ImagePixelFormat)
Constructor takes the pixelData byte array, width and height dimensions in pixels and the ImagePixelFormat.
Declaration
public ImageData(byte[] pixelData, int width, int height, ImagePixelFormat colorFormat)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | pixelData | The pixelData byte array contains all bitmap pixels. |
System.Int32 | width | Width in pixels. |
System.Int32 | height | Height in pixels. |
ImagePixelFormat | colorFormat | ImagePixelFormat provides additional information about pixel Encoding. |
ImageData(Int32, Int32)
Creates a new instance of type ImageData.
Declaration
public ImageData(int width = 2048, int height = 2048)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | Width in px. |
System.Int32 | height | Height in px. |
Properties
Height
Height in pixels.
Declaration
public int Height { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
IsEmpty
Declaration
public bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
PixelData
The byte array that makes up this ImageData instance.
Declaration
public byte[] PixelData { get; set; }
Property Value
Type | Description |
---|---|
System.Byte[] |
PixelFormat
PixelFormat provides additional information about pixel encoding.
Declaration
public ImagePixelFormat PixelFormat { get; }
Property Value
Type | Description |
---|---|
ImagePixelFormat |
Width
Width in pixels.
Declaration
public int Width { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
Blt(Int32, Int32, IImageData, Int32, Int32, Int32, Int32)
Copies a rectangular block of pixel data from a source image to a this image (Blt = BlockTransfer).
Declaration
public void Blt(int xDst, int yDst, IImageData src, int xSrc = 0, int ySrc = 0, int width = 0, int height = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | xDst | The x destination coordinate (where to place the block within dst). |
System.Int32 | yDst | The y destination coordinate (where to place the block within dst). |
IImageData | src | The source image. |
System.Int32 | xSrc | The x source coordinate (where to start copying from within src). |
System.Int32 | ySrc | The y source coordinate (where to start copying from within src). |
System.Int32 | width | The width of the block to copy. (default is src.Width). |
System.Int32 | height | The height of the block to copy (default is src.Height). |
Remarks
All specified parameters are clipped to avoid out-of-bounds indices. No warnings or exceptions are issued in case clipping results in a smaller or an empty block.
CreateImage(Int32, Int32, ColorUint)
Creates an image and fills it with the given color.
Declaration
public static ImageData CreateImage(int width, int height, ColorUint color)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The width (in pixels) of the image to create. |
System.Int32 | height | The height (in pixels) of the image to create. |
ColorUint | color | The color to fill the image with. |
Returns
Type | Description |
---|---|
ImageData | The newly created image. |
ScanLines(Int32, Int32, Int32, Int32)
Retrieve a rectangular block from this image that is represented by horizontal ScanLines from top to bottom along width and height, beginning at offsets xSrc and ySrc.
Declaration
public IEnumerator<ScanLine> ScanLines(int xSrc = 0, int ySrc = 0, int width = 0, int height = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | xSrc | x offset in pixels. |
System.Int32 | ySrc | y offset in pixels. |
System.Int32 | width | width of ScanLines in pixels. |
System.Int32 | height | Height describes how many ScanLines will be returned. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<ScanLine> | Returns a rectangular block of horizontal ScanLine instances. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException |