package starling.styles {
import starling.textures.Texture;
import starling.rendering.VertexDataFormat;
import starling.rendering.VertexData;
import starling.rendering.RenderState;
import starling.rendering.MeshEffect;
import starling.rendering.IndexData;
import starling.events.EventDispatcher;
import starling.display.Mesh;
import openfl.geom.Point;
import openfl.geom.Matrix;
[Event(name="enterFrame",type="starling.events.EnterFrameEvent")]
/**
 *  Dispatched every frame on styles assigned to display objects connected to the stage. 
 * @externs
 */
public class MeshStyle extends starling.events.EventDispatcher {
	/**
	 *  Creates a new MeshStyle instance.
	 *      *  Subclasses must provide a constructor that can be called without any arguments. 
	 */
	public function MeshStyle() {
		super();
	}
	/**
	 *  The vertex format expected by this style (the same as found in the MeshEffect-class). 
	 */
	public static var VERTEX_FORMAT:starling.rendering.VertexDataFormat;
	/**
	 *  Copies all properties of the given style to the current instance (or a subset, if the
	 *      *  classes don't match). Must be overridden by all subclasses!
	 *      
	 */
	public function copyFrom(meshStyle:starling.styles.MeshStyle):void {}
	/**
	 *  Creates a clone of this instance. The method will work for subclasses automatically,
	 *      *  no need to override it. 
	 */
	public function clone():starling.styles.MeshStyle { return null; }
	/**
	 *  Creates the effect that does the actual, low-level rendering.
	 *      *  To be overridden by subclasses!
	 *      
	 */
	public function createEffect():starling.rendering.MeshEffect { return null; }
	/**
	 *  Updates the settings of the given effect to match the current style.
	 *      *  The given <code>effect</code> will always match the class returned by
	 *      *  <code>createEffect</code>.
	 *      *
	 *      *  <p>To be overridden by subclasses!</p>
	 *      
	 */
	public function updateEffect(effect:starling.rendering.MeshEffect, state:starling.rendering.RenderState):void {}
	/**
	 *  Indicates if the current instance can be batched with the given style.
	 *      *  To be overridden by subclasses if default behavior is not sufficient.
	 *      *  The base implementation just checks if the styles are of the same type
	 *      *  and if the textures are compatible.
	 *      
	 */
	public function canBatchWith(meshStyle:starling.styles.MeshStyle):Boolean { return false; }
	/**
	 *  Copies the vertex data of the style's current target to the target of another style.
	 *      *  If you pass a matrix, all vertices will be transformed during the process.
	 *      *
	 *      *  <p>This method is used when batching meshes together for rendering. The parameter
	 *      *  <code>targetStyle</code> will point to the style of a <code>MeshBatch</code> (a
	 *      *  subclass of <code>Mesh</code>). Subclasses may override this method if they need
	 *      *  to modify the vertex data in that process.</p>
	 *      
	 */
	public function batchVertexData(targetStyle:starling.styles.MeshStyle, targetVertexID:int = undefined, matrix:openfl.geom.Matrix = undefined, vertexID:int = undefined, numVertices:int = undefined):void {}
	/**
	 *  Copies the index data of the style's current target to the target of another style.
	 *      *  The given offset value will be added to all indices during the process.
	 *      *
	 *      *  <p>This method is used when batching meshes together for rendering. The parameter
	 *      *  <code>targetStyle</code> will point to the style of a <code>MeshBatch</code> (a
	 *      *  subclass of <code>Mesh</code>). Subclasses may override this method if they need
	 *      *  to modify the index data in that process.</p>
	 *      
	 */
	public function batchIndexData(targetStyle:starling.styles.MeshStyle, targetIndexID:int = undefined, offset:int = undefined, indexID:int = undefined, numIndices:int = undefined):void {}
	override public function addEventListener(type:String, listener:Function):void {}
	override public function removeEventListener(type:String, listener:Function):void {}
	/**
	 *  The position of the vertex at the specified index, in the mesh's local coordinate
	 *      *  system.
	 *      *
	 *      *  <p>Only modify the position of a vertex if you know exactly what you're doing, as
	 *      *  some classes might not work correctly when their vertices are moved. E.g. the
	 *      *  <code>Quad</code> class expects its vertices to spawn up a perfectly rectangular
	 *      *  area; some of its optimized methods won't work correctly if that premise is no longer
	 *      *  fulfilled or the original bounds change.</p>
	 *      
	 */
	public function getVertexPosition(vertexID:int, out:openfl.geom.Point = undefined):openfl.geom.Point { return null; }
	public function setVertexPosition(vertexID:int, x:Number, y:Number):void {}
	/**
	 *  Returns the alpha value of the vertex at the specified index. 
	 */
	public function getVertexAlpha(vertexID:int):Number { return 0; }
	/**
	 *  Sets the alpha value of the vertex at the specified index to a certain value. 
	 */
	public function setVertexAlpha(vertexID:int, alpha:Number):void {}
	/**
	 *  Returns the RGB color of the vertex at the specified index. 
	 */
	public function getVertexColor(vertexID:int):int { return 0; }
	/**
	 *  Sets the RGB color of the vertex at the specified index to a certain value. 
	 */
	public function setVertexColor(vertexID:int, color:int):void {}
	/**
	 *  Returns the texture coordinates of the vertex at the specified index. 
	 */
	public function getTexCoords(vertexID:int, out:openfl.geom.Point = undefined):openfl.geom.Point { return null; }
	/**
	 *  Sets the texture coordinates of the vertex at the specified index to the given values. 
	 */
	public function setTexCoords(vertexID:int, u:Number, v:Number):void {}
	/**
	 *  Returns a reference to the vertex data of the assigned target (or <code>null</code>
	 *      *  if there is no target). Beware: the style itself does not own any vertices;
	 *      *  it is limited to manipulating those of the target mesh. 
	 */
	public function get vertexData():starling.rendering.VertexData { return null; }
	/**
	 *  Returns a reference to the index data of the assigned target (or <code>null</code>
	 *      *  if there is no target). Beware: the style itself does not own any indices;
	 *      *  it is limited to manipulating those of the target mesh. 
	 */
	public function get indexData():starling.rendering.IndexData { return null; }
	/**
	 *  The actual class of this style. 
	 */
	public function get type():Class { return null; }
	/**
	 *  Changes the color of all vertices to the same value.
	 *      *  The getter simply returns the color of the first vertex. 
	 */
	public function get color():int { return 0; }
	public function set color(value:int):void {}
	/**
	 *  The format used to store the vertices. 
	 */
	public function get vertexFormat():starling.rendering.VertexDataFormat { return null; }
	/**
	 *  The texture that is mapped to the mesh (or <code>null</code>, if there is none). 
	 */
	public function get texture():starling.textures.Texture { return null; }
	public function set texture(value:starling.textures.Texture):void {}
	/**
	 *  The smoothing filter that is used for the texture. @default bilinear 
	 */
	public function get textureSmoothing():String { return null; }
	public function set textureSmoothing(value:String):void {}
	/**
	 *  Indicates if pixels at the edges will be repeated or clamped.
	 *      *  Only works for power-of-two textures. @default false 
	 */
	public function get textureRepeat():Boolean { return false; }
	public function set textureRepeat(value:Boolean):void {}
	/**
	 *  The target the style is currently assigned to. 
	 */
	public function get target():starling.display.Mesh { return null; }
}
}
