Click or drag to resize
Ab4d.SharpEngine logo

RawImageData Class

RawImageData class contains image metadata and raw image data that is stored in the Data byte array.
Inheritance Hierarchy
SystemObject
  Ab4d.SharpEngine.CommonRawImageData

Namespace: Ab4d.SharpEngine.Common
Assembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 2.0.8956+4c7684e186ca1be74e7a284fbe739d9a1b843d3c
Syntax
C#
public class RawImageData

The RawImageData type exposes the following members.

Constructors
 NameDescription
Public methodRawImageData Constructor
Top
Properties
 NameDescription
Public propertyData Gets the byte array with image data.
Public propertyStatic memberEmpty Gets a RawImageData with empty Data array and Width and Height set to zero and Format set to Bgra.
Public propertyFormat Gets the image format. To change the format, call the ChangeFormat(Format) method.
Public propertyHasTransparentPixels Nullable Boolean that can specify if the image data contains transparent pixels (alpha value is less then 1 for at least one pixel).
Public propertyHeight Gets the image height in pixels. To change the size, call the Resize(Int32, Int32, Int32, Int32, Boolean) method.
Public propertyIsPreMultipliedAlpha Nullable Boolean that can specify if the image data contains pre-multiplied alpha colors (colors are multiplied by alpha value).
Public propertyStatic memberOneBlackPixelImage Gets a static 1 x 1 bitmap data with one black pixel with alpha set to 1 and Format set to Bgra.
Public propertyStride Gets the image stride in bytes (length of one data row). To change the size, call the Resize(Int32, Int32, Int32, Int32, Boolean) method.
Public propertyWidth Gets the image width in pixels. To change the size, call the Resize(Int32, Int32, Int32, Int32, Boolean) method.
Top
Methods
 NameDescription
Public methodChangeFormat Changes the value of the Format property. This does not change the data.
Public methodCheckTransparency CheckTransparency method checks the data of the image for transparent pixels and returns true in case any transparent pixel is find. It also sets the HasTransparency property.
Public methodCheckTransparencyAndConvertToPremultipliedAlpha CheckTransparencyAndConvertToPremultipliedAlpha method converts the colors by multiplying the red, green and blue values by alpha value. This produces the pre-multiplied colors. The method also checks the data of the image for transparent pixels and returns true in case any transparent pixel is find. It also sets the HasTransparency property.
Public methodStatic memberCheckTransparentPixels CheckTransparentPixels returns true when the image data contains transparent pixels (where alpha is less the 1); for fully opaque image false is returned.
Public methodClone Returns a cloned RawImageData with copied data array.
Public methodConvertToPremultipliedAlpha ConvertToPremultipliedAlpha method converts the colors by multiplying the red, green and blue values by alpha value. This produces the pre-multiplied colors.
Public methodStatic memberGetBytesPerPixel Returns number of bytes that is required to store the specified format. The method can get results only for the following formats: R8G8B8A8Unorm, B8G8R8A8Unorm, R8G8B8Unorm, B8G8R8Unorm, R8Unorm. Other formats will throw an exception.
Public methodGetColor Returns the color as uint value at the specified position.
Public methodGetColor4 Returns the color as Color4 value at the specified position.
Public methodGetColor4Relative Returns the color as Color4 value at the specified relative position (x and y should be in range from 0 to 1).
Public methodGetColorRelative Returns the color as uint value at the specified relative position (x and y should be in range from 0 to 1).
Public methodStatic memberGetFormatProperties GetFormatProperties sets the hasAlpha, pixelSize and alphaOffset properties from the image format. The method returns false when the format is not known.
Public methodRemovePremultipliedAlpha RemovePremultipliedAlpha method converts pre-multiplied alpha colors to non-pre-multiplied colors. This is done when IsPreMultipliedAlpha is not false and when format is B8G8R8A8Unorm or R8G8B8A8Unorm. After that the IsPreMultipliedAlpha is set to false.
Public methodResize Creates a new Data array with new dataLength and updates the Width, Height and Stride properties (Format value is preserved).
Public methodSetColor Set the color at the specified position
Public methodSetColor4 Set the color at the specified position
Public methodSetColor4Relative Set the color at the specified relative position (x and y should be in range from 0 to 1).
Public methodSetColorRelative Set the color at the specified relative position (x and y should be in range from 0 to 1).
Public methodSwapRedAndBlueColors SwapRedAndBlueColors converts RGBA to BGRA and vice versa.
Top
See Also