GSubTexture constructor

GSubTexture(
  1. GTexture parent, {
  2. GRect? region,
  3. bool ownsParent = false,
  4. GRect? frame,
  5. required bool rotated,
  6. double scaleModifier = 1,
})

Creates a new sub-texture from a parent texture.

The parent texture can be either a GTexture or another GSubTexture. The region defines the region of the parent texture that will be used for the sub-texture. The frame is an optional argument to specify the trimmed rectangle within the texture atlas, if not specified the sub-texture will use the same frame as the parent texture.

The rotated parameter indicates if the sub-texture is rotated 90 degrees clockwise (true) or not (false).

The scaleModifier argument allows to scale the sub-texture. This is useful for example to create high resolution textures, or to reduce the size of a texture for better performance.

Implementation

GSubTexture(
  GTexture parent, {
  GRect? region,
  bool ownsParent = false,
  GRect? frame,
  required bool rotated,
  double scaleModifier = 1,
}) {
  $setTo(
    parent,
    region: region,
    ownsParent: ownsParent,
    frame: frame,
    rotated: rotated,
    scaleModifier: scaleModifier,
  );
}