1 | /** |
2 | * libdmtx - Data Matrix Encoding/Decoding Library |
3 | * Copyright 2008, 2009 Mike Laughton. All rights reserved. |
4 | * |
5 | * See LICENSE file in the main project directory for full |
6 | * terms of use and distribution. |
7 | * |
8 | * Contact: Mike Laughton <mike@dragonflylogic.com> |
9 | * |
10 | * \file dmtx.h |
11 | * \brief Main libdmtx header |
12 | */ |
13 | |
14 | #ifndef __DMTX_H__ |
15 | #define __DMTX_H__ |
16 | |
17 | #ifdef __cplusplus |
18 | extern "C" { |
19 | #endif |
20 | |
21 | /* Time headers required for DmtxTime struct below */ |
22 | #include <time.h> |
23 | #ifdef HAVE_SYS_TIME_H |
24 | #include <sys/time.h> |
25 | #endif |
26 | |
27 | #ifndef M_PI |
28 | #define M_PI 3.14159265358979323846 |
29 | #endif |
30 | |
31 | #ifndef M_PI_2 |
32 | #define M_PI_2 1.57079632679489661923 |
33 | #endif |
34 | |
35 | #define DmtxVersion "0.7.4" |
36 | |
37 | #define DmtxUndefined -1 |
38 | |
39 | #define DmtxPassFail unsigned int |
40 | #define DmtxPass 1 |
41 | #define DmtxFail 0 |
42 | |
43 | #define DmtxBoolean unsigned int |
44 | #define DmtxTrue 1 |
45 | #define DmtxFalse 0 |
46 | |
47 | #define DmtxFormatMatrix 0 |
48 | #define DmtxFormatMosaic 1 |
49 | |
50 | #define DmtxSymbolSquareCount 24 |
51 | #define DmtxSymbolRectCount 6 |
52 | |
53 | #define DmtxModuleOff 0x00 |
54 | #define DmtxModuleOnRed 0x01 |
55 | #define DmtxModuleOnGreen 0x02 |
56 | #define DmtxModuleOnBlue 0x04 |
57 | #define DmtxModuleOnRGB 0x07 /* OnRed | OnGreen | OnBlue */ |
58 | #define DmtxModuleOn 0x07 |
59 | #define DmtxModuleUnsure 0x08 |
60 | #define DmtxModuleAssigned 0x10 |
61 | #define DmtxModuleVisited 0x20 |
62 | #define DmtxModuleData 0x40 |
63 | |
64 | #define DMTX_CHECK_BOUNDS(l,i) (assert((i) >= 0 && (i) < (l)->length && (l)->length <= (l)->capacity)) |
65 | |
66 | typedef enum { |
67 | DmtxStatusEncoding, /* Encoding is currently underway */ |
68 | DmtxStatusComplete, /* Encoding is done and everything went well */ |
69 | DmtxStatusInvalid, /* Something bad happened that sometimes happens */ |
70 | DmtxStatusFatal /* Something happened that should never happen */ |
71 | } DmtxStatus; |
72 | |
73 | typedef enum { |
74 | DmtxSchemeAutoFast = -2, |
75 | DmtxSchemeAutoBest = -1, |
76 | DmtxSchemeAscii = 0, |
77 | DmtxSchemeC40, |
78 | DmtxSchemeText, |
79 | DmtxSchemeX12, |
80 | DmtxSchemeEdifact, |
81 | DmtxSchemeBase256 |
82 | } DmtxScheme; |
83 | |
84 | typedef enum { |
85 | DmtxSymbolRectAuto = -3, |
86 | DmtxSymbolSquareAuto = -2, |
87 | DmtxSymbolShapeAuto = -1, |
88 | DmtxSymbol10x10 = 0, |
89 | DmtxSymbol12x12, |
90 | DmtxSymbol14x14, |
91 | DmtxSymbol16x16, |
92 | DmtxSymbol18x18, |
93 | DmtxSymbol20x20, |
94 | DmtxSymbol22x22, |
95 | DmtxSymbol24x24, |
96 | DmtxSymbol26x26, |
97 | DmtxSymbol32x32, |
98 | DmtxSymbol36x36, |
99 | DmtxSymbol40x40, |
100 | DmtxSymbol44x44, |
101 | DmtxSymbol48x48, |
102 | DmtxSymbol52x52, |
103 | DmtxSymbol64x64, |
104 | DmtxSymbol72x72, |
105 | DmtxSymbol80x80, |
106 | DmtxSymbol88x88, |
107 | DmtxSymbol96x96, |
108 | DmtxSymbol104x104, |
109 | DmtxSymbol120x120, |
110 | DmtxSymbol132x132, |
111 | DmtxSymbol144x144, |
112 | DmtxSymbol8x18, |
113 | DmtxSymbol8x32, |
114 | DmtxSymbol12x26, |
115 | DmtxSymbol12x36, |
116 | DmtxSymbol16x36, |
117 | DmtxSymbol16x48 |
118 | } DmtxSymbolSize; |
119 | |
120 | typedef enum { |
121 | DmtxDirNone = 0x00, |
122 | DmtxDirUp = 0x01 << 0, |
123 | DmtxDirLeft = 0x01 << 1, |
124 | DmtxDirDown = 0x01 << 2, |
125 | DmtxDirRight = 0x01 << 3, |
126 | DmtxDirHorizontal = DmtxDirLeft | DmtxDirRight, |
127 | DmtxDirVertical = DmtxDirUp | DmtxDirDown, |
128 | DmtxDirRightUp = DmtxDirRight | DmtxDirUp, |
129 | DmtxDirLeftDown = DmtxDirLeft | DmtxDirDown |
130 | } DmtxDirection; |
131 | |
132 | typedef enum { |
133 | DmtxSymAttribSymbolRows, |
134 | DmtxSymAttribSymbolCols, |
135 | DmtxSymAttribDataRegionRows, |
136 | DmtxSymAttribDataRegionCols, |
137 | DmtxSymAttribHorizDataRegions, |
138 | DmtxSymAttribVertDataRegions, |
139 | DmtxSymAttribMappingMatrixRows, |
140 | DmtxSymAttribMappingMatrixCols, |
141 | DmtxSymAttribInterleavedBlocks, |
142 | DmtxSymAttribBlockErrorWords, |
143 | DmtxSymAttribBlockMaxCorrectable, |
144 | DmtxSymAttribSymbolDataWords, |
145 | DmtxSymAttribSymbolErrorWords, |
146 | DmtxSymAttribSymbolMaxCorrectable |
147 | } DmtxSymAttribute; |
148 | |
149 | typedef enum { |
150 | DmtxCorner00 = 0x01 << 0, |
151 | DmtxCorner10 = 0x01 << 1, |
152 | DmtxCorner11 = 0x01 << 2, |
153 | DmtxCorner01 = 0x01 << 3 |
154 | } DmtxCornerLoc; |
155 | |
156 | typedef enum { |
157 | /* Encoding properties */ |
158 | DmtxPropScheme = 100, |
159 | DmtxPropSizeRequest, |
160 | DmtxPropMarginSize, |
161 | DmtxPropModuleSize, |
162 | /* Decoding properties */ |
163 | DmtxPropEdgeMin = 200, |
164 | DmtxPropEdgeMax, |
165 | DmtxPropScanGap, |
166 | DmtxPropSquareDevn, |
167 | DmtxPropSymbolSize, |
168 | DmtxPropEdgeThresh, |
169 | /* Image properties */ |
170 | DmtxPropWidth = 300, |
171 | DmtxPropHeight, |
172 | DmtxPropPixelPacking, |
173 | DmtxPropBitsPerPixel, |
174 | DmtxPropBytesPerPixel, |
175 | DmtxPropRowPadBytes, |
176 | DmtxPropRowSizeBytes, |
177 | DmtxPropImageFlip, |
178 | DmtxPropChannelCount, |
179 | /* Image modifiers */ |
180 | DmtxPropXmin = 400, |
181 | DmtxPropXmax, |
182 | DmtxPropYmin, |
183 | DmtxPropYmax, |
184 | DmtxPropScale |
185 | } DmtxProperty; |
186 | |
187 | typedef enum { |
188 | /* Custom format */ |
189 | DmtxPackCustom = 100, |
190 | /* 1 bpp */ |
191 | DmtxPack1bppK = 200, |
192 | /* 8 bpp grayscale */ |
193 | DmtxPack8bppK = 300, |
194 | /* 16 bpp formats */ |
195 | DmtxPack16bppRGB = 400, |
196 | DmtxPack16bppRGBX, |
197 | DmtxPack16bppXRGB, |
198 | DmtxPack16bppBGR, |
199 | DmtxPack16bppBGRX, |
200 | DmtxPack16bppXBGR, |
201 | DmtxPack16bppYCbCr, |
202 | /* 24 bpp formats */ |
203 | DmtxPack24bppRGB = 500, |
204 | DmtxPack24bppBGR, |
205 | DmtxPack24bppYCbCr, |
206 | /* 32 bpp formats */ |
207 | DmtxPack32bppRGBX = 600, |
208 | DmtxPack32bppXRGB, |
209 | DmtxPack32bppBGRX, |
210 | DmtxPack32bppXBGR, |
211 | DmtxPack32bppCMYK |
212 | } DmtxPackOrder; |
213 | |
214 | typedef enum { |
215 | DmtxFlipNone = 0x00, |
216 | DmtxFlipX = 0x01 << 0, |
217 | DmtxFlipY = 0x01 << 1 |
218 | } DmtxFlip; |
219 | |
220 | typedef double DmtxMatrix3[3][3]; |
221 | |
222 | /** |
223 | * @struct DmtxPixelLoc |
224 | * @brief DmtxPixelLoc |
225 | */ |
226 | typedef struct DmtxPixelLoc_struct { |
227 | int X; |
228 | int Y; |
229 | } DmtxPixelLoc; |
230 | |
231 | /** |
232 | * @struct DmtxVector2 |
233 | * @brief DmtxVector2 |
234 | */ |
235 | typedef struct DmtxVector2_struct { |
236 | double X; |
237 | double Y; |
238 | } DmtxVector2; |
239 | |
240 | /** |
241 | * @struct DmtxRay2 |
242 | * @brief DmtxRay2 |
243 | */ |
244 | typedef struct DmtxRay2_struct { |
245 | double tMin; |
246 | double tMax; |
247 | DmtxVector2 p; |
248 | DmtxVector2 v; |
249 | } DmtxRay2; |
250 | |
251 | typedef unsigned char DmtxByte; |
252 | |
253 | /** |
254 | * @struct DmtxByteList |
255 | * @brief DmtxByteList |
256 | * Use signed int for length fields instead of size_t to play nicely with RS |
257 | * arithmetic |
258 | */ |
259 | typedef struct DmtxByteList_struct DmtxByteList; |
260 | struct DmtxByteList_struct |
261 | { |
262 | int length; |
263 | int capacity; |
264 | DmtxByte *b; |
265 | }; |
266 | |
267 | typedef struct DmtxEncodeStream_struct DmtxEncodeStream; |
268 | struct DmtxEncodeStream_struct |
269 | { |
270 | int currentScheme; /* Current encodation scheme */ |
271 | int inputNext; /* Index of next unprocessed input word in queue */ |
272 | int outputChainValueCount; /* Count of output values pushed within current scheme chain */ |
273 | int outputChainWordCount; /* Count of output words pushed within current scheme chain */ |
274 | char *reason; /* Reason for status */ |
275 | int sizeIdx; /* Symbol size of completed stream */ |
276 | DmtxStatus status; |
277 | DmtxByteList *input; |
278 | DmtxByteList *output; |
279 | }; |
280 | |
281 | /** |
282 | * @struct DmtxImage |
283 | * @brief DmtxImage |
284 | */ |
285 | typedef struct DmtxImage_struct { |
286 | int width; |
287 | int height; |
288 | int pixelPacking; |
289 | int bitsPerPixel; |
290 | int bytesPerPixel; |
291 | int rowPadBytes; |
292 | int rowSizeBytes; |
293 | int imageFlip; |
294 | int channelCount; |
295 | int channelStart[4]; |
296 | int bitsPerChannel[4]; |
297 | unsigned char *pxl; |
298 | } DmtxImage; |
299 | |
300 | /** |
301 | * @struct DmtxPointFlow |
302 | * @brief DmtxPointFlow |
303 | */ |
304 | typedef struct DmtxPointFlow_struct { |
305 | int plane; |
306 | int arrive; |
307 | int depart; |
308 | int mag; |
309 | DmtxPixelLoc loc; |
310 | } DmtxPointFlow; |
311 | |
312 | /** |
313 | * @struct DmtxBestLine |
314 | * @brief DmtxBestLine |
315 | */ |
316 | typedef struct DmtxBestLine_struct { |
317 | int angle; |
318 | int hOffset; |
319 | int mag; |
320 | int stepBeg; |
321 | int stepPos; |
322 | int stepNeg; |
323 | int distSq; |
324 | double devn; |
325 | DmtxPixelLoc locBeg; |
326 | DmtxPixelLoc locPos; |
327 | DmtxPixelLoc locNeg; |
328 | } DmtxBestLine; |
329 | |
330 | /** |
331 | * @struct DmtxRegion |
332 | * @brief DmtxRegion |
333 | */ |
334 | typedef struct DmtxRegion_struct { |
335 | |
336 | /* Trail blazing values */ |
337 | int jumpToPos; /* */ |
338 | int jumpToNeg; /* */ |
339 | int stepsTotal; /* */ |
340 | DmtxPixelLoc finalPos; /* */ |
341 | DmtxPixelLoc finalNeg; /* */ |
342 | DmtxPixelLoc boundMin; /* */ |
343 | DmtxPixelLoc boundMax; /* */ |
344 | DmtxPointFlow flowBegin; /* */ |
345 | |
346 | /* Orientation values */ |
347 | int polarity; /* */ |
348 | int stepR; |
349 | int stepT; |
350 | DmtxPixelLoc locR; /* remove if stepR works above */ |
351 | DmtxPixelLoc locT; /* remove if stepT works above */ |
352 | |
353 | /* Region fitting values */ |
354 | int leftKnown; /* known == 1; unknown == 0 */ |
355 | int leftAngle; /* hough angle of left edge */ |
356 | DmtxPixelLoc leftLoc; /* known (arbitrary) location on left edge */ |
357 | DmtxBestLine leftLine; /* */ |
358 | int bottomKnown; /* known == 1; unknown == 0 */ |
359 | int bottomAngle; /* hough angle of bottom edge */ |
360 | DmtxPixelLoc bottomLoc; /* known (arbitrary) location on bottom edge */ |
361 | DmtxBestLine bottomLine; /* */ |
362 | int topKnown; /* known == 1; unknown == 0 */ |
363 | int topAngle; /* hough angle of top edge */ |
364 | DmtxPixelLoc topLoc; /* known (arbitrary) location on top edge */ |
365 | int rightKnown; /* known == 1; unknown == 0 */ |
366 | int rightAngle; /* hough angle of right edge */ |
367 | DmtxPixelLoc rightLoc; /* known (arbitrary) location on right edge */ |
368 | |
369 | /* Region calibration values */ |
370 | int onColor; /* */ |
371 | int offColor; /* */ |
372 | int sizeIdx; /* Index of arrays that store Data Matrix constants */ |
373 | int symbolRows; /* Number of total rows in symbol including alignment patterns */ |
374 | int symbolCols; /* Number of total columns in symbol including alignment patterns */ |
375 | int mappingRows; /* Number of data rows in symbol */ |
376 | int mappingCols; /* Number of data columns in symbol */ |
377 | |
378 | /* Transform values */ |
379 | DmtxMatrix3 raw2fit; /* 3x3 transformation from raw image to fitted barcode grid */ |
380 | DmtxMatrix3 fit2raw; /* 3x3 transformation from fitted barcode grid to raw image */ |
381 | } DmtxRegion; |
382 | |
383 | /** |
384 | * @struct DmtxMessage |
385 | * @brief DmtxMessage |
386 | */ |
387 | typedef struct DmtxMessage_struct { |
388 | size_t arraySize; /* mappingRows * mappingCols */ |
389 | size_t codeSize; /* Size of encoded data (data words + error words) */ |
390 | size_t outputSize; /* Size of buffer used to hold decoded data */ |
391 | int outputIdx; /* Internal index used to store output progress */ |
392 | int padCount; |
393 | unsigned char *array; /* Pointer to internal representation of Data Matrix modules */ |
394 | unsigned char *code; /* Pointer to internal storage of code words (data and error) */ |
395 | unsigned char *output; /* Pointer to internal storage of decoded output */ |
396 | } DmtxMessage; |
397 | |
398 | /** |
399 | * @struct DmtxScanGrid |
400 | * @brief DmtxScanGrid |
401 | */ |
402 | typedef struct DmtxScanGrid_struct { |
403 | /* set once */ |
404 | int minExtent; /* Smallest cross size used in scan */ |
405 | int maxExtent; /* Size of bounding grid region (2^N - 1) */ |
406 | int xOffset; /* Offset to obtain image X coordinate */ |
407 | int yOffset; /* Offset to obtain image Y coordinate */ |
408 | int xMin; /* Minimum X in image coordinate system */ |
409 | int xMax; /* Maximum X in image coordinate system */ |
410 | int yMin; /* Minimum Y in image coordinate system */ |
411 | int yMax; /* Maximum Y in image coordinate system */ |
412 | |
413 | /* reset for each level */ |
414 | int total; /* Total number of crosses at this size */ |
415 | int extent; /* Length/width of cross in pixels */ |
416 | int jumpSize; /* Distance in pixels between cross centers */ |
417 | int pixelTotal; /* Total pixel count within an individual cross path */ |
418 | int startPos; /* X and Y coordinate of first cross center in pattern */ |
419 | |
420 | /* reset for each cross */ |
421 | int pixelCount; /* Progress (pixel count) within current cross pattern */ |
422 | int xCenter; /* X center of current cross pattern */ |
423 | int yCenter; /* Y center of current cross pattern */ |
424 | } DmtxScanGrid; |
425 | |
426 | /** |
427 | * @struct DmtxTime |
428 | * @brief DmtxTime |
429 | */ |
430 | typedef struct DmtxTime_struct { |
431 | time_t sec; |
432 | unsigned long usec; |
433 | } DmtxTime; |
434 | |
435 | /** |
436 | * @struct DmtxDecode |
437 | * @brief DmtxDecode |
438 | */ |
439 | typedef struct DmtxDecode_struct { |
440 | /* Options */ |
441 | int edgeMin; |
442 | int edgeMax; |
443 | int scanGap; |
444 | double squareDevn; |
445 | int sizeIdxExpected; |
446 | int edgeThresh; |
447 | |
448 | /* Image modifiers */ |
449 | int xMin; |
450 | int xMax; |
451 | int yMin; |
452 | int yMax; |
453 | int scale; |
454 | |
455 | /* Internals */ |
456 | /* int cacheComplete; */ |
457 | unsigned char *cache; |
458 | DmtxImage *image; |
459 | DmtxScanGrid grid; |
460 | } DmtxDecode; |
461 | |
462 | /** |
463 | * @struct DmtxEncode |
464 | * @brief DmtxEncode |
465 | */ |
466 | typedef struct DmtxEncode_struct { |
467 | int method; |
468 | int scheme; |
469 | int sizeIdxRequest; |
470 | int marginSize; |
471 | int moduleSize; |
472 | int pixelPacking; |
473 | int imageFlip; |
474 | int rowPadBytes; |
475 | DmtxMessage *message; |
476 | DmtxImage *image; |
477 | DmtxRegion region; |
478 | DmtxMatrix3 xfrm; /* XXX still necessary? */ |
479 | DmtxMatrix3 rxfrm; /* XXX still necessary? */ |
480 | } DmtxEncode; |
481 | |
482 | /** |
483 | * @struct DmtxChannel |
484 | * @brief DmtxChannel |
485 | */ |
486 | typedef struct DmtxChannel_struct { |
487 | int encScheme; /* current encodation scheme */ |
488 | int invalid; /* channel status (invalid if non-zero) */ |
489 | unsigned char *inputPtr; /* pointer to current input character */ |
490 | unsigned char *inputStop; /* pointer to position after final input character */ |
491 | int encodedLength; /* encoded length (units of 2/3 bits) */ |
492 | int currentLength; /* current length (units of 2/3 bits) */ |
493 | int firstCodeWord; /* */ |
494 | unsigned char encodedWords[1558]; |
495 | } DmtxChannel; |
496 | |
497 | /* Wrap in a struct for fast copies */ |
498 | /** |
499 | * @struct DmtxChannelGroup |
500 | * @brief DmtxChannelGroup |
501 | */ |
502 | typedef struct DmtxChannelGroup_struct { |
503 | DmtxChannel channel[6]; |
504 | } DmtxChannelGroup; |
505 | |
506 | /** |
507 | * @struct DmtxTriplet |
508 | * @brief DmtxTriplet |
509 | */ |
510 | typedef struct DmtxTriplet_struct { |
511 | unsigned char value[3]; |
512 | } DmtxTriplet; |
513 | |
514 | /** |
515 | * @struct DmtxQuadruplet |
516 | * @brief DmtxQuadruplet |
517 | */ |
518 | typedef struct DmtxQuadruplet_struct { |
519 | unsigned char value[4]; |
520 | } DmtxQuadruplet; |
521 | |
522 | /* dmtxtime.c */ |
523 | extern DmtxTime dmtxTimeNow(void); |
524 | extern DmtxTime dmtxTimeAdd(DmtxTime t, long msec); |
525 | extern int dmtxTimeExceeded(DmtxTime timeout); |
526 | |
527 | /* dmtxencode.c */ |
528 | extern DmtxEncode *dmtxEncodeCreate(void); |
529 | extern DmtxPassFail dmtxEncodeDestroy(DmtxEncode **enc); |
530 | extern DmtxPassFail dmtxEncodeSetProp(DmtxEncode *enc, int prop, int value); |
531 | extern int dmtxEncodeGetProp(DmtxEncode *enc, int prop); |
532 | extern DmtxPassFail dmtxEncodeDataMatrix(DmtxEncode *enc, int n, unsigned char *s); |
533 | extern DmtxPassFail dmtxEncodeDataMosaic(DmtxEncode *enc, int n, unsigned char *s); |
534 | |
535 | /* dmtxdecode.c */ |
536 | extern DmtxDecode *dmtxDecodeCreate(DmtxImage *img, int scale); |
537 | extern DmtxPassFail dmtxDecodeDestroy(DmtxDecode **dec); |
538 | extern DmtxPassFail dmtxDecodeSetProp(DmtxDecode *dec, int prop, int value); |
539 | extern int dmtxDecodeGetProp(DmtxDecode *dec, int prop); |
540 | extern /*@exposed@*/ unsigned char *dmtxDecodeGetCache(DmtxDecode *dec, int x, int y); |
541 | extern DmtxPassFail dmtxDecodeGetPixelValue(DmtxDecode *dec, int x, int y, int channel, /*@out@*/ int *value); |
542 | extern DmtxMessage *dmtxDecodeMatrixRegion(DmtxDecode *dec, DmtxRegion *reg, int fix); |
543 | extern DmtxMessage *dmtxDecodeMosaicRegion(DmtxDecode *dec, DmtxRegion *reg, int fix); |
544 | extern unsigned char *dmtxDecodeCreateDiagnostic(DmtxDecode *dec, /*@out@*/ int *totalBytes, /*@out@*/ int *, int style); |
545 | |
546 | /* dmtxregion.c */ |
547 | extern DmtxRegion *dmtxRegionCreate(DmtxRegion *reg); |
548 | extern DmtxPassFail dmtxRegionDestroy(DmtxRegion **reg); |
549 | extern DmtxRegion *dmtxRegionFindNext(DmtxDecode *dec, DmtxTime *timeout); |
550 | extern DmtxRegion *dmtxRegionScanPixel(DmtxDecode *dec, int x, int y); |
551 | extern DmtxPassFail dmtxRegionUpdateCorners(DmtxDecode *dec, DmtxRegion *reg, DmtxVector2 p00, |
552 | DmtxVector2 p10, DmtxVector2 p11, DmtxVector2 p01); |
553 | extern DmtxPassFail dmtxRegionUpdateXfrms(DmtxDecode *dec, DmtxRegion *reg); |
554 | |
555 | /* dmtxmessage.c */ |
556 | extern DmtxMessage *dmtxMessageCreate(int sizeIdx, int symbolFormat); |
557 | extern DmtxPassFail dmtxMessageDestroy(DmtxMessage **msg); |
558 | |
559 | /* dmtximage.c */ |
560 | extern DmtxImage *dmtxImageCreate(unsigned char *pxl, int width, int height, int pack); |
561 | extern DmtxPassFail dmtxImageDestroy(DmtxImage **img); |
562 | extern DmtxPassFail dmtxImageSetChannel(DmtxImage *img, int channelStart, int bitsPerChannel); |
563 | extern DmtxPassFail dmtxImageSetProp(DmtxImage *img, int prop, int value); |
564 | extern int dmtxImageGetProp(DmtxImage *img, int prop); |
565 | extern int dmtxImageGetByteOffset(DmtxImage *img, int x, int y); |
566 | extern DmtxPassFail dmtxImageGetPixelValue(DmtxImage *img, int x, int y, int channel, /*@out@*/ int *value); |
567 | extern DmtxPassFail dmtxImageSetPixelValue(DmtxImage *img, int x, int y, int channel, int value); |
568 | extern DmtxBoolean dmtxImageContainsInt(DmtxImage *img, int margin, int x, int y); |
569 | extern DmtxBoolean dmtxImageContainsFloat(DmtxImage *img, double x, double y); |
570 | |
571 | /* dmtxvector2.c */ |
572 | extern DmtxVector2 *dmtxVector2AddTo(DmtxVector2 *v1, const DmtxVector2 *v2); |
573 | extern DmtxVector2 *dmtxVector2Add(/*@out@*/ DmtxVector2 *vOut, const DmtxVector2 *v1, const DmtxVector2 *v2); |
574 | extern DmtxVector2 *dmtxVector2SubFrom(DmtxVector2 *v1, const DmtxVector2 *v2); |
575 | extern DmtxVector2 *dmtxVector2Sub(/*@out@*/ DmtxVector2 *vOut, const DmtxVector2 *v1, const DmtxVector2 *v2); |
576 | extern DmtxVector2 *dmtxVector2ScaleBy(DmtxVector2 *v, double s); |
577 | extern DmtxVector2 *dmtxVector2Scale(/*@out@*/ DmtxVector2 *vOut, const DmtxVector2 *v, double s); |
578 | extern double dmtxVector2Cross(const DmtxVector2 *v1, const DmtxVector2 *v2); |
579 | extern double dmtxVector2Norm(DmtxVector2 *v); |
580 | extern double dmtxVector2Dot(const DmtxVector2 *v1, const DmtxVector2 *v2); |
581 | extern double dmtxVector2Mag(const DmtxVector2 *v); |
582 | extern double dmtxDistanceFromRay2(const DmtxRay2 *r, const DmtxVector2 *q); |
583 | extern double dmtxDistanceAlongRay2(const DmtxRay2 *r, const DmtxVector2 *q); |
584 | extern DmtxPassFail dmtxRay2Intersect(/*@out@*/ DmtxVector2 *point, const DmtxRay2 *p0, const DmtxRay2 *p1); |
585 | extern DmtxPassFail dmtxPointAlongRay2(/*@out@*/ DmtxVector2 *point, const DmtxRay2 *r, double t); |
586 | |
587 | /* dmtxmatrix3.c */ |
588 | extern void dmtxMatrix3Copy(/*@out@*/ DmtxMatrix3 m0, DmtxMatrix3 m1); |
589 | extern void dmtxMatrix3Identity(/*@out@*/ DmtxMatrix3 m); |
590 | extern void dmtxMatrix3Translate(/*@out@*/ DmtxMatrix3 m, double tx, double ty); |
591 | extern void dmtxMatrix3Rotate(/*@out@*/ DmtxMatrix3 m, double angle); |
592 | extern void dmtxMatrix3Scale(/*@out@*/ DmtxMatrix3 m, double sx, double sy); |
593 | extern void dmtxMatrix3Shear(/*@out@*/ DmtxMatrix3 m, double shx, double shy); |
594 | extern void dmtxMatrix3LineSkewTop(/*@out@*/ DmtxMatrix3 m, double b0, double b1, double sz); |
595 | extern void dmtxMatrix3LineSkewTopInv(/*@out@*/ DmtxMatrix3 m, double b0, double b1, double sz); |
596 | extern void dmtxMatrix3LineSkewSide(/*@out@*/ DmtxMatrix3 m, double b0, double b1, double sz); |
597 | extern void dmtxMatrix3LineSkewSideInv(/*@out@*/ DmtxMatrix3 m, double b0, double b1, double sz); |
598 | extern void dmtxMatrix3Multiply(/*@out@*/ DmtxMatrix3 mOut, DmtxMatrix3 m0, DmtxMatrix3 m1); |
599 | extern void dmtxMatrix3MultiplyBy(DmtxMatrix3 m0, DmtxMatrix3 m1); |
600 | extern int dmtxMatrix3VMultiply(/*@out@*/ DmtxVector2 *vOut, DmtxVector2 *vIn, DmtxMatrix3 m); |
601 | extern int dmtxMatrix3VMultiplyBy(DmtxVector2 *v, DmtxMatrix3 m); |
602 | extern void dmtxMatrix3Print(DmtxMatrix3 m); |
603 | |
604 | /* dmtxsymbol.c */ |
605 | extern int dmtxSymbolModuleStatus(DmtxMessage *mapping, int sizeIdx, int row, int col); |
606 | extern int dmtxGetSymbolAttribute(int attribute, int sizeIdx); |
607 | extern int dmtxGetBlockDataSize(int sizeIdx, int blockIdx); |
608 | |
609 | /* dmtxbytelist.c */ |
610 | extern DmtxByteList dmtxByteListBuild(DmtxByte *storage, int capacity); |
611 | extern void dmtxByteListInit(DmtxByteList *list, int length, DmtxByte value, DmtxPassFail *passFail); |
612 | extern void dmtxByteListClear(DmtxByteList *list); |
613 | extern DmtxBoolean dmtxByteListHasCapacity(DmtxByteList *list); |
614 | extern void dmtxByteListCopy(DmtxByteList *dst, const DmtxByteList *src, DmtxPassFail *passFail); |
615 | extern void dmtxByteListPush(DmtxByteList *list, DmtxByte value, DmtxPassFail *passFail); |
616 | extern DmtxByte dmtxByteListPop(DmtxByteList *list, DmtxPassFail *passFail); |
617 | extern void dmtxByteListPrint(DmtxByteList *list, char *prefix); |
618 | |
619 | extern char *dmtxVersion(void); |
620 | |
621 | #ifdef __cplusplus |
622 | } |
623 | #endif |
624 | |
625 | #endif |
626 | |