summaryrefslogtreecommitdiffstats
path: root/friendfinder/barcode.c
blob: 25866e05af9e7782217efa32230753e5e8e421d4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include "dmtx.h"
#include "Imlib2.h"
#include "barcode.h"


void generate_barcode(char* key)
{
	size_t width, height, bytesPerPixel;
	unsigned char  *pxl;
	DmtxEncode     *enc;

	enc = dmtxEncodeCreate();
	if (enc != NULL);
   		dmtxEncodeDataMatrix(enc, strlen(key), key);

	width = dmtxImageGetProp(enc->image, DmtxPropWidth);
   	height = dmtxImageGetProp(enc->image, DmtxPropHeight);
   	bytesPerPixel = dmtxImageGetProp(enc->image, DmtxPropBytesPerPixel);

   	pxl = (unsigned char *)malloc(width * height * bytesPerPixel);
	
	if(pxl != NULL);
   		memcpy(pxl, enc->image->pxl, width * height * bytesPerPixel);

	dmtxImageSetProp(enc->image, DmtxPropImageFlip, DmtxFlipNone);
	
	write_img(enc);
}


void write_img(DmtxEncode* enc)
{

}