private static void embedPositionDetectionPattern(int xStart, int yStart, ByteMatrix matrix) { for (int y = 0; y < 7; ++y) { int[] patternY = POSITION_DETECTION_PATTERN[y]; for (int x = 0; x < 7; ++x) { matrix.set(xStart + x, yStart + y, patternY[x]); } } }
private static void embedPositionDetectionPattern(int xStart, int yStart, ByteMatrix matrix) { for (int y = 0; y < 7; ++y) { int[] patternY = POSITION_DETECTION_PATTERN[y]; for (int x = 0; x < 7; ++x) { matrix.set(xStart + x, yStart + y, patternY[x]); } } }
private static void embedPositionAdjustmentPattern(int xStart, int yStart, ByteMatrix matrix) { for (int y = 0; y < 5; ++y) { int[] patternY = POSITION_ADJUSTMENT_PATTERN[y]; for (int x = 0; x < 5; ++x) { matrix.set(xStart + x, yStart + y, patternY[x]); } } }
private static void embedPositionAdjustmentPattern(int xStart, int yStart, ByteMatrix matrix) { for (int y = 0; y < 5; ++y) { int[] patternY = POSITION_ADJUSTMENT_PATTERN[y]; for (int x = 0; x < 5; ++x) { matrix.set(xStart + x, yStart + y, patternY[x]); } } }
private static void embedVerticalSeparationPattern(int xStart, int yStart, ByteMatrix matrix) throws WriterException { for (int y = 0; y < 7; ++y) { if (!isEmpty(matrix.get(xStart, yStart + y))) { throw new WriterException(); } matrix.set(xStart, yStart + y, 0); } }
private static void embedTimingPatterns(ByteMatrix matrix) { // -8 is for skipping position detection patterns (size 7), and two horizontal/vertical // separation patterns (size 1). Thus, 8 = 7 + 1. for (int i = 8; i < matrix.getWidth() - 8; ++i) { int bit = (i + 1) % 2; // Horizontal line. if (isEmpty(matrix.get(i, 6))) { matrix.set(i, 6, bit); } // Vertical line. if (isEmpty(matrix.get(6, i))) { matrix.set(6, i, bit); } } }
private static void embedHorizontalSeparationPattern(int xStart, int yStart, ByteMatrix matrix) throws WriterException { for (int x = 0; x < 8; ++x) { if (!isEmpty(matrix.get(xStart + x, yStart))) { throw new WriterException(); } matrix.set(xStart + x, yStart, 0); } }
private static void embedHorizontalSeparationPattern(int xStart, int yStart, ByteMatrix matrix) throws WriterException { for (int x = 0; x < 8; ++x) { if (!isEmpty(matrix.get(xStart + x, yStart))) { throw new WriterException(); } matrix.set(xStart + x, yStart, 0); } }
private static void embedVerticalSeparationPattern(int xStart, int yStart, ByteMatrix matrix) throws WriterException { for (int y = 0; y < 7; ++y) { if (!isEmpty(matrix.get(xStart, yStart + y))) { throw new WriterException(); } matrix.set(xStart, yStart + y, 0); } }
private static void embedDarkDotAtLeftBottomCorner(ByteMatrix matrix) throws WriterException { if (matrix.get(8, matrix.getHeight() - 8) == 0) { throw new WriterException(); } matrix.set(8, matrix.getHeight() - 8, 1); }
private static void embedDarkDotAtLeftBottomCorner(ByteMatrix matrix) throws WriterException { if (matrix.get(8, matrix.getHeight() - 8) == 0) { throw new WriterException(); } matrix.set(8, matrix.getHeight() - 8, 1); }
private static void embedHorizontalSeparationPattern(int xStart, int yStart, ByteMatrix matrix) throws WriterException { // We know the width and height. if (HORIZONTAL_SEPARATION_PATTERN[0].length != 8 || HORIZONTAL_SEPARATION_PATTERN.length != 1) { throw new WriterException("Bad horizontal separation pattern"); } for (int x = 0; x < 8; ++x) { if (!isEmpty(matrix.get(xStart + x, yStart))) { throw new WriterException(); } matrix.set(xStart + x, yStart, HORIZONTAL_SEPARATION_PATTERN[0][x]); } }
private static void embedVerticalSeparationPattern(int xStart, int yStart, ByteMatrix matrix) throws WriterException { // We know the width and height. if (VERTICAL_SEPARATION_PATTERN[0].length != 1 || VERTICAL_SEPARATION_PATTERN.length != 7) { throw new WriterException("Bad vertical separation pattern"); } for (int y = 0; y < 7; ++y) { if (!isEmpty(matrix.get(xStart, yStart + y))) { throw new WriterException(); } matrix.set(xStart, yStart + y, VERTICAL_SEPARATION_PATTERN[y][0]); } }
private static void embedDarkDotAtLeftBottomCorner(ByteMatrix matrix) throws WriterException { if (matrix.get(8, matrix.getHeight() - 8) == 0) { throw new WriterException(); } matrix.set(8, matrix.getHeight() - 8, 1); }
private static void embedDarkDotAtLeftBottomCorner(ByteMatrix matrix) throws WriterException { if (matrix.get(8, matrix.getHeight() - 8) == 0) { throw new WriterException(); } matrix.set(8, matrix.getHeight() - 8, 1); }
private static void embedHorizontalSeparationPattern(int xStart, int yStart, ByteMatrix matrix) throws WriterException { // We know the width and height. if (HORIZONTAL_SEPARATION_PATTERN[0].length != 8 || HORIZONTAL_SEPARATION_PATTERN.length != 1) { throw new WriterException("Bad horizontal separation pattern"); } for (int x = 0; x < 8; ++x) { if (!isEmpty(matrix.get(xStart + x, yStart))) { throw new WriterException(); } matrix.set(xStart + x, yStart, HORIZONTAL_SEPARATION_PATTERN[0][x]); } }
private static void embedVerticalSeparationPattern(int xStart, int yStart, ByteMatrix matrix) throws WriterException { // We know the width and height. if (VERTICAL_SEPARATION_PATTERN[0].length != 1 || VERTICAL_SEPARATION_PATTERN.length != 7) { throw new WriterException("Bad vertical separation pattern"); } for (int y = 0; y < 7; ++y) { if (!isEmpty(matrix.get(xStart, yStart + y))) { throw new WriterException(); } matrix.set(xStart, yStart + y, VERTICAL_SEPARATION_PATTERN[y][0]); } }
private static void embedPositionDetectionPattern(int xStart, int yStart, ByteMatrix matrix) throws WriterException { // We know the width and height. if (POSITION_DETECTION_PATTERN[0].length != 7 || POSITION_DETECTION_PATTERN.length != 7) { throw new WriterException("Bad position detection pattern"); } for (int y = 0; y < 7; ++y) { for (int x = 0; x < 7; ++x) { if (!isEmpty(matrix.get(xStart + x, yStart + y))) { throw new WriterException(); } matrix.set(xStart + x, yStart + y, POSITION_DETECTION_PATTERN[y][x]); } } }
private static void embedPositionAdjustmentPattern(int xStart, int yStart, ByteMatrix matrix) throws WriterException { // We know the width and height. if (POSITION_ADJUSTMENT_PATTERN[0].length != 5 || POSITION_ADJUSTMENT_PATTERN.length != 5) { throw new WriterException("Bad position adjustment"); } for (int y = 0; y < 5; ++y) { for (int x = 0; x < 5; ++x) { if (!isEmpty(matrix.get(xStart + x, yStart + y))) { throw new WriterException(); } matrix.set(xStart + x, yStart + y, POSITION_ADJUSTMENT_PATTERN[y][x]); } } }
private static void embedPositionAdjustmentPattern(int xStart, int yStart, ByteMatrix matrix) throws WriterException { // We know the width and height. if (POSITION_ADJUSTMENT_PATTERN[0].length != 5 || POSITION_ADJUSTMENT_PATTERN.length != 5) { throw new WriterException("Bad position adjustment"); } for (int y = 0; y < 5; ++y) { for (int x = 0; x < 5; ++x) { if (!isEmpty(matrix.get(xStart + x, yStart + y))) { throw new WriterException(); } matrix.set(xStart + x, yStart + y, POSITION_ADJUSTMENT_PATTERN[y][x]); } } }