@Override protected final void drawTrace(org.geogebra.common.awt.GGraphics2D g2) { g2.setPaint(getObjectColor()); g2.setStroke(objStroke); if (lineVisible) g2.draw(line); if (arrowheadVisible) g2.fill(gp); }
public final void drawPreview(org.geogebra.common.awt.GGraphics2D g2) { if (isVisible) { g2.setPaint(getObjectColor()); updateStrokes(geo); g2.setStroke(objStroke); if (arrowheadVisible) g2.fill(gp); if (lineVisible) g2.draw(line); } }
protected void highlightLabel(GGraphics2D g2, boolean latex) { if (geo.isLabelVisible() && geo.doHighlighting()) { if (latex) { g2.fillRect(xLabel, yLabel, labelSize.x, labelSize.y); } else { g2.fillRect( xLabel, yLabel + ((boxHeight - getH()) / 2), labelSize.x, getH() + HIGHLIGHT_MARGIN); } } }
@Override public final void draw(GGraphics2D g2) { if (isVisible) { fill(g2, gp, false); // fill using default/hatching/image as // appropriate if (geo.doHighlighting()) { g2.setPaint(geo.getSelColor()); g2.setStroke(selStroke); g2.draw(gp); } if (geo.lineThickness > 0) { g2.setPaint(getObjectColor()); g2.setStroke(objStroke); g2.draw(gp); } if (labelVisible) { g2.setPaint(slope.getLabelColor()); g2.setFont(view.getFontLine()); drawLabel(g2); g2.drawString(horLabel, xLabelHor, yLabelHor); } } }
@Override public void draw(org.geogebra.common.awt.GGraphics2D g2) { if (isVisible) { if (traceDrawingNeeded) { traceDrawingNeeded = false; org.geogebra.common.awt.GGraphics2D g2d = view.getBackgroundGraphics(); if (g2d != null) drawTrace(g2d); } if (geo.doHighlighting()) { g2.setPaint(((GeoElement) v).getSelColor()); g2.setStroke(selStroke); if (lineVisible) g2.draw(line); } g2.setPaint(getObjectColor()); g2.setStroke(objStroke); if (lineVisible) g2.draw(line); if (arrowheadVisible) g2.fill(gp); if (labelVisible) { g2.setFont(view.getFontVector()); g2.setPaint(((GeoElement) v).getLabelColor()); drawLabel(g2); } } }
protected int getTextHeight(GGraphics2D g2, String text) { // make sure layout won't be null ("" makes it null). GTextLayout layout = g2.getFontRenderContext().getTextLayout("".equals(text) ? "A" : text, getLabelFont()); return (int) (layout.getBounds().getHeight()); }
protected void drawOnCanvas(org.geogebra.common.awt.GGraphics2D g2, String text) { App app = view.getApplication(); setPreferredSize(getPreferredSize()); GFont vFont = view.getFont(); setLabelFont(app.getFontCanDisplay(text, false, vFont.getStyle(), getLabelFontSize())); g2.setFont(getLabelFont()); g2.setStroke(EuclidianStatic.getDefaultStroke()); g2.setPaint(geo.getObjectColor()); if (geo.isVisible()) { drawWidget(g2); } }
@Override public void drawActionObjects(org.geogebra.common.awt.GGraphics2D g2) { // TODO layers for Buttons and Textfields // for cross-platform UI the stroke must be reset to show buttons // properly, see #442 g2.setStroke(org.geogebra.common.euclidian.EuclidianStatic.getDefaultStroke()); evjpanel.paintChildren(org.geogebra.desktop.awt.GGraphics2DD.getAwtGraphics(g2)); // draws // Buttons // and // Textfields }
protected void drawLabel(GGraphics2D g2, GeoElement geo0, String text) { if (isLatexString(text)) { drawLatex(g2, geo0, getLabelFont(), text, xLabel, yLabel); } else { g2.setPaint(geo.getObjectColor()); EuclidianStatic.drawIndexedString( view.getApplication(), g2, text, xLabel, yLabel + getTextBottom(), false, false); } }
@Override public void paintBackground(org.geogebra.common.awt.GGraphics2D g2) { g2.drawImage(bgImage, null, 0, 0); }
protected GTextLayout getLayout(GGraphics2D g2, String text, GFont font) { // make sure layout won't be null ("" makes it null). return g2.getFontRenderContext().getTextLayout("".equals(text) ? "A" : text, font); }
@Override public void draw(org.geogebra.common.awt.GGraphics2D g2) { // Save fill, color and alfa of object GColor color = geo.getSelColor(); FillType fillType = geo.getFillType(); int hatchingDistance = geo.getHatchingDistance(); String symbol = geo.getFillSymbol(); double hatchingAngle = geo.getHatchingAngle(); String fileName = geo.getImageFileName(); float alpha = geo.getAlphaValue(); AlgoBarChart algop = (AlgoBarChart) geo.getParentAlgorithm(); int k; if (isVisible) { try { if (geo.doHighlighting()) { g2.setPaint(sum.getSelColor()); g2.setStroke(selStroke); for (int i = 0; i < gp.length; i++) { k = i + 1; if (algop.getBarColor(k) != null) { GColor col = algop.getBarColor(k); g2.setPaint( AwtFactory.prototype.newColor( col.getRed(), col.getGreen(), col.getBlue(), col.getAlpha())); } g2.draw(gp[i]); } g2.setPaint(color); } } catch (Exception e) { App.debug(e.getMessage()); } try { if (algo.getDrawType() != DrawType.STEP_GRAPH_CONTINUOUS) { /* * Use tags for draw if there are */ for (int i = 0; i < gp.length; i++) { k = i + 1; if (algop.getBarColor(k) != null) { GColor col = algop.getBarColor(k); geo.setObjColor(col); geo.setAlphaValue(col.getAlpha()); } if (algop.getBarAlpha(k) != -1.0) { geo.setAlphaValue(algop.getBarAlpha(k)); } geo.setFillType(algop.getBarFillType(k)); if (algop.getBarSymbol(k) != null) { geo.setFillSymbol(algop.getBarSymbol(k)); } if (algop.getBarImage(k) != null) { geo.setImageFileName(algop.getBarImage(k)); } if (algop.getBarHatchDistance(k) != -1) { geo.setHatchingDistance(algop.getBarHatchDistance(k)); } if (algop.getBarHatchAngle(k) != -1) { geo.setHatchingAngle(algop.getBarHatchAngle(k)); } fill(g2, gp[i], false); // fill using // default/hatching/image as // appropriate // Restore values geo.setObjColor(color); geo.setFillType(fillType); geo.setHatchingAngle((int) hatchingAngle); geo.setHatchingDistance(hatchingDistance); geo.setFillSymbol(symbol); geo.setImageFileName(fileName); geo.setAlphaValue(alpha); } } } catch (Exception e) { e.printStackTrace(); } try { if (geo.getLineThickness() > 0) { g2.setPaint(getObjectColor()); g2.setStroke(objStroke); for (int i = 0; i < gp.length; i++) { k = i + 1; if (algop.getBarColor(k) != null) { GColor col = algop.getBarColor(k); g2.setPaint( AwtFactory.prototype.newColor( col.getRed(), col.getGreen(), col.getBlue(), geo.getLineOpacity())); } g2.draw(gp[i]); } g2.setPaint(color); } } catch (Exception e) { App.debug(e.getMessage()); } if (labelVisible) { g2.setFont(view.getFontConic()); g2.setPaint(geo.getLabelColor()); drawLabel(g2); } // point if (algo.hasPoints()) { for (int i = 0; i < drawPoints.size(); i++) { drawPoints.get(i).draw(g2); } } } }