java.awt.Graphics2D.fillOval()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(9.6k)|赞(0)|评价(0)|浏览(328)

本文整理了Java中java.awt.Graphics2D.fillOval()方法的一些代码示例,展示了Graphics2D.fillOval()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graphics2D.fillOval()方法的具体详情如下:
包路径:java.awt.Graphics2D
类名称:Graphics2D
方法名:fillOval

Graphics2D.fillOval介绍

暂无

代码示例

代码示例来源:origin: plantuml/plantuml

@Override
  public void draw(ColorMapper colorMapper, Graphics2D g2d) {
    g2d.setColor(Color.BLACK);
    final int delta = diameterExternal - diameterInternal + 1;
    g2d.drawOval(0, 0, diameterExternal, diameterExternal);
    g2d.fillOval(delta / 2, delta / 2, diameterInternal, diameterInternal);
  }
}

代码示例来源:origin: runelite/runelite

public static void renderMinimapLocation(Graphics2D graphics, Point mini, Color color)
{
  graphics.setColor(Color.BLACK);
  graphics.fillOval(mini.getX() - MINIMAP_DOT_RADIUS / 2, mini.getY() - MINIMAP_DOT_RADIUS / 2 + 1, MINIMAP_DOT_RADIUS, MINIMAP_DOT_RADIUS);
  graphics.setColor(color);
  graphics.fillOval(mini.getX() - MINIMAP_DOT_RADIUS / 2, mini.getY() - MINIMAP_DOT_RADIUS / 2, MINIMAP_DOT_RADIUS, MINIMAP_DOT_RADIUS);
}

代码示例来源:origin: MovingBlocks/Terasology

@Override
public void render(BufferedImage img, Region region) {
  TreeFacet treeFacet = region.getFacet(TreeFacet.class);
  Graphics2D g = img.createGraphics();
  g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  for (Entry<BaseVector3i, TreeGenerator> entry : treeFacet.getRelativeEntries().entrySet()) {
    TreeGenerator treeGen = entry.getValue();
    int wx = entry.getKey().getX();
    int wz = entry.getKey().getZ();
    int r = radiusFunc.apply(treeGen);
    Color color = colorFunc.apply(treeGen);
    // the fill area is offset by +1/+1 pixel
    // otherwise it will bleed out at the top left corner
    g.setColor(color);
    g.fillOval(wx - r + 1, wz - r + 1, r * 2 - 1, r * 2 - 1);
    g.setColor(color.darker());
    g.drawOval(wx - r, wz - r, r * 2, r * 2);
  }
  g.dispose();
}

代码示例来源:origin: libgdx/libgdx

g.setColor(Color.white);
g.fillRect(chartX, chartY, chartWidth, chartHeight);
g.setColor(Color.black);
g.drawRect(chartX, chartY, chartWidth, chartHeight);
    int x = (int)(yAxisWidth + chartWidth * percent);
    if (i != 0 && i != xSplit) {
      g.setColor(Color.lightGray);
      g.drawLine(x, chartY + 1, x, chartY + chartHeight);
      g.setColor(Color.black);
  int x = (int)pixel.x - pointSize / 2;
  int y = (int)pixel.y - pointSize / 2;
  g.fillOval(x, y, pointSize, pointSize);
  if (isExpanded) {
    g.setColor(Color.black);

代码示例来源:origin: libgdx/libgdx

g.setColor(Color.white);
g.fillRect(chartX, chartY, chartWidth, chartHeight);
g.setColor(Color.black);
g.drawRect(chartX, chartY, chartWidth, chartHeight);
    int x = (int)(yAxisWidth + chartWidth * percent);
    if (i != 0 && i != xSplit) {
      g.setColor(Color.lightGray);
      g.drawLine(x, chartY + 1, x, chartY + chartHeight);
      g.setColor(Color.black);
  int x = (int)pixel.x - pointSize / 2;
  int y = (int)pixel.y - pointSize / 2;
  g.fillOval(x, y, pointSize, pointSize);
  if (isExpanded) {
    g.setColor(Color.black);

代码示例来源:origin: stackoverflow.com

RenderingHints.KEY_ANTIALIASING,
  RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(Color.black);
a = getWidth() / 2;
b = getHeight() / 2;
int r2 = Math.abs(m - r) / 2;
g2d.drawOval(a - r, b - r, 2 * r, 2 * r);
g2d.setColor(Color.blue);
for (int i = 0; i < n; i++) {
  double t = 2 * Math.PI * i / n;
  int x = (int) Math.round(a + r * Math.cos(t));
  int y = (int) Math.round(b + r * Math.sin(t));
  g2d.fillOval(x - r2, y - r2, 2 * r2, 2 * r2);

代码示例来源:origin: sarxos/webcam-capture

g2.setColor(Color.LIGHT_GRAY);
g2.fillRoundRect(cx, cy, 70, 40, 10, 10);
g2.setColor(Color.WHITE);
g2.fillOval(cx + 5, cy + 5, 30, 30);
g2.setColor(Color.LIGHT_GRAY);
g2.fillOval(cx + 10, cy + 10, 20, 20);
g2.setColor(Color.WHITE);
g2.fillOval(cx + 12, cy + 12, 16, 16);
g2.fillRoundRect(cx + 50, cy + 5, 15, 10, 5, 5);
g2.fillRect(cx + 63, cy + 25, 7, 2);

代码示例来源:origin: runelite/runelite

graphics.setColor(COLOR_ICON_BACKGROUND);
graphics.fillOval(
  point.getX() - totalWidth / 2 + currentPosX - bgPadding,
  point.getY() - icon.getHeight() / 2 - OVERLAY_ICON_DISTANCE - bgPadding,
  icon.getHeight() + bgPadding * 2);
graphics.setColor(COLOR_ICON_BORDER);
graphics.drawOval(
  point.getX() - totalWidth / 2 + currentPosX - bgPadding,
  null);
graphics.setColor(COLOR_ICON_BORDER_FILL);
Arc2D.Double arc = new Arc2D.Double(
  point.getX() - totalWidth / 2 + currentPosX - bgPadding,

代码示例来源:origin: runelite/runelite

@Override
public Dimension render(Graphics2D g)
{
  g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
  if (config.showHitpoints())
  {
    renderRegen(g, WidgetInfo.MINIMAP_HEALTH_ORB, plugin.getHitpointsPercentage(), HITPOINTS_COLOR);
  }
  if (config.showSpecial())
  {
    if (client.getVar(VarPlayer.SPECIAL_ATTACK_ENABLED) == 1)
    {
      final Widget widget = client.getWidget(WidgetInfo.MINIMAP_SPEC_ORB);
      if (widget != null && !widget.isHidden())
      {
        final Rectangle bounds = widget.getBounds();
        g.setColor(RegenMeterOverlay.OVERLAY_COLOR);
        g.fillOval(
          bounds.x + OFFSET,
          bounds.y + (int) (bounds.height / 2 - (DIAMETER) / 2),
          (int) DIAMETER, (int) DIAMETER);
      }
    }
    renderRegen(g, WidgetInfo.MINIMAP_SPEC_ORB, plugin.getSpecialPercentage(), SPECIAL_COLOR);
  }
  return null;
}

代码示例来源:origin: runelite/runelite

graphics.setColor(npcColor);
final List<NPC> npcs = client.getNpcs();
for (NPC npc : npcs)
  if (minimapLocation != null)
    graphics.fillOval(minimapLocation.getX(), minimapLocation.getY(), 4, 4);
graphics.setColor(npcColor);
final List<Player> players = client.getPlayers();
for (Player player : players)
  if (minimapLocation != null)
    graphics.fillOval(minimapLocation.getX(), minimapLocation.getY(), 4, 4);
graphics.setColor(playerColor);
graphics.fillRect(local.getMinimapLocation().getX(), local.getMinimapLocation().getY(), 3, 3);

代码示例来源:origin: runelite/runelite

graphics.setColor(Color.YELLOW);
      + PUZZLE_TILE_SIZE / 2 - markerSize / 2;
  graphics.fillOval(x, y, markerSize, markerSize);

代码示例来源:origin: magefree/mage

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);
}

代码示例来源:origin: magefree/mage

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);
}

代码示例来源:origin: stackoverflow.com

RenderingHints.KEY_ANTIALIASING,
  RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(Color.blue);
double v = Double.valueOf(this.getText());
int d = (int)(v * SIZE);
int r = d / 2;
g2d.fillOval(x + HALF - r, y + HALF - r, d, d);

代码示例来源:origin: vsch/flexmark-java

public static BufferedImage drawHighlightOval(
    BufferedImage image,
    int x, int y, int w, int h,
    Color borderColor, int borderWidth,
    Color innerFillColor
) {
  //BufferedImage output = UIUtil.createImage(w, h, BufferedImage.TYPE_INT_ARGB);
  //noinspection UndesirableClassUsage
  BufferedImage output = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_ARGB);
  int imgW = image.getWidth();
  int imgH = image.getHeight();
  Graphics2D g2 = output.createGraphics();
  g2.setRenderingHint(
      RenderingHints.KEY_ANTIALIASING,
      RenderingHints.VALUE_ANTIALIAS_ON
  );
  boolean innerFilled = innerFillColor.getAlpha() != 0;
  g2.drawImage(image, 0, 0, null);
  if (innerFilled) {
    g2.setColor(innerFillColor);
    g2.fillOval(x, y, w, h);
  }
  if (borderWidth > 0) {
    g2.setColor(borderColor);
    g2.setStroke(new BasicStroke(borderWidth, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, borderWidth));
    g2.drawOval(x, y, w, h);
  }
  g2.dispose();
  return output;
}

代码示例来源:origin: magefree/mage

protected int drawTransformationCircle(Graphics2D g, Paint borderPaint) {
  int transformCircleOffset = 0;
  if (isTransformCard()) {
    transformCircleOffset = boxHeight - contentInset;
    g.setPaint(borderPaint);
    g.drawOval(borderWidth, totalContentInset, boxHeight - 1, boxHeight - 1);
    g.setColor(Color.black);
    g.fillOval(borderWidth + 1, totalContentInset + 1, boxHeight - 2, boxHeight - 2);
    g.setColor(Color.white);
    if (isTransformed) {
      g.fillArc(borderWidth + 3, totalContentInset + 3, boxHeight - 6, boxHeight - 6, 90, 270);
      g.setColor(Color.black);
      g.fillArc(borderWidth + 3 + 3, totalContentInset + 3, boxHeight - 6 - 3, boxHeight - 6, 90, 270);
    } else {
      g.fillOval(borderWidth + 3, totalContentInset + 3, boxHeight - 6, boxHeight - 6);
    }
  }
  return transformCircleOffset;
}

代码示例来源:origin: 0opslab/opslabJutil

g2d.setColor(ovalColor);
g2d.fillOval(x, y, width, height);
fos = new FileOutputStream(toPath);
ImageIO.write(image, imageFormat, fos);

代码示例来源:origin: 0opslab/opslabJutil

g2d.setColor(ovalColor);
    int x = (int) point.getX();
    int y = (int) point.getY();
    g2d.fillOval(x, y, width, height);

代码示例来源:origin: jbox2d/jbox2d

@Override
public void drawPoint(Vec2 argPoint, float argRadiusOnScreen, Color3f argColor) {
 getWorldToScreenToOut(argPoint, sp1);
 Graphics2D g = getGraphics();
 Color c = cpool.getColor(argColor.x, argColor.y, argColor.z);
 g.setColor(c);
 sp1.x -= argRadiusOnScreen;
 sp1.y -= argRadiusOnScreen;
 g.fillOval((int) sp1.x, (int) sp1.y, (int) argRadiusOnScreen * 2, (int) argRadiusOnScreen * 2);
}

代码示例来源:origin: 0opslab/opslabJutil

g2d.setColor(lineColor);
g2d.setColor(ovalColor);
    int x = xPoints[i];
    int y = yPoints[i];
    g2d.fillOval(x, y, width, height);

相关文章

Graphics2D类方法