renderSprite method
void
renderSprite(
- dynamic v1,
- dynamic element,
- Material material
Implementation
void renderSprite(RenderableSprite v1, RenderableSprite element, Material material) {
double scaleX = element.scale.x * widthHalf;
double scaleY = element.scale.y * heightHalf;
if (material is PointsMaterial) {
scaleX *= material.size!;
scaleY *= material.size!;
}
String path = 'M${convert(v1.x - scaleX * 0.5)},'
'${convert(v1.y - scaleY * 0.5)}h'
'${convert(scaleX)}v'
'${convert(scaleY)}h'
'${convert(-scaleX)}z';
String style = '';
if (material is SpriteMaterial || material is PointsMaterial) {
style = 'fill:${material.color.getStyle()};fill-opacity:${material.opacity}';
}
addPath(style, path);
}