本文整理汇总了Java中org.piccolo2d.nodes.PPath.setStrokePaint方法的典型用法代码示例。如果您正苦于以下问题:Java PPath.setStrokePaint方法的具体用法?Java PPath.setStrokePaint怎么用?Java PPath.setStrokePaint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.piccolo2d.nodes.PPath
的用法示例。
在下文中一共展示了PPath.setStrokePaint方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import org.piccolo2d.nodes.PPath; //导入方法依赖的package包/类
public void initialize() {
final PLayer layer = getCanvas().getLayer();
final Random random = new Random();
for (int i = 0; i < 1000; i++) {
final PPath each = PPath.createRectangle(0, 0, 100, 80);
each.scale(random.nextFloat() * 2);
each.offset(random.nextFloat() * 10000, random.nextFloat() * 10000);
each.setPaint(new Color(random.nextFloat(), random.nextFloat(), random.nextFloat()));
each.setStroke(new BasicStroke(1 + 10 * random.nextFloat()));
each.setStrokePaint(new Color(random.nextFloat(), random.nextFloat(), random.nextFloat()));
layer.addChild(each);
}
getCanvas().removeInputEventListener(getCanvas().getPanEventHandler());
getCanvas().addInputEventListener(new PNavigationEventHandler());
}
示例2: initialize
import org.piccolo2d.nodes.PPath; //导入方法依赖的package包/类
public void initialize() {
PPath eacha = PPath.createRectangle(50, 50, 300, 300);
eacha.setPaint(Color.red);
getCanvas().getLayer().addChild(eacha);
eacha = PPath.createRectangle(-50, -50, 100, 100);
eacha.setPaint(Color.green);
getCanvas().getLayer().addChild(eacha);
eacha = PPath.createRectangle(350, 350, 100, 100);
eacha.setPaint(Color.green);
getCanvas().getLayer().addChild(eacha);
getCanvas().getCamera().addInputEventListener(new PBasicInputEventHandler() {
public void mousePressed(final PInputEvent event) {
if (!(event.getPickedNode() instanceof PCamera)) {
event.setHandled(true);
getCanvas().getCamera().animateViewToPanToBounds(event.getPickedNode().getGlobalFullBounds(), 500);
}
}
});
final PLayer layer = getCanvas().getLayer();
final Random random = new Random();
for (int i = 0; i < 1000; i++) {
final PPath each = PPath.createRectangle(0, 0, 100, 80);
each.scale(random.nextFloat() * 2);
each.offset(random.nextFloat() * 10000, random.nextFloat() * 10000);
each.setPaint(new Color(random.nextFloat(), random.nextFloat(), random.nextFloat()));
each.setStroke(new BasicStroke(1 + 10 * random.nextFloat()));
each.setStrokePaint(new Color(random.nextFloat(), random.nextFloat(), random.nextFloat()));
layer.addChild(each);
}
getCanvas().removeInputEventListener(getCanvas().getZoomEventHandler());
}
示例3: createRectNode
import org.piccolo2d.nodes.PPath; //导入方法依赖的package包/类
private void createRectNode(final int i) {
PPath path = PPath.createRectangle(0.0f, 0.0f, 50.0f * i/N + 10.0f, 50.0f * i/N + 10.0f);
int r = 200 * i/N + 45;
path.setPaint(new Color(r, 0, 0, 200));
path.setStrokePaint(new Color(r - 10, 0, 0, 200));
path.setOffset(random.nextDouble() * 1000.0d - random.nextDouble() * 1000.0,
random.nextDouble() * 1000.0d - random.nextDouble() * 1000.0);
getCanvas().getLayer().addChild(path);
}
示例4: OffscreenCanvasExample
import org.piccolo2d.nodes.PPath; //导入方法依赖的package包/类
/**
* Create a new offscreen canvas example with the specified graphics device.
*
* @param device graphics device
*/
public OffscreenCanvasExample(final GraphicsDevice device) {
final GraphicsConfiguration configuration = device.getDefaultConfiguration();
frame = new Frame(configuration);
frame.setUndecorated(true);
frame.setIgnoreRepaint(true);
frame.setBounds(100, 100, 400, 400);
frame.setVisible(true);
frame.createBufferStrategy(2);
canvas = new POffscreenCanvas(400, 400);
final PText text = new PText("Offscreen Canvas Example");
text.setFont(text.getFont().deriveFont(32.0f));
text.setTextPaint(new Color(200, 200, 200));
text.offset(200.0f - text.getWidth() / 2.0f, 200.0f - text.getHeight() / 2.0f);
final PPath rect = PPath.createRectangle(0.0f, 0.0f, 360.0f, 360.0f);
rect.setPaint(new Color(20, 20, 20, 80));
rect.setStroke(new BasicStroke(2.0f));
rect.setStrokePaint(new Color(20, 20, 20));
rect.offset(20.0f, 20.0f);
canvas.getCamera().getLayer(0).addChild(text);
canvas.getCamera().getLayer(0).addChild(rect);
final Rectangle2D right = new Rectangle2D.Double(200.0f, 200.0f, 800.0f, 800.0f);
final Rectangle2D left = new Rectangle2D.Double(-200.0f, 200.0f, 225.0f, 225.0f);
final Rectangle2D start = new Rectangle2D.Double(0.0f, 0.0f, 400.0f, 400.0f);
final PActivity toRight = canvas.getCamera().animateViewToCenterBounds(right, true, 5000);
final PActivity toLeft = canvas.getCamera().animateViewToCenterBounds(left, true, 5000);
final PActivity toStart = canvas.getCamera().animateViewToCenterBounds(start, true, 5000);
toLeft.startAfter(toRight);
toStart.startAfter(toLeft);
}
示例5: initialize
import org.piccolo2d.nodes.PPath; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void initialize() {
final PText label = new PText("Stroke Example");
label.setFont(label.getFont().deriveFont(24.0f));
label.offset(20.0d, 20.0d);
final PPath rect = PPath.createRectangle(50.0f, 50.0f, 300.0f, 300.0f);
rect.setStroke(new BasicStroke(4.0f));
rect.setStrokePaint(new Color(80, 80, 80));
final PText fixedWidthLabel = new PText("PFixedWidthStrokes");
fixedWidthLabel.setTextPaint(new Color(80, 0, 0));
fixedWidthLabel.offset(100.0d, 80.0d);
final PPath fixedWidthRect0 = PPath.createRectangle(100.0f, 100.0f, 200.0f, 50.0f);
fixedWidthRect0.setStroke(new PFixedWidthStroke(2.0f));
fixedWidthRect0.setStrokePaint(new Color(60, 60, 60));
final PPath fixedWidthRect1 = PPath.createRectangle(100.0f, 175.0f, 200.0f, 50.0f);
fixedWidthRect1.setStroke(new PFixedWidthStroke(1.5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 10.0f));
// fixedWidthRect1.setStroke(new PFixedWidthStroke(1.5f,
// PFixedWidthStroke.CAP_ROUND, PFixedWidthStroke.JOIN_MITER, 10.0f));
fixedWidthRect1.setStrokePaint(new Color(40, 40, 40));
final PPath fixedWidthRect2 = PPath.createRectangle(100.0f, 250.0f, 200.0f, 50.0f);
fixedWidthRect2.setStroke(new PFixedWidthStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 10.0f,
new float[] { 2.0f, 3.0f, 4.0f }, 1.0f));
// fixedWidthRect2.setStroke(new PFixedWidthStroke(1.0f,
// PFixedWidthStroke.CAP_ROUND, PFixedWidthStroke.JOIN_MITER, 10.0f, new
// float[] { 2.0f, 3.0f, 4.0f }, 1.0f));
fixedWidthRect2.setStrokePaint(new Color(20, 20, 20));
getCanvas().getLayer().addChild(label);
getCanvas().getLayer().addChild(rect);
getCanvas().getLayer().addChild(fixedWidthLabel);
getCanvas().getLayer().addChild(fixedWidthRect0);
getCanvas().getLayer().addChild(fixedWidthRect1);
getCanvas().getLayer().addChild(fixedWidthRect2);
}