Leptonica 1.68
C Image Processing Library

ptabasic.c File Reference

Implements 1d and 2d arrays of points (Pta, Ptaa) More...

#include <string.h>
#include "allheaders.h"

Go to the source code of this file.

Functions

PTAptaCreate (l_int32 n)
PTAptaCreateFromNuma (NUMA *nax, NUMA *nay)
void ptaDestroy (PTA **ppta)
PTAptaCopy (PTA *pta)
PTAptaClone (PTA *pta)
l_int32 ptaEmpty (PTA *pta)
l_int32 ptaAddPt (PTA *pta, l_float32 x, l_float32 y)
l_int32 ptaExtendArrays (PTA *pta)
l_int32 ptaGetRefcount (PTA *pta)
l_int32 ptaChangeRefcount (PTA *pta, l_int32 delta)
l_int32 ptaGetCount (PTA *pta)
l_int32 ptaGetPt (PTA *pta, l_int32 index, l_float32 *px, l_float32 *py)
l_int32 ptaGetIPt (PTA *pta, l_int32 index, l_int32 *px, l_int32 *py)
l_int32 ptaSetPt (PTA *pta, l_int32 index, l_float32 x, l_float32 y)
l_int32 ptaGetArrays (PTA *pta, NUMA **pnax, NUMA **pnay)
PTAptaRead (const char *filename)
PTAptaReadStream (FILE *fp)
l_int32 ptaWrite (const char *filename, PTA *pta, l_int32 type)
l_int32 ptaWriteStream (FILE *fp, PTA *pta, l_int32 type)
PTAAptaaCreate (l_int32 n)
void ptaaDestroy (PTAA **pptaa)
l_int32 ptaaAddPta (PTAA *ptaa, PTA *pta, l_int32 copyflag)
l_int32 ptaaExtendArray (PTAA *ptaa)
l_int32 ptaaGetCount (PTAA *ptaa)
PTAptaaGetPta (PTAA *ptaa, l_int32 index, l_int32 accessflag)
l_int32 ptaaGetPt (PTAA *ptaa, l_int32 ipta, l_int32 jpt, l_float32 *px, l_float32 *py)
PTAAptaaRead (const char *filename)
PTAAptaaReadStream (FILE *fp)
l_int32 ptaaWrite (const char *filename, PTAA *ptaa, l_int32 type)
l_int32 ptaaWriteStream (FILE *fp, PTAA *ptaa, l_int32 type)

Variables

static const l_int32 INITIAL_PTR_ARRAYSIZE = 20

Detailed Description

Implements 1d and 2d arrays of points (Pta, Ptaa)

Definition in file ptabasic.c.


Function Documentation

PTA* ptaCreateFromNuma ( NUMA nax,
NUMA nay 
)

ptaCreateFromNuma()

Input: nax (<optional> can be null) nay Return: pta, or null on error.

Definition at line 115 of file ptabasic.c.

References ERROR_PTR, NULL, numaGetCount(), numaGetFValue(), numaGetXParameters(), PROCNAME, ptaAddPt(), and ptaCreate().

Referenced by dewarpBuildModel(), and main().

void ptaDestroy ( PTA **  ppta)

ptaDestroy()

Input: &pta (<to be="" nulled>="">) Return: void

Note:

  • Decrements the ref count and, if 0, destroys the pta.
  • Always nulls the input ptr.

Definition at line 156 of file ptabasic.c.

References FREE, L_WARNING, NULL, PROCNAME, ptaChangeRefcount(), ptaGetRefcount(), Pta::x, and Pta::y.

Referenced by boxaAffineTransform(), boxaRotate(), boxaScale(), boxaTranslate(), boxIntersectByLine(), ccbaDisplayBorder(), ccbaDisplayImage1(), ccbaDisplayImage2(), ccbaGenerateGlobalLocs(), ccbaGenerateSinglePath(), ccbaGenerateSPGlobalLocs(), ccbaGenerateStepChains(), ccbDestroy(), dewarpBuildModel(), generatePtaBox(), generatePtaBoxa(), generatePtaHashBox(), generatePtaPolyline(), generatePtaWideLine(), jbAccumulateComposites(), jbClasserDestroy(), jbClassifyCorrelation(), jbClassifyRankHaus(), jbDataDestroy(), jbGetLLCorners(), main(), pdfdataDestroy(), pixAffinePtaWithAlpha(), pixBilinearPtaWithAlpha(), pixDeskewLocal(), pixDisplayMatchedPattern(), pixDisplayPtaa(), pixExtractOnLine(), pixGenerateSelBoundary(), pixGenerateSelWithRuns(), pixGetLocalSkewAngles(), pixGetOuterBorderPta(), pixGetRunsOnLine(), pixProjectivePtaWithAlpha(), pixRemoveMatchedPattern(), pixRenderBox(), pixRenderBoxa(), pixRenderBoxaArb(), pixRenderBoxaBlend(), pixRenderBoxArb(), pixRenderBoxBlend(), pixRenderHashBox(), pixRenderHashBoxArb(), pixRenderHashBoxBlend(), pixRenderLine(), pixRenderLineArb(), pixRenderLineBlend(), pixRenderPolyline(), pixRenderPolylineArb(), pixRenderPolylineBlend(), pixRenderRandomCmapPtaa(), ptaaDestroy(), ptaaGetBoundaryPixels(), ptaaGetPt(), ptaaRemoveShortLines(), ptaaWriteStream(), selaAddCrossJunctions(), selaAddTJunctions(), selDisplayInPix(), wshedApply(), and wshedDestroy().

PTA* ptaCopy ( PTA pta)

ptaCopy()

Input: pta Return: copy of pta, or null on error

Definition at line 189 of file ptabasic.c.

References ERROR_PTR, Pta::n, Pta::nalloc, NULL, PROCNAME, ptaAddPt(), ptaCreate(), and ptaGetPt().

Referenced by ptaaAddPta(), and ptaaGetPta().

PTA* ptaClone ( PTA pta)

ptaClone()

Input: pta Return: ptr to same pta, or null on error

Definition at line 219 of file ptabasic.c.

References ERROR_PTR, NULL, PROCNAME, and ptaChangeRefcount().

Referenced by generatePtaBoxa(), generatePtaPolyline(), jbDataSave(), pixGetOuterBorderPta(), pixRenderRandomCmapPtaa(), ptaaAddPta(), and ptaaGetPta().

l_int32 ptaEmpty ( PTA pta)

ptaEmpty()

Input: pta Return: 0 if OK, 1 on error

Note: this only resets the "n" field, for reuse

Definition at line 240 of file ptabasic.c.

References ERROR_INT, Pta::n, and PROCNAME.

Referenced by getCutPathForHole().

l_int32 ptaExtendArrays ( PTA pta)

ptaExtendArrays()

Input: pta Return: 0 if OK; 1 on error

Definition at line 291 of file ptabasic.c.

References ERROR_INT, Pta::nalloc, NULL, PROCNAME, reallocNew(), Pta::x, and Pta::y.

Referenced by ptaAddPt().

l_int32 ptaGetRefcount ( PTA pta)

Definition at line 316 of file ptabasic.c.

References ERROR_INT, PROCNAME, and Pta::refcount.

Referenced by ptaDestroy().

l_int32 ptaChangeRefcount ( PTA pta,
l_int32  delta 
)

Definition at line 327 of file ptabasic.c.

References ERROR_INT, PROCNAME, and Pta::refcount.

Referenced by ptaClone(), ptaCreate(), and ptaDestroy().

l_int32 ptaGetCount ( PTA pta)
l_int32 ptaSetPt ( PTA pta,
l_int32  index,
l_float32  x,
l_float32  y 
)

ptaSetPt()

Input: pta index (into arrays) x, y Return: 0 if OK; 1 on error

Definition at line 426 of file ptabasic.c.

References ERROR_INT, Pta::n, PROCNAME, Pta::x, and Pta::y.

Referenced by generateMediaboxPdf().

l_int32 ptaGetArrays ( PTA pta,
NUMA **  pnax,
NUMA **  pnay 
)

ptaGetArrays()

Input: pta &nax (<optional return>=""> numa of x array) &nay (<optional return>=""> numa of y array) Return: 0 if OK; 1 on error or if pta is empty

Notes: (1) This copies the internal arrays into new Numas.

Definition at line 456 of file ptabasic.c.

References Numa::array, ERROR_INT, Numa::n, NULL, numaCreate(), PROCNAME, ptaGetCount(), Pta::x, and Pta::y.

Referenced by dewarpBuildModel(), main(), and pixGetLocalSkewAngles().

PTA* ptaRead ( const char *  filename)

ptaRead()

Input: filename Return: pta, or null on error

Definition at line 504 of file ptabasic.c.

References ERROR_PTR, fopenReadStream(), NULL, PROCNAME, and ptaReadStream().

PTA* ptaReadStream ( FILE *  fp)

ptaReadStream()

Input: stream Return: pta, or null on error

Definition at line 533 of file ptabasic.c.

References ERROR_PTR, NULL, PROCNAME, PTA_VERSION_NUMBER, ptaAddPt(), ptaCreate(), and version.

Referenced by ptaaReadStream(), and ptaRead().

l_int32 ptaWrite ( const char *  filename,
PTA pta,
l_int32  type 
)

ptaWrite()

Input: filename pta type (0 for float values; 1 for integer values) Return: 0 if OK, 1 on error

Definition at line 584 of file ptabasic.c.

References ERROR_INT, fopenWriteStream(), NULL, PROCNAME, and ptaWriteStream().

l_int32 ptaWriteStream ( FILE *  fp,
PTA pta,
l_int32  type 
)

ptaWriteStream()

Input: stream pta type (0 for float values; 1 for integer values) Return: 0 if OK; 1 on error

Definition at line 616 of file ptabasic.c.

References ERROR_INT, PROCNAME, PTA_VERSION_NUMBER, ptaGetCount(), ptaGetIPt(), and ptaGetPt().

Referenced by main(), ptaaWriteStream(), and ptaWrite().

void ptaaDestroy ( PTAA **  pptaa)
l_int32 ptaaExtendArray ( PTAA ptaa)

ptaaExtendArray()

Input: ptaa Return: 0 if OK, 1 on error

Definition at line 770 of file ptabasic.c.

References ERROR_INT, Ptaa::nalloc, NULL, PROCNAME, Ptaa::pta, and reallocNew().

Referenced by ptaaAddPta().

l_int32 ptaaGetPt ( PTAA ptaa,
l_int32  ipta,
l_int32  jpt,
l_float32 px,
l_float32 py 
)

ptaaGetPt()

Input: ptaa ipta (to the i-th pta) jpt (index to the j-th pt in the pta) &x (<optional return>=""> float x value) &y (<optional return>=""> float y value) Return: 0 if OK; 1 on error

Definition at line 848 of file ptabasic.c.

References ERROR_INT, L_CLONE, Pta::n, Ptaa::n, PROCNAME, ptaaGetPta(), ptaDestroy(), and ptaGetPt().

Referenced by dewarpBuildModel().

PTAA* ptaaRead ( const char *  filename)

ptaaRead()

Input: filename Return: ptaa, or null on error

Definition at line 887 of file ptabasic.c.

References ERROR_PTR, fopenReadStream(), NULL, PROCNAME, and ptaaReadStream().

Referenced by main().

PTAA* ptaaReadStream ( FILE *  fp)

ptaaReadStream()

Input: stream Return: ptaa, or null on error

Definition at line 916 of file ptabasic.c.

References ERROR_PTR, L_INSERT, NULL, PROCNAME, PTA_VERSION_NUMBER, ptaaAddPta(), ptaaCreate(), ptaReadStream(), and version.

Referenced by ptaaRead().

l_int32 ptaaWrite ( const char *  filename,
PTAA ptaa,
l_int32  type 
)

ptaaWrite()

Input: filename ptaa type (0 for float values; 1 for integer values) Return: 0 if OK, 1 on error

Definition at line 955 of file ptabasic.c.

References ERROR_INT, fopenWriteStream(), NULL, PROCNAME, and ptaaWriteStream().

Referenced by dewarpBuildModel(), main(), and pixGetRegionsBinary().

l_int32 ptaaWriteStream ( FILE *  fp,
PTAA ptaa,
l_int32  type 
)

ptaaWriteStream()

Input: stream ptaa type (0 for float values; 1 for integer values) Return: 0 if OK; 1 on error

Definition at line 987 of file ptabasic.c.

References ERROR_INT, L_CLONE, PROCNAME, PTA_VERSION_NUMBER, ptaaGetCount(), ptaaGetPta(), ptaDestroy(), and ptaWriteStream().

Referenced by main(), and ptaaWrite().


Variable Documentation

const l_int32 INITIAL_PTR_ARRAYSIZE = 20 [static]

Definition at line 70 of file ptabasic.c.

Referenced by ptaaCreate(), and ptaCreate().

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines