List of utility methods to do Graphics Draw
void | paintOval(int x, int y, Color c, int size, Graphics g) paint Oval g.setColor(c); Point pos = getMapPos(x, y); g.fillOval(pos.x - (size / 2), pos.y - (size / 2), size, size); |
void | paintPoint(java.awt.Graphics g2, int x, int y) paint Point g2.fillRect(x, y, 1, 1); |
void | paintRectCompartment(Graphics g, Dimension size, int x, int y, Color fillColor, Color strokeColor) Paints the rectangle compartment at given coordinate with given fill color and stroke color. g.setColor(fillColor); g.fillRect(x, y, size.width, size.height); g.setColor(strokeColor); g.drawRect(x, y, size.width, size.height); |
void | paintRectShadow(Graphics g, int x, int y, int width, int height) Draw a shadow shaped as a Rectangle with smooth edges with a depth of 5 if possible. paintRectShadow(g, x, y, width, height, 5); |
void | paintShape(Shape shape, Graphics2D g2d, Color colorStroke, Stroke stroke, Color colorFill, double downsample) paint Shape if (colorFill != null) { g2d.setColor(colorFill); g2d.fill(shape); if (colorStroke != null) { if (stroke != null) g2d.setStroke(stroke); g2d.setColor(colorStroke); ... |
void | paintSprite(Graphics g, int x, int y, int[][] sprite, Color[] colors) Paint the given sprite. for (int i = 0; i < sprite.length; i++) { for (int j = 0; j < sprite[i].length; j++) { if (sprite[i][j] == 0) continue; g.setColor(colors[sprite[i][j] - 1]); g.drawLine(x + i, y + j, x + i, y + j); |
Graphics2D | prepareGraphics(Graphics g) prepare Graphics Graphics2D g2 = (Graphics2D) g; Map rhints = (Map) (Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints")); if (rhints == null && Boolean.getBoolean("swing.aatext")) { g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); } else if (rhints != null) { g2.addRenderingHints(rhints); return g2; ... |
void | printAll(java.awt.Graphics2D g2, java.awt.Component component) print All if (component != null) { int x = component.getX(); int y = component.getY(); g2.translate(x, y); try { java.awt.Shape prevClip = g2.getClip(); try { java.awt.Component c = getViewportViewIfNecessary(component); ... |
void | raiseOval(Graphics2D g2, Rectangle r, Color foreColor) draw an image in a rectangle Color background = g2.getBackground(); Color oldColor = g2.getColor(); Ellipse2D e = new Ellipse2D.Double(r.getX(), r.getY(), r.getWidth(), r.getHeight()); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); Paint oldPaint = g2.getPaint(); GradientPaint gp = new GradientPaint(r.x, r.y, foreColor, r.width, r.height, background, true); g2.setPaint(gp); g2.fill(e); ... |
void | raiseRect(Graphics2D g2, Rectangle r, Color foreColor) draw an image in a rectangle Color oldColor = g2.getColor(); g2.setColor(foreColor); g2.fill3DRect(r.x, r.y, r.width, r.height, true); g2.setColor(oldColor); |