Пример #1
0
        /// <summary>
        /// (1) Before calling this function for the first time, use
        ///     pixaCreate() to make the %pixa that will accumulate the pix.
        ///     This is passed in each time pixSaveTiled() is called.
        /// (2) %outwidth is the scaled width.  After scaling, the image is
        ///     saved in the input pixa, along with a box that specifies
        ///     the location to place it when tiled later.  Disable saving
        ///     the pix by setting %outwidth == 0.
        /// (3) %newrow and %space specify the location of the new pix
        ///     with respect to the last one(s) that were entered.
        /// (4) All pix are saved as 32 bpp RGB.
        /// (5) If both %bmf and %textstr are defined, this generates a pix
        ///     with the additional text; otherwise, no text is written.
        /// (6) The text is written before scaling, so it is properly
        ///     antialiased in the scaled pix.  However, if the pix on
        ///     different calls have different widths, the size of the
        ///     text will vary.
        /// (7) See pixSaveTiledOutline() for other implementation details.
        /// </summary>
        /// <param name="pixs">1, 2, 4, 8, 32 bpp</param>
        /// <param name="pixa">the pix are accumulated here; as 32 bpp</param>
        /// <param name="outwidth">in pixels; use 0 to disable entirely</param>
        /// <param name="newrow">true to start a new row; false to go on same row as previous</param>
        /// <param name="space">horizontal and vertical spacing, in pixels</param>
        /// <param name="linewidth">width of added outline for image; 0 for no outline</param>
        /// <param name="bmf">[optional] font struct</param>
        /// <param name="textstr">[optional] text string to be added</param>
        /// <param name="val">color to set the text</param>
        /// <param name="location">L_ADD_ABOVE, L_ADD_AT_TOP, L_ADD_AT_BOT, L_ADD_BELOW</param>
        /// <returns>false if OK, true on error</returns>
        public static bool pixSaveTiledWithText(this Pix pixs, Pixa pixa, int outwidth, bool newrow, int space, int linewidth, L_Bmf bmf, string textstr, uint val, FlagsForAddingTextToAPix location)
        {
            if (null == pixs ||
                null == pixa)
            {
                throw new ArgumentNullException("pixs, pixa cannot be null.");
            }

            return(Native.DllImports.pixSaveTiledWithText((HandleRef)pixs, (HandleRef)pixa, outwidth, newrow, space, linewidth, (HandleRef)bmf, textstr, val, location));
        }
Пример #2
0
        // Font layout
        public static Pix pixAddSingleTextblock(this Pix pixs, L_Bmf bmf, string textstr, uint val, FlagsForAddingTextToAPix location, out int poverflow)
        {
            var pointer = Native.DllImports.pixAddSingleTextblock((HandleRef)pixs, (HandleRef)bmf, textstr, val, (int)location, out poverflow);

            return(new Pix(pointer));
        }