mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Remove unnecessary rendering
This commit is contained in:
parent
f0f79754f1
commit
bb7d5c862f
@ -134,6 +134,11 @@
|
||||
return pskl.utils.FrameUtils.createFromImage(resizedImage);
|
||||
},
|
||||
|
||||
createFromCanvas : function (canvas, x, y, w, h, preserveOpacity) {
|
||||
var imgData = canvas.getContext('2d').getImageData(x, y, w, h).data;
|
||||
return pskl.utils.FrameUtils.createFromImageData_(imgData, w, h, preserveOpacity);
|
||||
},
|
||||
|
||||
/*
|
||||
* Create a pskl.model.Frame from an Image object. By default transparent
|
||||
* pixels will be converted to completely opaque or completely transparent
|
||||
|
@ -24,7 +24,7 @@
|
||||
for (var i = 0 ; i < frameCount ; i++) {
|
||||
context.clearRect(0, 0 , frameWidth, height);
|
||||
context.drawImage(image, frameWidth * i, 0, frameWidth, height, 0, 0, frameWidth, height);
|
||||
var frame = pskl.utils.FrameUtils.createFromImage(canvas);
|
||||
var frame = pskl.utils.FrameUtils.createFromCanvas(canvas, 0, 0, frameWidth, height);
|
||||
frames.push(frame);
|
||||
}
|
||||
return frames;
|
||||
|
Loading…
Reference in New Issue
Block a user