Cuts a new RenderTextureQuad out of this RenderTextureQuad. The offset
of the new 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.
Source
RenderTextureQuad cut(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(); var sourceRectangle = new Rectangle<int>(rL, rT, rR - rL, rB - rT); var offsetRectangle = new Rectangle<int>(0, 0, rR - rL, rB - rT); return new RenderTextureQuad.slice(this, sourceRectangle, offsetRectangle); }