/** * @see Shape#outlineShape(Graphics) */ @Override protected void outlineShape ( final Graphics graphics ) { final float lineInset = Math.max ( 1.0f, getLineWidthFloat () ) / 2.0f; final int inset1 = (int)Math.floor ( lineInset ); final int inset2 = (int)Math.ceil ( lineInset ); final Rectangle r = Rectangle.SINGLETON.setBounds ( getBounds () ); r.x += inset1; r.y += inset1; r.width -= inset1 + inset2; r.height -= inset1 + inset2; graphics.drawRectangle ( r ); }
/** * @see Shape#outlineShape(Graphics) */ @Override protected void outlineShape ( final Graphics graphics ) { final float lineInset = Math.max ( 1.0f, getLineWidthFloat () ) / 2.0f; final int inset1 = (int)Math.floor ( lineInset ); final int inset2 = (int)Math.ceil ( lineInset ); final Rectangle r = Rectangle.SINGLETON.setBounds ( getBounds () ); r.x += inset1; r.y += inset1; r.width -= inset1 + inset2; r.height -= inset1 + inset2; graphics.drawRectangle ( r ); }
/** * @param figure * @param graphics */ public static void drawBorderDecorator(CSSFigure figure, Graphics graphics) { graphics.setLineWidth(1); graphics.setLineStyle(Graphics.LINE_DASH); graphics.setForegroundColor(ColorConstants.lightGray); List fragments = figure.getFragmentsForRead(); for (int i = 0, size = fragments.size(); i < size; i++) { FlowBox box = (FlowBox) fragments.get(i); // XXX: why -1? graphics.drawRectangle(box._x, box._y, box.getWidth() - 1, box .getHeight() - 1); } graphics.restoreState(); }
/** * Debug code. * * @param g * @param box */ public static void drawBox(Graphics g, FlowBox box) { Color color = null; if (box instanceof BlockBox) { // color = ColorConstants.red; } else if (box instanceof LineBox) { color = ColorConstants.blue; } else if (box instanceof TextFragmentBox) { color = ColorConstants.green; } else { color = ColorConstants.darkGreen; } if (color != null) { g.setForegroundColor(color); g.setLineStyle(Graphics.LINE_DASH); g.setLineWidth(1); g.drawRectangle(box._x, box._y, box.getWidth(), box.getHeight()); } }
public void paintFigure(Graphics g) { ICSSStyle style = this.getCSSStyle(); if (style != null) { ITagEditInfo info = (ITagEditInfo) style .getAdapter(ITagEditInfo.class); if (info != null && info.needTableDecorator()) { List cells = _tableInfo.getCells(); for (int i = 0, size = cells.size(); i < size; i++) { TableCellInfo cellInfo = (TableCellInfo) cells.get(i); IFigure cellfigure = cellInfo.getFigure(); Rectangle rect = cellfigure.getBounds().getCopy(); rect = rect.expand(1, 1); g.setLineStyle(Graphics.LINE_SOLID); g.setLineWidth(1); g.setForegroundColor(ColorConstants.lightGray); g.drawRectangle(rect); } } } }
/** * Draws the handle with fill color and outline color dependent * on the primary selection status of the owner editpart. * * @param g The graphics used to paint the figure. */ public void paintFigure(Graphics g) { Rectangle r = getBounds(); r.shrink(1, 1); try { g.setBackgroundColor(getFillColor()); g.setAlpha(getAlpha()); g.fillRectangle(r.x, r.y, r.width, r.height); g.setForegroundColor(getBorderColor()); g.drawRectangle(r.x, r.y, r.width, r.height); } finally { //We don't really own rect 'r', so fix it. r.expand(1, 1); } }
public void paintFigure(Graphics g) { // TODO: could we use an image label toggle button here instead? Image arrowImage = null; if (_stateMachine.isMenuShowing()) { arrowImage = PDPlugin.getDefault().getImage("pin_down.gif"); } else { arrowImage = PDPlugin.getDefault().getImage("pin_up.gif"); } Rectangle r = getBounds(); g.setAlpha(75); g.setBackgroundColor(getFillColor()); g.fillRectangle(r.x, r.y, r.width, r.height); g.setAlpha(getAlpha()); g.drawImage(arrowImage, r.x+1, r.y+1); g.setForegroundColor(getBorderColor()); g.drawRectangle(r.x, r.y, r.width-1, r.height-1); }