diff --git a/README.html b/README.html index 84535febc..af02bd0ff 100644 --- a/README.html +++ b/README.html @@ -75,12 +75,12 @@ - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *====================================================================*/ -README (version 1.79.0) -File update: 1 Jan 2020 +README (version 1.80.0) +File update: 28 July 2020 --------------------------- -gunzip leptonica-1.79.0.tar.gz -tar -xvf leptonica-1.79.0.tar +gunzip leptonica-1.80.0.tar.gz +tar -xvf leptonica-1.80.0.tar @@ -117,7 +117,7 @@
- * Notes: - * (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) %scalefactor scales the input image. After scaling and - * possible depth conversion, 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 %scalefactor == 0.0. - * (3) %newrow and %space specify the location of the new pix - * with respect to the last one(s) that were entered. - * (4) %dp specifies the depth at which all pix are saved. It can - * be only 8 or 32 bpp. Any colormap is removed. This is only - * used at the first invocation. - * (5) This function uses two variables from call to call. - * If they were static, the function would not be .so or thread - * safe, and furthermore, there would be interference with two or - * more pixa accumulating images at a time. Consequently, - * we use the first pix in the pixa to store and obtain both - * the depth and the current position of the bottom (one pixel - * below the lowest image raster line when laid out using - * the boxa). The bottom variable is stored in the input format - * field, which is the only field available for storing an int. - *- */ -l_ok -pixSaveTiledOutline(PIX *pixs, - PIXA *pixa, - l_float32 scalefactor, - l_int32 newrow, - l_int32 space, - l_int32 linewidth, - l_int32 dp) -{ -l_int32 n, top, left, bx, by, bw, w, h, depth, bottom; -BOX *box; -PIX *pix1, *pix2, *pix3, *pix4; - - PROCNAME("pixSaveTiledOutline"); - - lept_stderr("\n######################################################" - "\n Notice:\n" - " pixSaveTiledOutline() has been deprecated in leptonica \n" - " since version 1.78. It will be removed in 1.80.\n" - "######################################################" - "\n\n\n"); - - if (scalefactor == 0.0) return 0; - - if (!pixs) - return ERROR_INT("pixs not defined", procName, 1); - if (!pixa) - return ERROR_INT("pixa not defined", procName, 1); - - n = pixaGetCount(pixa); - if (n == 0) { - bottom = 0; - if (dp != 8 && dp != 32) { - L_WARNING("dp not 8 or 32 bpp; using 32\n", procName); - depth = 32; - } else { - depth = dp; - } - } else { /* extract the depth and bottom params from the first pix */ - pix1 = pixaGetPix(pixa, 0, L_CLONE); - depth = pixGetDepth(pix1); - bottom = pixGetInputFormat(pix1); /* not typical usage! */ - pixDestroy(&pix1); - } - - /* Remove colormap if it exists; otherwise a copy. This - * guarantees that pix4 is not a clone of pixs. */ - pix1 = pixRemoveColormapGeneral(pixs, REMOVE_CMAP_BASED_ON_SRC, L_COPY); - - /* Scale and convert to output depth */ - if (scalefactor == 1.0) { - pix2 = pixClone(pix1); - } else if (scalefactor > 1.0) { - pix2 = pixScale(pix1, scalefactor, scalefactor); - } else { /* scalefactor < 1.0) */ - if (pixGetDepth(pix1) == 1) - pix2 = pixScaleToGray(pix1, scalefactor); - else - pix2 = pixScale(pix1, scalefactor, scalefactor); - } - pixDestroy(&pix1); - if (depth == 8) - pix3 = pixConvertTo8(pix2, 0); - else - pix3 = pixConvertTo32(pix2); - pixDestroy(&pix2); - - /* Add black outline */ - if (linewidth > 0) - pix4 = pixAddBorder(pix3, linewidth, 0); - else - pix4 = pixClone(pix3); - pixDestroy(&pix3); - - /* Find position of current pix (UL corner plus size) */ - if (n == 0) { - top = 0; - left = 0; - } else if (newrow == 1) { - top = bottom + space; - left = 0; - } else { /* n > 0 */ - pixaGetBoxGeometry(pixa, n - 1, &bx, &by, &bw, NULL); - top = by; - left = bx + bw + space; - } - - pixGetDimensions(pix4, &w, &h, NULL); - bottom = L_MAX(bottom, top + h); - box = boxCreate(left, top, w, h); - pixaAddPix(pixa, pix4, L_INSERT); - pixaAddBox(pixa, box, L_INSERT); - - /* Save the new bottom value */ - pix1 = pixaGetPix(pixa, 0, L_CLONE); - pixSetInputFormat(pix1, bottom); /* not typical usage! */ - pixDestroy(&pix1); - return 0; -} - - -/*! - * \brief pixSaveTiledWithText() - * - * \param[in] pixs 1, 2, 4, 8, 32 bpp - * \param[in] pixa the pix are accumulated here; as 32 bpp - * \param[in] outwidth in pixels; use 0 to disable entirely - * \param[in] newrow 1 to start a new row; 0 to go on same row as previous - * \param[in] space horizontal and vertical spacing, in pixels - * \param[in] linewidth width of added outline for image; 0 for no outline - * \param[in] bmf [optional] font struct - * \param[in] textstr [optional] text string to be added - * \param[in] val color to set the text - * \param[in] location L_ADD_ABOVE, L_ADD_AT_TOP, L_ADD_AT_BOT, L_ADD_BELOW - * \return 0 if OK, 1 on error. - * - *
- * Notes: - * (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. - *- */ -l_ok -pixSaveTiledWithText(PIX *pixs, - PIXA *pixa, - l_int32 outwidth, - l_int32 newrow, - l_int32 space, - l_int32 linewidth, - L_BMF *bmf, - const char *textstr, - l_uint32 val, - l_int32 location) -{ -PIX *pix1, *pix2, *pix3, *pix4; - - PROCNAME("pixSaveTiledWithText"); - - lept_stderr("\n######################################################" - "\n Notice:\n" - " pixSaveTiledWithText() has been deprecated in leptonica \n" - " since version 1.78. It will be removed in 1.80.\n" - "######################################################" - "\n\n\n"); - - if (outwidth == 0) return 0; - - if (!pixs) - return ERROR_INT("pixs not defined", procName, 1); - if (!pixa) - return ERROR_INT("pixa not defined", procName, 1); - - pix1 = pixConvertTo32(pixs); - if (linewidth > 0) - pix2 = pixAddBorder(pix1, linewidth, 0); - else - pix2 = pixClone(pix1); - if (bmf && textstr) - pix3 = pixAddSingleTextblock(pix2, bmf, textstr, val, location, NULL); - else - pix3 = pixClone(pix2); - pix4 = pixScaleToSize(pix3, outwidth, 0); - pixSaveTiled(pix4, pixa, 1.0, newrow, space, 32); - pixDestroy(&pix1); - pixDestroy(&pix2); - pixDestroy(&pix3); - pixDestroy(&pix4); - return 0; -} -#endif diff --git a/version-notes.html b/version-notes.html index 7fc5f47e0..1fb9384af 100644 --- a/version-notes.html +++ b/version-notes.html @@ -89,7 +89,7 @@
-1.80.0 Not yet released +1.80.0 28 Jan 2020 * Improve bmp handling of 1 bpp images and sanity checking of params. * Add function to display all rgb gamut colors * in Makefile.am, use option serial-tests to avoid races in testing