本文整理汇总了Java中org.eclipse.swt.graphics.GC.drawPath方法的典型用法代码示例。如果您正苦于以下问题:Java GC.drawPath方法的具体用法?Java GC.drawPath怎么用?Java GC.drawPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.graphics.GC
的用法示例。
在下文中一共展示了GC.drawPath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: arcSelf
import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
/**
* Paints an looping arc from scr to tgt.
* <p/>
* <b>Assumption:</b> The tgt is located right/below of the src.
*/
public static float[] arcSelf(GC gc, Point src, Point tgt) {
Path path = new Path(gc.getDevice());
int diffH = 10;
int diff = diffH * 3;
path.moveTo((int) src.x, (int) src.y);
path.cubicTo(
(int) src.x + diff, (int) src.y - diffH,
(int) tgt.x, (int) tgt.y - diff,
(int) tgt.x, (int) tgt.y);
gc.drawPath(path);
float[] pp = path.getPathData().points;
return pp;
}
示例2: arc
import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
/** Paints an arc from src to tgt using the given control point ctr. */
public static float[] arc(GC gc, Point ctr, Point src, Point tgt) {
Path path = new Path(gc.getDevice());
path.moveTo((int) src.x, (int) src.y);
path.quadTo((int) ctr.x, (int) ctr.y, (int) tgt.x, (int) tgt.y);
gc.drawPath(path);
float[] pp = path.getPathData().points;
return pp;
}
示例3: arcReversed
import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
/**
* Paints an arc from src to tgt.
* <p/>
* <b>Assumption:</b> The tgt is located below of the src.
*/
public static float[] arcReversed(GC gc, Point src, Point tgt) {
Path path = new Path(gc.getDevice());
int ydiff = (int) ((tgt.y - src.y) / 3);
path.moveTo((int) src.x, (int) src.y);
path.cubicTo((int) src.x, (int) src.y + ydiff, (int) tgt.x, (int) tgt.y - ydiff * 2, (int) tgt.x, (int) tgt.y);
gc.drawPath(path);
float[] pp = path.getPathData().points;
return pp;
}
示例4: drawPie
import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
public static void
drawPie(
GC gc,Image image, int x, int y,int width,int height,int percent, boolean draw_border )
{
Rectangle image_size = image.getBounds();
int width_pad = ( width - image_size.width )/2;
int height_pad = ( height - image_size.height )/2;
int angle = (percent * 360) / 100;
if(angle<4){
angle = 0; // workaround fillArc rendering bug
}
Region old_clipping = new Region();
gc.getClipping(old_clipping);
Path path_done = new Path(gc.getDevice());
path_done.addArc(x,y,width,height,90,-angle);
path_done.lineTo( x+width/2, y+height/2);
path_done.close();
gc.setClipping( path_done );
gc.drawImage(image, x+width_pad, y+height_pad+1);
Path path_undone = new Path(gc.getDevice());
path_undone.addArc(x,y,width,height,90-angle,angle-360);
path_undone.lineTo( x+width/2, y+height/2);
path_undone.close();
gc.setClipping( path_undone );
gc.setAlpha( 75 );
gc.drawImage(image, x+width_pad, y+height_pad+1);
gc.setAlpha( 255 );
gc.setClipping( old_clipping );
if ( draw_border ){
gc.setForeground(Colors.blue);
if ( percent == 100 ){
gc.drawOval(x , y , width-1, height-1);
}else{
if ( angle > 0 ){
gc.drawPath( path_done );
}
}
}
path_done.dispose();
path_undone.dispose();
old_clipping.dispose();
}