Package edu.umd.cs.piccolo.nodes

Examples of edu.umd.cs.piccolo.nodes.PImage


   * Draw the image with the given name at (x,y). Any image loaded stays in
   * memory, so if you intend to redraw an image, you do not have to use
   * createImage again.
   */
  public void drawImage(String internalName, int x_pos, int y_pos) {
    PImage img = SVImageHandler.getImage(internalName);
    img.setX(x_pos);
    img.setY(y_pos);
    layer.addChild(img);
  }
View Full Code Here


      System.exit(1);
    }

    bi.setRGB(0, 0, width, height, pictureArray, 0, width);

    PImage img = new PImage(bi);

    images.put(imageName, img);

    imageName = null;
    readImageData = false;
View Full Code Here

   *
   * @param location The (local) location from where to open the file. This is
   * also the internal name associated with the image (if you want to draw it).
   */
  public static void openImage(String location) {
    PImage img = new PImage(location);
    images.put(location, img);
  }
View Full Code Here

  public ImageViewer() throws HeadlessException {
    super();
   
    canvas = new PSwingCanvas();
    imageNode = new PImage();   
    imageNode.setScale(scale);
    canvas.getLayer().addChild(imageNode);   
    add(canvas);
   
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
View Full Code Here

  public BufferedImage createImage(){
    final PCanvas canvas = new PCanvas();

    BufferedImage backgroundImage = getScreenRegion().capture();
    final PImage background = new PImage(backgroundImage);
    canvas.getLayer().addChild(background);
    canvas.setBounds(0,0,backgroundImage.getWidth(),backgroundImage.getHeight());

    PLayer layer = canvas.getLayer();
    Rectangle r = getScreenRegion().getBounds();
View Full Code Here

    private PImage image;

    DragDropFrame(URL background, URL dragTarget) throws IOException {
      final PCanvas canvas = new PCanvas();
      image = new PImage();

      BufferedImage backgroundImage = ImageIO.read(background);
      PImage backgroundNode = new PImage();
      backgroundNode.setImage(backgroundImage);
      //backgroundNode.setPickable(false);
      //canvas.get
     
      BufferedImage dragTargetImage = ImageIO.read(dragTarget);
      PImage dragTargetNode = new PImage();
      dragTargetNode.setPickable(true);     
      dragTargetNode.setOffset(10,10);
      dragTargetNode.setImage(dragTargetImage);
           
      canvas.getLayer().addChild(backgroundNode);
      canvas.getLayer().addChild(dragTargetNode);           
     
      add(canvas);
     
      dragTargetNode.addInputEventListener(new PDragEventHandler(){

        @Override
        protected void startDrag(PInputEvent event) {
        //  System.out.println("Start dragging");
        }
       
      });
     
      dragTargetNode.addInputEventListener(new PBasicInputEventHandler(){

        @Override
        public void keyTyped(PInputEvent event) {
          super.keyTyped(event);
         
View Full Code Here

    return addShadow(foregroundNode);
  }
 
  static public PNode createFrom(ImageElement element){
    PImage p = new PImage(element.image);

    PNode foregroundNode = new PNode();
    foregroundNode.addChild(p);
    foregroundNode.setHeight(p.getHeight()+4);
    foregroundNode.setWidth(p.getWidth()+4);
    p.setOffset(2,2);

    foregroundNode.setOffset(element.x, element.y);

    return addShadow(foregroundNode);
  }
View Full Code Here

        addTextLabel(layer, actionName, 3, 3);   
       
        // draw the target image
        BufferedImage targetImage = ((DefaultTarget) target).toImage();
        if (targetImage != null){
          PImage im = new PImage(targetImage);
          im.setOffset(3, 30);
          im.setPaint(Color.black);
          addNodeWithShadow(layer, im);
        }
       
        // draw a rectangle around the screen region in which find was performed
        addRectangle(layer, screenRegion.getBounds().x - loggedScreenRegion.getBounds().x,
View Full Code Here

TOP

Related Classes of edu.umd.cs.piccolo.nodes.PImage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.