SAFR Windows SDK
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties Events
RealNetworks.CameraKit.ImageMapper Class Reference

An image mapper allows you to efficiently gain read-only access to the pixels of an image. It works with bitmap and texture backed images. More...

Inheritance diagram for RealNetworks.CameraKit.ImageMapper:

Public Member Functions

delegate void Callback (ImageMapping mapping)
 Image mapping callback. This callback is invoked with the mapped image pixels. More...
 
 ImageMapper ()
 Creates an image mapper instance. More...
 
void Dispose ()
 
void Dispose (bool fromIDisposable)
 
void CopyTo (Image image, WriteableBitmap bitmap)
 Copies the pixel from the given image into the given writable bitmap. More...
 
void CopyFrom (byte[] pixels, int width, int height, int bytesPerRow, PixelFormat pixelFormat, Image image)
 Copies pixels from the given byte array into an image. The image and the pixels in the byte array must have the same width and height. More...
 
void CopyFrom (IntPtr pixels, int width, int height, int bytesPerRow, PixelFormat pixelFormat, Image image)
 Copies pixels from the given IntPtr into an image. The image and the pixels in the byte array must have the same width and height. More...
 
void Map (Image image, ImageAccess mode, Callback callback)
 Makes the pixels of the given image available to the given closure. This function takes care of downloading / upload the image pixels if the image is backed by a texture. More...
 
void Map (Image image, ImageMapping.Target target, ImageAccess mode, Callback callback)
 Same as plain Map() but allows you to map to either a CPU-based bitmap or a CUDA-based unified memory texture. More...
 

Detailed Description

An image mapper allows you to efficiently gain read-only access to the pixels of an image. It works with bitmap and texture backed images.

Constructor & Destructor Documentation

◆ ImageMapper()

RealNetworks.CameraKit.ImageMapper.ImageMapper ( )

Creates an image mapper instance.

Member Function Documentation

◆ Callback()

delegate void RealNetworks.CameraKit.ImageMapper.Callback ( ImageMapping  mapping)

Image mapping callback. This callback is invoked with the mapped image pixels.

Parameters
mappinginformation about the mapped image pixels

◆ CopyFrom() [1/2]

void RealNetworks.CameraKit.ImageMapper.CopyFrom ( byte[]  pixels,
int  width,
int  height,
int  bytesPerRow,
PixelFormat  pixelFormat,
Image  image 
)

Copies pixels from the given byte array into an image. The image and the pixels in the byte array must have the same width and height.

Parameters
pixelsbyte array with the pixels
widthwidth of a row
heightheight of the bitmap
bytesPerRowbytes per row
pixelFormatthe pixel format
imagethe image

◆ CopyFrom() [2/2]

void RealNetworks.CameraKit.ImageMapper.CopyFrom ( IntPtr  pixels,
int  width,
int  height,
int  bytesPerRow,
PixelFormat  pixelFormat,
Image  image 
)

Copies pixels from the given IntPtr into an image. The image and the pixels in the byte array must have the same width and height.

Parameters
pixelsIntPtr pointing to the pixels
widthwidth of a row
heightheight of the bitmap
bytesPerRowbytes per row
pixelFormatthe pixel format
imagethe image

◆ CopyTo()

void RealNetworks.CameraKit.ImageMapper.CopyTo ( Image  image,
WriteableBitmap  bitmap 
)

Copies the pixel from the given image into the given writable bitmap.

Parameters
imagethe image
bitmapthe bitmap

◆ Dispose() [1/2]

void RealNetworks.CameraKit.ImageMapper.Dispose ( )

◆ Dispose() [2/2]

void RealNetworks.CameraKit.ImageMapper.Dispose ( bool  fromIDisposable)

◆ Map() [1/2]

void RealNetworks.CameraKit.ImageMapper.Map ( Image  image,
ImageAccess  mode,
Callback  callback 
)

Makes the pixels of the given image available to the given closure. This function takes care of downloading / upload the image pixels if the image is backed by a texture.

Parameters
imagethe image
modethe CPU access mode
callbackthe closure that receives the image mapping

◆ Map() [2/2]

void RealNetworks.CameraKit.ImageMapper.Map ( Image  image,
ImageMapping.Target  target,
ImageAccess  mode,
Callback  callback 
)

Same as plain Map() but allows you to map to either a CPU-based bitmap or a CUDA-based unified memory texture.

Parameters
imagethe image
targetspecifies whether to map to a CPU bitmap or a CUDA texture
modethe CPU access mode
callbackthe closure that receives the image mapping