use of java.awt.Graphics2D in project qrcode by yanbe.
the class J2SEDebugCanvas method drawMatrix.
public void drawMatrix(boolean[][] matrix) {
if (image == null) {
image = new BufferedImage(matrix.length, matrix[0].length, BufferedImage.TYPE_INT_ARGB);
setSize(matrix.length, matrix[0].length);
}
Graphics2D g2d = image.createGraphics();
g2d.setColor(java.awt.Color.WHITE);
int width = getWidth();
for (int x = 0; x < matrix.length; x++) {
g2d.drawLine(x, 0, x, width);
}
g2d.setColor(java.awt.Color.BLACK);
for (int x = 0; x < matrix.length; x++) {
for (int y = 0; y < matrix[0].length; y++) {
if (matrix[x][y] == true)
g2d.drawLine(x, y, x, y);
}
}
repaint();
}
use of java.awt.Graphics2D in project qrcode by yanbe.
the class JMFCanvas method drawPoint.
public void drawPoint(Point point, int color) {
Graphics2D g2d = image.createGraphics();
g2d.setColor(new Color(color));
g2d.drawLine(point.getX(), point.getY(), point.getX(), point.getY());
repaint();
}
use of java.awt.Graphics2D in project qrcode by yanbe.
the class JMFCanvas method drawLines.
public void drawLines(Line[] lines, int color) {
Graphics2D g2d = image.createGraphics();
g2d.setColor(new Color(color));
for (int i = 0; i < lines.length; i++) {
g2d.drawLine(lines[i].getP1().getX(), lines[i].getP1().getY(), lines[i].getP2().getX(), lines[i].getP2().getY());
}
repaint();
}
use of java.awt.Graphics2D in project qrcode by yanbe.
the class J2SEDebugCanvas method drawPoints.
public void drawPoints(Point[] points, int color) {
Graphics2D g2d = image.createGraphics();
g2d.setColor(new Color(color));
for (int i = 0; i < points.length; i++) g2d.drawLine(points[i].getX(), points[i].getY(), points[i].getX(), points[i].getY());
repaint();
}
use of java.awt.Graphics2D in project qrcode by yanbe.
the class J2SEDebugCanvas method drawLine.
public void drawLine(Line line, int color) {
Graphics2D g2d = image.createGraphics();
g2d.setColor(new Color(color));
g2d.drawLine(line.getP1().getX(), line.getP1().getY(), line.getP2().getX(), line.getP2().getY());
repaint();
}
Aggregations