Esempio n. 1
0
	/*
	 * Qrcode data encoding, implements Barcode2dBase::encode()
	 */
	bool BarcodeQrcode::encode( const std::string& cookedData, Matrix<bool>& encodedData )
	{
		QRcode *qrcode = QRcode_encodeString( cookedData.c_str(), 0, QR_ECLEVEL_M, QR_MODE_8, 1 );
		if ( qrcode == NULL )
		{
			return false;
		}


		int w = qrcode->width;
		encodedData.resize( w, w );
		
		
		for ( int iy = 0; iy < w; iy++ )
		{
			for ( int ix = 0; ix < w; ix++ )
			{
				encodedData[iy][ix] = qrcode->data[ iy*w + ix ] & 0x01;
			}
		}


		QRcode_free( qrcode );
		QRcode_clearCache();

		return true;
	}
Esempio n. 2
0
int main(int argc, char **argv)
{
	int loop = 1000;
	if(argc == 2) {
		loop = atoi(argv[1]);
	}
	monkey_split_an(loop);
	monkey_encode_an(loop);
	monkey_split_8(loop);
	monkey_encode_8(loop);
	monkey_split_kanji(loop);
	monkey_encode_kanji(loop);
	monkey_split_structure(loop);

	QRcode_clearCache();

	return 0;
}
Esempio n. 3
0
int main(void)
{
	test_iterate();
	test_iterate2();
	//print_filler();
	test_filler();
	test_format();
	test_encode();
	test_encode2();
	test_encode3();
	test_encodeNull();
	test_encodeEmpty();
	test_encodeNull8();
	test_encodeEmpty8();
	test_encodeTooLong();
	test_01234567();
	test_invalid_input();
//	print_01234567();
	test_struct_example();
	test_struct_semilong();
	test_null_free();
	test_qrraw_new();
	test_mqrraw_new();
	test_encodeData();
	test_formatInfo();
	test_decodeSimple();
	test_decodeLong();
	test_decodeVeryLong();
	//print_fillerMQR();
	test_fillerMQR();
	test_formatInfoMQR();
	test_encodeTooLongMQR();
	test_decodeShortMQR();

	QRcode_clearCache();

	report();

	return 0;
}