Search in sources :

Example 6 with Image

use of javax.microedition.lcdui.Image 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)

Example 7 with Image

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

the class J2MEImage method drawCross.

public void drawCross(Point point, 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(point.getX() - 5, point.getY(), point.getX() + 5, point.getY());
    g.drawLine(point.getX(), point.getY() - 5, point.getX(), point.getY() + 5);
    image = bufImage;
    repaint();
}
Also used : Graphics(javax.microedition.lcdui.Graphics) QRCodeImage(jp.sourceforge.qrcode.data.QRCodeImage) Image(javax.microedition.lcdui.Image)

Aggregations

Image (javax.microedition.lcdui.Image)7 QRCodeImage (jp.sourceforge.qrcode.data.QRCodeImage)7 Graphics (javax.microedition.lcdui.Graphics)6 Point (jp.sourceforge.qrcode.geom.Point)4 IOException (java.io.IOException)1 QRCodeDecoder (jp.sourceforge.qrcode.QRCodeDecoder)1 DecodingFailedException (jp.sourceforge.qrcode.exception.DecodingFailedException)1