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();
}
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();
}
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();
}
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();
}
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();
}
Aggregations