Refine search
public void makeTransparent(Graphics2D g2) { Color col = g2.getColor(); Composite comp = null; // force transparence of this layer only. If no buffering we would clear layers below if (buffering) { comp = g2.getComposite(); g2.setComposite(AlphaComposite.Clear); } g2.setColor(new Color(0, 0, 0, 0)); g2.fillRect(0, 0, bounds.width, bounds.height); g2.setColor(col); if (comp != null) { g2.setComposite(comp); } }
public void plotNode(Graphics2D g2, NodeAccess na, int loc, Color c, int size, String text) { double lat = na.getLatitude(loc); double lon = na.getLongitude(loc); if (lat < bounds.minLat || lat > bounds.maxLat || lon < bounds.minLon || lon > bounds.maxLon) { return; } Color old = g2.getColor(); g2.setColor(c); plot(g2, lat, lon, size); g2.setColor(old); }
public void processFlash(final Graphics2D graphics) { if (flashStart == null) { return; } if (client.getGameCycle() % 40 >= 20) { return; } final Color color = graphics.getColor(); graphics.setColor(FLASH_COLOR); graphics.fill(new Rectangle(client.getCanvas().getSize())); graphics.setColor(color); if (Instant.now().minusMillis(FLASH_DURATION).isAfter(flashStart)) { flashStart = null; } }
Color curColor = g2.getColor(); g2.setColor(paintColor); g2.drawString(nodeStr, (float) (nodeTab + start.getX()), (float) (start.getY() + nodeAscent)); g2.setColor(curColor); double layerMultiplier = (1.0 + belowLineSkip + aboveLineSkip + parentSkip); double layerHeight = nodeHeight * layerMultiplier;
-SNAP_CORNER_SIZE.height); final Color previous = graphics.getColor(); graphics.setColor(corner.contains(mousePosition) ? SNAP_CORNER_ACTIVE_COLOR : SNAP_CORNER_COLOR); graphics.fill(corner); graphics.setColor(previous); final Color previous = graphics.getColor(); graphics.setColor(movedOverlay == overlay ? MOVING_OVERLAY_ACTIVE_COLOR : MOVING_OVERLAY_COLOR); graphics.draw(bounds); graphics.setColor(previous);
public static void drawShadowText(Graphics2D g2, String s, int x, int y, Color shadowColor, int offset) { g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); Color c = g2.getColor(); g2.setColor(shadowColor); g2.drawString(s, x, y + offset); g2.setColor(c); g2.drawString(s, x, y); }
protected BufferedImage getStartImage(int imageType, int width, int height) { if (imageType == BufferedImage.TYPE_CUSTOM) imageType = BufferedImage.TYPE_3BYTE_BGR; BufferedImage image = new BufferedImage(width, height, imageType); // white background Graphics2D g2D = (Graphics2D) image.getGraphics(); Color save = g2D.getColor(); g2D.setColor(Color.WHITE); g2D.fillRect(0, 0, image.getWidth(), image.getHeight()); g2D.setColor(save); return image; }
private BufferedImage getStartImage(int imageType) { Dimension dim = getStartDimension(); if (imageType == BufferedImage.TYPE_CUSTOM) imageType = ImageMosaicJDBCReader.DEFAULT_IMAGE_TYPE; BufferedImage image = new BufferedImage((int) dim.getWidth(), (int) dim.getHeight(), imageType); Graphics2D g2D = (Graphics2D) image.getGraphics(); Color save = g2D.getColor(); g2D.setColor(backgroundColor); g2D.fillRect(0, 0, image.getWidth(), image.getHeight()); g2D.setColor(save); return image; }
public static void drawRoundedBox(Graphics2D g, int x, int y, int w, int h, int bevel, Paint border, Paint fill) { g.setColor(new Color(0, 0, 0, 150)); g.drawOval(x - 1, y - 1, bevel * 2, h); g.setPaint(border); g.drawOval(x, y, bevel * 2 - 1, h - 1); g.drawOval(x + w - bevel * 2, y, bevel * 2 - 1, h - 1); g.drawOval(x + 1, y + 1, bevel * 2 - 3, h - 3); g.drawOval(x + 1 + w - bevel * 2, y + 1, bevel * 2 - 3, h - 3); g.drawRect(x + bevel, y, w - 2 * bevel, h - 1); g.drawRect(x + 1 + bevel, y + 1, w - 2 * bevel - 2, h - 3); g.setPaint(fill); g.fillOval(x + 2, y + 2, bevel * 2 - 4, h - 4); g.fillOval(x + 2 + w - bevel * 2, y + 2, bevel * 2 - 4, h - 4); g.fillRect(x + bevel, y + 2, w - 2 * bevel, h - 4); g.setPaint(fill); g.setColor(abitbrighter(g.getColor())); g.drawLine(x + 1 + bevel, y + 1, x + 1 + bevel + w - 2 * bevel - 2, y + 1); g.setPaint(fill); g.setColor(abitdarker(g.getColor())); g.drawLine(x + 1 + bevel, y + h - 2, x + 1 + bevel + w - 2 * bevel - 2, y + h - 2); }
public static void drawZendikarLandBox(Graphics2D g, int x, int y, int w, int h, int bevel, Paint border, Paint fill) { g.setColor(new Color(0, 0, 0, 150)); g.drawOval(x - 1, y, bevel * 2, h); g.setPaint(border); g.drawOval(x, y, bevel * 2 - 1, h - 1); g.drawOval(x + w - bevel * 2, y, bevel * 2 - 1, h - 1); g.drawOval(x + 1, y + 1, bevel * 2 - 3, h - 3); g.drawOval(x + 1 + w - bevel * 2, y + 1, bevel * 2 - 3, h - 3); // The big circle in the middle.. (diameter=2+1/4 of height) - 3/4 above line, 1/2 below 0.75 + .5 + 1= 2.25 = 9/4 g.drawOval(x + w / 2 - h - h / 8, y - 3 * h / 4, 9 * h / 4, 9 * h / 4); g.drawRect(x + bevel, y, w - 2 * bevel, h - 1); g.drawRect(x + 1 + bevel, y + 1, w - 2 * bevel - 2, h - 3); g.setPaint(fill); g.setColor(abitbrighter(g.getColor())); g.drawLine(x + 1 + bevel, y + 1, x + 1 + bevel + w - 2 * bevel - 2, y + 1); g.setPaint(fill); g.setColor(abitdarker(g.getColor())); g.drawLine(x + 1 + bevel, y + h - 2, x + 1 + bevel + w - 2 * bevel - 2, y + h - 2); g.fillOval(x + 2, y + 2, bevel * 2 - 4, h - 4); g.fillOval(x + 2 + w - bevel * 2, y + 2, bevel * 2 - 4, h - 4); g.fillRect(x + bevel, y + 2, w - 2 * bevel, h - 4); g.fillOval(x + w / 2 - h - h / 8, y - 3 * h / 4, 9 * h / 4, 9 * h / 4); }
public void draw(Graphics2D g) { if (getPointCount() < 2) return; // Since a contour has no fill or stroke information, draw it in black. // We save the current color so as not to disrupt the context. java.awt.Color savedColor = g.getColor(); Stroke savedStroke = g.getStroke(); GeneralPath gp = new GeneralPath(GeneralPath.WIND_EVEN_ODD, getPointCount()); _extendPath(gp); g.setColor(java.awt.Color.BLACK); g.setStroke(DEFAULT_STROKE); g.draw(gp); g.setColor(savedColor); g.setStroke(savedStroke); }
/** * @param width * @param height * @param backgroundColor * @param outputTransparentColor * @return BufferdImage filled with outputTransparentColor */ private BufferedImage getEmptyImage( int width, int height, Color backGroundcolor, Color outputTransparentColor) { BufferedImage emptyImage = new BufferedImage(width, height, DEFAULT_IMAGE_TYPE); Graphics2D g2D = (Graphics2D) emptyImage.getGraphics(); Color save = g2D.getColor(); g2D.setColor(backGroundcolor); g2D.fillRect(0, 0, emptyImage.getWidth(), emptyImage.getHeight()); g2D.setColor(save); if (outputTransparentColor != null) emptyImage = new RenderedImageAdapter( ImageUtilities.maskColor(outputTransparentColor, emptyImage)) .getAsBufferedImage(); return emptyImage; }
/** * Glyph bounding boxes. */ @Override protected void showGlyph(Matrix textRenderingMatrix, PDFont font, int code, String unicode, Vector displacement) throws IOException { // draw glyph super.showGlyph(textRenderingMatrix, font, code, unicode, displacement); // bbox in EM -> user units Shape bbox = new Rectangle2D.Float(0, 0, font.getWidth(code) / 1000, 1); AffineTransform at = textRenderingMatrix.createAffineTransform(); bbox = at.createTransformedShape(bbox); // save Graphics2D graphics = getGraphics(); Color color = graphics.getColor(); Stroke stroke = graphics.getStroke(); Shape clip = graphics.getClip(); // draw graphics.setClip(graphics.getDeviceConfiguration().getBounds()); graphics.setColor(Color.RED); graphics.setStroke(new BasicStroke(.5f)); graphics.draw(bbox); // restore graphics.setStroke(stroke); graphics.setColor(color); graphics.setClip(clip); }
/** * Filled path bounding boxes. */ @Override public void fillPath(int windingRule) throws IOException { // bbox in user units Shape bbox = getLinePath().getBounds2D(); // draw path (note that getLinePath() is now reset) super.fillPath(windingRule); // save Graphics2D graphics = getGraphics(); Color color = graphics.getColor(); Stroke stroke = graphics.getStroke(); Shape clip = graphics.getClip(); // draw graphics.setClip(graphics.getDeviceConfiguration().getBounds()); graphics.setColor(Color.GREEN); graphics.setStroke(new BasicStroke(.5f)); graphics.draw(bbox); // restore graphics.setStroke(stroke); graphics.setColor(color); graphics.setClip(clip); }
protected BufferedImage getStartImage(BufferedImage copyFrom, int width, int height) { Map<String, Object> properties = null; if (copyFrom.getPropertyNames() != null) { properties = new HashMap<String, Object>(); for (String name : copyFrom.getPropertyNames()) { properties.put(name, copyFrom.getProperty(name)); } } SampleModel sm = copyFrom.getSampleModel().createCompatibleSampleModel(width, height); WritableRaster raster = Raster.createWritableRaster(sm, null); BufferedImage image = new BufferedImage( copyFrom.getColorModel(), raster, copyFrom.isAlphaPremultiplied(), (Hashtable<?, ?>) properties); // white background Graphics2D g2D = (Graphics2D) image.getGraphics(); Color save = g2D.getColor(); g2D.setColor(Color.WHITE); g2D.fillRect(0, 0, image.getWidth(), image.getHeight()); g2D.setColor(save); return image; }
visGraphics.setColor(Color.WHITE); visGraphics.fillRect(0, 0, width, visHeight + 40); visGraphics.setColor(Color.BLACK); curOffset = displayRange * c + halfMin; visGraphics.setColor(new Color(230, 255, 255)); visGraphics.fillRect(0, curOffset, samplesPerSecond, displayRange); visGraphics.setColor(Color.BLACK); visGraphics.setColor(visGraphics.getColor().brighter().brighter());