org.eclipse.swt.graphics.GC.drawArc()方法的使用及代码示例

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

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

GC.drawArc介绍

[英]Draws the outline of a circular or elliptical arc within the specified rectangular area.

The resulting arc begins at startAngle and extends for arcAngle degrees, using the current color. Angles are interpreted such that 0 degrees is at the 3 o'clock position. A positive value indicates a counter-clockwise rotation while a negative value indicates a clockwise rotation.

The center of the arc is the center of the rectangle whose origin is (x, y) and whose size is specified by the width and height arguments.

The resulting arc covers an area width + 1 pixels wide by height + 1 pixels tall.
[中]在指定的矩形区域内绘制圆弧或椭圆弧的轮廓。
生成的圆弧从startAngle开始,使用当前颜色延伸arcAngle度。角度的解释应确保0度位于3点钟位置。正值表示逆时针旋转,负值表示顺时针旋转。
弧的中心是矩形的中心,其原点为(xy),其大小由widthheight参数指定。
生成的圆弧覆盖的区域宽width + 1像素,高height + 1像素。

代码示例

代码示例来源:origin: org.microemu/microemu-javase-swt

public void drawArc(int x, int y, int width, int height, int startAngle, int endAngle) 
{
  gc.drawArc(x + transX, y + transY, width, height, startAngle, endAngle);
}

代码示例来源:origin: org.jfree/swtgraphics2d

/**
 * Draws an arc that is part of an ellipse that fits within the specified
 * framing rectangle.
 *
 * @param x  the x-coordinate.
 * @param y  the y-coordinate.
 * @param width  the frame width.
 * @param height  the frame height.
 * @param arcStart  the arc starting point, in degrees.
 * @param arcAngle  the extent of the arc.
 *
 * @see #fillArc(int, int, int, int, int, int)
 */
@Override
public void drawArc(int x, int y, int width, int height, int arcStart,
    int arcAngle) {
  this.gc.drawArc(x, y, width - 1, height - 1, arcStart, arcAngle);
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

/**
 * Fills the interior of an oval, within the specified
 * rectangular area, with the receiver's background
 * color.
 *
 * @param x the x coordinate of the upper left corner of the oval to be filled
 * @param y the y coordinate of the upper left corner of the oval to be filled
 * @param width the width of the oval to be filled
 * @param height the height of the oval to be filled
 *
 * @exception SWTException <ul>
 *    <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
 * </ul>
 *
 * @see #drawOval
 */
public void fillOval( int x, int y, int width, int height ) {
 checkDisposed();
 drawArc( x, y, width, height, 0, 360, true );
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

/**
 * Draws the outline of an oval, using the foreground color,
 * within the specified rectangular area.
 * <p>
 * The result is a circle or ellipse that fits within the
 * rectangle specified by the <code>x</code>, <code>y</code>,
 * <code>width</code>, and <code>height</code> arguments.
 * </p><p>
 * The oval covers an area that is <code>width + 1</code>
 * pixels wide and <code>height + 1</code> pixels tall.
 * </p>
 *
 * @param x the x coordinate of the upper left corner of the oval to be drawn
 * @param y the y coordinate of the upper left corner of the oval to be drawn
 * @param width the width of the oval to be drawn
 * @param height the height of the oval to be drawn
 *
 * @exception SWTException <ul>
 *    <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
 * </ul>
 */
public void drawOval( int x, int y, int width, int height ) {
 checkDisposed();
 drawArc( x, y, width, height, 0, 360, false );
}

代码示例来源:origin: org.piccolo2d/piccolo2d-swt

/**
 * Draws a filledArc with the options provided.
 * 
 * @param x the x coordinate of the upper-left corner of the arc to be
 *            filled.
 * @param y the y coordinate of the upper-left corner of the arc to be
 *            filled.
 * @param width the width of the arc to be filled.
 * @param height the height of the arc to be filled.
 * @param startAngle the beginning angle.
 * @param extent the angular extent of the arc, relative to the start angle.
 */
public void fillArc(final double x, final double y, final double width, final double height,
    final double startAngle, final double extent) {
  TEMP_RECT.setRect(x, y, width, height);
  SWTShapeManager.transform(TEMP_RECT, transform);
  gc.drawArc((int) (TEMP_RECT.getX() + 0.5), (int) (TEMP_RECT.getY() + 0.5), (int) (TEMP_RECT.getWidth() + 0.5),
      (int) (TEMP_RECT.getHeight() + 0.5), (int) (startAngle + 0.5), (int) (startAngle + extent + 0.5));
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

drawArc( x, y, width, height, startAngle, arcAngle, false );

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

drawArc( x, y, width, height, startAngle, arcAngle, true );

代码示例来源:origin: org.piccolo2d/piccolo2d-swt

gc.drawArc((int) (TEMP_RECT.getX() + 0.5), (int) (TEMP_RECT.getY() + 0.5), (int) (TEMP_RECT.getWidth() + 0.5),
    (int) (TEMP_RECT.getHeight() + 0.5), (int) (startAngle + 0.5), (int) (startAngle + extent + 0.5));

代码示例来源:origin: alblue/com.packtpub.e4

private void drawClock(PaintEvent e) {
  e.gc.drawArc(e.x, e.y, e.width - 1, e.height - 1, 0, 360);
  ZonedDateTime now = ZonedDateTime.now(zone);
  int seconds = now.getSecond();
  int arc = (15 - seconds) * 6 % 360;
  if (handColor == null) {
    e.gc.setBackground(color);
  } else {
    e.gc.setBackground(handColor);
  }
  e.gc.fillArc(e.x, e.y, e.width - 1, e.height - 1, arc - 1, 2);
  e.gc.setBackground(e.display.getSystemColor(SWT.COLOR_BLACK));
  int hours = now.getHour();
  arc = (3 - hours) * 30 % 360;
  e.gc.fillArc(e.x, e.y, e.width - 1, e.height - 1, arc - 5, 10);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

gc.drawArc(cx + 1, cy + 1, size.x - 2, size.y - 2, 0, 360);
gc.drawRectangle(cx + (size.x - 10) / 2, cy + (size.y - 10) / 2, 10, 10);
Point extent = gc.textExtent(canvasString);

代码示例来源:origin: org.xworker/xworker_swt

@ActionParams(names="canvas,gc,shape")
  public static void draw(Canvas canvas, GC gc, SimpleShape shape, ActionContext actionContext) {
    Thing thing = shape.getThing();
    if(shape.getThing().getBoolean("fill")) {
      gc.fillArc(0, 0, shape.getWidth(), shape.getHeight()
          ,thing.getInt("startAngle"), thing.getInt("endAngle"));
    }else {
      gc.drawArc(0, 0, shape.getWidth(), shape.getHeight()
          ,thing.getInt("startAngle"), thing.getInt("endAngle"));
    }
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

transform.rotate(-(angle + 360/n * i));
gc.setTransform(transform);
gc.drawArc(0, 0, width/3, height/6, 0, 180);
transform.dispose();

相关文章

GC类方法