pixels-hx v0.0.3
hxPixels
An hxperimental (cross-target/cross-lib) Pixels abstract, in Haxe 3.1+
Simple interface to access/manipulate pixel values among different targets and libs, having a way to get/set individual pixels (or bytes), and be able to apply them back to the original source (taking care of framework-specific details under the hood).
API
For the supported libs the following methods are implemented (note that all color values are in ARGB format):
get/setPixel32(): get/set pixel value (with alpha) atx,yget/setPixel(): get/set pixel value (without alpha) atx,yget/setByte(): get/set byte value aticlone(): make a duplicate of thePixelsinstancefillRect(): fill a rect area with pixel value (with alpha)bytes: access to the raw underlying bytes (in source-specific format)format: change internal color mapping
Supported classes/libs
BitmapData: flash, openfl and nme (andapplyToBitmapData()for flambe+flash)Texture: for flambe (applyToFlambeTexture()only for html, due to limitations imposed by Stage3d)BufferedImage: for javaImageData: for plain jsTextureandAssetImage: for snow/luxe
Implementation
Pixels is an abstract over haxe.io.Bytes. It stores the raw bytes in the underlying bytes var (in source-specific color format), auto-converting to ARGB when using get/set methods (see other branches for the inverse approach).
Usage
See the src folder for examples on how to use it, and file issues if you have problems or spot a bug.