Добавлен метод rect
This commit is contained in:
parent
1f75426cd8
commit
dbdfa99fea
@ -96,6 +96,22 @@ public class GraphicsExt {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void rect(double x, double y, double width, double height) {
|
||||||
|
rect(new Rect(x, y, width, height));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void rect(Rect rect) {
|
||||||
|
final double x1 = rect.getX();
|
||||||
|
final double y1 = rect.getY();
|
||||||
|
final double x2 = x1 + rect.getWidth();
|
||||||
|
final double y2 = y1 + rect.getHeight();
|
||||||
|
move(x1, y1);
|
||||||
|
draw(x2, y1);
|
||||||
|
draw(x2, y2);
|
||||||
|
draw(x1, y2);
|
||||||
|
draw(x1, y1);
|
||||||
|
}
|
||||||
|
|
||||||
private int convertX(double x) {
|
private int convertX(double x) {
|
||||||
return (int) (x * (width / X_MAX) + 0.5d);
|
return (int) (x * (width / X_MAX) + 0.5d);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user