HomeForumSourceResearchGuide
Sign in to contribute to source. how it works
Type definition file media.image.ImageTransform by barry
expand copy to clipboardexpand
uses media.PixelMap
uses media.PixelMapYUV

/* {"description" : "A data type used to specify a chroma key." } */
data ChromaKeySpec {
	/* {"@description" : "The red value (between 0 and 255) of the pixels to convert to transparent." } */
	byte r
	/* {"@description" : "The green value (between 0 and 255) of the pixels to convert to transparent." } */
	byte g
	/* {"@description" : "The blue value (between 0 and 255) of the pixels to convert to transparent." } */
	byte b
	/* {"@description" : "The tolerance level for determining foreground (things not to make transparent)." } */
	byte fgTolerance
	/* {"@description" : "The tolerance level for determining background (things to make transparent)." } */
	byte bgTolerance
}

/* {"description" : "This API supports common transform functions for images." } */
interface ImageTransform {

	/* {"@description" : "Create a new image transform instance. This instance will only be capable of outputting pixel maps of the given size." } */
	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)

	}
Revision history
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 5 (this version) by barry
Notes for this version: Updates documentation strings.
Version 4 by barry
Version 3 by barry
Version 2 by barry
Version 1 by barry