Leptonica  1.82.0
Image processing and image analysis suite
graphics.c File Reference
#include <string.h>
#include <math.h>
#include "allheaders.h"

Go to the source code of this file.

Functions

PTAgeneratePtaLine (l_int32 x1, l_int32 y1, l_int32 x2, l_int32 y2)
 
PTAgeneratePtaWideLine (l_int32 x1, l_int32 y1, l_int32 x2, l_int32 y2, l_int32 width)
 
PTAgeneratePtaBox (BOX *box, l_int32 width)
 
PTAgeneratePtaBoxa (BOXA *boxa, l_int32 width, l_int32 removedups)
 
PTAgeneratePtaHashBox (BOX *box, l_int32 spacing, l_int32 width, l_int32 orient, l_int32 outline)
 
PTAgeneratePtaHashBoxa (BOXA *boxa, l_int32 spacing, l_int32 width, l_int32 orient, l_int32 outline, l_int32 removedups)
 
PTAAgeneratePtaaBoxa (BOXA *boxa)
 
PTAAgeneratePtaaHashBoxa (BOXA *boxa, l_int32 spacing, l_int32 width, l_int32 orient, l_int32 outline)
 
PTAgeneratePtaPolyline (PTA *ptas, l_int32 width, l_int32 closeflag, l_int32 removedups)
 
PTAgeneratePtaGrid (l_int32 w, l_int32 h, l_int32 nx, l_int32 ny, l_int32 width)
 
PTAconvertPtaLineTo4cc (PTA *ptas)
 
PTAgeneratePtaFilledCircle (l_int32 radius)
 
PTAgeneratePtaFilledSquare (l_int32 side)
 
PTAgeneratePtaLineFromPt (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)
 
PTAmakePlotPtaFromNuma (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)
 
PTAmakePlotPtaFromNumaGen (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)
 
PIXpixRenderRandomCmapPtaa (PIX *pix, PTAA *ptaa, l_int32 polyflag, l_int32 width, l_int32 closeflag)
 
PIXpixRenderPolygon (PTA *ptas, l_int32 width, l_int32 *pxmin, l_int32 *pymin)
 
PIXpixFillPolygon (PIX *pixs, PTA *pta, l_int32 xmin, l_int32 ymin)
 
PIXpixRenderContours (PIX *pixs, l_int32 startval, l_int32 incr, l_int32 outdepth)
 
PIXfpixAutoRenderContours (FPIX *fpix, l_int32 ncontours)
 
PIXfpixRenderContours (FPIX *fpixs, l_float32 incr, l_float32 proxim)
 
PTApixGeneratePtaBoundary (PIX *pixs, l_int32 width)
 

Detailed Description


     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.

Function Documentation

◆ convertPtaLineTo4cc()

PTA* convertPtaLineTo4cc ( PTA ptas)

convertPtaLineTo4cc()

Parameters
[in]ptas8-connected line of points
Returns
ptad 4-connected line, or NULL on error
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 790 of file graphics.c.

References ptaAddPt(), ptaCreate(), ptaGetCount(), and ptaGetIPt().

Referenced by pixRenderPolygon().

◆ fpixAutoRenderContours()

PIX* fpixAutoRenderContours ( FPIX fpix,
l_int32  ncontours 
)

fpixAutoRenderContours()

Parameters
[in]fpix
[in]ncontoursin [2 ... 500]; typically about 50
Returns
pixd 8 bpp, or NULL on error
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 2773 of file graphics.c.

References fpixGetMax(), fpixGetMin(), and fpixRenderContours().

◆ fpixRenderContours()

PIX* fpixRenderContours ( FPIX fpixs,
l_float32  incr,
l_float32  proxim 
)

fpixRenderContours()

Parameters
[in]fpixs
[in]incrincrement between contours; must be > 0.0
[in]proximrequired proximity to target value; default 0.15
Returns
pixd 8 bpp, or NULL on error
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 2811 of file graphics.c.

References fpixGetData(), fpixGetDimensions(), fpixGetWpl(), pixcmapAddColor(), pixcmapCreate(), pixCreate(), pixGetData(), and pixSetColormap().

Referenced by dewarpaShowArrays(), dewarpDebug(), and fpixAutoRenderContours().

◆ generatePtaaBoxa()

PTAA* generatePtaaBoxa ( BOXA boxa)

generatePtaaBoxa()

Parameters
[in]boxa
Returns
ptaa, or NULL on error
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 573 of file graphics.c.

References boxaGetBox(), boxaGetCount(), boxDestroy(), boxGetGeometry(), L_CLONE, L_INSERT, ptaaAddPta(), ptaaCreate(), ptaAddPt(), and ptaCreate().

◆ generatePtaaHashBoxa()

PTAA* generatePtaaHashBoxa ( BOXA boxa,
l_int32  spacing,
l_int32  width,
l_int32  orient,
l_int32  outline 
)

generatePtaaHashBoxa()

Parameters
[in]boxa
[in]spacingspacing between hash lines; must be > 1
[in]widthhash line width
[in]orientorientation of lines: L_HORIZONTAL_LINE, L_POS_SLOPE_LINE, L_VERTICAL_LINE, L_NEG_SLOPE_LINE
[in]outline0 to skip drawing box outline
Returns
ptaa, or NULL on error
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 626 of file graphics.c.

References boxaGetBox(), boxaGetCount(), boxDestroy(), generatePtaHashBox(), L_CLONE, L_HORIZONTAL_LINE, L_INSERT, L_NEG_SLOPE_LINE, L_POS_SLOPE_LINE, L_VERTICAL_LINE, ptaaAddPta(), and ptaaCreate().

◆ generatePtaBox()

PTA* generatePtaBox ( BOX box,
l_int32  width 
)

generatePtaBox()

Parameters
[in]box
[in]widthof line
Returns
ptad, or NULL on error
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 276 of file graphics.c.

References boxGetGeometry(), generatePtaWideLine(), ptaCreate(), ptaDestroy(), and ptaJoin().

Referenced by generatePtaBoxa(), generatePtaHashBox(), pixRenderBox(), pixRenderBoxArb(), and pixRenderBoxBlend().

◆ generatePtaBoxa()

PTA* generatePtaBoxa ( BOXA boxa,
l_int32  width,
l_int32  removedups 
)

generatePtaBoxa()

Parameters
[in]boxa
[in]width
[in]removedups1 to remove, 0 to leave
Returns
ptad, or NULL on error
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 353 of file graphics.c.

References boxaGetBox(), boxaGetCount(), boxDestroy(), generatePtaBox(), L_CLONE, ptaClone(), ptaCreate(), ptaDestroy(), ptaJoin(), and ptaRemoveDupsByAset().

Referenced by generatePtaGrid(), pixRenderBoxa(), pixRenderBoxaArb(), and pixRenderBoxaBlend().

◆ generatePtaFilledCircle()

PTA* generatePtaFilledCircle ( l_int32  radius)

generatePtaFilledCircle()

Parameters
[in]radius
Returns
pta, or NULL on error
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 833 of file graphics.c.

References ptaAddPt(), and ptaCreate().

Referenced by dewarpFindVertDisparity(), makePlotPtaFromNumaGen(), pixRenderHorizEndPoints(), and selDisplayInPix().

◆ generatePtaFilledSquare()

PTA* generatePtaFilledSquare ( l_int32  side)

generatePtaFilledSquare()

Parameters
[in]side
Returns
pta, or NULL on error
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 873 of file graphics.c.

References ptaAddPt(), and ptaCreate().

Referenced by makePlotPtaFromNumaGen().

◆ generatePtaGrid()

PTA* generatePtaGrid ( l_int32  w,
l_int32  h,
l_int32  nx,
l_int32  ny,
l_int32  width 
)

generatePtaGrid()

Parameters
[in]w,hof region where grid will be displayed
[in]nx,nynumber of rectangles in each direction in grid
[in]widthof rendered lines
Returns
ptad, or NULL on error

Definition at line 732 of file graphics.c.

References boxaAddBox(), boxaCreate(), boxaDestroy(), boxCreate(), generatePtaBoxa(), and L_INSERT.

Referenced by pixRenderGridArb().

◆ generatePtaHashBox()

PTA* generatePtaHashBox ( BOX box,
l_int32  spacing,
l_int32  width,
l_int32  orient,
l_int32  outline 
)

generatePtaHashBox()

Parameters
[in]box
[in]spacingspacing between lines; must be > 1
[in]widthof line
[in]orientorientation of lines: L_HORIZONTAL_LINE, L_POS_SLOPE_LINE, L_VERTICAL_LINE, L_NEG_SLOPE_LINE
[in]outline0 to skip drawing box outline
Returns
ptad, or NULL on error
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 410 of file graphics.c.

References boxGetGeometry(), boxIntersectByLine(), generatePtaBox(), generatePtaWideLine(), L_HORIZONTAL_LINE, L_NEG_SLOPE_LINE, L_POS_SLOPE_LINE, L_VERTICAL_LINE, ptaCreate(), ptaDestroy(), and ptaJoin().

Referenced by generatePtaaHashBoxa(), generatePtaHashBoxa(), pixRenderHashBox(), pixRenderHashBoxArb(), and pixRenderHashBoxBlend().

◆ generatePtaHashBoxa()

PTA* generatePtaHashBoxa ( BOXA boxa,
l_int32  spacing,
l_int32  width,
l_int32  orient,
l_int32  outline,
l_int32  removedups 
)

generatePtaHashBoxa()

Parameters
[in]boxa
[in]spacingspacing between lines; must be > 1
[in]widthof line
[in]orientorientation of lines: L_HORIZONTAL_LINE, ...
[in]orientorientation of lines: L_HORIZONTAL_LINE, L_POS_SLOPE_LINE, L_VERTICAL_LINE, L_NEG_SLOPE_LINE
[in]outline0 to skip drawing box outline
[in]removedups1 to remove, 0 to leave
Returns
ptad, or NULL on error
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 513 of file graphics.c.

References boxaGetBox(), boxaGetCount(), boxDestroy(), generatePtaHashBox(), L_CLONE, L_HORIZONTAL_LINE, L_NEG_SLOPE_LINE, L_POS_SLOPE_LINE, L_VERTICAL_LINE, ptaClone(), ptaCreate(), ptaDestroy(), ptaJoin(), and ptaRemoveDupsByAset().

Referenced by pixRenderHashBoxa(), pixRenderHashBoxaArb(), and pixRenderHashBoxaBlend().

◆ generatePtaLine()

PTA* generatePtaLine ( l_int32  x1,
l_int32  y1,
l_int32  x2,
l_int32  y2 
)

generatePtaLine()

Parameters
[in]x1,y1end point 1
[in]x2,y2end point 2
Returns
pta, or NULL on error
Notes:
     (1) Uses Bresenham line drawing, which results in an 8-connected line.

Definition at line 141 of file graphics.c.

References ptaAddPt(), and ptaCreate().

Referenced by generatePtaLineFromPt(), generatePtaWideLine(), and makePlotPtaFromNumaGen().

◆ generatePtaLineFromPt()

PTA* generatePtaLineFromPt ( l_int32  x,
l_int32  y,
l_float64  length,
l_float64  radang 
)

generatePtaLineFromPt()

Parameters
[in]x,ypoint of origination
[in]lengthof line, including starting point
[in]radangangle in radians, CW from horizontal
Returns
pta, or NULL on error
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 907 of file graphics.c.

References generatePtaLine().

Referenced by selaAddCrossJunctions(), and selaAddTJunctions().

◆ generatePtaPolyline()

PTA* generatePtaPolyline ( PTA ptas,
l_int32  width,
l_int32  closeflag,
l_int32  removedups 
)

generatePtaPolyline()

Parameters
[in]ptasvertices of polyline
[in]width
[in]closeflag1 to close the contour; 0 otherwise
[in]removedups1 to remove, 0 to leave
Returns
ptad, or NULL on error

Definition at line 674 of file graphics.c.

References generatePtaWideLine(), ptaClone(), ptaCreate(), ptaDestroy(), ptaGetCount(), ptaGetIPt(), ptaJoin(), and ptaRemoveDupsByAset().

Referenced by pixRenderPolygon(), pixRenderPolyline(), pixRenderPolylineArb(), pixRenderPolylineBlend(), and pixRenderRandomCmapPtaa().

◆ generatePtaWideLine()

PTA* generatePtaWideLine ( l_int32  x1,
l_int32  y1,
l_int32  x2,
l_int32  y2,
l_int32  width 
)

generatePtaWideLine()

Parameters
[in]x1,y1end point 1
[in]x2,y2end point 2
[in]width
Returns
ptaj, or NULL on error

Definition at line 206 of file graphics.c.

References generatePtaLine(), ptaDestroy(), and ptaJoin().

Referenced by generatePtaBox(), generatePtaHashBox(), generatePtaPolyline(), pixRenderLine(), pixRenderLineArb(), and pixRenderLineBlend().

◆ locatePtRadially()

l_ok locatePtRadially ( l_int32  xr,
l_int32  yr,
l_float64  dist,
l_float64  radang,
l_float64 *  px,
l_float64 *  py 
)

locatePtRadially()

Parameters
[in]xr,yrreference point
[in]radangangle in radians, CW from horizontal
[in]distdistance of point from reference point along line given by the specified angle
[out]px,pylocation of point
Returns
0 if OK, 1 on error

Definition at line 931 of file graphics.c.

◆ makePlotPtaFromNuma()

PTA* makePlotPtaFromNuma ( NUMA na,
l_int32  size,
l_int32  plotloc,
l_int32  linewidth,
l_int32  max 
)

makePlotPtaFromNuma()

Parameters
[in]na
[in]sizepix height for horizontal plot; pix width for vertical plot
[in]plotloclocation of plot: L_PLOT_AT_TOP, etc
[in]linewidthwidth of "line" that is drawn; between 1 and 7
[in]maxmaximum excursion in pixels from baseline
Returns
ptad, or NULL on error
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 1032 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().

◆ makePlotPtaFromNumaGen()

PTA* makePlotPtaFromNumaGen ( NUMA na,
l_int32  orient,
l_int32  linewidth,
l_int32  refpos,
l_int32  max,
l_int32  drawref 
)

makePlotPtaFromNumaGen()

Parameters
[in]na
[in]orientL_HORIZONTAL_LINE, L_VERTICAL_LINE
[in]linewidthwidth of "line" that is drawn; between 1 and 7
[in]refposreference position: y for horizontal; x for vertical
[in]maxmaximum excursion in pixels from baseline
[in]drawref1 to draw the reference line and its normal
Returns
ptad, or NULL on error
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 1155 of file graphics.c.

References generatePtaFilledCircle(), generatePtaFilledSquare(), generatePtaLine(), L_HORIZONTAL_LINE, L_VERTICAL_LINE, numaGetCount(), numaGetFValue(), numaGetMax(), numaGetMin(), numaGetParameters(), ptaAddPt(), ptaClone(), ptaCreate(), ptaDestroy(), ptaJoin(), and ptaReplicatePattern().

Referenced by makePlotPtaFromNuma(), and pixRenderPlotFromNumaGen().

◆ pixFillPolygon()

PIX* pixFillPolygon ( PIX pixs,
PTA pta,
l_int32  xmin,
l_int32  ymin 
)

pixFillPolygon()

Parameters
[in]pixs1 bpp, with 4-connected polygon outline
[in]ptavertices of the polygon
[in]xmin,yminmin values of vertices of polygon
Returns
pixd with outline filled, or NULL on error
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 2561 of file graphics.c.

◆ pixGeneratePtaBoundary()

PTA* pixGeneratePtaBoundary ( PIX pixs,
l_int32  width 
)

pixGeneratePtaBoundary()

Parameters
[in]pixs1 bpp
[in]widthof boundary line
Returns
pta, or NULL on error
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 2890 of file graphics.c.

◆ pixRenderBox()

l_ok pixRenderBox ( PIX pix,
BOX box,
l_int32  width,
l_int32  op 
)

pixRenderBox()

Parameters
[in]pixany depth, not cmapped
[in]box
[in]widththickness of box lines
[in]opone of L_SET_PIXELS, L_CLEAR_PIXELS, L_FLIP_PIXELS
Returns
0 if OK, 1 on error

Definition at line 1617 of file graphics.c.

References generatePtaBox(), L_CLEAR_PIXELS, L_FLIP_PIXELS, L_SET_PIXELS, pixRenderPta(), and ptaDestroy().

◆ pixRenderBoxa()

l_ok pixRenderBoxa ( PIX pix,
BOXA boxa,
l_int32  width,
l_int32  op 
)

pixRenderBoxa()

Parameters
[in]pixany depth, not cmapped
[in]boxa
[in]widththickness of line
[in]opone of L_SET_PIXELS, L_CLEAR_PIXELS, L_FLIP_PIXELS
Returns
0 if OK, 1 on error

Definition at line 1734 of file graphics.c.

References generatePtaBoxa(), L_CLEAR_PIXELS, L_FLIP_PIXELS, L_SET_PIXELS, pixRenderPta(), and ptaDestroy().

◆ pixRenderBoxaArb()

l_ok pixRenderBoxaArb ( PIX pix,
BOXA boxa,
l_int32  width,
l_uint8  rval,
l_uint8  gval,
l_uint8  bval 
)

pixRenderBoxaArb()

Parameters
[in]pixany depth; colormapped is ok
[in]boxa
[in]widththickness of line
[in]rval,gval,bval
Returns
0 if OK, 1 on error

Definition at line 1772 of file graphics.c.

References generatePtaBoxa(), pixRenderPtaArb(), and ptaDestroy().

Referenced by boxaCombineOverlaps(), and boxaCombineOverlapsInPair().

◆ pixRenderBoxaBlend()

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 
)

pixRenderBoxaBlend()

Parameters
[in]pix32 bpp rgb
[in]boxa
[in]widththickness of line
[in]rval,gval,bval
[in]fractin [0.0 - 1.0]: 1.0 is no transparency; 0.0 is complete transparency (no effect)
[in]removedups1 to remove; 0 otherwise
Returns
0 if OK, 1 on error

Definition at line 1813 of file graphics.c.

References generatePtaBoxa(), pixRenderPtaBlend(), and ptaDestroy().

◆ pixRenderBoxArb()

l_ok pixRenderBoxArb ( PIX pix,
BOX box,
l_int32  width,
l_uint8  rval,
l_uint8  gval,
l_uint8  bval 
)

pixRenderBoxArb()

Parameters
[in]pixany depth, cmapped ok
[in]box
[in]widththickness of box lines
[in]rval,gval,bval
Returns
0 if OK, 1 on error

Definition at line 1655 of file graphics.c.

References generatePtaBox(), pixRenderPtaArb(), and ptaDestroy().

Referenced by boxaDisplayTiled(), pixaDisplayBoxaa(), pixCompareGrayByHisto(), recogShowMatch(), and showExtractNumbers().

◆ pixRenderBoxBlend()

l_ok pixRenderBoxBlend ( PIX pix,
BOX box,
l_int32  width,
l_uint8  rval,
l_uint8  gval,
l_uint8  bval,
l_float32  fract 
)

pixRenderBoxBlend()

Parameters
[in]pix32 bpp rgb
[in]box
[in]widththickness of box lines
[in]rval,gval,bval
[in]fractin [0.0 - 1.0]: 1.0 is no transparency; 0.0 is complete transparency (no effect)
Returns
0 if OK, 1 on error

Definition at line 1695 of file graphics.c.

References generatePtaBox(), pixRenderPtaBlend(), and ptaDestroy().

◆ pixRenderContours()

PIX* pixRenderContours ( PIX pixs,
l_int32  startval,
l_int32  incr,
l_int32  outdepth 
)

pixRenderContours()

Parameters
[in]pixs8 or 16 bpp; no colormap
[in]startvalvalue of lowest contour; must be in [0 ... maxval]
[in]incrincrement to next contour; must be > 0
[in]outdeptheither 1 or depth of pixs
Returns
pixd, or NULL on error
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 2647 of file graphics.c.

◆ pixRenderGridArb()

l_ok pixRenderGridArb ( PIX pix,
l_int32  nx,
l_int32  ny,
l_int32  width,
l_uint8  rval,
l_uint8  gval,
l_uint8  bval 
)

pixRenderGridArb()

Parameters
[in]pixany depth, cmapped ok
[in]nx,nynumber of rectangles in each direction
[in]widththickness of grid lines
[in]rval,gval,bval
Returns
0 if OK, 1 on error

Definition at line 2377 of file graphics.c.

References generatePtaGrid(), pixGetDimensions(), pixRenderPtaArb(), and ptaDestroy().

◆ pixRenderHashBox()

l_ok pixRenderHashBox ( PIX pix,
BOX box,
l_int32  spacing,
l_int32  width,
l_int32  orient,
l_int32  outline,
l_int32  op 
)

pixRenderHashBox()

Parameters
[in]pixany depth, not cmapped
[in]box
[in]spacingspacing between lines; must be > 1
[in]widththickness of box and hash lines
[in]orientorientation of lines: L_HORIZONTAL_LINE, ...
[in]outline0 to skip drawing box outline
[in]opone of L_SET_PIXELS, L_CLEAR_PIXELS, L_FLIP_PIXELS
Returns
0 if OK, 1 on error

Definition at line 1856 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, pixRenderPta(), and ptaDestroy().

◆ pixRenderHashBoxa()

l_ok pixRenderHashBoxa ( PIX pix,
BOXA boxa,
l_int32  spacing,
l_int32  width,
l_int32  orient,
l_int32  outline,
l_int32  op 
)

pixRenderHashBoxa()

Parameters
[in]pixany depth, not cmapped
[in]boxa
[in]spacingspacing between lines; must be > 1
[in]widththickness of box and hash lines
[in]orientorientation of lines: L_HORIZONTAL_LINE, L_POS_SLOPE_LINE, L_VERTICAL_LINE, L_NEG_SLOPE_LINE
[in]outline0 to skip drawing box outline
[in]opone of L_SET_PIXELS, L_CLEAR_PIXELS, L_FLIP_PIXELS
Returns
0 if OK, 1 on error

Definition at line 2088 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, pixRenderPta(), and ptaDestroy().

◆ pixRenderHashBoxaArb()

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 
)

pixRenderHashBoxaArb()

Parameters
[in]pixany depth; cmapped ok
[in]box
[in]spacingspacing between lines; must be > 1
[in]widththickness of box and hash lines
[in]orientorientation of lines: L_HORIZONTAL_LINE, L_POS_SLOPE_LINE, L_VERTICAL_LINE, L_NEG_SLOPE_LINE
[in]outline0 to skip drawing box outline
[in]rval,gval,bval
Returns
0 if OK, 1 on error

Definition at line 2140 of file graphics.c.

References generatePtaHashBoxa(), L_HORIZONTAL_LINE, L_NEG_SLOPE_LINE, L_POS_SLOPE_LINE, L_VERTICAL_LINE, pixRenderPtaArb(), and ptaDestroy().

◆ pixRenderHashBoxaBlend()

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 
)

pixRenderHashBoxaBlend()

Parameters
[in]pix32 bpp rgb
[in]boxa
[in]spacingspacing between lines; must be > 1
[in]widththickness of box and hash lines
[in]orientorientation of lines: L_HORIZONTAL_LINE, L_POS_SLOPE_LINE, L_VERTICAL_LINE, L_NEG_SLOPE_LINE
[in]outline0 to skip drawing box outline
[in]rval,gval,bval
[in]fractin [0.0 - 1.0]: 1.0 is no transparency; 0.0 is complete transparency (no effect)
Returns
0 if OK, 1 on error

Definition at line 2194 of file graphics.c.

References generatePtaHashBoxa(), L_HORIZONTAL_LINE, L_NEG_SLOPE_LINE, L_POS_SLOPE_LINE, L_VERTICAL_LINE, pixRenderPtaBlend(), and ptaDestroy().

Referenced by boxaCompareRegions().

◆ pixRenderHashBoxArb()

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 
)

pixRenderHashBoxArb()

Parameters
[in]pixany depth; cmapped ok
[in]box
[in]spacingspacing between lines; must be > 1
[in]widththickness of box and hash lines
[in]orientorientation of lines: L_HORIZONTAL_LINE, ...
[in]outline0 to skip drawing box outline
[in]rval,gval,bval
Returns
0 if OK, 1 on error

Definition at line 1906 of file graphics.c.

References generatePtaHashBox(), L_HORIZONTAL_LINE, L_NEG_SLOPE_LINE, L_POS_SLOPE_LINE, L_VERTICAL_LINE, pixRenderPtaArb(), and ptaDestroy().

◆ pixRenderHashBoxBlend()

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 
)

pixRenderHashBoxBlend()

Parameters
[in]pix32 bpp
[in]box
[in]spacingspacing between lines; must be > 1
[in]widththickness of box and hash lines
[in]orientorientation of lines: L_HORIZONTAL_LINE, ...
[in]outline0 to skip drawing box outline
[in]rval,gval,bval
[in]fractin [0.0 - 1.0]: 1.0 is no transparency; 0.0 is complete transparency (no effect)
Returns
0 if OK, 1 on error

Definition at line 1958 of file graphics.c.

References generatePtaHashBox(), L_HORIZONTAL_LINE, L_NEG_SLOPE_LINE, L_POS_SLOPE_LINE, L_VERTICAL_LINE, pixRenderPtaBlend(), and ptaDestroy().

◆ pixRenderHashMaskArb()

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 
)

pixRenderHashMaskArb()

Parameters
[in]pixany depth; cmapped ok
[in]pixm1 bpp clipping mask for hash marks
[in]x,yUL corner of pixm with respect to pix
[in]spacingspacing between lines; must be > 1
[in]widththickness of box and hash lines
[in]orientorientation of lines: L_HORIZONTAL_LINE, L_POS_SLOPE_LINE, L_VERTICAL_LINE, L_NEG_SLOPE_LINE
[in]outline0 to skip drawing box outline
[in]rval,gval,bval
Returns
0 if OK, 1 on error
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 2018 of file graphics.c.

◆ pixRenderLine()

l_ok pixRenderLine ( PIX pix,
l_int32  x1,
l_int32  y1,
l_int32  x2,
l_int32  y2,
l_int32  width,
l_int32  op 
)

pixRenderLine()

Parameters
[in]pixany depth, not cmapped
[in]x1,y1
[in]x2,y2
[in]widththickness of line
[in]opone of L_SET_PIXELS, L_CLEAR_PIXELS, L_FLIP_PIXELS
Returns
0 if OK, 1 on error

Definition at line 1496 of file graphics.c.

References generatePtaWideLine(), L_CLEAR_PIXELS, L_FLIP_PIXELS, L_SET_PIXELS, pixRenderPta(), and ptaDestroy().

Referenced by kernelDisplayInPix(), selDisplayInPix(), and selMakePlusSign().

◆ pixRenderLineArb()

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 
)

pixRenderLineArb()

Parameters
[in]pixany depth, cmapped ok
[in]x1,y1
[in]x2,y2
[in]widththickness of line
[in]rval,gval,bval
Returns
0 if OK, 1 on error

Definition at line 1536 of file graphics.c.

References generatePtaWideLine(), pixRenderPtaArb(), and ptaDestroy().

◆ pixRenderLineBlend()

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 
)

pixRenderLineBlend()

Parameters
[in]pix32 bpp rgb
[in]x1,y1
[in]x2,y2
[in]widththickness of line
[in]rval,gval,bval
[in]fract
Returns
0 if OK, 1 on error

Definition at line 1577 of file graphics.c.

References generatePtaWideLine(), pixRenderPtaBlend(), and ptaDestroy().

◆ pixRenderPlotFromNuma()

l_ok pixRenderPlotFromNuma ( PIX **  ppix,
NUMA na,
l_int32  plotloc,
l_int32  linewidth,
l_int32  max,
l_uint32  color 
)

pixRenderPlotFromNuma()

Parameters
[in,out]ppixany type; replaced if not 32 bpp rgb
[in]nato be plotted
[in]plotloclocation of plot: L_PLOT_AT_TOP, etc
[in]linewidthwidth of "line" that is drawn; between 1 and 7
[in]maxmaximum excursion in pixels from baseline
[in]colorplot color: 0xrrggbb00
Returns
0 if OK, 1 on error
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 973 of file graphics.c.

References L_PLOT_AT_BOT, L_PLOT_AT_MID_HORIZ, L_PLOT_AT_TOP, makePlotPtaFromNuma(), and pixGetDimensions().

◆ pixRenderPlotFromNumaGen()

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 
)

pixRenderPlotFromNumaGen()

Parameters
[in,out]ppixany type; replaced if not 32 bpp rgb
[in]nato be plotted
[in]orientL_HORIZONTAL_LINE, L_VERTICAL_LINE
[in]linewidthwidth of "line" that is drawn; between 1 and 7
[in]refposreference position: y for horizontal; x for vertical
[in]maxmaximum excursion in pixels from baseline
[in]drawref1 to draw the reference line and its normal
[in]colorplot color: 0xrrggbb00
Returns
0 if OK, 1 on error
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 1089 of file graphics.c.

References makePlotPtaFromNumaGen().

◆ pixRenderPolygon()

PIX* pixRenderPolygon ( PTA ptas,
l_int32  width,
l_int32 *  pxmin,
l_int32 *  pymin 
)

pixRenderPolygon()

Parameters
[in]ptasof vertices, none repeated
[in]widthof polygon outline
[out]pxmin[optional] min x value of input pts
[out]pymin[optional] min y value of input pts
Returns
pix 1 bpp, with outline generated, or NULL on error
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 2506 of file graphics.c.

References convertPtaLineTo4cc(), generatePtaPolyline(), L_SET_PIXELS, pixCreate(), pixRenderPolyline(), ptaClone(), ptaDestroy(), and ptaGetRange().

◆ pixRenderPolyline()

l_ok pixRenderPolyline ( PIX pix,
PTA ptas,
l_int32  width,
l_int32  op,
l_int32  closeflag 
)

pixRenderPolyline()

Parameters
[in]pixany depth, not cmapped
[in]ptas
[in]widththickness of line
[in]opone of L_SET_PIXELS, L_CLEAR_PIXELS, L_FLIP_PIXELS
[in]closeflag1 to close the contour; 0 otherwise
Returns
0 if OK, 1 on error
Notes:
     This renders a closed contour.

Definition at line 2248 of file graphics.c.

References generatePtaPolyline(), L_CLEAR_PIXELS, L_FLIP_PIXELS, L_SET_PIXELS, pixRenderPta(), and ptaDestroy().

Referenced by pixRenderPolygon().

◆ pixRenderPolylineArb()

l_ok pixRenderPolylineArb ( PIX pix,
PTA ptas,
l_int32  width,
l_uint8  rval,
l_uint8  gval,
l_uint8  bval,
l_int32  closeflag 
)

pixRenderPolylineArb()

Parameters
[in]pixany depth; cmapped ok
[in]ptas
[in]widththickness of line
[in]rval,gval,bval
[in]closeflag1 to close the contour; 0 otherwise
Returns
0 if OK, 1 on error
Notes:
     This renders a closed contour.

Definition at line 2293 of file graphics.c.

References generatePtaPolyline(), pixRenderPtaArb(), and ptaDestroy().

◆ pixRenderPolylineBlend()

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 
)

pixRenderPolylineBlend()

Parameters
[in]pix32 bpp rgb
[in]ptas
[in]widththickness of line
[in]rval,gval,bval
[in]fractin [0.0 - 1.0]: 1.0 is no transparency; 0.0 is complete transparency (no effect)
[in]closeflag1 to close the contour; 0 otherwise
[in]removedups1 to remove; 0 otherwise
Returns
0 if OK, 1 on error

Definition at line 2336 of file graphics.c.

References generatePtaPolyline(), pixRenderPtaBlend(), and ptaDestroy().

◆ pixRenderPta()

l_ok pixRenderPta ( PIX pix,
PTA pta,
l_int32  op 
)

pixRenderPta()

Parameters
[in]pixany depth, not cmapped
[in]ptaarbitrary set of points
[in]opone of L_SET_PIXELS, L_CLEAR_PIXELS, L_FLIP_PIXELS
Returns
0 if OK, 1 on error
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 1267 of file graphics.c.

Referenced by pixRenderBox(), pixRenderBoxa(), pixRenderHashBox(), pixRenderHashBoxa(), pixRenderLine(), pixRenderPolyline(), selaAddCrossJunctions(), and selaAddTJunctions().

◆ pixRenderPtaArb()

l_ok pixRenderPtaArb ( PIX pix,
PTA pta,
l_uint8  rval,
l_uint8  gval,
l_uint8  bval 
)

pixRenderPtaArb()

Parameters
[in]pixany depth, cmapped ok
[in]ptaarbitrary set of points
[in]rval,gval,bval
Returns
0 if OK, 1 on error
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 1356 of file graphics.c.

Referenced by pixRenderBoxaArb(), pixRenderBoxArb(), pixRenderGridArb(), pixRenderHashBoxaArb(), pixRenderHashBoxArb(), pixRenderLineArb(), pixRenderPolylineArb(), and pixRenderRandomCmapPtaa().

◆ pixRenderPtaBlend()

l_ok pixRenderPtaBlend ( PIX pix,
PTA pta,
l_uint8  rval,
l_uint8  gval,
l_uint8  bval,
l_float32  fract 
)

pixRenderPtaBlend()

Parameters
[in]pix32 bpp rgb
[in]ptaarbitrary set of points
[in]rval,gval,bval
[in]fract
Returns
0 if OK, 1 on error
Notes:
     (1) This function clips the rendering to pix.

Definition at line 1431 of file graphics.c.

Referenced by pixRenderBoxaBlend(), pixRenderBoxBlend(), pixRenderHashBoxaBlend(), pixRenderHashBoxBlend(), pixRenderLineBlend(), and pixRenderPolylineBlend().

◆ pixRenderRandomCmapPtaa()

PIX* pixRenderRandomCmapPtaa ( PIX pix,
PTAA ptaa,
l_int32  polyflag,
l_int32  width,
l_int32  closeflag 
)

pixRenderRandomCmapPtaa()

Parameters
[in]pix1, 2, 4, 8, 16, 32 bpp
[in]ptaa
[in]polyflag1 to interpret each Pta as a polyline; 0 to simply render the Pta as a set of pixels
[in]widththickness of line; use only for polyline
[in]closeflag1 to close the contour; 0 otherwise; use only for polyline mode
Returns
pixd cmapped, 8 bpp or NULL on error
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 2437 of file graphics.c.

References generatePtaPolyline(), L_CLONE, pixcmapCreateRandom(), pixcmapGetColor(), pixConvertTo8(), pixRenderPtaArb(), pixSetColormap(), ptaaGetCount(), ptaaGetPta(), ptaClone(), and ptaDestroy().