/* {"description" : "This API supports common transform functions for images." } */
uses media.PixelMap
uses media.PixelMapYUV
data ChromaKeySpec {
byte r
byte g
byte b
byte fgTolerance
byte bgTolerance
}
interface ImageTransform {
ImageTransform(WH outputSize)
/* {"@description" : "Convert an RGBA image to YUV." } */
PixelMapYUV rgbaToYUV(PixelMap p, opt byte pixelFormat)
/* {"@description" : "Convert a YUV image to RGBA." } */
PixelMap yuvToRGBA(PixelMapYUV p, opt ChromaKeySpec spec)
/* {"@description" : "Crop an image, by identifying a rectangle within that image. The identified rectangle is extracted as a new image and returned." } */
PixelMap crop(PixelMap p, int x, int y)
/* {"@description" : "Set pixels matching the given colour to be transparent." } */
PixelMap chromaKey(PixelMap p, ChromaKeySpec spec, opt byte pixelFormat)
/* {"@description" : "Apply a run-length-encoded mask to the pixels." } */
PixelMap runAlphaMask(PixelMap p, byte mask[], opt byte pixelFormat)
}To propose a new revision to this entity, use dana source put -ut your/new/version.dn -n media.image.ImageTransform -m "reason for update" -u yourUsername
Version 4 (this version) by barry
Notes for this version: Improves performance by pre-allocating a storage area for return values, adds a run-length alpha mask function