Add adjustment filter

This commit is contained in:
Bill 2021-12-08 21:19:37 -05:00
parent 3346723e69
commit dcafaca1d4
2 changed files with 10 additions and 2 deletions

View File

@ -391,7 +391,14 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
partCount--; partCount--;
} }
if(this._avatarSpriteData && this._avatarSpriteData.paletteIsGrayscale) this.convertToGrayscale(container); if(this._avatarSpriteData)
{
if(!container.filters) container.filters = [];
if(this._avatarSpriteData.colorTransform) container.filters.push(this._avatarSpriteData.colorTransform);
if(this._avatarSpriteData.paletteIsGrayscale) this.convertToGrayscale(container);
}
if(!cache) if(!cache)
{ {
@ -1019,7 +1026,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
colorFilter.matrix = [_local_3, _local_4, _local_5, 0, 0, _local_3, _local_4, _local_5, 0, 0, _local_3, _local_4, _local_5, 0, 0, 0, 0, 0, 1, 0]; colorFilter.matrix = [_local_3, _local_4, _local_5, 0, 0, _local_3, _local_4, _local_5, 0, 0, _local_3, _local_4, _local_5, 0, 0, 0, 0, 0, 1, 0];
container.filters = [ colorFilter ]; container.filters.push(colorFilter);
return container; return container;
} }

View File

@ -48,6 +48,7 @@ export class AvatarDataContainer implements IAvatarDataContainer
this._paletteIsGrayscale = false; this._paletteIsGrayscale = false;
} }
this._colorTransform = new AdjustmentFilter({ red: (this._r / 255), green: (this._g / 255), blue: (this._b / 255), alpha: this._alphaMultiplier });
this._colorMap = this.generatePaletteMapForGrayscale(this._backGround, this._foreGround); this._colorMap = this.generatePaletteMapForGrayscale(this._backGround, this._foreGround);
} }