createImageTextureSync method

GTexture createImageTextureSync([
  1. bool adjustOffset = true,
  2. double resolution = 1,
  3. GRect? rect
])

Creates a texture from the synchronous image generated from this display object.

adjustOffset determines whether to adjust the offset of the generated image to the top-left corner of the display object's bounds. If true, the pivot point of the generated texture will be set to (bounds.x, bounds.y). Defaults to true. resolution determines the resolution of the generated image. Defaults to 1. rect determines the bounds of the image to generate. Defaults to null, which means that the method will use the filter bounds of the display object. Returns a GTexture instance.

Implementation

GTexture createImageTextureSync([
  bool adjustOffset = true,
  double resolution = 1,
  GRect? rect,
]) {
  final img = createImageSync(adjustOffset, resolution, rect);
  var tx = GTexture.fromImage(img, resolution);
  tx.pivotX = bounds!.x;
  tx.pivotY = bounds!.y;
  return tx;
}