6528c7724b
!! NOT STABLE !! Initial implementation. No UI update yet. Check js/model/Piskel.js and js/model/Layer.js for an overview of the new API. Piskels can be saved on the existing service. Previous piskels cannot be loaded. This should be fixed soon.
22 lines
No EOL
573 B
JavaScript
22 lines
No EOL
573 B
JavaScript
(function () {
|
|
var ns = $.namespace('pskl.utils');
|
|
|
|
ns.FrameUtils = {
|
|
merge : function (frames) {
|
|
var merged = frames[0].clone();
|
|
var w = merged.getWidth(), h = merged.getHeight();
|
|
for (var i = 1 ; i < frames.length ; i++) {
|
|
pskl.utils.FrameUtils.mergeFrames_(merged, frames[i]);
|
|
}
|
|
return merged;
|
|
},
|
|
|
|
mergeFrames_ : function (frameA, frameB) {
|
|
frameB.forEachPixel(function (p, col, row) {
|
|
if (p != Constants.TRANSPARENT_COLOR) {
|
|
frameA.setPixel(col, row, p);
|
|
}
|
|
});
|
|
}
|
|
};
|
|
})(); |