FT_Bitmap_Convert() private method

private FT_Bitmap_Convert ( IntPtr library, IntPtr source, IntPtr target, int alignment ) : System.Error
library System.IntPtr
source System.IntPtr
target System.IntPtr
alignment int
return System.Error
Example #1
0
        /// <summary>
        /// Convert a bitmap object with depth 1bpp, 2bpp, 4bpp, or 8bpp to a bitmap object with depth 8bpp, making the
        /// number of used bytes per line (a.k.a. the ‘pitch’) a multiple of ‘alignment’.
        /// </summary>
        /// <remarks><para>
        /// It is possible to call <see cref="Convert"/> multiple times without calling
        /// <see cref="Dispose()"/> (the memory is simply reallocated).
        /// </para><para>
        /// Use <see cref="Dispose()"/> to finally remove the bitmap object.
        /// </para><para>
        /// The ‘library’ argument is taken to have access to FreeType's memory handling functions.
        /// </para></remarks>
        /// <param name="library">A handle to a library object.</param>
        /// <param name="alignment">
        /// The pitch of the bitmap is a multiple of this parameter. Common values are 1, 2, or 4.
        /// </param>
        /// <returns>The target bitmap.</returns>
        public FTBitmap Convert(Library library, int alignment)
        {
            if (disposed)
            {
                throw new ObjectDisposedException("FTBitmap", "Cannot access a disposed object.");
            }

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

            FTBitmap newBitmap = new FTBitmap(library);
            IntPtr   bmpRef    = newBitmap.reference;
            Error    err       = FT.FT_Bitmap_Convert(library.Reference, Reference, bmpRef, alignment);

            newBitmap.Reference = bmpRef;

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

            return(newBitmap);
        }
Example #2
0
        /// <summary>
        /// Convert a bitmap object with depth 1bpp, 2bpp, 4bpp, or 8bpp to a bitmap object with depth 8bpp, making the
        /// number of used bytes per line (a.k.a. the ‘pitch’) a multiple of ‘alignment’.
        /// </summary>
        /// <remarks><para>
        /// It is possible to call <see cref="Convert"/> multiple times without calling
        /// <see cref="Dispose"/> (the memory is simply reallocated).
        /// </para><para>
        /// Use <see cref="Dispose"/> to finally remove the bitmap object.
        /// </para><para>
        /// The ‘library’ argument is taken to have access to FreeType's memory handling functions.
        /// </para></remarks>
        /// <param name="library">A handle to a library object.</param>
        /// <param name="alignment">
        /// The pitch of the bitmap is a multiple of this parameter. Common values are 1, 2, or 4.
        /// </param>
        /// <returns>The target bitmap.</returns>
        public FTBitmap Convert(Library library, int alignment)
        {
            if (library == null)
            {
                throw new ArgumentNullException("library");
            }

            FTBitmap newBitmap = new FTBitmap(library);
            IntPtr   bmpRef    = newBitmap.Reference;
            Error    err       = FT.FT_Bitmap_Convert(library.Reference, Reference, bmpRef, alignment);

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

            return(newBitmap);
        }