![]() |
Leptonica 1.85.0
Image processing and image analysis suite
|
#include <string.h>#include <math.h>#include "allheaders.h"Go to the source code of this file.
Functions | |
| PTA * | generatePtaLine (l_int32 x1, l_int32 y1, l_int32 x2, l_int32 y2) |
| PTA * | generatePtaWideLine (l_int32 x1, l_int32 y1, l_int32 x2, l_int32 y2, l_int32 width) |
| PTA * | generatePtaBox (BOX *box, l_int32 width) |
| PTA * | generatePtaBoxa (BOXA *boxa, l_int32 width, l_int32 removedups) |
| PTA * | generatePtaHashBox (BOX *box, l_int32 spacing, l_int32 width, l_int32 orient, l_int32 outline) |
| PTA * | generatePtaHashBoxa (BOXA *boxa, l_int32 spacing, l_int32 width, l_int32 orient, l_int32 outline, l_int32 removedups) |
| PTAA * | generatePtaaBoxa (BOXA *boxa) |
| PTAA * | generatePtaaHashBoxa (BOXA *boxa, l_int32 spacing, l_int32 width, l_int32 orient, l_int32 outline) |
| PTA * | generatePtaPolyline (PTA *ptas, l_int32 width, l_int32 closeflag, l_int32 removedups) |
| PTA * | generatePtaGrid (l_int32 w, l_int32 h, l_int32 nx, l_int32 ny, l_int32 width) |
| PTA * | convertPtaLineTo4cc (PTA *ptas) |
| PTA * | generatePtaFilledCircle (l_int32 radius) |
| PTA * | generatePtaFilledSquare (l_int32 side) |
| PTA * | generatePtaLineFromPt (l_int32 x, l_int32 y, l_float64 length, l_float64 radang) |
| l_ok | locatePtRadially (l_int32 xr, l_int32 yr, l_float64 dist, l_float64 radang, l_float64 *px, l_float64 *py) |
| l_ok | pixRenderPlotFromNuma (PIX **ppix, NUMA *na, l_int32 plotloc, l_int32 linewidth, l_int32 max, l_uint32 color) |
| PTA * | makePlotPtaFromNuma (NUMA *na, l_int32 size, l_int32 plotloc, l_int32 linewidth, l_int32 max) |
| l_ok | pixRenderPlotFromNumaGen (PIX **ppix, NUMA *na, l_int32 orient, l_int32 linewidth, l_int32 refpos, l_int32 max, l_int32 drawref, l_uint32 color) |
| PTA * | makePlotPtaFromNumaGen (NUMA *na, l_int32 orient, l_int32 linewidth, l_int32 refpos, l_int32 max, l_int32 drawref) |
| l_ok | pixRenderPta (PIX *pix, PTA *pta, l_int32 op) |
| l_ok | pixRenderPtaArb (PIX *pix, PTA *pta, l_uint8 rval, l_uint8 gval, l_uint8 bval) |
| l_ok | pixRenderPtaBlend (PIX *pix, PTA *pta, l_uint8 rval, l_uint8 gval, l_uint8 bval, l_float32 fract) |
| l_ok | pixRenderLine (PIX *pix, l_int32 x1, l_int32 y1, l_int32 x2, l_int32 y2, l_int32 width, l_int32 op) |
| l_ok | pixRenderLineArb (PIX *pix, l_int32 x1, l_int32 y1, l_int32 x2, l_int32 y2, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval) |
| l_ok | pixRenderLineBlend (PIX *pix, l_int32 x1, l_int32 y1, l_int32 x2, l_int32 y2, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval, l_float32 fract) |
| l_ok | pixRenderBox (PIX *pix, BOX *box, l_int32 width, l_int32 op) |
| l_ok | pixRenderBoxArb (PIX *pix, BOX *box, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval) |
| l_ok | pixRenderBoxBlend (PIX *pix, BOX *box, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval, l_float32 fract) |
| l_ok | pixRenderBoxa (PIX *pix, BOXA *boxa, l_int32 width, l_int32 op) |
| l_ok | pixRenderBoxaArb (PIX *pix, BOXA *boxa, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval) |
| l_ok | pixRenderBoxaBlend (PIX *pix, BOXA *boxa, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval, l_float32 fract, l_int32 removedups) |
| l_ok | pixRenderHashBox (PIX *pix, BOX *box, l_int32 spacing, l_int32 width, l_int32 orient, l_int32 outline, l_int32 op) |
| l_ok | pixRenderHashBoxArb (PIX *pix, BOX *box, l_int32 spacing, l_int32 width, l_int32 orient, l_int32 outline, l_int32 rval, l_int32 gval, l_int32 bval) |
| l_ok | pixRenderHashBoxBlend (PIX *pix, BOX *box, l_int32 spacing, l_int32 width, l_int32 orient, l_int32 outline, l_int32 rval, l_int32 gval, l_int32 bval, l_float32 fract) |
| l_ok | pixRenderHashMaskArb (PIX *pix, PIX *pixm, l_int32 x, l_int32 y, l_int32 spacing, l_int32 width, l_int32 orient, l_int32 outline, l_int32 rval, l_int32 gval, l_int32 bval) |
| l_ok | pixRenderHashBoxa (PIX *pix, BOXA *boxa, l_int32 spacing, l_int32 width, l_int32 orient, l_int32 outline, l_int32 op) |
| l_ok | pixRenderHashBoxaArb (PIX *pix, BOXA *boxa, l_int32 spacing, l_int32 width, l_int32 orient, l_int32 outline, l_int32 rval, l_int32 gval, l_int32 bval) |
| l_ok | pixRenderHashBoxaBlend (PIX *pix, BOXA *boxa, l_int32 spacing, l_int32 width, l_int32 orient, l_int32 outline, l_int32 rval, l_int32 gval, l_int32 bval, l_float32 fract) |
| l_ok | pixRenderPolyline (PIX *pix, PTA *ptas, l_int32 width, l_int32 op, l_int32 closeflag) |
| l_ok | pixRenderPolylineArb (PIX *pix, PTA *ptas, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval, l_int32 closeflag) |
| l_ok | pixRenderPolylineBlend (PIX *pix, PTA *ptas, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval, l_float32 fract, l_int32 closeflag, l_int32 removedups) |
| l_ok | pixRenderGridArb (PIX *pix, l_int32 nx, l_int32 ny, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval) |
| PIX * | pixRenderRandomCmapPtaa (PIX *pix, PTAA *ptaa, l_int32 polyflag, l_int32 width, l_int32 closeflag) |
| PIX * | pixRenderPolygon (PTA *ptas, l_int32 width, l_int32 *pxmin, l_int32 *pymin) |
| PIX * | pixFillPolygon (PIX *pixs, PTA *pta, l_int32 xmin, l_int32 ymin) |
| PIX * | pixRenderContours (PIX *pixs, l_int32 startval, l_int32 incr, l_int32 outdepth) |
| PIX * | fpixAutoRenderContours (FPIX *fpix, l_int32 ncontours) |
| PIX * | fpixRenderContours (FPIX *fpixs, l_float32 incr, l_float32 proxim) |
| PTA * | pixGeneratePtaBoundary (PIX *pixs, l_int32 width) |
Pta generation for arbitrary shapes built with lines
PTA *generatePtaLine()
PTA *generatePtaWideLine()
PTA *generatePtaBox()
PTA *generatePtaBoxa()
PTA *generatePtaHashBox()
PTA *generatePtaHashBoxa()
PTAA *generatePtaaBoxa()
PTAA *generatePtaaHashBoxa()
PTA *generatePtaPolyline()
PTA *generatePtaGrid()
PTA *convertPtaLineTo4cc()
PTA *generatePtaFilledCircle()
PTA *generatePtaFilledSquare()
PTA *generatePtaLineFromPt()
l_int32 locatePtRadially()
Rendering function plots directly on images
l_int32 pixRenderPlotFromNuma()
l_int32 pixRenderPlotFromNumaGen()
PTA *makePlotPtaFromNuma()
PTA *makePlotPtaFromNumaGen()
Pta rendering
l_int32 pixRenderPta()
l_int32 pixRenderPtaArb()
l_int32 pixRenderPtaBlend()
Rendering of arbitrary shapes built with lines
l_int32 pixRenderLine()
l_int32 pixRenderLineArb()
l_int32 pixRenderLineBlend()
l_int32 pixRenderBox()
l_int32 pixRenderBoxArb()
l_int32 pixRenderBoxBlend()
l_int32 pixRenderBoxa()
l_int32 pixRenderBoxaArb()
l_int32 pixRenderBoxaBlend()
l_int32 pixRenderHashBox()
l_int32 pixRenderHashBoxArb()
l_int32 pixRenderHashBoxBlend()
l_int32 pixRenderHashMaskArb()
l_int32 pixRenderHashBoxa()
l_int32 pixRenderHashBoxaArb()
l_int32 pixRenderHashBoxaBlend()
l_int32 pixRenderPolyline()
l_int32 pixRenderPolylineArb()
l_int32 pixRenderPolylineBlend()
l_int32 pixRenderGrid()
l_int32 pixRenderRandomCmapPtaa()
Rendering and filling of polygons
PIX *pixRenderPolygon()
PIX *pixFillPolygon()
Contour rendering on grayscale images
PIX *pixRenderContours()
PIX *fpixAutoRenderContours()
PIX *fpixRenderContours()
Boundary pt generation on 1 bpp images
PTA *pixGeneratePtaBoundary()
The line rendering functions are relatively crude, but they
get the job done for most simple situations. We use the pta
(array of points) as an intermediate data structure. For example,
to render a line we first generate a pta.
Some rendering functions come in sets of three. For example
pixRenderLine() -- render on 1 bpp pix
pixRenderLineArb() -- render on 32 bpp pix with arbitrary (r,g,b)
pixRenderLineBlend() -- render on 32 bpp pix, blending the
(r,g,b) graphic object with the underlying rgb pixels.
There are also procedures for plotting a function, computed
from the row or column pixels, directly on the image.
Definition in file graphics.c.
| [in] | ptas | 8-connected line of points |
Notes:
(1) When a polyline is generated with width = 1, the resulting
line is not 4-connected in general. This function adds
points as necessary to convert the line to 4-cconnected.
It is useful when rendering 1 bpp on a pix.
(2) Do not use this for lines generated with width > 1.
Definition at line 770 of file graphics.c.
Referenced by pixRenderPolygon().
| [in] | fpix | |
| [in] | ncontours | in [2 ... 500]; typically about 50 |
Notes:
(1) The increment is set to get approximately ncontours.
(2) The proximity to the target value for contour display
is set to 0.15.
(3) Negative values are rendered in red; positive values as black.
Definition at line 2685 of file graphics.c.
References fpixRenderContours().
| [in] | fpixs | |
| [in] | incr | increment between contours; must be > 0.0 |
| [in] | proxim | required proximity to target value; default 0.15 |
Notes:
(1) Values are displayed when val/incr is within +-proxim
to an integer. The default value is 0.15; smaller values
result in thinner contour lines.
(2) Negative values are rendered in red; positive values as black.
Definition at line 2721 of file graphics.c.
References SET_DATA_BYTE.
Referenced by fpixAutoRenderContours().
| [in] | boxa |
Notes:
(1) This generates a pta of the four corners for each box in
the boxa.
(2) Each of these pta can be rendered onto a pix with random colors,
by using pixRenderRandomCmapPtaa() with closeflag = 1.
Definition at line 561 of file graphics.c.
| PTAA * generatePtaaHashBoxa | ( | BOXA * | boxa, |
| l_int32 | spacing, | ||
| l_int32 | width, | ||
| l_int32 | orient, | ||
| l_int32 | outline ) |
| [in] | boxa | |
| [in] | spacing | spacing between hash lines; must be > 1 |
| [in] | width | hash line width |
| [in] | orient | orientation of lines: L_HORIZONTAL_LINE, L_POS_SLOPE_LINE, L_VERTICAL_LINE, L_NEG_SLOPE_LINE |
| [in] | outline | 0 to skip drawing box outline |
Notes:
(1) The orientation takes on one of 4 orientations (horiz, vertical,
slope +1, slope -1).
(2) The full outline is also drawn if outline = 1.
(3) Each of these pta can be rendered onto a pix with random colors,
by using pixRenderRandomCmapPtaa() with closeflag = 1.
Definition at line 612 of file graphics.c.
References generatePtaHashBox(), L_CLONE, L_HORIZONTAL_LINE, L_INSERT, L_NEG_SLOPE_LINE, L_POS_SLOPE_LINE, and L_VERTICAL_LINE.
| [in] | box | |
| [in] | width | of line |
Notes:
(1) Because the box is constructed so that we don't have any
overlapping lines, there is no need to remove duplicates.
Definition at line 272 of file graphics.c.
References generatePtaWideLine().
Referenced by generatePtaBoxa(), generatePtaHashBox(), pixRenderBox(), pixRenderBoxArb(), and pixRenderBoxBlend().
| [in] | boxa | |
| [in] | width | |
| [in] | removedups | 1 to remove, 0 to leave |
Notes:
(1) If boxa has overlapping boxes, and if blending will
be used to give a transparent effect, transparency
artifacts at line intersections can be removed using
removedups = 1.
Definition at line 347 of file graphics.c.
References generatePtaBox(), and L_CLONE.
Referenced by generatePtaGrid(), pixRenderBoxa(), pixRenderBoxaArb(), and pixRenderBoxaBlend().
| PTA * generatePtaFilledCircle | ( | l_int32 | radius | ) |
| [in] | radius |
Notes:
(1) The circle is has diameter = 2 * radius + 1.
(2) It is located with the center of the circle at the
point (radius, radius).
(3) Consequently, it typically must be translated if
it is to represent a set of pixels in an image.
Definition at line 811 of file graphics.c.
Referenced by makePlotPtaFromNumaGen().
| PTA * generatePtaFilledSquare | ( | l_int32 | side | ) |
| [in] | side |
Notes:
(1) The center of the square can be chosen to be at
(side / 2, side / 2). It must be translated by this amount
when used for replication.
Definition at line 849 of file graphics.c.
Referenced by makePlotPtaFromNumaGen().
| PTA * generatePtaGrid | ( | l_int32 | w, |
| l_int32 | h, | ||
| l_int32 | nx, | ||
| l_int32 | ny, | ||
| l_int32 | width ) |
| [in] | w,h | of region where grid will be displayed |
| [in] | nx,ny | number of rectangles in each direction in grid |
| [in] | width | of rendered lines |
Definition at line 714 of file graphics.c.
References generatePtaBoxa(), and L_INSERT.
Referenced by pixRenderGridArb().
| PTA * generatePtaHashBox | ( | BOX * | box, |
| l_int32 | spacing, | ||
| l_int32 | width, | ||
| l_int32 | orient, | ||
| l_int32 | outline ) |
| [in] | box | |
| [in] | spacing | spacing between lines; must be > 1 |
| [in] | width | of line |
| [in] | orient | orientation of lines: L_HORIZONTAL_LINE, L_POS_SLOPE_LINE, L_VERTICAL_LINE, L_NEG_SLOPE_LINE |
| [in] | outline | 0 to skip drawing box outline |
Notes:
(1) The orientation takes on one of 4 orientations (horiz, vertical,
slope +1, slope -1).
(2) The full outline is also drawn if outline = 1.
Definition at line 402 of file graphics.c.
References generatePtaBox(), generatePtaWideLine(), L_HORIZONTAL_LINE, L_NEG_SLOPE_LINE, L_POS_SLOPE_LINE, and L_VERTICAL_LINE.
Referenced by generatePtaaHashBoxa(), generatePtaHashBoxa(), pixRenderHashBox(), pixRenderHashBoxArb(), pixRenderHashBoxBlend(), and pixRenderHashMaskArb().
| PTA * generatePtaHashBoxa | ( | BOXA * | boxa, |
| l_int32 | spacing, | ||
| l_int32 | width, | ||
| l_int32 | orient, | ||
| l_int32 | outline, | ||
| l_int32 | removedups ) |
| [in] | boxa | |
| [in] | spacing | spacing between lines; must be > 1 |
| [in] | width | of line |
| [in] | orient | orientation of lines: L_HORIZONTAL_LINE, ... |
| [in] | orient | orientation of lines: L_HORIZONTAL_LINE, L_POS_SLOPE_LINE, L_VERTICAL_LINE, L_NEG_SLOPE_LINE |
| [in] | outline | 0 to skip drawing box outline |
| [in] | removedups | 1 to remove, 0 to leave |
Notes:
(1) The orientation takes on one of 4 orientations (horiz, vertical,
slope +1, slope -1).
(2) The full outline is also drawn if outline = 1.
(3) If the boxa has overlapping boxes, and if blending will
be used to give a transparent effect, transparency
artifacts at line intersections can be removed using
removedups = 1.
Definition at line 503 of file graphics.c.
References generatePtaHashBox(), L_CLONE, L_HORIZONTAL_LINE, L_NEG_SLOPE_LINE, L_POS_SLOPE_LINE, and L_VERTICAL_LINE.
Referenced by pixRenderHashBoxa(), pixRenderHashBoxaArb(), and pixRenderHashBoxaBlend().
| PTA * generatePtaLine | ( | l_int32 | x1, |
| l_int32 | y1, | ||
| l_int32 | x2, | ||
| l_int32 | y2 ) |
| [in] | x1,y1 | end point 1 |
| [in] | x2,y2 | end point 2 |
Notes:
(1) Uses Bresenham line drawing, which results in an 8-connected line.
Definition at line 141 of file graphics.c.
Referenced by generatePtaLineFromPt(), generatePtaWideLine(), and makePlotPtaFromNumaGen().
| PTA * generatePtaLineFromPt | ( | l_int32 | x, |
| l_int32 | y, | ||
| l_float64 | length, | ||
| l_float64 | radang ) |
| [in] | x,y | point of origination |
| [in] | length | of line, including starting point |
| [in] | radang | angle in radians, CW from horizontal |
Notes:
(1) length of the line is 1 greater than the distance
used in locatePtRadially(). Example: a distance of 1
gives rise to a length of 2.
Definition at line 882 of file graphics.c.
References generatePtaLine().
| [in] | ptas | vertices of polyline |
| [in] | width | |
| [in] | closeflag | 1 to close the contour; 0 otherwise |
| [in] | removedups | 1 to remove, 0 to leave |
Definition at line 658 of file graphics.c.
References generatePtaWideLine().
Referenced by pixRenderPolygon(), pixRenderPolyline(), pixRenderPolylineArb(), pixRenderPolylineBlend(), and pixRenderRandomCmapPtaa().
| PTA * generatePtaWideLine | ( | l_int32 | x1, |
| l_int32 | y1, | ||
| l_int32 | x2, | ||
| l_int32 | y2, | ||
| l_int32 | width ) |
| [in] | x1,y1 | end point 1 |
| [in] | x2,y2 | end point 2 |
| [in] | width |
Definition at line 204 of file graphics.c.
References generatePtaLine().
Referenced by generatePtaBox(), generatePtaHashBox(), generatePtaPolyline(), pixRenderLine(), pixRenderLineArb(), and pixRenderLineBlend().
| l_ok locatePtRadially | ( | l_int32 | xr, |
| l_int32 | yr, | ||
| l_float64 | dist, | ||
| l_float64 | radang, | ||
| l_float64 * | px, | ||
| l_float64 * | py ) |
| [in] | xr,yr | reference point |
| [in] | radang | angle in radians, CW from horizontal |
| [in] | dist | distance of point from reference point along line given by the specified angle |
| [out] | px,py | location of point |
Definition at line 906 of file graphics.c.
| PTA * makePlotPtaFromNuma | ( | NUMA * | na, |
| l_int32 | size, | ||
| l_int32 | plotloc, | ||
| l_int32 | linewidth, | ||
| l_int32 | max ) |
| [in] | na | |
| [in] | size | pix height for horizontal plot; pix width for vertical plot |
| [in] | plotloc | location of plot: L_PLOT_AT_TOP, etc |
| [in] | linewidth | width of "line" that is drawn; between 1 and 7 |
| [in] | max | maximum excursion in pixels from baseline |
Notes:
(1) This generates points from numa representing y(x) or x(y)
with respect to a pix. A horizontal plot y(x) is drawn for
a function of column position, and a vertical plot is drawn
for a function x(y) of row position. The baseline is located
so that all plot points will fit in the pix.
(2) See makePlotPtaFromNumaGen() for more details.
Definition at line 1003 of file graphics.c.
References L_HORIZONTAL_LINE, L_PLOT_AT_BOT, L_PLOT_AT_LEFT, L_PLOT_AT_MID_HORIZ, L_PLOT_AT_MID_VERT, L_PLOT_AT_RIGHT, L_PLOT_AT_TOP, L_VERTICAL_LINE, and makePlotPtaFromNumaGen().
Referenced by pixRenderPlotFromNuma().
| PTA * makePlotPtaFromNumaGen | ( | NUMA * | na, |
| l_int32 | orient, | ||
| l_int32 | linewidth, | ||
| l_int32 | refpos, | ||
| l_int32 | max, | ||
| l_int32 | drawref ) |
| [in] | na | |
| [in] | orient | L_HORIZONTAL_LINE, L_VERTICAL_LINE |
| [in] | linewidth | width of "line" that is drawn; between 1 and 7 |
| [in] | refpos | reference position: y for horizontal; x for vertical |
| [in] | max | maximum excursion in pixels from baseline |
| [in] | drawref | 1 to draw the reference line and its normal |
Notes:
(1) This generates points from numa representing y(x) or x(y)
with respect to a pix. For y(x), we draw a horizontal line
at the reference position and a vertical line at the edge; then
we draw the values of numa, scaled so that the maximum
excursion from the reference position is max pixels.
(2) The start and delx parameters of numa are used to refer
its values to the raster lines (L_VERTICAL_LINE) or columns
(L_HORIZONTAL_LINE).
(3) The linewidth is chosen in the interval [1 ... 7].
(4) refpos should be chosen so the plot is entirely within the pix
that it will be painted onto.
(5) This would typically be used to plot, in place, a function
computed along pixel rows or columns.
Definition at line 1122 of file graphics.c.
References generatePtaFilledCircle(), generatePtaFilledSquare(), generatePtaLine(), L_HORIZONTAL_LINE, and L_VERTICAL_LINE.
Referenced by makePlotPtaFromNuma(), and pixRenderPlotFromNumaGen().
| [in] | pixs | 1 bpp, with 4-connected polygon outline |
| [in] | pta | vertices of the polygon |
| [in] | xmin,ymin | min values of vertices of polygon |
Notes:
(1) This fills the interior of the polygon, returning a
new pix. It works for both convex and non-convex polygons.
(2) To generate a filled polygon from pta:
PIX *pixt = pixRenderPolygon(pta, 1, &xmin, &ymin);
PIX *pixd = pixFillPolygon(pixt, pta, xmin, ymin);
pixDestroy(&pixt);
Definition at line 2477 of file graphics.c.
| [in] | pixs | 1 bpp |
| [in] | width | of boundary line |
Notes:
(1) Similar to ptaGetBoundaryPixels(), except here:
* we only get pixels in the foreground
* we can have a "line" width greater than 1 pixel.
(2) Once generated, this can be applied to a random 1 bpp image
to add a color boundary as follows:
Pta *pta = pixGeneratePtaBoundary(pixs, width);
Pix *pix1 = pixConvert1To8Cmap(pixs);
pixRenderPtaArb(pix1, pta, rval, gval, bval);
Definition at line 2798 of file graphics.c.
| [in] | pix | any depth, not cmapped |
| [in] | box | |
| [in] | width | thickness of box lines |
| [in] | op | one of L_SET_PIXELS, L_CLEAR_PIXELS, L_FLIP_PIXELS |
Definition at line 1571 of file graphics.c.
References generatePtaBox(), L_CLEAR_PIXELS, L_FLIP_PIXELS, L_SET_PIXELS, and pixRenderPta().
| [in] | pix | any depth, not cmapped |
| [in] | boxa | |
| [in] | width | thickness of line |
| [in] | op | one of L_SET_PIXELS, L_CLEAR_PIXELS, L_FLIP_PIXELS |
Definition at line 1682 of file graphics.c.
References generatePtaBoxa(), L_CLEAR_PIXELS, L_FLIP_PIXELS, L_SET_PIXELS, and pixRenderPta().
| l_ok pixRenderBoxaArb | ( | PIX * | pix, |
| BOXA * | boxa, | ||
| l_int32 | width, | ||
| l_uint8 | rval, | ||
| l_uint8 | gval, | ||
| l_uint8 | bval ) |
| [in] | pix | any depth; colormapped is ok |
| [in] | boxa | |
| [in] | width | thickness of line |
| [in] | rval,gval,bval |
Definition at line 1718 of file graphics.c.
References generatePtaBoxa(), and pixRenderPtaArb().
| l_ok pixRenderBoxaBlend | ( | PIX * | pix, |
| BOXA * | boxa, | ||
| l_int32 | width, | ||
| l_uint8 | rval, | ||
| l_uint8 | gval, | ||
| l_uint8 | bval, | ||
| l_float32 | fract, | ||
| l_int32 | removedups ) |
| [in] | pix | 32 bpp rgb |
| [in] | boxa | |
| [in] | width | thickness of line |
| [in] | rval,gval,bval | |
| [in] | fract | in [0.0 - 1.0]: 1.0 is no transparency; 0.0 is complete transparency (no effect) |
| [in] | removedups | 1 to remove; 0 otherwise |
Definition at line 1757 of file graphics.c.
References generatePtaBoxa(), and pixRenderPtaBlend().
| l_ok pixRenderBoxArb | ( | PIX * | pix, |
| BOX * | box, | ||
| l_int32 | width, | ||
| l_uint8 | rval, | ||
| l_uint8 | gval, | ||
| l_uint8 | bval ) |
| [in] | pix | any depth, cmapped ok |
| [in] | box | |
| [in] | width | thickness of box lines |
| [in] | rval,gval,bval |
Definition at line 1607 of file graphics.c.
References generatePtaBox(), and pixRenderPtaArb().
| l_ok pixRenderBoxBlend | ( | PIX * | pix, |
| BOX * | box, | ||
| l_int32 | width, | ||
| l_uint8 | rval, | ||
| l_uint8 | gval, | ||
| l_uint8 | bval, | ||
| l_float32 | fract ) |
| [in] | pix | 32 bpp rgb |
| [in] | box | |
| [in] | width | thickness of box lines |
| [in] | rval,gval,bval | |
| [in] | fract | in [0.0 - 1.0]: 1.0 is no transparency; 0.0 is complete transparency (no effect) |
Definition at line 1645 of file graphics.c.
References generatePtaBox(), and pixRenderPtaBlend().
| [in] | pixs | 8 or 16 bpp; no colormap |
| [in] | startval | value of lowest contour; must be in [0 ... maxval] |
| [in] | incr | increment to next contour; must be > 0 |
| [in] | outdepth | either 1 or depth of pixs |
Notes:
(1) The output can be either 1 bpp, showing just the contour
lines, or a copy of the input pixs with the contour lines
superposed.
Definition at line 2561 of file graphics.c.
References GET_DATA_BYTE, GET_DATA_TWO_BYTES, SET_DATA_BIT, SET_DATA_BYTE, and SET_DATA_TWO_BYTES.
| l_ok pixRenderGridArb | ( | PIX * | pix, |
| l_int32 | nx, | ||
| l_int32 | ny, | ||
| l_int32 | width, | ||
| l_uint8 | rval, | ||
| l_uint8 | gval, | ||
| l_uint8 | bval ) |
| [in] | pix | any depth, cmapped ok |
| [in] | nx,ny | number of rectangles in each direction |
| [in] | width | thickness of grid lines |
| [in] | rval,gval,bval |
Definition at line 2299 of file graphics.c.
References generatePtaGrid(), and pixRenderPtaArb().
| l_ok pixRenderHashBox | ( | PIX * | pix, |
| BOX * | box, | ||
| l_int32 | spacing, | ||
| l_int32 | width, | ||
| l_int32 | orient, | ||
| l_int32 | outline, | ||
| l_int32 | op ) |
| [in] | pix | any depth, not cmapped |
| [in] | box | |
| [in] | spacing | spacing between lines; must be > 1 |
| [in] | width | thickness of box and hash lines |
| [in] | orient | orientation of lines: L_HORIZONTAL_LINE, ... |
| [in] | outline | 0 to skip drawing box outline |
| [in] | op | one of L_SET_PIXELS, L_CLEAR_PIXELS, L_FLIP_PIXELS |
Definition at line 1798 of file graphics.c.
References generatePtaHashBox(), L_CLEAR_PIXELS, L_FLIP_PIXELS, L_HORIZONTAL_LINE, L_NEG_SLOPE_LINE, L_POS_SLOPE_LINE, L_SET_PIXELS, L_VERTICAL_LINE, and pixRenderPta().
| l_ok pixRenderHashBoxa | ( | PIX * | pix, |
| BOXA * | boxa, | ||
| l_int32 | spacing, | ||
| l_int32 | width, | ||
| l_int32 | orient, | ||
| l_int32 | outline, | ||
| l_int32 | op ) |
| [in] | pix | any depth, not cmapped |
| [in] | boxa | |
| [in] | spacing | spacing between lines; must be > 1 |
| [in] | width | thickness of box and hash lines |
| [in] | orient | orientation of lines: L_HORIZONTAL_LINE, L_POS_SLOPE_LINE, L_VERTICAL_LINE, L_NEG_SLOPE_LINE |
| [in] | outline | 0 to skip drawing box outline |
| [in] | op | one of L_SET_PIXELS, L_CLEAR_PIXELS, L_FLIP_PIXELS |
Definition at line 2022 of file graphics.c.
References generatePtaHashBoxa(), L_CLEAR_PIXELS, L_FLIP_PIXELS, L_HORIZONTAL_LINE, L_NEG_SLOPE_LINE, L_POS_SLOPE_LINE, L_SET_PIXELS, L_VERTICAL_LINE, and pixRenderPta().
| l_ok pixRenderHashBoxaArb | ( | PIX * | pix, |
| BOXA * | boxa, | ||
| l_int32 | spacing, | ||
| l_int32 | width, | ||
| l_int32 | orient, | ||
| l_int32 | outline, | ||
| l_int32 | rval, | ||
| l_int32 | gval, | ||
| l_int32 | bval ) |
| [in] | pix | any depth; cmapped ok |
| [in] | box | |
| [in] | spacing | spacing between lines; must be > 1 |
| [in] | width | thickness of box and hash lines |
| [in] | orient | orientation of lines: L_HORIZONTAL_LINE, L_POS_SLOPE_LINE, L_VERTICAL_LINE, L_NEG_SLOPE_LINE |
| [in] | outline | 0 to skip drawing box outline |
| [in] | rval,gval,bval |
Definition at line 2072 of file graphics.c.
References generatePtaHashBoxa(), L_HORIZONTAL_LINE, L_NEG_SLOPE_LINE, L_POS_SLOPE_LINE, L_VERTICAL_LINE, and pixRenderPtaArb().
| l_ok pixRenderHashBoxaBlend | ( | PIX * | pix, |
| BOXA * | boxa, | ||
| l_int32 | spacing, | ||
| l_int32 | width, | ||
| l_int32 | orient, | ||
| l_int32 | outline, | ||
| l_int32 | rval, | ||
| l_int32 | gval, | ||
| l_int32 | bval, | ||
| l_float32 | fract ) |
| [in] | pix | 32 bpp rgb |
| [in] | boxa | |
| [in] | spacing | spacing between lines; must be > 1 |
| [in] | width | thickness of box and hash lines |
| [in] | orient | orientation of lines: L_HORIZONTAL_LINE, L_POS_SLOPE_LINE, L_VERTICAL_LINE, L_NEG_SLOPE_LINE |
| [in] | outline | 0 to skip drawing box outline |
| [in] | rval,gval,bval | |
| [in] | fract | in [0.0 - 1.0]: 1.0 is no transparency; 0.0 is complete transparency (no effect) |
Definition at line 2124 of file graphics.c.
References generatePtaHashBoxa(), L_HORIZONTAL_LINE, L_NEG_SLOPE_LINE, L_POS_SLOPE_LINE, L_VERTICAL_LINE, and pixRenderPtaBlend().
| l_ok pixRenderHashBoxArb | ( | PIX * | pix, |
| BOX * | box, | ||
| l_int32 | spacing, | ||
| l_int32 | width, | ||
| l_int32 | orient, | ||
| l_int32 | outline, | ||
| l_int32 | rval, | ||
| l_int32 | gval, | ||
| l_int32 | bval ) |
| [in] | pix | any depth; cmapped ok |
| [in] | box | |
| [in] | spacing | spacing between lines; must be > 1 |
| [in] | width | thickness of box and hash lines |
| [in] | orient | orientation of lines: L_HORIZONTAL_LINE, ... |
| [in] | outline | 0 to skip drawing box outline |
| [in] | rval,gval,bval |
Definition at line 1846 of file graphics.c.
References generatePtaHashBox(), L_HORIZONTAL_LINE, L_NEG_SLOPE_LINE, L_POS_SLOPE_LINE, L_VERTICAL_LINE, and pixRenderPtaArb().
| l_ok pixRenderHashBoxBlend | ( | PIX * | pix, |
| BOX * | box, | ||
| l_int32 | spacing, | ||
| l_int32 | width, | ||
| l_int32 | orient, | ||
| l_int32 | outline, | ||
| l_int32 | rval, | ||
| l_int32 | gval, | ||
| l_int32 | bval, | ||
| l_float32 | fract ) |
| [in] | pix | 32 bpp |
| [in] | box | |
| [in] | spacing | spacing between lines; must be > 1 |
| [in] | width | thickness of box and hash lines |
| [in] | orient | orientation of lines: L_HORIZONTAL_LINE, ... |
| [in] | outline | 0 to skip drawing box outline |
| [in] | rval,gval,bval | |
| [in] | fract | in [0.0 - 1.0]: 1.0 is no transparency; 0.0 is complete transparency (no effect) |
Definition at line 1896 of file graphics.c.
References generatePtaHashBox(), L_HORIZONTAL_LINE, L_NEG_SLOPE_LINE, L_POS_SLOPE_LINE, L_VERTICAL_LINE, and pixRenderPtaBlend().
| l_ok pixRenderHashMaskArb | ( | PIX * | pix, |
| PIX * | pixm, | ||
| l_int32 | x, | ||
| l_int32 | y, | ||
| l_int32 | spacing, | ||
| l_int32 | width, | ||
| l_int32 | orient, | ||
| l_int32 | outline, | ||
| l_int32 | rval, | ||
| l_int32 | gval, | ||
| l_int32 | bval ) |
| [in] | pix | any depth; cmapped ok |
| [in] | pixm | 1 bpp clipping mask for hash marks |
| [in] | x,y | UL corner of pixm with respect to pix |
| [in] | spacing | spacing between lines; must be > 1 |
| [in] | width | thickness of box and hash lines |
| [in] | orient | orientation of lines: L_HORIZONTAL_LINE, L_POS_SLOPE_LINE, L_VERTICAL_LINE, L_NEG_SLOPE_LINE |
| [in] | outline | 0 to skip drawing box outline |
| [in] | rval,gval,bval |
Notes:
(1) This is an in-place operation that renders hash lines
through a mask pixm onto pix. The mask origin is
translated by (x,y) relative to the origin of pix.
Definition at line 1954 of file graphics.c.
References generatePtaHashBox(), L_HORIZONTAL_LINE, L_NEG_SLOPE_LINE, L_POS_SLOPE_LINE, L_VERTICAL_LINE, PIX_SRC, and pixRenderPtaArb().
| l_ok pixRenderLine | ( | PIX * | pix, |
| l_int32 | x1, | ||
| l_int32 | y1, | ||
| l_int32 | x2, | ||
| l_int32 | y2, | ||
| l_int32 | width, | ||
| l_int32 | op ) |
| [in] | pix | any depth, not cmapped |
| [in] | x1,y1 | |
| [in] | x2,y2 | |
| [in] | width | thickness of line |
| [in] | op | one of L_SET_PIXELS, L_CLEAR_PIXELS, L_FLIP_PIXELS |
Definition at line 1456 of file graphics.c.
References generatePtaWideLine(), L_CLEAR_PIXELS, L_FLIP_PIXELS, L_SET_PIXELS, and pixRenderPta().
| l_ok pixRenderLineArb | ( | PIX * | pix, |
| l_int32 | x1, | ||
| l_int32 | y1, | ||
| l_int32 | x2, | ||
| l_int32 | y2, | ||
| l_int32 | width, | ||
| l_uint8 | rval, | ||
| l_uint8 | gval, | ||
| l_uint8 | bval ) |
| [in] | pix | any depth, cmapped ok |
| [in] | x1,y1 | |
| [in] | x2,y2 | |
| [in] | width | thickness of line |
| [in] | rval,gval,bval |
Definition at line 1494 of file graphics.c.
References generatePtaWideLine(), and pixRenderPtaArb().
| l_ok pixRenderLineBlend | ( | PIX * | pix, |
| l_int32 | x1, | ||
| l_int32 | y1, | ||
| l_int32 | x2, | ||
| l_int32 | y2, | ||
| l_int32 | width, | ||
| l_uint8 | rval, | ||
| l_uint8 | gval, | ||
| l_uint8 | bval, | ||
| l_float32 | fract ) |
| [in] | pix | 32 bpp rgb |
| [in] | x1,y1 | |
| [in] | x2,y2 | |
| [in] | width | thickness of line |
| [in] | rval,gval,bval | |
| [in] | fract |
Definition at line 1533 of file graphics.c.
References generatePtaWideLine(), and pixRenderPtaBlend().
| l_ok pixRenderPlotFromNuma | ( | PIX ** | ppix, |
| NUMA * | na, | ||
| l_int32 | plotloc, | ||
| l_int32 | linewidth, | ||
| l_int32 | max, | ||
| l_uint32 | color ) |
| [in,out] | ppix | any type; replaced if not 32 bpp rgb |
| [in] | na | to be plotted |
| [in] | plotloc | location of plot: L_PLOT_AT_TOP, etc |
| [in] | linewidth | width of "line" that is drawn; between 1 and 7 |
| [in] | max | maximum excursion in pixels from baseline |
| [in] | color | plot color: 0xrrggbb00 |
Notes:
(1) Simplified interface for plotting row or column aligned data
on a pix.
(2) This replaces pix with a 32 bpp rgb version if it is not
already 32 bpp. It then draws the plot on the pix.
(3) See makePlotPtaFromNumaGen() for more details.
Definition at line 946 of file graphics.c.
References L_PLOT_AT_BOT, L_PLOT_AT_MID_HORIZ, L_PLOT_AT_TOP, makePlotPtaFromNuma(), and pixRenderPtaArb().
| l_ok pixRenderPlotFromNumaGen | ( | PIX ** | ppix, |
| NUMA * | na, | ||
| l_int32 | orient, | ||
| l_int32 | linewidth, | ||
| l_int32 | refpos, | ||
| l_int32 | max, | ||
| l_int32 | drawref, | ||
| l_uint32 | color ) |
| [in,out] | ppix | any type; replaced if not 32 bpp rgb |
| [in] | na | to be plotted |
| [in] | orient | L_HORIZONTAL_LINE, L_VERTICAL_LINE |
| [in] | linewidth | width of "line" that is drawn; between 1 and 7 |
| [in] | refpos | reference position: y for horizontal; x for vertical |
| [in] | max | maximum excursion in pixels from baseline |
| [in] | drawref | 1 to draw the reference line and its normal |
| [in] | color | plot color: 0xrrggbb00 |
Notes:
(1) General interface for plotting row or column aligned data
on a pix.
(2) This replaces pix with a 32 bpp rgb version if it is not
already 32 bpp. It then draws the plot on the pix.
(3) See makePlotPtaFromNumaGen() for other input parameters.
Definition at line 1058 of file graphics.c.
References makePlotPtaFromNumaGen(), and pixRenderPtaArb().
| [in] | ptas | of vertices, none repeated |
| [in] | width | of polygon outline |
| [out] | pxmin | [optional] min x value of input pts |
| [out] | pymin | [optional] min y value of input pts |
Notes:
(1) The pix is the minimum size required to contain the origin
and the polygon. For example, the max x value of the input
points is w - 1, where w is the pix width.
(2) The rendered line is 4-connected, so that an interior or
exterior 8-c.c. flood fill operation works properly.
Definition at line 2424 of file graphics.c.
References convertPtaLineTo4cc(), generatePtaPolyline(), L_SET_PIXELS, and pixRenderPolyline().
| [in] | pix | any depth, not cmapped |
| [in] | ptas | |
| [in] | width | thickness of line |
| [in] | op | one of L_SET_PIXELS, L_CLEAR_PIXELS, L_FLIP_PIXELS |
| [in] | closeflag | 1 to close the contour; 0 otherwise |
Notes:
This renders a closed contour.
Definition at line 2176 of file graphics.c.
References generatePtaPolyline(), L_CLEAR_PIXELS, L_FLIP_PIXELS, L_SET_PIXELS, and pixRenderPta().
Referenced by pixRenderPolygon().
| l_ok pixRenderPolylineArb | ( | PIX * | pix, |
| PTA * | ptas, | ||
| l_int32 | width, | ||
| l_uint8 | rval, | ||
| l_uint8 | gval, | ||
| l_uint8 | bval, | ||
| l_int32 | closeflag ) |
| [in] | pix | any depth; cmapped ok |
| [in] | ptas | |
| [in] | width | thickness of line |
| [in] | rval,gval,bval | |
| [in] | closeflag | 1 to close the contour; 0 otherwise |
Notes:
This renders a closed contour.
Definition at line 2219 of file graphics.c.
References generatePtaPolyline(), and pixRenderPtaArb().
| l_ok pixRenderPolylineBlend | ( | PIX * | pix, |
| PTA * | ptas, | ||
| l_int32 | width, | ||
| l_uint8 | rval, | ||
| l_uint8 | gval, | ||
| l_uint8 | bval, | ||
| l_float32 | fract, | ||
| l_int32 | closeflag, | ||
| l_int32 | removedups ) |
| [in] | pix | 32 bpp rgb |
| [in] | ptas | |
| [in] | width | thickness of line |
| [in] | rval,gval,bval | |
| [in] | fract | in [0.0 - 1.0]: 1.0 is no transparency; 0.0 is complete transparency (no effect) |
| [in] | closeflag | 1 to close the contour; 0 otherwise |
| [in] | removedups | 1 to remove; 0 otherwise |
Definition at line 2260 of file graphics.c.
References generatePtaPolyline(), and pixRenderPtaBlend().
| [in] | pix | any depth, not cmapped |
| [in] | pta | arbitrary set of points |
| [in] | op | one of L_SET_PIXELS, L_CLEAR_PIXELS, L_FLIP_PIXELS |
Notes:
(1) L_SET_PIXELS puts all image bits in each pixel to 1
(black for 1 bpp; white for depth > 1)
(2) L_CLEAR_PIXELS puts all image bits in each pixel to 0
(white for 1 bpp; black for depth > 1)
(3) L_FLIP_PIXELS reverses all image bits in each pixel
(4) This function clips the rendering to the pix. It performs
clipping for functions such as pixRenderLine(),
pixRenderBox() and pixRenderBoxa(), that call pixRenderPta().
Definition at line 1233 of file graphics.c.
References L_CLEAR_PIXELS, L_FLIP_PIXELS, and L_SET_PIXELS.
Referenced by pixRenderBox(), pixRenderBoxa(), pixRenderHashBox(), pixRenderHashBoxa(), pixRenderLine(), pixRenderPolyline(), and pixRenderPtaArb().
| [in] | pix | any depth, cmapped ok |
| [in] | pta | arbitrary set of points |
| [in] | rval,gval,bval |
Notes:
(1) If pix is colormapped, render this color (or the nearest
color if the cmap is full) on each pixel.
(2) The rgb components have the standard dynamic range [0 ... 255]
(3) If pix is not colormapped, do the best job you can using
the input colors:
~ d = 1: set the pixels
~ d = 2, 4, 8: average the input rgb value
~ d = 32: use the input rgb value
(4) This function clips the rendering to pix.
Definition at line 1320 of file graphics.c.
References L_SET_PIXELS, and pixRenderPta().
Referenced by pixRenderBoxaArb(), pixRenderBoxArb(), pixRenderGridArb(), pixRenderHashBoxaArb(), pixRenderHashBoxArb(), pixRenderHashMaskArb(), pixRenderLineArb(), pixRenderPlotFromNuma(), pixRenderPlotFromNumaGen(), pixRenderPolylineArb(), and pixRenderRandomCmapPtaa().
| l_ok pixRenderPtaBlend | ( | PIX * | pix, |
| PTA * | pta, | ||
| l_uint8 | rval, | ||
| l_uint8 | gval, | ||
| l_uint8 | bval, | ||
| l_float32 | fract ) |
| [in] | pix | 32 bpp rgb |
| [in] | pta | arbitrary set of points |
| [in] | rval,gval,bval | |
| [in] | fract |
Notes:
(1) This function clips the rendering to pix.
Definition at line 1393 of file graphics.c.
References COLOR_BLUE, COLOR_GREEN, COLOR_RED, and GET_DATA_BYTE.
Referenced by pixRenderBoxaBlend(), pixRenderBoxBlend(), pixRenderHashBoxaBlend(), pixRenderHashBoxBlend(), pixRenderLineBlend(), and pixRenderPolylineBlend().
| PIX * pixRenderRandomCmapPtaa | ( | PIX * | pix, |
| PTAA * | ptaa, | ||
| l_int32 | polyflag, | ||
| l_int32 | width, | ||
| l_int32 | closeflag ) |
| [in] | pix | 1, 2, 4, 8, 16, 32 bpp |
| [in] | ptaa | |
| [in] | polyflag | 1 to interpret each Pta as a polyline; 0 to simply render the Pta as a set of pixels |
| [in] | width | thickness of line; use only for polyline |
| [in] | closeflag | 1 to close the contour; 0 otherwise; use only for polyline mode |
Notes:
(1) This is a debugging routine, that displays a set of
pixels, selected by the set of Ptas in a Ptaa,
in a random color in a pix.
(2) If polyflag == 1, each Pta is considered to be a polyline,
and is rendered using width and closeflag. Each polyline
is rendered in a random color.
(3) If polyflag == 0, all points in each Pta are rendered in a
random color. The width and closeflag parameters are ignored.
(4) The output pix is 8 bpp and colormapped. Up to 254
different, randomly selected colors, can be used.
(5) The rendered pixels replace the input pixels. They will
be clipped silently to the input pix.
Definition at line 2357 of file graphics.c.
References generatePtaPolyline(), L_CLONE, and pixRenderPtaArb().