FT_Glyph_StrokeBorder() private method

private FT_Glyph_StrokeBorder ( IntPtr &pglyph, IntPtr stoker, [ inside, [ destroy ) : System.Error
pglyph System.IntPtr
stoker System.IntPtr
inside [
destroy [
return System.Error
Exemplo n.º 1
0
        /// <summary>
        /// Stroke a given outline glyph object with a given stroker, but only return either its inside or outside
        /// border.
        /// </summary>
        /// <remarks>
        /// The source glyph is untouched in case of error.
        /// </remarks>
        /// <param name="stroker">A stroker handle.</param>
        /// <param name="inside">A Boolean. If 1, return the inside border, otherwise the outside border.</param>
        /// <param name="destroy">A Boolean. If 1, the source glyph object is destroyed on success.</param>
        /// <returns>New glyph handle.</returns>
        public Glyph StrokeBorder(Stroker stroker, bool inside, 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_StrokeBorder(ref sourceRef, stroker.Reference, inside, 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));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Stroke a given outline glyph object with a given stroker, but only return either its inside or outside
        /// border.
        /// </summary>
        /// <remarks>
        /// The source glyph is untouched in case of error.
        /// </remarks>
        /// <param name="stroker">A stroker handle.</param>
        /// <param name="inside">A Boolean. If 1, return the inside border, otherwise the outside border.</param>
        /// <param name="destroy">A Boolean. If 1, the source glyph object is destroyed on success.</param>
        /// <returns>New glyph handle.</returns>
        public Glyph StrokeBorder(Stroker stroker, bool inside)
        {
            if (stroker == null)
            {
                throw new ArgumentNullException("stroker");
            }

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

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


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