Class MetaImage
Managed facade over SDK meta images that own a native handle and expose EXIF, bitmap, and rendering metadata. Use the provided factory helpers to create instances and always dispose when you finish with the native buffer.
Namespace: ImageSdkWrapper Assembly: ImageSdkWrapper.MAUI
Inheritance: object
public class MetaImage : IDisposable, IEquatable<MetaImage>
Constructor
MetaImage()
Creates an empty meta image without an associated bitmap. Use Bitmap or SetInstance(nint) to populate later.
public MetaImage()
MetaImage(MetaImage)
Creates a deep copy of the provided meta image by duplicating the native instance.
public MetaImage(MetaImage source)
Parameters
source(MetaImage): Source instance to duplicate.
MetaImage(object)
Creates a meta image backed by the provided platform bitmap.
public MetaImage(object bitmap)
Parameters
bitmap(object): Platform bitmap object provided by the hosting framework.
MetaImage(object, object, string)
Creates a meta image from a bitmap using platform-specific context and metadata path (Android overload).
public MetaImage(object bitmap, object AndroidContext, string metadataUri)
Parameters
bitmap(object): Platform bitmap object.AndroidContext(object): Android context required for EXIF parsing.metadataUri(string): Optional metadata file path.
MetaImage(object, string)
Creates a meta image from a bitmap and optionally loads EXIF metadata from the supplied URI.
public MetaImage(object bitmap, string metadataUri)
Parameters
bitmap(object): Platform bitmap object.metadataUri(string): File path to read EXIF metadata from.
Field
Color1Bit
Constant representing a one-bit colour hint.
public const int Color1Bit = 1
Returns
- int
ColorMono
Constant representing a monochrome colour hint.
public const int ColorMono = 2
Returns
- int
ColorRgba
Constant representing an RGBA colour hint.
public const int ColorRgba = 3
Returns
- int
ColorUndefined
Constant representing an undefined colour hint.
public const int ColorUndefined = 0
Returns
- int
ExifFlipHorizontal
EXIF orientation value indicating horizontal flip.
public const int ExifFlipHorizontal = 2
Returns
- int
ExifFlipVertical
EXIF orientation value indicating vertical flip.
public const int ExifFlipVertical = 4
Returns
- int
ExifInvalid
EXIF orientation value indicating invalid orientation.
public const int ExifInvalid = -1
Returns
- int
ExifNormal
EXIF orientation value indicating normal orientation.
public const int ExifNormal = 1
Returns
- int
ExifRotate180
EXIF orientation value indicating 180-degree rotation.
public const int ExifRotate180 = 3
Returns
- int
ExifRotate270
EXIF orientation value indicating 270-degree rotation.
public const int ExifRotate270 = 8
Returns
- int
ExifRotate90
EXIF orientation value indicating 90-degree rotation.
public const int ExifRotate90 = 6
Returns
- int
ExifTranspose
EXIF orientation value indicating transpose.
public const int ExifTranspose = 5
Returns
- int
ExifTransverse
EXIF orientation value indicating transverse orientation.
public const int ExifTransverse = 7
Returns
- int
ExifUndefined
EXIF orientation value indicating undefined orientation.
public const int ExifUndefined = 0
Returns
- int
_Instance
Backing field for the native meta image handle.
protected nint _Instance
Returns
- IntPtr
Method
Dispose()
Releases the native handle and associated buffers. Multiple invocations are safe.
public void Dispose()
EnsureBitmapMutable()
Legacy helper retained for API compatibility; no longer required.
[Obsolete("Deprecated")]
public void EnsureBitmapMutable()
Equals(MetaImage)
Determines whether the current instance references the same native handle as another meta image.
public bool Equals(MetaImage other)
Parameters
other(MetaImage): Other instance to compare.
Returns
- bool
FromStream(Stream, string)
Creates a meta image by reading encoded data from the provided stream and optional metadata cache.
public static MetaImage FromStream(Stream stream, string metaDataPath = "")
Parameters
stream(Stream): Encoded image data stream.metaDataPath(string): Optional path to associated metadata.
Returns
- MetaImage
GetBitmap()
Converts the internal representation to a platform bitmap owned by the caller.
public object GetBitmap()
Returns
- object: A framework bitmap or
nullif conversion fails.
RecycleBitmap()
Releases the bitmap buffer and disposes the current instance, mirroring the behaviour of the Java implementation.
public void RecycleBitmap()
SafeGetBitmap(MetaImage)
Safely converts the provided meta image to a bitmap, returning null when the instance is absent.
public static object SafeGetBitmap(MetaImage img)
Parameters
img(MetaImage): Meta image to convert ornull.
Returns
- object
SafeRecycleBitmap(MetaImage, MetaImage)
Disposes the given source only if it does not reference the same native handle as origin.
public static void SafeRecycleBitmap(MetaImage source, MetaImage origin)
Parameters
source(MetaImage): Instance to dispose.origin(MetaImage): Reference instance allowed to keep its handle.
SetInstance(nint)
Replaces the current native handle with the provided one, disposing any existing handle first.
public void SetInstance(nint h)
Parameters
h(IntPtr): New native handle.
ToStream()
Serialises the current bitmap to an encoded stream understood by the SDK.
public Stream ToStream()
Returns
- Stream: A memory stream containing the encoded image, or
nullif the export failed.
Property
Bitmap
Gets or sets the backing bitmap via the platform helper.
public object Bitmap { get; set; }
Returns
- object
BitmapBounds
Gets the bitmap bounds reported by the native handle.
public PxlPoint BitmapBounds { get; }
Returns
- PxlPoint
ColorHint
Gets or sets the color hint used for subsequent processing of the image buffer.
public MetaImage.EColorHint ColorHint { get; set; }
Returns
- EColorHint
Device
Gets or sets the originating device class.
public MetaImage.EDevicePlatform Device { get; set; }
Returns
- EDevicePlatform
ExifOrientation
Gets or sets the EXIF orientation applied to the image.
public MetaImage.EOrienation ExifOrientation { get; set; }
Returns
- EOrienation
Flash
Gets or sets the flash state recorded for the capture.
public MetaImage.FlashMode Flash { get; set; }
Returns
- FlashMode
Handle
Gets the native handle used by the underlying SDK. Consumers should treat the pointer as opaque.
public nint Handle { get; }
Returns
- IntPtr
Iso
Gets or sets the ISO metadata associated with the capture.
public int Iso { get; set; }
Returns
- int
MetadataUri
Gets or sets the optional URI pointing to metadata associated with the image on disk.
public string MetadataUri { get; set; }
Returns
- string
PageNumber
Gets or sets the logical page number associated with the image.
public int PageNumber { get; set; }
Returns
- int
StrongShadows
Gets or sets whether the image contains strong shadows that influence processing presets.
public bool StrongShadows { get; set; }
Returns
- bool