FT_Glyph_Stroke() private method

private FT_Glyph_Stroke ( IntPtr &pglyph, IntPtr stoker, [ destroy ) : System.Error
pglyph System.IntPtr
stoker System.IntPtr
destroy [
return System.Error
Example #1
0
        /// <summary>
        /// Stroke a given outline glyph object with a given stroker.
        /// </summary>
        /// <remarks>
        /// The source glyph is untouched in case of error.
        /// </remarks>
        /// <param name="stroker">A stroker handle.</param>
        /// <param name="destroy">A Boolean. If 1, the source glyph object is destroyed on success.</param>
        /// <returns>New glyph handle.</returns>
        public Glyph Stroke(Stroker stroker, bool destroy)
        {
            if (IsDisposed)
            {
                throw new ObjectDisposedException("Glyph", "Cannot access a disposed object.");
            }

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

            IntPtr sourceRef = Reference;
            Error  err       = FT.FT_Glyph_Stroke(ref sourceRef, stroker.Reference, destroy);

            if (destroy && err == Error.Ok)
            {
                //if FT_Glyph_Stroke destroys the glyph, keep the C# side synchronized.
                IsDisposed = true;
                reference  = IntPtr.Zero;
            }

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

            //check if the pointer didn't change.
            if (sourceRef == Reference)
            {
                return(this);
            }
            return(new Glyph(sourceRef, Library));
        }
Example #2
0
        /// <summary>
        /// Stroke a given outline glyph object with a given stroker.
        /// </summary>
        /// <remarks>
        /// The source glyph is untouched in case of error.
        /// </remarks>
        /// <param name="stroker">A stroker handle.</param>
        /// <param name="destroy">A Boolean. If 1, the source glyph object is destroyed on success.</param>
        /// <returns>New glyph handle.</returns>
        public Glyph Stroke(Stroker stroker)
        {
            if (stroker == null)
            {
                throw new ArgumentNullException("stroker");
            }

            IntPtr sourceRef = Reference;
            Error  err       = FT.FT_Glyph_Stroke(ref sourceRef, stroker.Reference, false);

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

            //check if the pointer didn't change.
            return(sourceRef == Reference ? this : new Glyph(sourceRef, Library));
        }