render method

  1. @override
void render(
  1. Canvas? canvas, [
  2. Paint? paint
])
override

(Internal usage)

Renders the texture in the given canvas using the optional paint. By default, the texture is rendered with the GTexture.$defaultPaint, which can be modified by passing a different Paint instance.

If the texture is rotated, the sourceRegion is swapped for rendering.

Implementation

@override
void render(ui.Canvas? canvas, [ui.Paint? paint]) {
  paint ??= GTexture.$defaultPaint;
  paint.isAntiAlias = true;
  canvas!.drawImageRect(root!, _sourceRegionRect, _destRect, paint);
//    final sub = texture as GSubTexture;
//    final dest = Rect.fromLTWH(
//      0,
//      0,
//      sub.region.width / texture.scale,
//      sub.region.height / texture.scale,
//    );
//    $canvas.drawImageRect(
//      sub.root,
//      sub.region.toNative(),
//      dest,
//      _paint,
//    );
}