libdmtx 0.7.8.7
libdmtx is a software library that enables programs to read and write Data Matrix barcodes of the modern ECC200 variety.
Loading...
Searching...
No Matches
dmtxencode.c File Reference

libdmtx - Data Matrix Encoding/Decoding Library Copyright 2008, 2009 Mike Laughton. More...

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "dmtx.h"
#include "dmtxstatic.h"

Go to the source code of this file.

Macros

#define ISDIGIT(n)
 

Functions

DmtxEncodedmtxEncodeCreate (void)
 Initialize encode struct with default values.
 
DmtxPassFail dmtxEncodeDestroy (DmtxEncode **enc)
 Deinitialize encode struct.
 
DmtxPassFail dmtxEncodeSetProp (DmtxEncode *enc, int prop, int value)
 Set encoding behavior property.
 
int dmtxEncodeGetProp (DmtxEncode *enc, int prop)
 Get encoding behavior property.
 
DmtxPassFail dmtxEncodeDataMatrix (DmtxEncode *enc, int inputSize, unsigned char *inputString)
 Convert message into Data Matrix image.
 
DmtxPassFail dmtxEncodeDataMosaic (DmtxEncode *enc, int inputSize, unsigned char *inputString)
 Convert message into Data Mosaic image.
 
static int encodeDataCodewords (DmtxByteList *input, DmtxByteList *output, int sizeIdxRequest, DmtxScheme scheme, int fnc1)
 Convert input into message using specific encodation scheme.
 
static void printPattern (DmtxEncode *enc)
 Write encoded message to image.
 

Detailed Description

libdmtx - Data Matrix Encoding/Decoding Library Copyright 2008, 2009 Mike Laughton.

All rights reserved. Copyright 2012-2016 Vadim A. Misbakh-Soloviov. All rights reserved.

See LICENSE file in the main project directory for full terms of use and distribution.

Contact: Vadim A. Misbakh-Soloviov dmtx@.nosp@m.mva..nosp@m.name Mike Laughton mike@.nosp@m.drag.nosp@m.onfly.nosp@m.logi.nosp@m.c.com

Base encoding logic

Definition in file dmtxencode.c.

Macro Definition Documentation

◆ ISDIGIT

#define ISDIGIT ( n)
Value:
(n > 47 && n < 58)

Definition at line 26 of file dmtxencode.c.

Function Documentation

◆ dmtxEncodeCreate()

DmtxEncode * dmtxEncodeCreate ( void )
extern

Initialize encode struct with default values.

Returns
Initialized DmtxEncode struct

Definition at line 32 of file dmtxencode.c.

◆ dmtxEncodeDataMatrix()

DmtxPassFail dmtxEncodeDataMatrix ( DmtxEncode * enc,
int inputSize,
unsigned char * inputString )
extern

Convert message into Data Matrix image.

Parameters
enc
inputSize
inputString
Returns
DmtxPass | DmtxFail

Definition at line 171 of file dmtxencode.c.

◆ dmtxEncodeDataMosaic()

DmtxPassFail dmtxEncodeDataMosaic ( DmtxEncode * enc,
int inputSize,
unsigned char * inputString )
extern

Convert message into Data Mosaic image.

1) count how many codewords it would take to encode the whole thing 2) take ceiling N of codeword count divided by 3 3) using minimum symbol size that can accomodate N codewords: 4) create several barcodes over iterations of increasing numbers of input codewords until you go one too far 5) if codewords remain after filling R, G, and B barcodes then go back to 3 and try with next larger size 6) take the 3 different images you created and write out a new barcode

Parameters
enc
inputSize
inputString
Returns
DmtxPass | DmtxFail

Definition at line 259 of file dmtxencode.c.

◆ dmtxEncodeDestroy()

DmtxPassFail dmtxEncodeDestroy ( DmtxEncode ** enc)
extern

Deinitialize encode struct.

Parameters
enc
Returns
void

Definition at line 70 of file dmtxencode.c.

◆ dmtxEncodeGetProp()

int dmtxEncodeGetProp ( DmtxEncode * enc,
int prop )
extern

Get encoding behavior property.

Parameters
enc
prop
Returns
value

Definition at line 146 of file dmtxencode.c.

◆ dmtxEncodeSetProp()

DmtxPassFail dmtxEncodeSetProp ( DmtxEncode * enc,
int prop,
int value )
extern

Set encoding behavior property.

Parameters
enc
prop
value
Returns
DmtxPass | DmtxFail

Definition at line 99 of file dmtxencode.c.

◆ encodeDataCodewords()

static int encodeDataCodewords ( DmtxByteList * input,
DmtxByteList * output,
int sizeIdxRequest,
DmtxScheme scheme,
int fnc1 )
static

Convert input into message using specific encodation scheme.

Returns
Count of encoded data words

Future: pass DmtxEncode to this function with an error reason field, which goes to EncodeSingle... too

Definition at line 390 of file dmtxencode.c.

◆ printPattern()

static void printPattern ( DmtxEncode * enc)
static

Write encoded message to image.

Parameters
enc

Definition at line 415 of file dmtxencode.c.