MCPcopy Create free account
hub / github.com/devilsen/CZXing / EncodeLowLevel

Function EncodeLowLevel

czxing/src/main/cpp/zxing/src/pdf417/PDFEncoder.cpp:396–441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

394}
395
396static BarcodeMatrix EncodeLowLevel(const std::vector<int>& fullCodewords, int c, int r, int errorCorrectionLevel, bool compact)
397{
398 BarcodeMatrix logic;
399 logic.init(r, c);
400
401 int idx = 0;
402 for (int y = 0; y < r; y++) {
403 int cluster = y % 3;
404 logic.startRow();
405 EncodeChar(START_PATTERN, 17, logic.currentRow());
406
407 int left;
408 int right;
409 if (cluster == 0) {
410 left = (30 * (y / 3)) + ((r - 1) / 3);
411 right = (30 * (y / 3)) + (c - 1);
412 }
413 else if (cluster == 1) {
414 left = (30 * (y / 3)) + (errorCorrectionLevel * 3) + ((r - 1) % 3);
415 right = (30 * (y / 3)) + ((r - 1) / 3);
416 }
417 else {
418 left = (30 * (y / 3)) + (c - 1);
419 right = (30 * (y / 3)) + (errorCorrectionLevel * 3) + ((r - 1) % 3);
420 }
421
422 int pattern = CODEWORD_TABLE[cluster][left];
423 EncodeChar(pattern, 17, logic.currentRow());
424
425 for (int x = 0; x < c; x++) {
426 pattern = CODEWORD_TABLE[cluster][fullCodewords[idx]];
427 EncodeChar(pattern, 17, logic.currentRow());
428 idx++;
429 }
430
431 if (compact) {
432 EncodeChar(STOP_PATTERN, 1, logic.currentRow()); // encodes stop line for compact pdf417
433 }
434 else {
435 pattern = CODEWORD_TABLE[cluster][right];
436 EncodeChar(pattern, 17, logic.currentRow());
437 EncodeChar(STOP_PATTERN, 18, logic.currentRow());
438 }
439 }
440 return logic;
441}
442
443/**
444* Determine optimal nr of columns and rows for the specified number of

Callers 1

generateBarcodeLogicMethod · 0.70

Calls 3

startRowMethod · 0.80
EncodeCharFunction · 0.70
initMethod · 0.45

Tested by

no test coverage detected