//--------------------------------------
//             InfiniText
//
//        For documentation or 
//    if you have any issues, visit
//        powerUI.kulestar.com
//
//    Copyright  2013 Kulestar Ltd
//          www.kulestar.com
//--------------------------------------

using System;


namespace InfiniText{
	
	/// <summary>
	/// Used as a temporary holder of data during glyph loading.
	/// </summary>
	
	public class GlyphPoint{
		
		/// <summary>The X coordinate of this path node.</summary>
		public float X;
		/// <summary>The Y coordinate of this path node.</summary>
		public float Y;
		/// <summary>True if this point is valid.</summary>
		public bool Active;
		/// <summary>Is this point on the curve? Control point otherwise.</summary>
		public bool OnCurve;
		/// <summary>Stores the flags for the current loading glyph.</summary>
		public byte[] Flags;
		/// <summary>The point coords for the current loading glyph.</summary>
		public float[] Coords;
		
		
		/// <summary>Creates an empty path node.</summary>
		public GlyphPoint(byte[] flags,float[] coords){
			
			Flags=flags;
			Coords=coords;
			
		}
		
		public void Set(GlyphPoint point){
			
			Active=true;
			OnCurve=point.OnCurve;
			X=point.X;
			Y=point.Y;
			
		}
		
		public void Set(int index){
			
			Active=true;
			
			// On the curve?
			OnCurve=(Flags[index]==1);
			
			// Double index:
			index*=2;
			
			// Coords:
			X=Coords[index];
			Y=Coords[index+1];
			
		}
		
	}

}