public RoundRectangle2D evaluate(RoundRectangle2D v0, RoundRectangle2D v1, float fraction) { double x = v0.getX() + ((v1.getX() - v0.getX()) * fraction); double y = v0.getY() + ((v1.getY() - v0.getY()) * fraction); double w = v0.getWidth() + ((v1.getWidth() - v0.getWidth()) * fraction); double h = v0.getHeight() + ((v1.getHeight() - v0.getHeight()) * fraction); double arcw = v0.getArcWidth() + ((v1.getArcWidth() - v0.getArcWidth()) * fraction); double arch = v0.getArcHeight() + ((v1.getArcHeight() - v0.getArcHeight()) * fraction); RoundRectangle2D value = (RoundRectangle2D) v0.clone(); value.setRoundRect(x, y, w, h, arcw, arch); return value; }
RoundRectIterator(RoundRectangle2D rr, AffineTransform at) { this.x = rr.getX(); this.y = rr.getY(); this.w = rr.getWidth(); this.h = rr.getHeight(); this.aw = Math.min(w, Math.abs(rr.getArcWidth())); this.ah = Math.min(h, Math.abs(rr.getArcHeight())); this.affine = at; if (aw < 0 || ah < 0) { // Don't draw anything... index = ctrlpts.length; } }
private void drawShadow(Graphics2D g2, RoundRectangle2D rect) { BufferedImage image = new BufferedImage( (int) rect.getWidth() + 8, (int) rect.getHeight() + 8, BufferedImage.TYPE_INT_ARGB); Graphics2D buffer = (Graphics2D) image.getGraphics(); buffer.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); buffer.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); buffer.setColor(new Color(0.0f, 0.0f, 0.0f, 0.5f)); buffer.translate(4, 4); buffer.fill(rect); ConvolveOp blur = new ConvolveOp(new Kernel(5, 5, BLUR_KERNEL)); g2.drawImage(image, blur, 0, 0); buffer.dispose(); image.flush(); }
public void setLocation(Point p) { rr.setRoundRect(p.x, p.y, rr.getWidth(), getHeight(), 20, 20); }