cut method
Cuts a RenderTextureQuad out of this RenderTextureQuad. The offset
of the RenderTextureQuad will be adjusted to match the origin of
the rectangle
.
The rectangle
is in target coordinates. Those coordinates take the
pixelRatio into account. Please read more about HiDpi textures to
learn more about this topic.
Implementation
RenderTextureQuad cut(Rectangle<num> rectangle) {
final rL = (rectangle.left * pixelRatio).round();
final rT = (rectangle.top * pixelRatio).round();
final rR = (rectangle.right * pixelRatio).round();
final rB = (rectangle.bottom * pixelRatio).round();
final sourceRectangle = Rectangle<int>(rL, rT, rR - rL, rB - rT);
final offsetRectangle = Rectangle<int>(0, 0, rR - rL, rB - rT);
return RenderTextureQuad.slice(this, sourceRectangle, offsetRectangle);
}