Exemplo n.º 1
0
		/// <summary>
		/// Creates a bitmap out of a projection
		/// </summary>
		/// <param name="projection">
		/// The projection <see cref="BitmapProjection"/>
		/// </param>
		/// <returns>
		/// A <see cref="Pixbuf"/> with the projection graphical representation.
		/// </returns>
		public static Pixbuf CreateProjectionBitmap(BitmapProjection projection)
		{
			int max=-1;
			foreach(int i in projection.Values)
			{
				if(max<i)
				{
					max=i;
				}		
			}

			FloatBitmap bitmap = new FloatBitmap(projection.Values.Length, 
			                                     max);
			
			
			for(int k=0;k<projection.Values.Length;k++)
			{
				Console.WriteLine(projection.Values[k]);
				for(int j = 0; j< projection.Values[k];j++)
				{
				
					bitmap[k,j] = FloatBitmap.Black;
				}
			}		
			
			return bitmap.CreatePixbuf();
		}
        /// <summary>
        /// Creates BitmapProjection instances.
        /// </summary>
        /// <param name="mode">
        /// The <see cref="ProjectionMode"/> used for the projection.
        /// </param>
        /// <param name="mtb">
        /// The <see cref="MathTextBitmap"/> to be projected.
        /// </param>
        /// <returns>
        /// The <see cref="BitmapProjection"/> created.
        /// </returns>
        public static BitmapProjection CreateProjection(ProjectionMode mode,
                                                        MathTextBitmap mtb)
        {
            BitmapProjection res = null;

            switch (mode)
            {
            case (ProjectionMode.Horizontal):
                res = new HorizontalBitmapProjection(mtb);
                break;

            case (ProjectionMode.Vertical):
                res = new VerticalBitmapProjection(mtb);
                break;

            default:
                throw new ArgumentException(
                          "No puede usar None para crear una nueva projección");
            }
            return(res);
        }