当前位置: 首页>>代码示例>>Java>>正文


Java GC.drawPath方法代码示例

本文整理汇总了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;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:21,代码来源:GraphUtils.java

示例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;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:11,代码来源:GraphUtils.java

示例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;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:16,代码来源:GraphUtils.java

示例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();

}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:65,代码来源:PieUtils.java


注:本文中的org.eclipse.swt.graphics.GC.drawPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。