Skip to content

Commit

Permalink
Final changes for leptonica release 1.80.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DanBloomberg committed Jul 28, 2020
1 parent 13f812c commit 1ac72c9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 271 deletions.
19 changes: 10 additions & 9 deletions README.html
Original file line number Diff line number Diff line change
Expand Up @@ -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

</pre>

Expand Down Expand Up @@ -117,7 +117,7 @@ <h2> <A NAME="BUILDING">
Libraries, executables and prototypes are easily made, as described below.

When you extract from the archive, all files are put in a
subdirectory 'leptonica-1.79.0'. In that directory you will
subdirectory 'leptonica-1.80.0'. In that directory you will
find a src directory containing the source files for the library,
and a prog directory containing source files for various
testing and example programs.
Expand Down Expand Up @@ -252,7 +252,7 @@ <h2> <A NAME="BUILDING">
make install

Configure also supports building in a separate directory from the
source. Run "/(path-to)/leptonica-1.79.0/configure" and then "make"
source. Run "/(path-to)/leptonica-1.80.0/configure" and then "make"
from the desired build directory.

Configure has a number of useful options; run "configure --help" for
Expand Down Expand Up @@ -1126,8 +1126,8 @@ <h2> <A NAME="CONTENTS">
http://code.google.com/p/leptonica, as well as all versions after 1.60.
These have now been transferred by Egor Pugin to github:
github.com/danbloomberg/leptonica
where all releases (1.42 - 1.79.0) are available; e.g.,
https://github.com/DanBloomberg/leptonica/releases/tag/1.79.0
where all releases (1.42 - 1.80.0) are available; e.g.,
https://github.com/DanBloomberg/leptonica/releases/tag/1.80.0
The more recent releases, from 1.74, are also available at
leptonica.org/download.html
Note that if you are downloading from github, the releases are more
Expand All @@ -1150,7 +1150,8 @@ <h2> <A NAME="CONTENTS">
1.76 : 5.3.0
1.77 : 5.3.0
1.78 : 5.3.0
1.79 : 5.4.0 (not yet released as of 1/1/2020)
1.79 : 5.4.0
1.80 : 5.4.0 (not released as of 7/28/2020)

A brief version chronology is maintained in version-notes.html.
Starting with gcc 4.3.3, error warnings (-Werror) are given for
Expand Down
10 changes: 8 additions & 2 deletions prog/reg_wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@
# alltests_reg generate
# alltests_reg compare
#
# A few of the tests require gnuplot. These tests, listed below,
# are skipped if gnuplot is not available.
# Some of the tests require gnuplot. These tests, listed below,
# are skipped if gnuplot is not available. You can determine if a
# test requires gnuplot, if any of these situations is true:
# * a function starting with "gplot" is called
# * a function starting with "boxaPlot" is called
# * a function starting with "pixCompare" is called
# * the function pixItalicWords() is called
# * the function pixWordMaskByDilation() is called
#
# The wrapper receives several parameters in this form:
# path/to/source/config/test-driver <TEST DRIVER ARGS> -- ./foo_reg
Expand Down
259 changes: 0 additions & 259 deletions src/writefile.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@
*
* Nonfunctional stub of pix output for debugging
* l_int32 pixDisplayWrite()
* l_int32 pixSaveTiled()
* l_int32 pixSaveTiledOutline()
* l_int32 pixSaveTiledWithText()
*
* Supported file formats:
* (1) Writing is supported without any external libraries:
Expand Down Expand Up @@ -1210,259 +1207,3 @@ pixDisplayWrite(PIX *pixs,
"\n\n\n");
return 1;
}

#if 0
/*!
* \brief pixSaveTiled()
*
* \param[in] pixs 1, 2, 4, 8, 32 bpp
* \param[in] pixa the pix are accumulated here
* \param[in] scalefactor 0.0 to disable; otherwise this is a scale factor
* \param[in] newrow 0 if placed on the same row as previous; 1 otherwise
* \param[in] space horizontal and vertical spacing, in pixels
* \param[in] dp depth of pixa; 8 or 32 bpp; only used on first call
* \return 0 if OK, 1 on error.
*/
l_ok
pixSaveTiled(PIX *pixs,
PIXA *pixa,
l_float32 scalefactor,
l_int32 newrow,
l_int32 space,
l_int32 dp)
{
lept_stderr("\n######################################################"
"\n Notice:\n"
" pixSaveTiled() has been deprecated in leptonica \n"
" since version 1.78. It will be removed in 1.80.\n"
"######################################################"
"\n\n\n");

/* Save without an outline */
return pixSaveTiledOutline(pixs, pixa, scalefactor, newrow, space, 0, dp);
}


/*!
* \brief pixSaveTiledOutline()
*
* \param[in] pixs 1, 2, 4, 8, 32 bpp
* \param[in] pixa the pix are accumulated here
* \param[in] scalefactor 0.0 to disable; otherwise this is a scale factor
* \param[in] newrow 0 if placed on the same row as previous; 1 otherwise
* \param[in] space horizontal and vertical spacing, in pixels
* \param[in] linewidth width of added outline for image; 0 for no outline
* \param[in] dp depth of pixa; 8 or 32 bpp; only used on first call
* \return 0 if OK, 1 on error.
*
* <pre>
* 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.
* </pre>
*/
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.
*
* <pre>
* 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.
* </pre>
*/
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
2 changes: 1 addition & 1 deletion version-notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ <h2 align=center> <IMG SRC="moller52.jpg" border=1 ALIGN_MIDDLE> </h2>

<pre>

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
Expand Down

0 comments on commit 1ac72c9

Please sign in to comment.