|
Leptonica
1.54
|
Переменные | |
| static const l_int32 | INITIAL_PTR_ARRAYSIZE = 20 |
Input: dpix Return: same dpix (ptr), or null on error
Notes: (1) See pixClone() for definition and usage.
Input: dpixd (<optional>; can be null, or equal to dpixs,
or different from dpixs)
dpixs
Return: dpixd, or null on error
Notes: (1) There are three cases: (a) dpixd == null (makes a new dpix; refcount = 1) (b) dpixd == dpixs (no-op) (c) dpixd != dpixs (data copy; no change in refcount) If the refcount of dpixd > 1, case (c) will side-effect these handles. (2) The general pattern of use is: dpixd = dpixCopy(dpixd, dpixs); This will work for all three cases. For clarity when the case is known, you can use: (a) dpixd = dpixCopy(NULL, dpixs); (c) dpixCopy(dpixd, dpixs); (3) For case (c), we check if dpixs and dpixd are the same size. If so, the data is copied directly. Otherwise, the data is reallocated to the correct size and the copy proceeds. The refcount of dpixd is unchanged. (4) This operation, like all others that may involve a pre-existing dpixd, will side-effect any existing clones of dpixd.
Input: width, height
Return: dpix (with data allocated and initialized to 0),
or null on error
Notes: (1) Makes a DPix of specified size, with the data array allocated and initialized to 0.
| void dpixDestroy | ( | DPIX ** | pdpix | ) |
Input: &dpix <will be nulled> Return: void
Notes: (1) Decrements the ref count and, if 0, destroys the dpix. (2) Always nulls the input ptr.
Input: dpixd (can be equal to dpixs or NULL)
dpixs
Return: dpixd always
Notes: (1) On big-endian hardware, this does byte-swapping on each of the 4-byte words in the dpix data. On little-endians, the data is unchanged. This is used for serialization of dpix; the data is serialized in little-endian byte order because most hardware is little-endian. (2) The operation can be either in-place or, if dpixd == NULL, a new dpix is made. If not in-place, caller must catch the returned pointer.
Input: dpix
&w, &h (<optional return>; each can be null)
Return: 0 if OK, 1 on error
Input: dpix
(x,y) pixel coords
&val (<return> pixel value)
Return: 0 if OK; 1 on error
| DPIX* dpixRead | ( | const char * | filename | ) |
Input: filename Return: dpix, or null on error
| DPIX* dpixReadStream | ( | FILE * | fp | ) |
Input: stream Return: dpix, or null on error
Input: dpixd, dpixs Return: 0 if OK, 1 on error
Input: dpix
w, h
Return: 0 if OK, 1 on error
Input: dpix
(x,y) pixel coords
val (pixel value)
Return: 0 if OK; 1 on error
Input: filename
dpix
Return: 0 if OK, 1 on error
Input: stream (opened for "wb")
dpix
Return: 0 if OK, 1 on error
Input: fpixa
fpix (to be added)
copyflag (L_INSERT, L_COPY, L_CLONE)
Return: 0 if OK; 1 on error
Input: fpixa Return: 0 if OK, 1 on error
Input: fpixas
copyflag:
L_COPY makes a new fpixa and copies each fpix
L_CLONE gives a new ref-counted handle to the input fpixa
L_COPY_CLONE makes a new fpixa with clones of all fpix
Return: new fpixa, or null on error
Input: n (initial number of ptrs) Return: fpixa, or null on error
| void fpixaDestroy | ( | FPIXA ** | pfpixa | ) |
Input: &fpixa (<can be nulled>) Return: void
Notes: (1) Decrements the ref count and, if 0, destroys the fpixa. (2) Always nulls the input ptr.
Input: fpixa Return: 0 if OK; 1 on error
Notes: (1) Doubles the size of the fpixa ptr array.
Input: fpixa Return: 0 if OK; 1 on error
Notes: (1) If necessary, reallocs new fpixa ptrs array to @size.
Input: fpixa Return: count, or 0 if no pixa
Input: fpixa
index (into fpixa array)
Return: data (not a copy), or null on error
Input: fpixa
index (to the index-th fpix)
accesstype (L_COPY or L_CLONE)
Return: fpix, or null on error
Input: fpixa
index (to the index-th box)
&w, &h (<optional return>; each can be null)
Return: 0 if OK, 1 on error
Input: fpixa
index (into fpixa array)
(x,y) pixel coords
&val (<return> pixel value)
Return: 0 if OK; 1 on error
Input: fpixa
index (into fpixa array)
(x,y) pixel coords
val (pixel value)
Return: 0 if OK; 1 on error
Input: fpix Return: same fpix (ptr), or null on error
Notes: (1) See pixClone() for definition and usage.
Input: fpixd (<optional>; can be null, or equal to fpixs,
or different from fpixs)
fpixs
Return: fpixd, or null on error
Notes: (1) There are three cases: (a) fpixd == null (makes a new fpix; refcount = 1) (b) fpixd == fpixs (no-op) (c) fpixd != fpixs (data copy; no change in refcount) If the refcount of fpixd > 1, case (c) will side-effect these handles. (2) The general pattern of use is: fpixd = fpixCopy(fpixd, fpixs); This will work for all three cases. For clarity when the case is known, you can use: (a) fpixd = fpixCopy(NULL, fpixs); (c) fpixCopy(fpixd, fpixs); (3) For case (c), we check if fpixs and fpixd are the same size. If so, the data is copied directly. Otherwise, the data is reallocated to the correct size and the copy proceeds. The refcount of fpixd is unchanged. (4) This operation, like all others that may involve a pre-existing fpixd, will side-effect any existing clones of fpixd.
Input: width, height
Return: fpixd (with data allocated and initialized to 0),
or null on error
Notes: (1) Makes a FPix of specified size, with the data array allocated and initialized to 0.
| void fpixDestroy | ( | FPIX ** | pfpix | ) |
Input: &fpix <will be nulled> Return: void
Notes: (1) Decrements the ref count and, if 0, destroys the fpix. (2) Always nulls the input ptr.
Input: fpixd (can be equal to fpixs or NULL)
fpixs
Return: fpixd always
Notes: (1) On big-endian hardware, this does byte-swapping on each of the 4-byte floats in the fpix data. On little-endians, the data is unchanged. This is used for serialization of fpix; the data is serialized in little-endian byte order because most hardware is little-endian. (2) The operation can be either in-place or, if fpixd == NULL, a new fpix is made. If not in-place, caller must catch the returned pointer.
Input: fpix
&w, &h (<optional return>; each can be null)
Return: 0 if OK, 1 on error
Input: fpix
(x,y) pixel coords
&val (<return> pixel value)
Return: 0 if OK; 1 on error
Input: stream
fpix
factor (subsampled)
Return: 0 if OK, 1 on error
Notes: (1) Subsampled printout of fpix for debugging.
| FPIX* fpixRead | ( | const char * | filename | ) |
Input: filename Return: fpix, or null on error
| FPIX* fpixReadStream | ( | FILE * | fp | ) |
Input: stream Return: fpix, or null on error
Input: fpixd, fpixs Return: 0 if OK, 1 on error
Notes: (1) If the data sizes differ, this destroys the existing data in fpixd and allocates a new, uninitialized, data array of the same size as the data in fpixs. Otherwise, this doesn't do anything.
Input: fpix
w, h
Return: 0 if OK, 1 on error
Input: fpix
(x,y) pixel coords
val (pixel value)
Return: 0 if OK; 1 on error
Input: filename
fpix
Return: 0 if OK, 1 on error
Input: stream (opened for "wb")
fpix
Return: 0 if OK, 1 on error
|
static |