Move PDF417, Aztec Writers up a level for consistency

git-svn-id: https://zxing.googlecode.com/svn/trunk@2644 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen@gmail.com 2013-04-10 16:33:21 +00:00
parent 44f46dee34
commit ab1c907ad8
6 changed files with 26 additions and 20 deletions

View file

@ -16,7 +16,7 @@
package com.google.zxing;
import com.google.zxing.aztec.encoder.AztecWriter;
import com.google.zxing.aztec.AztecWriter;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.datamatrix.DataMatrixWriter;
import com.google.zxing.oned.CodaBarWriter;
@ -26,7 +26,7 @@ import com.google.zxing.oned.EAN13Writer;
import com.google.zxing.oned.EAN8Writer;
import com.google.zxing.oned.ITFWriter;
import com.google.zxing.oned.UPCAWriter;
import com.google.zxing.pdf417.encoder.PDF417Writer;
import com.google.zxing.pdf417.PDF417Writer;
import com.google.zxing.qrcode.QRCodeWriter;
import java.util.Map;

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.google.zxing.aztec.encoder;
package com.google.zxing.aztec;
import java.nio.charset.Charset;
import java.util.Map;
@ -22,6 +22,8 @@ import java.util.Map;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.Writer;
import com.google.zxing.aztec.encoder.AztecCode;
import com.google.zxing.aztec.encoder.Encoder;
import com.google.zxing.common.BitMatrix;
public final class AztecWriter implements Writer {

View file

@ -14,13 +14,16 @@
* limitations under the License.
*/
package com.google.zxing.pdf417.encoder;
package com.google.zxing.pdf417;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.Writer;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.pdf417.encoder.Compaction;
import com.google.zxing.pdf417.encoder.Dimensions;
import com.google.zxing.pdf417.encoder.PDF417;
import java.util.Map;

View file

@ -21,7 +21,7 @@ package com.google.zxing.pdf417.encoder;
*
* @author Jacob Haynes
*/
final class BarcodeMatrix {
public final class BarcodeMatrix {
private final BarcodeRow[] matrix;
private int currentRow;
@ -59,19 +59,19 @@ final class BarcodeMatrix {
return matrix[currentRow];
}
byte[][] getMatrix() {
public byte[][] getMatrix() {
return getScaledMatrix(1, 1);
}
byte[][] getScaledMatrix(int Scale) {
return getScaledMatrix(Scale, Scale);
public byte[][] getScaledMatrix(int scale) {
return getScaledMatrix(scale, scale);
}
byte[][] getScaledMatrix(int xScale, int yScale) {
public byte[][] getScaledMatrix(int xScale, int yScale) {
byte[][] matrixOut = new byte[height * yScale][width * xScale];
int yMax = height * yScale;
for (int ii = 0; ii < yMax; ii++) {
matrixOut[yMax - ii - 1] = matrix[ii / yScale].getScaledRow(xScale);
for (int i = 0; i < yMax; i++) {
matrixOut[yMax - i - 1] = matrix[i / yScale].getScaledRow(xScale);
}
return matrixOut;
}

View file

@ -25,7 +25,7 @@ import com.google.zxing.WriterException;
/**
* Top-level class for the logic part of the PDF417 implementation.
*/
final class PDF417 {
public final class PDF417 {
/**
* The start pattern (17 bits)
@ -518,11 +518,11 @@ final class PDF417 {
private int maxRows;
private int minRows;
PDF417() {
public PDF417() {
this(false);
}
PDF417(boolean compact) {
public PDF417(boolean compact) {
this.compact = compact;
compaction = Compaction.AUTO;
minCols = 2;
@ -531,7 +531,7 @@ final class PDF417 {
minRows = 2;
}
BarcodeMatrix getBarcodeMatrix() {
public BarcodeMatrix getBarcodeMatrix() {
return barcodeMatrix;
}
@ -638,7 +638,7 @@ final class PDF417 {
*
* @param msg the message to encode
*/
void generateBarcodeLogic(String msg, int errorCorrectionLevel) throws WriterException {
public void generateBarcodeLogic(String msg, int errorCorrectionLevel) throws WriterException {
//1. step: High-level encoding
int errorCorrectionCodeWords = PDF417ErrorCorrection.getErrorCorrectionCodewordCount(errorCorrectionLevel);
@ -683,7 +683,7 @@ final class PDF417 {
* @param errorCorrectionCodeWords number of error correction code words
* @return dimension object containing cols as width and rows as height
*/
int[] determineDimensions(int sourceCodeWords, int errorCorrectionCodeWords) throws WriterException {
private int[] determineDimensions(int sourceCodeWords, int errorCorrectionCodeWords) throws WriterException {
float ratio = 0.0f;
int[] dimension = null;
@ -728,7 +728,7 @@ final class PDF417 {
/**
* Sets max/min row/col values
*/
void setDimensions(int maxCols, int minCols, int maxRows, int minRows) {
public void setDimensions(int maxCols, int minCols, int maxRows, int minRows) {
this.maxCols = maxCols;
this.minCols = minCols;
this.maxRows = maxRows;
@ -738,7 +738,7 @@ final class PDF417 {
/**
* Sets compaction to values stored in {@link Compaction} enum
*/
void setCompaction(Compaction compaction) {
public void setCompaction(Compaction compaction) {
this.compaction = compaction;
}
@ -746,7 +746,7 @@ final class PDF417 {
* Sets compact to be true or false
* @param compact
*/
void setCompact(boolean compact) {
public void setCompact(boolean compact) {
this.compact = compact;
}

View file

@ -24,6 +24,7 @@ import java.util.Random;
import java.util.regex.Pattern;
import com.google.zxing.FormatException;
import com.google.zxing.aztec.AztecWriter;
import org.junit.Assert;
import org.junit.Test;