An idea inspired by the cleanup readme
// Load with base image from URL
Caman.fromURL('/images/test.jpg')// Initialize with a blank white canvasCaman.blank({width: 200, height: 200}).then(function (caman) {});// Initialize from an img DOM nodeCaman.fromImage(image).then(function (caman) {});// Initialize from another canvasCaman.fromCanvas(canvas).then(function (caman) {});
Suggest:
// Load base image from URL
Caman.from(string url);
// Find a canvas or image in the existing DOM, by selector
Caman.from(string selector);
// From an existing canvas node
Caman.from(object canvas node);
// From an existing image node
Caman.from(object image node);
// Create a blank caman canvase from an object containing width/height
// maybe other initialization parameters?
Caman.from(object dimensions);
Purely because it's easy to remember.
All of them return a Promise, resolved with the same caman object shown in the cleanup readme
Yeah... it could be done this way. I dunno, I was enjoying being explicit with the initialization. Maybe it's something that could be offered in addition to all of the explicit ones.