The ZIM version of CreateJS has been updated to 1.5.0. This now includes the BitmapData class from Flash ported here:
https://github.com/u-kudox/BitmapData_for_EaselJS
with examples here:
https://github.com/u-kudox/BitmapData_for_EaselJS/tree/master/examples
and docs here:
https://airsdk.dev/reference/actionscript/3.0/
Look up BitmapData under All Classes. Press the properties and methods to see examples of each.
The basics have been added to the ZIM Docs as well under CODE and then a new subcategory of CREATEJS CLASSES.
https://zimjs.com/docs.html?item=BitmapData
// here is coloring a tile
// cache the tile to get a cacheCanvas for the BitmapData
STYLE = {color:white, borderColor:black, borderWidth:3, backdropColor:white, backdropPadding:20};
const tile = new Tile([new Circle(50), new Rectangle(100,100)],5,4,20,20).cache();
// Create a new createjs.BitmapData - needs a canvas
const bitmapData = new createjs.BitmapData(tile.cacheCanvas);
// Just a normal ZIM ColorPicker
STYLE = {shadowColor:-1};
const picker = new ColorPicker(250, [red,orange,green,yellow], 4)
.pos(0,30,CENTER,BOTTOM);
// Make a Bitmap to show the bitmapData.canvas
const bitmap = new Bitmap(bitmapData.canvas).center().cur();
bitmap.on("mousedown", ()=>{
// convert our mouse point to a point on the bitmap
const point = bitmap.globalToLocal(F.mouseX, F.mouseY);
// avoid pressing on a dark color
const currentColor = bitmapData.getPixel(point.x, point.y);
if (currentColor<convertColor(dark, "hexnumber")) return;
// get the colorPicker color as hexstring - needed for floodFill
const newColor = convertColor(picker.selectedColor, 'hexstring');
// do a floodFill from the point with the new color
bitmapData.floodFill(point.x, point.y, newColor);
S.update();
});
There are some other goodies in the BitmapData class including putting a rectangle around a color, palette options, etc. Actually, u-kudox (u-kudox) · GitHub has ported other Flash classes too including a couple 3D matrix and vector classes. Check the examples section of each of the repositories. I did not see anything beyond data examples - in the console - but it would be neat to see if these lead to 3D support - like P5js has.