createImageTexture method
Creates a new GTexture
asynchronously from the display object's image.
The image is retrieved using the createImage method, and a new texture
is created from the image with the specified resolution.
If a rect
is specified, only the portion of the image within the bounds
of the rectangle will be used to create the texture.
If adjustOffset
is true, the image will be adjusted to remove any
offsets from the top left corner.
Implementation
Future<GTexture> createImageTexture([
bool adjustOffset = true,
double resolution = 1,
GRect? rect,
]) async {
final img = await createImage(adjustOffset, resolution, rect);
var tx = GTexture.fromImage(img, resolution);
tx.pivotX = bounds!.x;
tx.pivotY = bounds!.y;
return tx;
}