Engine.Filter = class
{
	getAddedWidth()
	{
		return 0;
	}

	getAddedHeight()
	{
		return 0;
	}

	static applyFiltersAndCache(baseDrawable /*Drawable*/, filters /*List<Filter>*/, baseName /*string*/)
	{
		
		// var name = "FilterGenerated" + (baseDrawable.graphic != null ? baseDrawable.graphic.name + baseDrawable.graphic.id : "");
		// if (baseName != null) name += baseName;
		
		// name += "SX" + baseDrawable.scale.x + "SY" + baseDrawable.scale.y;
		
		// var addedWidth = 0;
		// var addedHeight = 0;
		// for (var filter of filters)
		// {
		// 	addedWidth += filter.getAddedWidth();
		// 	addedHeight += filter.getAddedHeight();
		// 	name += "_" + filter.getName();
		// }
		
		// if it is already in the cache do not bother doing any more work
		// if (Engine.GraphicFactoryInstance.graphicDataByName.hasOwnProperty(name))
		// {
		// 	//Debug.Log("Graphic found " + name);
		// 	return name;
		// }
		// baseDrawable.layer = OrthoCamera.RenderToTextureLayer;
		// Drawable.Root.addChild(baseDrawable);
		
		// var addedX = addedWidth / 2;
		// var addedY = addedHeight / 2;
		
		// var drawableRect = baseDrawable.GetScaledBounds();
		// baseDrawable.x = addedX - drawableRect.xMin;
		// baseDrawable.y = addedY - drawableRect.yMin;
		// //baseDrawable.MatchToSprite();
		// Drawable.Root.SortUpdate(Drawable.MaxOrderRange);
		// Drawable.Root.UpdateTransformsForCache();
		
		// var size = 128;
		// /*
  //           while(size < drawableRect.width || size < drawableRect.height || size >= 1024)
		// {
		// 	var * = 2;
		// }
		// */

  //           //Render the texture
		// var texture = EngineSettings.Default2DCamera.RenderToTexture(1 << OrthoCamera.RenderToTextureLayer,size, size);
		
		// foreach (Filter filter in filters)
		// {
		// 	filter.ApplyFilter(texture);
		// }
		
		// var textureID = GraphicFactory.Instance.AddTextureToCache(texture);
		
		// var totalWidth = (int)(drawableRect.width + addedWidth);
		// var totalHeight = (int)(drawableRect.height + addedHeight);
		
		// //Rect pixelRect = new Rect(-((totalWidth) / 2) - drawableRect.xMin, -(totalHeight / 2) - drawableRect.yMin, totalWidth, totalHeight);
		// var pixelRect = new Rect(0,0, totalWidth, totalHeight);
		// var rect = new Rect(0,0, 0, 0);
		
		// //Convert to UV Coords
		// rect.x = pixelRect.x / texture.width;
		// rect.y = pixelRect.y / texture.height;
		// rect.width = pixelRect.width / texture.width;
		// rect.height = pixelRect.height / texture.height;
		
		// if (Utils.ShouldFlipTextureYCoords)
		// {
		// 	//Account for unity being backwards in the y tex coords
		// 	rect.y = 1.0 - rect.y;
			
		// 	// since the texture is upside down, we have to flip the rect
		// 	// NOTE: anybody reading this texture should be aware that the graphic inside pixelRect
		// 	// will be upside down too!
		// 	pixelRect.y = texture.height - pixelRect.y - 1 - pixelRect.height + 1;
		// }
		
		// var center = new Vector2(-drawableRect.xMin + addedX,-drawableRect.yMin + addedY);
		
		// var sequence = new SpriteSequenceDef();
		// sequence.AddFrame(center, rect, pixelRect, textureID);
		
		// var sequences = new List<SpriteSequenceDef>();
		// sequences.Add(sequence);
		
		// var filteredGraphic = new GraphicDef();
		// filteredGraphic.Loaded(sequences);
		
		// baseDrawable.Parent.removeChild(baseDrawable);
		
		// filteredGraphic.Name = name;
		// GraphicFactory.Instance.AddGraphicDef(filteredGraphic);
		
		// Debug.Log("Graphic generated "+name);
		
		// return name;
	}
}