use of javax.microedition.lcdui.Image in project qrcode by yanbe.
the class J2MEImage method drawMatrix.
public void drawMatrix(boolean[][] matrix) {
Image bufImage = Image.createImage(image.getWidth(), image.getHeight());
Graphics g = bufImage.getGraphics();
g.setColor(0xCCCCCC);
for (int y = 0; y < matrix[0].length; y++) {
for (int x = 0; x < matrix.length; x++) {
if (matrix[x][y] == true)
g.drawLine(x, y, x + 1, y);
}
}
image = bufImage;
repaint();
}
use of javax.microedition.lcdui.Image in project qrcode by yanbe.
the class J2MEImage method drawLines.
public void drawLines(Line[] lines, int color) {
Image bufImage = Image.createImage(image.getWidth(), image.getHeight());
Graphics g = bufImage.getGraphics();
g.drawImage(image, 0, 0, 0);
g.setColor(color);
for (int i = 0; i < lines.length - 1; i++) {
g.drawLine(lines[i].getP1().getX(), lines[i].getP1().getY(), lines[i].getP2().getX(), lines[i].getP2().getY());
}
image = bufImage;
repaint();
}
use of javax.microedition.lcdui.Image in project qrcode by yanbe.
the class J2MEImage method cameraCanvasCaptured.
void cameraCanvasCaptured(byte[] pngData) {
cameraCanvas.stop();
displayCanvas.setImage(pngData);
Display.getDisplay(this).setCurrent(displayCanvas);
Image image = Image.createImage(pngData, 0, pngData.length);
// TODO Uncomment below for demo on emulator
try {
image = Image.createImage("/qrcode.jpg");
} catch (IOException ioe) {
}
QRCodeDecoder decoder = new QRCodeDecoder();
QRCodeDecoder.setCanvas(displayCanvas);
try {
decodedTextBox.setDecodedString(new String(decoder.decode(new J2MEImage(image))));
} catch (DecodingFailedException dfe) {
displayCanvas.println("Decoding failed");
displayCanvas.println("(" + dfe.getMessage() + ")");
displayCanvas.println("--------");
return;
}
displayCanvas.println("--------");
displayCanvas.addViewDecodedStringCommand();
}
use of javax.microedition.lcdui.Image in project qrcode by yanbe.
the class J2MEImage method drawPoints.
public void drawPoints(Point[] points, int color) {
Image bufImage = Image.createImage(image.getWidth(), image.getHeight());
Graphics g = bufImage.getGraphics();
g.drawImage(image, 0, 0, 0);
g.setColor(color);
for (int i = 0; i < points.length - 1; i++) {
g.drawLine(points[i].getX(), points[i].getY(), points[i].getX() + 1, points[i].getY());
}
image = bufImage;
repaint();
}
use of javax.microedition.lcdui.Image in project qrcode by yanbe.
the class J2MEImage method drawLine.
public void drawLine(Line line, int color) {
Image bufImage = Image.createImage(image.getWidth(), image.getHeight());
Graphics g = bufImage.getGraphics();
g.drawImage(image, 0, 0, 0);
g.setColor(color);
g.drawLine(line.getP1().getX(), line.getP1().getY(), line.getP2().getX(), line.getP2().getY());
image = bufImage;
repaint();
}
Aggregations