"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "core/src/main/java/com/google/zxing/oned/EAN8Writer.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.

EAN8Writer.java  (zxing-zxing-3.4.0):EAN8Writer.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.FormatException; import com.google.zxing.FormatException;
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 an EAN8 code as a {@link BitMatrix}. * This object renders an EAN8 code as a {@link BitMatrix}.
* *
* @author aripollak@gmail.com (Ari Pollak) * @author aripollak@gmail.com (Ari Pollak)
*/ */
public final class EAN8Writer extends UPCEANWriter { public final class EAN8Writer extends UPCEANWriter {
private static final int CODE_WIDTH = 3 + // start guard private static final int CODE_WIDTH = 3 + // start guard
(7 * 4) + // left bars (7 * 4) + // left bars
5 + // middle guard 5 + // middle guard
(7 * 4) + // right bars (7 * 4) + // right bars
3; // end guard 3; // end guard
@Override @Override
public BitMatrix encode(String contents, protected Collection<BarcodeFormat> getSupportedWriteFormats() {
BarcodeFormat format, return Collections.singleton(BarcodeFormat.EAN_8);
int width,
int height,
Map<EncodeHintType,?> hints) throws WriterException {
if (format != BarcodeFormat.EAN_8) {
throw new IllegalArgumentException("Can only encode EAN_8, but got "
+ format);
}
return super.encode(contents, format, width, height, hints);
} }
/** /**
* @return a byte array of horizontal pixels (false = white, true = black) * @return a byte array of horizontal pixels (false = white, true = black)
*/ */
@Override @Override
public boolean[] encode(String contents) { public boolean[] encode(String contents) {
int length = contents.length(); int length = contents.length();
switch (length) { switch (length) {
case 7: case 7:
 End of changes. 4 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)