Texture.fromImage constructor

Texture.fromImage(
  1. Image image, {
  2. Vector2? position,
  3. Vector2? size,
  4. Vector2? trimOffset,
  5. Vector2? trimSize,
})

Implementation

Texture.fromImage(
  this.image, {
  Vector2? position,
  Vector2? size,
  Vector2? trimOffset,
  Vector2? trimSize,
}) {
  this.position = position ?? Vector2.zero();
  this.size = size ??
      Vector2(
        image.width.toDouble(),
        image.height.toDouble(),
      );
  this.trimOffset = trimOffset ?? Vector2.zero();
  this.trimSize = trimSize ??
      size ??
      Vector2(
        image.width.toDouble(),
        image.height.toDouble(),
      );
}