phaser/v3/src/gameobjects/image/ImageCanvasRenderer.js

22 lines
569 B
JavaScript
Raw Normal View History

2017-01-12 17:11:58 +00:00
var ImageCanvasRenderer = function (renderer, src, interpolationPercentage)
{
var frame = src.frame;
var alpha = src.color.worldAlpha * 255 << 24;
// Skip rendering?
if (src.skipRender || !src.visible || alpha === 0 || !frame.cutWidth || !frame.cutHeight)
{
return;
}
var data = src.transform.getCanvasTransformData(interpolationPercentage, renderer);
2017-01-12 17:11:58 +00:00
var tint = src.color._glTint;
var bg = src.color._glBg;
renderer.drawImage(frame, src.blendMode, data, alpha, tint, bg);
2017-01-12 17:11:58 +00:00
};
module.exports = ImageCanvasRenderer;