Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function swapColor(colorToSwap:uint,newColor:uint):void{
- if(this._palette.indexOf(newColor) != -1){return;}
- for(var x:int=0;x<this._source.width;x++){
- for(var y:int=0;y<this._source.height;y++){
- if(this._source.getPixel(x,y) == colorToSwap){
- this._source.setPixel(x,y,newColor);
- var index:int = this._palette.indexOf(colorToSwap);
- if(index != -1){
- this._palette[index] = newColor;
- }
- }
- }
- }
- this.updateBuffer();
- }
Add Comment
Please, Sign In to add comment