addRegion method

void addRegion(
  1. String? name,
  2. GRect region, [
  3. GRect? frame,
  4. bool rotated = false,
])

Adds a new sub-texture region to the atlas using the provided name, region and optional frame and rotation values.

The name parameter is a String representing the name of the sub-texture region.

The region parameter is a GRect object representing the rectangular region of the sub-texture in the atlas texture.

The frame parameter is an optional GRect object representing the rectangular region of the sub-texture frame, which is the area of the texture used in rendering. If not provided, the entire region area will be used as the frame.

The rotated parameter is an optional boolean value representing whether the sub-texture region should be rotated. If set to true, the sub-texture will be rendered at a 90-degree angle from its original orientation.

Implementation

void addRegion(
  String? name,
  GRect region, [
  GRect? frame,
  bool rotated = false,
]) {
  addSubTexture(
      name,
      GSubTexture(
        _atlasTexture!,
        region: region,
        frame: frame,
        rotated: rotated,
      ));
}