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

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

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

GC.fillArc介绍

[英]Fills the interior of a circular or elliptical arc within the specified rectangular area, with the receiver's background color.

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 fillArc(int x, int y, int width, int height, int startAngle, int endAngle) 
{
  gc.fillArc(x + transX, y + transY, width, height, startAngle, endAngle);
}

代码示例来源:origin: BiglySoftware/BiglyBT

public static void drawPie(GC gc,int x, int y,int width,int height,int percent) {
  Color background = gc.getBackground();
  gc.setForeground(Colors.blue);
  int angle = (percent * 360) / 100;
  if(angle<4)
    angle = 0; // workaround fillArc rendering bug
  gc.setBackground(Colors.white);
  gc.fillArc(x,y,width,height,0,360);
  gc.setBackground(background);
  gc.fillArc(x,y,width,height,90,angle*-1);
  gc.drawOval(x , y , width-1, height-1);
}

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

/**
 * Fills 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 #drawArc(int, int, int, int, int, int)
 */
@Override
public void fillArc(int x, int y, int width, int height, int arcStart,
    int arcAngle) {
  switchColors();
  this.gc.fillArc(x, y, width - 1, height - 1, arcStart, arcAngle);
  switchColors();
}

代码示例来源: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.swt.cocoa.macosx/x86_64

gc.fillArc(x, paintY + size, size + 1, size + 1, 0, 360);
return;

代码示例来源: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.xworker/xworker_swt

gc.fillArc((int) cX-8, (int) cY-8, 16, 16, 0, 360);
  gc.setBackground(secondAreaClolor);            
  float secondWidth = (float)((r-medTickLen));
  gc.fillArc((int) (cX - secondWidth), (int) (cY - secondWidth), 
      (int) (2 * secondWidth), (int) (2 * secondWidth), (int) (90), (int) -(secondAngle + 180));
  gc.setBackground(minuteAreaClolor);
  float minuteWidth = (float)((r-medTickLen) * 0.9);
  gc.fillArc((int) (cX - minuteWidth), (int) (cY - minuteWidth), 
      (int) (2 * minuteWidth), (int) (2 * minuteWidth), (int) (90), (int) -(minuteAngle + 180));
  gc.setBackground(hourAreaClolor);            
  float hourWidth = (float)((r-longTickLen)*0.75);
  gc.fillArc((int) (cX - hourWidth), (int) (cY - hourWidth), 
      (int) (2 * hourWidth), (int) (2 * hourWidth), 90, (int) -(angle + 180));

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

gc.fillArc((int) cX-8, (int) cY-8, 16, 16, 0, 360);
  gc.setBackground(secondAreaClolor);            
  float secondWidth = (float)((r-medTickLen));
  gc.fillArc((int) (cX - secondWidth), (int) (cY - secondWidth), 
      (int) (2 * secondWidth), (int) (2 * secondWidth), (int) (90), (int)-(secondAngle + 180));
  gc.setBackground(minuteAreaClolor);
  float minuteWidth = (float)((r-medTickLen) * 0.9);
  gc.fillArc((int) (cX - minuteWidth), (int) (cY - minuteWidth), 
      (int) (2 * minuteWidth), (int) (2 * minuteWidth), (int) (90), (int) -(minuteAngle + 180));
  gc.setBackground(hourAreaClolor);            
  float hourWidth = (float)((r-longTickLen)*0.75);
  gc.fillArc((int) (cX - hourWidth), (int) (cY - hourWidth), 
      (int) (2 * hourWidth), (int) (2 * hourWidth), (int) 90,  (int) -(angle + 180));

相关文章

GC类方法