"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "core/src/main/java/com/google/zxing/oned/ITFWriter.java" between
zxing-zxing-3.4.0.tar.gz and zxing-zxing-3.4.1.tar.gz

About: ZXing ("zebra crossing") is a multi-format 1D/2D barcode image processing library implemented in Java, with ports to other languages.

ITFWriter.java  (zxing-zxing-3.4.0):ITFWriter.java  (zxing-zxing-3.4.1)
skipping to change at line 20 skipping to change at line 20
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.google.zxing.oned; package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat; import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix; import com.google.zxing.common.BitMatrix;
import java.util.Map; import java.util.Collection;
import java.util.Collections;
/** /**
* This object renders a ITF code as a {@link BitMatrix}. * This object renders a ITF code as a {@link BitMatrix}.
* *
* @author erik.barbara@gmail.com (Erik Barbara) * @author erik.barbara@gmail.com (Erik Barbara)
*/ */
public final class ITFWriter extends OneDimensionalCodeWriter { public final class ITFWriter extends OneDimensionalCodeWriter {
private static final int[] START_PATTERN = {1, 1, 1, 1}; private static final int[] START_PATTERN = {1, 1, 1, 1};
private static final int[] END_PATTERN = {3, 1, 1}; private static final int[] END_PATTERN = {3, 1, 1};
skipping to change at line 55 skipping to change at line 54
{W, W, N, N, N}, // 3 {W, W, N, N, N}, // 3
{N, N, W, N, W}, // 4 {N, N, W, N, W}, // 4
{W, N, W, N, N}, // 5 {W, N, W, N, N}, // 5
{N, W, W, N, N}, // 6 {N, W, W, N, N}, // 6
{N, N, N, W, W}, // 7 {N, N, N, W, W}, // 7
{W, N, N, W, N}, // 8 {W, N, N, W, N}, // 8
{N, W, N, W, N} // 9 {N, W, N, W, N} // 9
}; };
@Override @Override
public BitMatrix encode(String contents, protected Collection<BarcodeFormat> getSupportedWriteFormats() {
BarcodeFormat format, return Collections.singleton(BarcodeFormat.ITF);
int width,
int height,
Map<EncodeHintType,?> hints) throws WriterException {
if (format != BarcodeFormat.ITF) {
throw new IllegalArgumentException("Can only encode ITF, but got " + forma
t);
}
return super.encode(contents, format, width, height, hints);
} }
@Override @Override
public boolean[] encode(String contents) { public boolean[] encode(String contents) {
int length = contents.length(); int length = contents.length();
if (length % 2 != 0) { if (length % 2 != 0) {
throw new IllegalArgumentException("The length of the input should be even "); throw new IllegalArgumentException("The length of the input should be even ");
} }
if (length > 80) { if (length > 80) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
 End of changes. 3 change blocks. 
14 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)