/** * Paints the background of a token. * * @param x The x-coordinate of the token. * @param y The y-coordinate of the token. * @param width The width of the token (actually, the width of the part of * the token to paint). * @param height The height of the token. * @param g The graphics context with which to paint. * @param fontAscent The ascent of the token's font. * @param host The text area. * @param color The color with which to paint. */ protected void paintBackground(float x, float y, float width, float height, Graphics2D g, int fontAscent, RSyntaxTextArea host, Color color) { g.setColor(color); bgRect.setRect(x,y-fontAscent, width,height); //g.fill(bgRect); g.fillRect((int)x, (int)(y-fontAscent), (int)width, (int)height); }
@Override protected void paintImage(Graphics2D g2d, Color color) { Rectangle2D.Float path = new Rectangle2D.Float(); Dimension dimension = getDimension(); g2d.setStroke(new BasicStroke(16, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL)); g2d.scale(dimension.getHeight() / 128, dimension.getHeight() / 128); g2d.translate(40, 40); path.setRect(0, 0, 40, 40); g2d.setColor(color); Color bcolor = new Color(1f, 1f, 1f, 0f); g2d.setBackground(bcolor); g2d.fill(path); g2d.clearRect(16, 0, 8, 40); g2d.clearRect(0, 16, 40, 8); } }
@Override protected void paintImage(Graphics2D g2d, Color color) { Rectangle2D.Float path = new Rectangle2D.Float(); Dimension dimension = getDimension(); g2d.setStroke(new BasicStroke(16, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL)); g2d.scale(dimension.getHeight() / 128, dimension.getHeight() / 128); g2d.translate(40, 40); path.setRect(0, 0, 40, 40); g2d.setColor(color); Color bcolor = new Color(1f, 1f, 1f, 0f); g2d.setBackground(bcolor); g2d.fill(path); g2d.clearRect(16, 0, 8, 40); g2d.clearRect(0, 16, 40, 8); } }
public void setEmbeddedBounds(float x, float y, float w, float h) { if ((embeddedBounds == null || embeddedBounds.x != x || embeddedBounds.y != y || embeddedBounds.width != w || embeddedBounds.height != h)) { if (embeddedBounds == null) embeddedBounds = new Rectangle2D.Float(); embeddedBounds.setRect(x, y, w, h); if (win != null) { win.getContentPane().invalidate(); router.invokeLater(new Runnable() { public void run() { win.validate(); } }); } } }
public Rectangle2D.Float getBounds() { // lazy load the bounds as the calculation is very expensive if (bounds == null) { // word bounds build from child word bounds. for (WordText word : words) { if (bounds == null) { bounds = new Rectangle2D.Float(); bounds.setRect(word.getBounds()); } else { bounds.add(word.getBounds()); } } // empty line text check, return empty bound. if (bounds == null) { bounds = new Rectangle2D.Float(); } } return bounds; }
public final void setBounds(int x, int y, int width, int height) { boolean dirtify = (loc.x != x || loc.y != y || size.width != width || size.height != height); if (dirtify) appendToDirty(false); loc.x = x; loc.y = y; size.width = width; size.height = height; if ((prefSize.width == 0) || (prefSize.height == 0)) { prefSize.width = width; prefSize.height = height; } boundsf.setRect(x, y, width, height); if (dirtify) appendToDirty(true); } public final void setBounds(float x, float y, float width, float height)
protected void paintPage(Graphics g, float px, float py, float pw, float ph) { Graphics2D g2 = (Graphics2D) g.create(); GraphicsHelper.activeAntiAliasing(g2); tempRect.setRect(px, py, pw, ph); if (getPageFillColor() != null) { g2.setColor(getPageFillColor()); g2.fill(tempRect); } if (getPageStrokeColor() != null) { g2.setColor(getPageStrokeColor()); g2.draw(tempRect); } g2.dispose(); }
@Override public Canvas strokeRect(float x, float y, float width, float height) { currentState().prepareStroke(g2d); rect.setRect(x, y, width, height); g2d.draw(rect); isDirty = true; return this; }
@Override public Canvas strokeRect(float x, float y, float width, float height) { currentState().prepareStroke(g2d); rect.setRect(x, y, width, height); g2d.draw(rect); isDirty = true; return this; }
@Override public Canvas strokeRect(float x, float y, float width, float height) { currentState().prepareStroke(gfx); rect.setRect(x, y, width, height); gfx.draw(rect); isDirty = true; return this; }
@Override public void drawRect(int x, int y, int width, int height, boolean fill) { RECT.setRect(x, y, width, height); if (fill) { fill(RECT, true); } else { draw(RECT); } }
@Override public void drawRect(int x, int y, int width, int height, boolean fill) { RECT.setRect(x, y, width, height); if (fill) { fill(RECT, true); } else { draw(RECT); } }
public Shape getShape(float xMin, float yMin, float xMax, float yMax) { rect.setRect(xMin, yMin, xMax - xMin, yMax - yMin); return rect; } }
@Override public Canvas strokeRect(float x, float y, float width, float height) { currentState().prepareStroke(gfx); rect.setRect(x, y, width, height); gfx.draw(rect); isDirty = true; return this; }
protected void paintRect(Graphics2D g2, Rectangle rect, float x, float y, float w, float h) { g2.setColor(getRectFillColor(rect)); tempRect.setRect(x, y, w, h); g2.fill(tempRect); } }
@Override public Canvas fillRect(float x, float y, float width, float height) { currentState().prepareFill(g2d); rect.setRect(x, y, width, height); g2d.fill(rect); isDirty = true; return this; }
@Override public Canvas fillRect(float x, float y, float width, float height) { currentState().prepareFill(gfx); rect.setRect(x, y, width, height); gfx.fill(rect); isDirty = true; return this; }
@Override public Canvas fillRect(float x, float y, float width, float height) { currentState().prepareFill(gfx); rect.setRect(x, y, width, height); gfx.fill(rect); isDirty = true; return this; }
@Override public Canvas fillRect(float x, float y, float width, float height) { currentState().prepareFill(g2d); rect.setRect(x, y, width, height); g2d.fill(rect); isDirty = true; return this; }
public java.awt.geom.Rectangle2D.Float getDestination() { java.awt.geom.Rectangle2D.Float rect = new java.awt.geom.Rectangle2D.Float(); rect.setRect(destRect); return rect; }