diff --git a/packages/graphics/src/image.js b/packages/graphics/src/image.js index 9461379..9438ee8 100644 --- a/packages/graphics/src/image.js +++ b/packages/graphics/src/image.js @@ -20,6 +20,7 @@ export default class Image extends Resource { isFake: true, width: 0, }; + this.uri = ''; } // @todo Implement refcount with PIXI cache and we can do this. @@ -40,6 +41,7 @@ export default class Image extends Resource { } async load(buffer, uri) { + this.uri = uri; if (buffer) { if ('web' !== process.env.FLECKS_CORE_BUILD_TARGET) { const {height, width} = imageSize(Buffer.from(buffer)); @@ -111,6 +113,10 @@ export default class Image extends Resource { return [this.width, this.height]; } + get src() { + return this.texture?.baseTexture.resource.source.src || this.uri; + } + subimage(rectangle) { const subimage = new Image(); if (this.texture.isFake) {