renderRotated method
void
renderRotated({})
Implementation
void renderRotated({
required double srcX,
required double srcY,
required double srcWidth,
required double srcHeight,
required double dstX,
required double dstY,
required double rotation,
double anchorX = 0.5,
double anchorY = 0.5,
double scale = 1.0,
int color = 1,
}){
final scos = cos(rotation) * scale;
final ssin = sin(rotation) * scale;
final width = -scos * anchorX + ssin * anchorY;
final height = -ssin * anchorX - scos * anchorY;
final tx = dstX + width;
final ty = dstY + height;
final scaledHeight = srcHeight * scale * anchorY;
final scaledWidth = srcWidth * scale * anchorX;
const piHalf = pi * 0.5;
final adjX = _adj(rotation - piHalf, scaledHeight);
final adjY = _opp(rotation - piHalf, scaledHeight);
final adjY2 = _adj(rotation - piHalf, scaledWidth);
final adjX2 = _opp(rotation - piHalf, scaledWidth);
render(
color: color,
srcX: srcX,
srcY: srcY,
srcWidth: srcWidth,
srcHeight: srcHeight,
scale: cos(rotation) * scale,
rotation: sin(rotation) * scale,
dstX: tx + adjX2 + adjX,
dstY: ty - adjY2 + adjY,
);
}