Merge base/text layers

This commit is contained in:
Florrie 2018-01-23 12:03:39 -04:00
parent 430dbf0bd6
commit 78c54852c6
No known key found for this signature in database
GPG key ID: E2877D259442CB08

View file

@ -169,9 +169,15 @@ const loadOldTextCostume = function(baseMD5ext, textMD5ext, costume, runtime) {
)).then(imageElements => {
const [baseImageElement, textImageElement] = imageElements;
// @todo flatten the base and text images. The renderer should probably do the image processing that'll be needed here.
// The text part is currently displayed only for debugging.
costume.skinId = runtime.renderer.createBitmapSkin(textImageElement, costume.bitmapResolution, rotationCenter);
const canvas = document.createElement('canvas');
canvas.width = baseImageElement.width;
canvas.height = baseImageElement.height;
const ctx = canvas.getContext('2d')
ctx.drawImage(baseImageElement, 0, 0);
ctx.drawImage(textImageElement, 0, 0);
costume.skinId = runtime.renderer.createBitmapSkin(canvas, costume.bitmapResolution, rotationCenter);
return costume;
});