mirror of https://github.com/status-im/qzxing.git
Merge branch 'encoder_changes'
This commit is contained in:
commit
995c01a5c8
|
@ -303,7 +303,7 @@ QImage QZXing::encodeData(const QString& data)
|
|||
Ref<qrcode::QRCode> barcode = qrcode::Encoder::encode(data, qrcode::ErrorCorrectionLevel::L );
|
||||
Ref<qrcode::ByteMatrix> bytesRef = barcode->getMatrix();
|
||||
const std::vector< std::vector <char> >& bytes = bytesRef->getArray();
|
||||
QImage image(bytesRef->getWidth(), bytesRef->getHeight(), QImage::Format_ARGB32);
|
||||
image = QImage(bytesRef->getWidth(), bytesRef->getHeight(), QImage::Format_ARGB32);
|
||||
for(int i=0; i<bytesRef->getWidth(); i++)
|
||||
for(int j=0; j<bytesRef->getHeight(); j++)
|
||||
image.setPixel(i, j, bytes[i][j] ?
|
||||
|
@ -311,7 +311,7 @@ QImage QZXing::encodeData(const QString& data)
|
|||
qRgb(255,255,255));
|
||||
|
||||
image = image.scaled(240, 240);
|
||||
bool success = image.save("tmp.bmp","BMP");
|
||||
//bool success = image.save("tmp.bmp","BMP");
|
||||
} catch (std::exception& e) {
|
||||
std::cout << "Error: " << e.what() << std::endl;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ size_t ByteMatrix::getWidth() const
|
|||
return width_;
|
||||
}
|
||||
|
||||
char ByteMatrix::get(size_t x, size_t y) const
|
||||
signed char ByteMatrix::get(size_t x, size_t y) const
|
||||
{
|
||||
return bytes_[y][x];
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
|
||||
size_t getHeight() const;
|
||||
size_t getWidth() const;
|
||||
char get(size_t x, size_t y) const;
|
||||
signed char get(size_t x, size_t y) const;
|
||||
|
||||
std::vector< std::vector<char> > getArray() const;
|
||||
void set(size_t x, size_t y, const char value);
|
||||
|
|
|
@ -60,7 +60,7 @@ private:
|
|||
//static bool isOnlyDoubleByteKanji(const QString& content);
|
||||
|
||||
static int chooseMaskPattern(Ref<BitArray> bits,
|
||||
ErrorCorrectionLevel ecLevel,
|
||||
ErrorCorrectionLevel& ecLevel,
|
||||
Ref<Version> version,
|
||||
Ref<ByteMatrix> matrix);
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ Ref<QRCode> Encoder::encode(const QString& content, ErrorCorrectionLevel &ecLeve
|
|||
// Put data together into the overall payload
|
||||
headerAndDataBits.appendBitArray(dataBits);
|
||||
|
||||
zxing::qrcode::ECBlocks ecBlocks = version->getECBlocksForLevel(ecLevel);
|
||||
zxing::qrcode::ECBlocks &ecBlocks = version->getECBlocksForLevel(ecLevel);
|
||||
int numDataBytes = version->getTotalCodewords() - ecBlocks.getTotalECCodewords();
|
||||
|
||||
// Terminate the bits properly.
|
||||
|
@ -111,7 +111,7 @@ Ref<QRCode> Encoder::encode(const QString& content, ErrorCorrectionLevel &ecLeve
|
|||
|
||||
Ref<QRCode> qrCode(new QRCode);
|
||||
|
||||
qrCode->setECLevel(Ref<ErrorCorrectionLevel>(&ecLevel));
|
||||
qrCode->setECLevel(Ref<ErrorCorrectionLevel>(new ErrorCorrectionLevel(ecLevel)));
|
||||
qrCode->setMode(mode);
|
||||
qrCode->setVersion(version);
|
||||
|
||||
|
@ -202,7 +202,7 @@ Mode Encoder::chooseMode(const QString& content, const QString& encoding)
|
|||
//}
|
||||
|
||||
int Encoder::chooseMaskPattern(Ref<BitArray> bits,
|
||||
ErrorCorrectionLevel ecLevel,
|
||||
ErrorCorrectionLevel& ecLevel,
|
||||
Ref<Version> version,
|
||||
Ref<ByteMatrix> matrix)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue