Update IGetImageListener

This commit is contained in:
Bill 2025-01-14 18:50:09 -05:00
parent 8c370ca7da
commit feae4d4542
6 changed files with 19 additions and 8 deletions

View File

@ -1,7 +1,7 @@
import { Texture } from 'pixi.js'; import { IImageResult } from './IImageResult';
export interface IGetImageListener export interface IGetImageListener
{ {
imageReady(id: number, texture: Texture, image?: HTMLImageElement): void; imageReady(result: IImageResult): void;
imageFailed(id: number): void; imageFailed(id: number): void;
} }

View File

@ -0,0 +1,9 @@
export class ColorChannelType
{
public static CHANNELS_EQUAL: string = 'CHANNELS_EQUAL';
public static CHANNELS_UNIQUE: string = 'CHANNELS_UNIQUE';
public static CHANNELS_RED: string = 'CHANNELS_RED';
public static CHANNELS_GREEN: string = 'CHANNELS_GREEN';
public static CHANNELS_BLUE: string = 'CHANNELS_BLUE';
public static CHANNELS_DESATURATED: string = 'CHANNELS_DESATURATED';
}

View File

@ -1,3 +1,4 @@
export * from './ColorChannelType';
export * from './IAdvancedMap'; export * from './IAdvancedMap';
export * from './IBinaryReader'; export * from './IBinaryReader';
export * from './IBinaryWriter'; export * from './IBinaryWriter';

View File

@ -1,6 +1,5 @@
import { IAssetData, IAssetManager, IGraphicAsset, IGraphicAssetCollection } from '@nitrots/api'; import { IAssetData, IAssetManager, IGraphicAsset, IGraphicAssetCollection } from '@nitrots/api';
import { NitroBundle, NitroLogger } from '@nitrots/utils'; import { NitroBundle, NitroLogger } from '@nitrots/utils';
import '@pixi/gif';
import { Assets, Spritesheet, SpritesheetData, Texture } from 'pixi.js'; import { Assets, Spritesheet, SpritesheetData, Texture } from 'pixi.js';
import { GraphicAssetCollection } from './GraphicAssetCollection'; import { GraphicAssetCollection } from './GraphicAssetCollection';

View File

@ -4,9 +4,11 @@ import { Texture } from 'pixi.js';
export class ImageResult implements IImageResult export class ImageResult implements IImageResult
{ {
public id: number = 0; constructor(
public data: Texture = null; public id: number = 0,
public image: HTMLImageElement = null; public data: Texture = null,
public image: HTMLImageElement = null)
{}
public async getImage(): Promise<HTMLImageElement> public async getImage(): Promise<HTMLImageElement>
{ {

View File

@ -2519,7 +2519,7 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService
{ {
if(!listener) continue; if(!listener) continue;
listener.imageReady(id, null, image); listener.imageReady(new ImageResult(id, null, image));
} }
} }
} }
@ -2980,7 +2980,7 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService
{ {
if(!imageListener) continue; if(!imageListener) continue;
if(texture) imageListener.imageReady(objectId, texture); if(texture) imageListener.imageReady(new ImageResult(objectId, texture));
else imageListener.imageFailed(objectId); else imageListener.imageFailed(objectId);
} }
} }