MCPcopy Create free account
hub / github.com/creatale/node-dv / boxCreate

Function boxCreate

deps/leptonica/src/boxbasic.c:164–195  ·  view source on GitHub ↗

---------------------------------------------------------------------* * Box creation, destruction and copy * *---------------------------------------------------------------------*/ ! * \brief boxCreate() * * \param[in] x, y, w, h * \return box, or NULL on error * * * Notes: * (1) This clips the box to the +quad. If no part of the *

Source from the content-addressed store, hash-verified

162 * </pre>
163 */
164BOX *
165boxCreate(l_int32 x,
166 l_int32 y,
167 l_int32 w,
168 l_int32 h)
169{
170BOX *box;
171
172 PROCNAME("boxCreate");
173
174 if (w < 0 || h < 0)
175 return (BOX *)ERROR_PTR("w and h not both >= 0", procName, NULL);
176 if (x < 0) { /* take part in +quad */
177 w = w + x;
178 x = 0;
179 if (w <= 0)
180 return (BOX *)ERROR_PTR("x < 0 and box off +quad", procName, NULL);
181 }
182 if (y < 0) { /* take part in +quad */
183 h = h + y;
184 y = 0;
185 if (h <= 0)
186 return (BOX *)ERROR_PTR("y < 0 and box off +quad", procName, NULL);
187 }
188
189 if ((box = (BOX *)LEPT_CALLOC(1, sizeof(BOX))) == NULL)
190 return (BOX *)ERROR_PTR("box not made", procName, NULL);
191 boxSetGeometry(box, x, y, w, h);
192 box->refcount = 1;
193
194 return box;
195}
196
197
198/*!

Callers 15

cropMethod · 0.85
toBoxFunction · 0.85
generateMediaboxPdfFunction · 0.85
pixFindMinRunsOrthogonalFunction · 0.85
ioFormatTestFunction · 0.85
ptaConvertToBoxaFunction · 0.85
ptaConvertToBoxFunction · 0.85
boxaLinearFitFunction · 0.85
boxaWindowedMedianFunction · 0.85
boxaModifyWithBoxaFunction · 0.85
boxaConstrainSizeFunction · 0.85
boxaGetExtentFunction · 0.85

Calls 1

boxSetGeometryFunction · 0.85

Tested by

no test coverage detected