Пример #1
0
        /// <summary>
        /// Walk over an outline's structure to decompose it into individual segments and Bézier arcs. This function
        /// also emits ‘move to’ operations to indicate the start of new contours in the outline.
        /// </summary>
        /// <param name="funcInterface">
        /// A table of ‘emitters’, i.e., function pointers called during decomposition to indicate path operations.
        /// </param>
        /// <param name="user">
        /// A typeless pointer which is passed to each emitter during the decomposition. It can be used to store the
        /// state during the decomposition.
        /// </param>
        public void Decompose(OutlineFuncs funcInterface, IntPtr user)
        {
            if (disposed)
            {
                throw new ObjectDisposedException("Outline", "Cannot access a disposed object.");
            }

            if (funcInterface == null)
            {
                throw new ArgumentNullException("funcInterface");
            }

            //TODO cleanup/move to the outlinefuncs class
            IntPtr funcInterfaceRef = Marshal.AllocHGlobal(OutlineFuncsRec.SizeInBytes);

            Marshal.WriteIntPtr(funcInterfaceRef, Marshal.GetFunctionPointerForDelegate(funcInterface.MoveFunction));
            Marshal.WriteIntPtr(funcInterfaceRef, (int)Marshal.OffsetOf(typeof(OutlineFuncsRec), "line_to"), Marshal.GetFunctionPointerForDelegate(funcInterface.LineFuction));
            Marshal.WriteIntPtr(funcInterfaceRef, (int)Marshal.OffsetOf(typeof(OutlineFuncsRec), "conic_to"), Marshal.GetFunctionPointerForDelegate(funcInterface.ConicFunction));
            Marshal.WriteIntPtr(funcInterfaceRef, (int)Marshal.OffsetOf(typeof(OutlineFuncsRec), "cubic_to"), Marshal.GetFunctionPointerForDelegate(funcInterface.CubicFunction));

            Marshal.WriteInt32(funcInterfaceRef, (int)Marshal.OffsetOf(typeof(OutlineFuncsRec), "shift"), funcInterface.Shift);
            Marshal.WriteInt32(funcInterfaceRef, (int)Marshal.OffsetOf(typeof(OutlineFuncsRec), "delta"), funcInterface.Delta);

            Error err = FT.FT_Outline_Decompose(reference, funcInterfaceRef, user);

            Marshal.FreeHGlobal(funcInterfaceRef);

            if (err != Error.Ok)
            {
                throw new FreeTypeException(err);
            }
        }
Пример #2
0
        /// <summary>
        /// Walk over an outline's structure to decompose it into individual segments and Bézier arcs. This function
        /// also emits ‘move to’ operations to indicate the start of new contours in the outline.
        /// </summary>
        /// <param name="funcInterface">
        /// A table of ‘emitters’, i.e., function pointers called during decomposition to indicate path operations.
        /// </param>
        /// <param name="user">
        /// A typeless pointer which is passed to each emitter during the decomposition. It can be used to store the
        /// state during the decomposition.
        /// </param>
        public void Decompose(OutlineFuncs funcInterface, IntPtr user)
        {
            if (funcInterface == null)
            {
                throw new ArgumentNullException("funcInterface");
            }

            OutlineFuncsRec ofRec = funcInterface.Record;
            Error           err   = FT.FT_Outline_Decompose(Reference, ref ofRec, user);

            if (err != Error.Ok)
            {
                throw new FreeTypeException(err);
            }
        }
Пример #3
0
        /// <summary>
        /// Walk over an outline's structure to decompose it into individual segments and Bézier arcs. This function
        /// also emits ‘move to’ operations to indicate the start of new contours in the outline.
        /// </summary>
        /// <param name="funcInterface">
        /// A table of ‘emitters’, i.e., function pointers called during decomposition to indicate path operations.
        /// </param>
        /// <param name="user">
        /// A typeless pointer which is passed to each emitter during the decomposition. It can be used to store the
        /// state during the decomposition.
        /// </param>
        public void Decompose(OutlineFuncs funcInterface, IntPtr user)
        {
            if (disposed)
            {
                throw new ObjectDisposedException("Outline", "Cannot access a disposed object.");
            }

            if (funcInterface == null)
            {
                throw new ArgumentNullException("funcInterface");
            }

            OutlineFuncsRec ofRec = funcInterface.Record;
            Error           err   = FT.FT_Outline_Decompose(reference, ref ofRec, user);

            if (err != Error.Ok)
            {
                throw new FreeTypeException(err);
            }
        }
Пример #4
0
		/// <summary>
		/// Walk over an outline's structure to decompose it into individual segments and Bézier arcs. This function
		/// also emits ‘move to’ operations to indicate the start of new contours in the outline.
		/// </summary>
		/// <param name="funcInterface">
		/// A table of ‘emitters’, i.e., function pointers called during decomposition to indicate path operations.
		/// </param>
		/// <param name="user">
		/// A typeless pointer which is passed to each emitter during the decomposition. It can be used to store the
		/// state during the decomposition.
		/// </param>
		public void Decompose(OutlineFuncs funcInterface, IntPtr user)
		{
			if (disposed)
				throw new ObjectDisposedException("Outline", "Cannot access a disposed object.");

			if (funcInterface == null)
				throw new ArgumentNullException("funcInterface");

			OutlineFuncsRec ofRec = funcInterface.Record;
			Error err = FT.FT_Outline_Decompose(reference, ref ofRec, user);

			if (err != Error.Ok)
				throw new FreeTypeException(err);
		}
Пример #5
0
        /// <summary>
        /// Walk over an outline's structure to decompose it into individual segments and Bézier arcs. This function
        /// also emits ‘move to’ operations to indicate the start of new contours in the outline.
        /// </summary>
        /// <param name="funcInterface">
        /// A table of ‘emitters’, i.e., function pointers called during decomposition to indicate path operations.
        /// </param>
        /// <param name="user">
        /// A typeless pointer which is passed to each emitter during the decomposition. It can be used to store the
        /// state during the decomposition.
        /// </param>
        public void Decompose(OutlineFuncs funcInterface, IntPtr user)
        {
            if (disposed)
                throw new ObjectDisposedException("Outline", "Cannot access a disposed object.");

            if (funcInterface == null)
                throw new ArgumentNullException("funcInterface");

            //TODO cleanup/move to the outlinefuncs class
            IntPtr funcInterfaceRef = Marshal.AllocHGlobal(OutlineFuncsRec.SizeInBytes);
            Marshal.WriteIntPtr(funcInterfaceRef, Marshal.GetFunctionPointerForDelegate(funcInterface.MoveFunction));
            Marshal.WriteIntPtr(funcInterfaceRef, (int)Marshal.OffsetOf(typeof(OutlineFuncsRec), "line_to"), Marshal.GetFunctionPointerForDelegate(funcInterface.LineFuction));
            Marshal.WriteIntPtr(funcInterfaceRef, (int)Marshal.OffsetOf(typeof(OutlineFuncsRec), "conic_to"), Marshal.GetFunctionPointerForDelegate(funcInterface.ConicFunction));
            Marshal.WriteIntPtr(funcInterfaceRef, (int)Marshal.OffsetOf(typeof(OutlineFuncsRec), "cubic_to"), Marshal.GetFunctionPointerForDelegate(funcInterface.CubicFunction));

            Marshal.WriteInt32(funcInterfaceRef, (int)Marshal.OffsetOf(typeof(OutlineFuncsRec), "shift"), funcInterface.Shift);
            Marshal.WriteInt32(funcInterfaceRef, (int)Marshal.OffsetOf(typeof(OutlineFuncsRec), "delta"), funcInterface.Delta);

            Error err = FT.FT_Outline_Decompose(reference, funcInterfaceRef, user);

            Marshal.FreeHGlobal(funcInterfaceRef);

            if (err != Error.Ok)
                throw new FreeTypeException(err);
        }