nitro-renderer/src/nitro/room/ImageResult.ts

19 lines
424 B
TypeScript
Raw Normal View History

2021-08-03 05:50:15 +02:00
import { RenderTexture } from '@pixi/core';
2022-10-30 05:02:19 +01:00
import { TextureUtils } from '../../pixi-proxy';
2021-03-17 03:02:09 +01:00
export class ImageResult
{
2022-03-03 01:21:30 +01:00
public id: number = 0;
public data: RenderTexture = null;
public image: HTMLImageElement = null;
2021-03-17 03:02:09 +01:00
public getImage(): HTMLImageElement
{
2022-10-30 05:02:19 +01:00
if (this.image) return this.image;
2021-03-17 03:02:09 +01:00
2022-10-30 05:02:19 +01:00
if (!this.data) return null;
2021-03-17 03:02:09 +01:00
return TextureUtils.generateImage(this.data);
}
2021-08-03 05:50:15 +02:00
}