本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}