use of jp.sourceforge.qrcode.geom.Point in project qrcode by yanbe.
the class QRCodeDecoder method getAdjustPoints.
Point[] getAdjustPoints() {
// note that adjusts affect dependently
// i.e. below means (0,0), (2,3), (3,4), (1,2), (2,1), (1,1), (-1,-1)
// Point[] adjusts = {new Point(0,0), new Point(2,3), new Point(1,1),
// new Point(-2,-2), new Point(1,-1), new Point(-1,0), new Point(-2,-2)};
Vector adjustPoints = new Vector();
for (int d = 0; d < 4; d++) adjustPoints.addElement(new Point(1, 1));
int lastX = 0, lastY = 0;
for (int y = 0; y > -4; y--) {
for (int x = 0; x > -4; x--) {
if (x != y && ((x + y) % 2 == 0)) {
adjustPoints.addElement(new Point(x - lastX, y - lastY));
lastX = x;
lastY = y;
}
}
}
Point[] adjusts = new Point[adjustPoints.size()];
for (int i = 0; i < adjusts.length; i++) adjusts[i] = (Point) adjustPoints.elementAt(i);
return adjusts;
}
use of jp.sourceforge.qrcode.geom.Point 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 jp.sourceforge.qrcode.geom.Point in project qrcode by yanbe.
the class J2SEDebugCanvas method drawPolygon.
public void drawPolygon(Point[] points, int color) {
Graphics2D g2d = image.createGraphics();
g2d.setColor(new Color(color));
int numPoints = points.length;
int[] polygonX = new int[numPoints];
int[] polygonY = new int[numPoints];
for (int i = 0; i < numPoints; i++) {
polygonX[i] = points[i].getX();
polygonY[i] = points[i].getY();
}
g2d.drawPolygon(polygonX, polygonY, numPoints);
repaint();
}
use of jp.sourceforge.qrcode.geom.Point 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 jp.sourceforge.qrcode.geom.Point 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