Package org.nlogo.api

Examples of org.nlogo.api.Graphics2DWrapper


        spotlightImage.getHeight() != height) {
      spotlightImage = new java.awt.image.BufferedImage
          (width, height, java.awt.image.BufferedImage.TYPE_INT_ARGB);
    }

    Graphics2DWrapper sg = new Graphics2DWrapper(spotlightImage.createGraphics());
    sg.antiAliasing(true);

    if (dim) {
      sg.setComposite(java.awt.AlphaComposite.Src);
      sg.setColor(DIMMED);
      sg.fillRect(0, 0, width, height);
    } else {
      sg.setComposite(java.awt.AlphaComposite.Clear);
      sg.setColor(DIMMED);
      sg.fillRect(0, 0, width, height);
    }

    if (wrap) {
      topology.wrapDrawable(this, sg, xcor, ycor, spotlightSize, patchSize);
    } else {
      sg.push();
      double size = spotlightSize * patchSize + adjustSize(spotlightSize, patchSize);
      double offset = size / 2.0;
      double x = topology.graphicsX(xcor, patchSize) - offset;
      double y = topology.graphicsY(ycor, patchSize) - offset;
      sg.translate(x, y);
      draw(sg, size);
      sg.pop();
    }

    sg.antiAliasing(false);

    return spotlightImage;
  }
View Full Code Here


      setUpDrawingImage();
    }
  }

  public void stamp(org.nlogo.api.Agent agent, boolean erase) {
    Graphics2DWrapper tg = new Graphics2DWrapper(getAndCreateDrawing(false).createGraphics());
    tg.antiAliasing(true);
    tg.setComposite(erase ? java.awt.AlphaComposite.Clear : java.awt.AlphaComposite.SrcOver);

    topology.prepareToPaint(this, width, height);

    // we use world.patchSize here because the drawing does not
    // change resolution due to zooming. ev 4/2/08
    if (agent instanceof org.nlogo.api.Turtle) {
      turtleDrawer.drawTurtleShape
          (tg, topology, (org.nlogo.api.Turtle) agent, world.patchSize());
    } else if (agent instanceof org.nlogo.api.Link) {
      linkDrawer.drawLink
          (tg, topology, (org.nlogo.api.Link) agent, world.patchSize(), false);
    }
    tg.antiAliasing(false);

    markDirty();
  }
View Full Code Here

    if (drawingImage == null) {
      setUpDrawingImage();
    }

    if (drawingImage != null) {
      Graphics2DWrapper tg = new Graphics2DWrapper((java.awt.Graphics2D) drawingImage.getGraphics());

      tg.setPenWidth(penSize);

      if (penMode.equals("erase")) {
        tg.setComposite(java.awt.AlphaComposite.Clear);

        drawWrappedLine(tg, x1, y1, x2, y2, penSize);

        tg.setComposite(java.awt.AlphaComposite.SrcOver);
      } else {
        tg.antiAliasing(true);

        tg.setColor(org.nlogo.api.Color.getColor(penColor));

        drawWrappedLine(tg, x1, y1, x2, y2, penSize);

        tg.antiAliasing(false);
      }
    }
  }
View Full Code Here

    imageSize = (cellSize * (int) StrictMath.ceil(turtleSize));

    image = new java.awt.image.BufferedImage
        (imageSize, imageSize,
            java.awt.image.BufferedImage.TYPE_INT_ARGB);
    Graphics2DWrapper g = new Graphics2DWrapper((java.awt.Graphics2D) image.getGraphics());
    g.antiAliasing(true);
    try {
      shape.paint(g, color, 0, 0, turtleSize, cellSize, angle, 0.0);
    } finally {
      g.dispose();
    }
  }
View Full Code Here

    renderLabelsAsRectangles_$eq(renderLabelsAsRectangles);
  }

  ///
  public void paint(java.awt.Graphics2D g, ViewSettings settings) {
    paint(new Graphics2DWrapper(g, renderLabelsAsRectangles()), settings);
  }
View Full Code Here

TOP

Related Classes of org.nlogo.api.Graphics2DWrapper

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.