mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2025-01-18 14:36:26 +01:00
Update IGetImageListener
This commit is contained in:
parent
8c370ca7da
commit
feae4d4542
@ -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;
|
||||||
}
|
}
|
||||||
|
9
packages/api/src/utils/ColorChannelType.ts
Normal file
9
packages/api/src/utils/ColorChannelType.ts
Normal 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';
|
||||||
|
}
|
@ -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';
|
||||||
|
@ -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';
|
||||||
|
|
||||||
|
@ -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>
|
||||||
{
|
{
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user