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


Java Path.quadTo方法代码示例

本文整理汇总了Java中org.eclipse.swt.graphics.Path.quadTo方法的典型用法代码示例。如果您正苦于以下问题:Java Path.quadTo方法的具体用法?Java Path.quadTo怎么用?Java Path.quadTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.swt.graphics.Path的用法示例。


在下文中一共展示了Path.quadTo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: arc

import org.eclipse.swt.graphics.Path; //导入方法依赖的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

示例2: toSwtPath

import org.eclipse.swt.graphics.Path; //导入方法依赖的package包/类
/**
 * Converts an AWT <code>Shape</code> into a SWT <code>Path</code>.
 * 
 * @param shape  the shape.
 * 
 * @return The path.
 */
private Path toSwtPath(Shape shape) {
    int type;
    float[] coords = new float[6];
    Path path = new Path(this.gc.getDevice());
    PathIterator pit = shape.getPathIterator(null);
    while (!pit.isDone()) {
        type = pit.currentSegment(coords);
        switch (type) {
            case (PathIterator.SEG_MOVETO):
                path.moveTo(coords[0], coords[1]);
                break;
            case (PathIterator.SEG_LINETO):
                path.lineTo(coords[0], coords[1]);
                break;
            case (PathIterator.SEG_QUADTO):
                path.quadTo(coords[0], coords[1], coords[2], coords[3]);
                break;
            case (PathIterator.SEG_CUBICTO):
                path.cubicTo(coords[0], coords[1], coords[2], 
                        coords[3], coords[4], coords[5]);
                break;
            case (PathIterator.SEG_CLOSE):
                path.close();
                break;
            default:
                break;
        }
        pit.next();
    }
    return path;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:39,代码来源:SWTGraphics2D.java

示例3: toSwtPath

import org.eclipse.swt.graphics.Path; //导入方法依赖的package包/类
/**
 * Converts an AWT <code>Shape</code> into a SWT <code>Path</code>.
 *
 * @param shape  the shape (<code>null</code> not permitted).
 *
 * @return The path.
 */
private Path toSwtPath(Shape shape) {
    int type;
    float[] coords = new float[6];
    Path path = new Path(this.gc.getDevice());
    PathIterator pit = shape.getPathIterator(null);
    while (!pit.isDone()) {
        type = pit.currentSegment(coords);
        switch (type) {
            case (PathIterator.SEG_MOVETO):
                path.moveTo(coords[0], coords[1]);
                break;
            case (PathIterator.SEG_LINETO):
                path.lineTo(coords[0], coords[1]);
                break;
            case (PathIterator.SEG_QUADTO):
                path.quadTo(coords[0], coords[1], coords[2], coords[3]);
                break;
            case (PathIterator.SEG_CUBICTO):
                path.cubicTo(coords[0], coords[1], coords[2],
                        coords[3], coords[4], coords[5]);
                break;
            case (PathIterator.SEG_CLOSE):
                path.close();
                break;
            default:
                break;
        }
        pit.next();
    }
    return path;
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:39,代码来源:SWTGraphics2D.java

示例4: pathIterator2Path

import org.eclipse.swt.graphics.Path; //导入方法依赖的package包/类
/**
 * Converts a java 2d path iterator to a SWT path.
 * 
 * @param iter specifies the iterator to be converted.
 * @return the corresponding path object. Must be disposed() when no longer
 *         used.
 */
private Path pathIterator2Path(final PathIterator iter) {
    final float[] coords = new float[6];

    final Path path = new Path(device);

    while (!iter.isDone()) {
        final int type = iter.currentSegment(coords);

        switch (type) {
            case PathIterator.SEG_MOVETO:
                path.moveTo(coords[0], coords[1]);
                break;

            case PathIterator.SEG_LINETO:
                path.lineTo(coords[0], coords[1]);
                break;

            case PathIterator.SEG_CLOSE:
                path.close();
                break;

            case PathIterator.SEG_QUADTO:
                path.quadTo(coords[0], coords[1], coords[2], coords[3]);
                break;

            case PathIterator.SEG_CUBICTO:
                path.cubicTo(coords[0], coords[1], coords[2], coords[3], coords[4], coords[5]);
                break;
            default:
                // log this?
        }

        iter.next();
    }
    return path;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:44,代码来源:SWTGraphics2D.java

示例5: createScaledPath

import org.eclipse.swt.graphics.Path; //导入方法依赖的package包/类
/**
 * Scales given path by zoom factor
 * 
 * @param path
 *            Path to be scaled
 * @return Scaled path
 */
private Path createScaledPath(Path path) {
	PathData p = path.getPathData();
	for (int i = 0; i < p.points.length; i += 2) {
		p.points[i] = (float) (p.points[i] * zoom + fractionalX);
		p.points[i + 1] = (float) (p.points[i + 1] * zoom + fractionalY);
	}
	Path scaledPath = new Path(path.getDevice());
	int index = 0;
	for (int i = 0; i < p.types.length; i++) {
		byte type = p.types[i];
		switch (type) {
		case SWT.PATH_MOVE_TO:
			scaledPath.moveTo(p.points[index], p.points[index + 1]);
			index += 2;
			break;
		case SWT.PATH_LINE_TO:
			scaledPath.lineTo(p.points[index], p.points[index + 1]);
			index += 2;
			break;
		case SWT.PATH_CUBIC_TO:
			scaledPath.cubicTo(p.points[index], p.points[index + 1],
					p.points[index + 2], p.points[index + 3],
					p.points[index + 4], p.points[index + 5]);
			index += 6;
			break;
		case SWT.PATH_QUAD_TO:
			scaledPath.quadTo(p.points[index], p.points[index + 1],
					p.points[index + 2], p.points[index + 3]);
			index += 4;
			break;
		case SWT.PATH_CLOSE:
			scaledPath.close();
			break;
		}
	}
	return scaledPath;
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:45,代码来源:ScaledGraphics.java


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