"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "javase/src/main/java/com/google/zxing/client/j2se/BufferedImageLuminanceSource.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.

BufferedImageLuminanceSource.java  (zxing-zxing-3.4.0):BufferedImageLuminanceSource.java  (zxing-zxing-3.4.1)
skipping to change at line 70 skipping to change at line 70
int[] buffer = new int[width]; int[] buffer = new int[width];
for (int y = top; y < top + height; y++) { for (int y = top; y < top + height; y++) {
image.getRGB(left, y, width, 1, buffer, 0, sourceWidth); image.getRGB(left, y, width, 1, buffer, 0, sourceWidth);
for (int x = 0; x < width; x++) { for (int x = 0; x < width; x++) {
int pixel = buffer[x]; int pixel = buffer[x];
// The color of fully-transparent pixels is irrelevant. They are often , technically, fully-transparent // The color of fully-transparent pixels is irrelevant. They are often , technically, fully-transparent
// black (0 alpha, and then 0 RGB). They are often used, of course as the "white" area in a // black (0 alpha, and then 0 RGB). They are often used, of course as the "white" area in a
// barcode image. Force any such pixel to be white: // barcode image. Force any such pixel to be white:
if ((pixel & 0xFF000000) == 0) { if ((pixel & 0xFF000000) == 0) {
pixel = 0xFFFFFFFF; // = white // white, so we know its luminance is 255
} buffer[x] = 0xFF;
} else {
// .299R + 0.587G + 0.114B (YUV/YIQ for PAL and NTSC), // .299R + 0.587G + 0.114B (YUV/YIQ for PAL and NTSC),
// (306*R) >> 10 is approximately equal to R*0.299, and so on. // (306*R) >> 10 is approximately equal to R*0.299, and so on.
// 0x200 >> 10 is 0.5, it implements rounding. // 0x200 >> 10 is 0.5, it implements rounding.
buffer[x] = buffer[x] =
(306 * ((pixel >> 16) & 0xFF) + (306 * ((pixel >> 16) & 0xFF) +
601 * ((pixel >> 8) & 0xFF) + 601 * ((pixel >> 8) & 0xFF) +
117 * (pixel & 0xFF) + 117 * (pixel & 0xFF) +
0x200) >> 10; 0x200) >> 10;
}
} }
raster.setPixels(left, y, width, 1, buffer); raster.setPixels(left, y, width, 1, buffer);
} }
} }
this.left = left; this.left = left;
this.top = top; this.top = top;
} }
@Override @Override
 End of changes. 2 change blocks. 
10 lines changed or deleted 11 lines changed or added

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