RenderTextureQuad clip(Rectangle<num> rectangle)

Clips a new RenderTextureQuad from this RenderTextureQuad. The offset of the new RenderTextureQuad will be adjusted to match the origin of this RenderTextureQuad.

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.

Source

RenderTextureQuad clip(Rectangle<num> rectangle) {
  int rL = (rectangle.left * pixelRatio).round();
  int rT = (rectangle.top * pixelRatio).round();
  int rR = (rectangle.right * pixelRatio).round();
  int rB = (rectangle.bottom * pixelRatio).round();
  int ow = this.offsetRectangle.width;
  int oh = this.offsetRectangle.height;
  var sourceRectangle = new Rectangle<int>(rL, rT, rR - rL, rB - rT);
  var offsetRectangle = new Rectangle<int>(0 - rL, 0 - rT, ow, oh);
  return new RenderTextureQuad.slice(this, sourceRectangle, offsetRectangle);
}