Search in sources :

Example 1 with Graphics

use of javax.microedition.lcdui.Graphics 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();
}
Also used : Graphics(javax.microedition.lcdui.Graphics) QRCodeImage(jp.sourceforge.qrcode.data.QRCodeImage) Image(javax.microedition.lcdui.Image) Point(jp.sourceforge.qrcode.geom.Point)

Example 2 with Graphics

use of javax.microedition.lcdui.Graphics 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();
}
Also used : Graphics(javax.microedition.lcdui.Graphics) QRCodeImage(jp.sourceforge.qrcode.data.QRCodeImage) Image(javax.microedition.lcdui.Image) Point(jp.sourceforge.qrcode.geom.Point)

Example 3 with Graphics

use of javax.microedition.lcdui.Graphics 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();
}
Also used : Graphics(javax.microedition.lcdui.Graphics) QRCodeImage(jp.sourceforge.qrcode.data.QRCodeImage) Image(javax.microedition.lcdui.Image) Point(jp.sourceforge.qrcode.geom.Point)

Example 4 with Graphics

use of javax.microedition.lcdui.Graphics 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();
}
Also used : Graphics(javax.microedition.lcdui.Graphics) QRCodeImage(jp.sourceforge.qrcode.data.QRCodeImage) Image(javax.microedition.lcdui.Image)

Example 5 with Graphics

use of javax.microedition.lcdui.Graphics in project qrcode by yanbe.

the class J2MEImage method drawPolygon.

public void drawPolygon(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);
    int i = 0;
    for (; i < points.length - 1; i++) {
        g.drawLine(points[i].getX(), points[i].getY(), points[i + 1].getX(), points[i + 1].getY());
    }
    g.drawLine(points[i].getX(), points[i].getY(), points[0].getX(), points[0].getY());
    image = bufImage;
    repaint();
}
Also used : Graphics(javax.microedition.lcdui.Graphics) QRCodeImage(jp.sourceforge.qrcode.data.QRCodeImage) Image(javax.microedition.lcdui.Image) Point(jp.sourceforge.qrcode.geom.Point)

Aggregations

Graphics (javax.microedition.lcdui.Graphics)6 Image (javax.microedition.lcdui.Image)6 QRCodeImage (jp.sourceforge.qrcode.data.QRCodeImage)6 Point (jp.sourceforge.qrcode.geom.Point)4