mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Closes #467 : more efficient construction of BufferedImage from bit matrix
This commit is contained in:
parent
c3f91a0058
commit
6f0deeeda3
|
@ -62,11 +62,14 @@ public final class MatrixToImageWriter {
|
||||||
BufferedImage image = new BufferedImage(width, height, config.getBufferedImageColorModel());
|
BufferedImage image = new BufferedImage(width, height, config.getBufferedImageColorModel());
|
||||||
int onColor = config.getPixelOnColor();
|
int onColor = config.getPixelOnColor();
|
||||||
int offColor = config.getPixelOffColor();
|
int offColor = config.getPixelOffColor();
|
||||||
for (int x = 0; x < width; x++) {
|
int[] pixels = new int[width * height];
|
||||||
|
int index = 0;
|
||||||
for (int y = 0; y < height; y++) {
|
for (int y = 0; y < height; y++) {
|
||||||
image.setRGB(x, y, matrix.get(x, y) ? onColor : offColor);
|
for (int x = 0; x < width; x++) {
|
||||||
|
pixels[index++] = matrix.get(x, y) ? onColor : offColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
image.setRGB(0, 0, width, height, pixels, 0, width);
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,9 @@
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
<artifactId>jetty-maven-plugin</artifactId>
|
<artifactId>jetty-maven-plugin</artifactId>
|
||||||
<version>9.3.2.v20150730</version>
|
<version>9.3.2.v20150730</version>
|
||||||
|
<configuration>
|
||||||
|
<webAppSourceDirectory>src/web</webAppSourceDirectory>
|
||||||
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
Loading…
Reference in a new issue