示例#1
0
 /**
  * Creates a render pass position.
  *
  * @param pass The render pass.
  * @param list The animation list.
  */
 public RenderpassPosition(final T pass, final AnimationList list) {
   super(new Point2D.Double(pass.getOffsetX(), pass.getOffsetY()));
   bbox = new Rectangle2D.Double();
   pass.getBoundingBox(bbox);
   this.pass = pass;
   list.addAnimated(this);
   pass.setAnimationList(list);
 }
示例#2
0
 @Override
 public void draw(final Graphics2D gfx, final KanvasContext ctx) {
   ensureLayout();
   if (layout != null) {
     final Graphics2D g = (Graphics2D) gfx.create();
     final Rectangle2D bbox = new Rectangle2D.Double();
     getBoundingBox(bbox);
     layout.drawBackground(g, ctx, bbox, members);
     g.dispose();
   }
   gfx.setColor(java.awt.Color.GREEN);
   RenderpassPainter.draw(nlBack, gfx, ctx);
   final Rectangle2D view = ctx.getVisibleCanvas();
   boolean changed = false;
   T last = null;
   for (final RenderpassPosition<T> p : members) {
     final T r = p.pass;
     if (!r.isVisible()) {
       continue;
     }
     if (p.checkBBoxChange()) {
       changed = true;
     }
     final Rectangle2D bbox = p.getPassBBox();
     if (!view.intersects(bbox)) {
       continue;
     }
     final Graphics2D g = (Graphics2D) gfx.create();
     g.clip(bbox);
     final double dx = r.getOffsetX();
     final double dy = r.getOffsetY();
     g.translate(dx, dy);
     final KanvasContext c = RenderpassPainter.getContextFor(r, ctx);
     r.draw(g, c);
     g.dispose();
     drawBetween(gfx, ctx, last, r);
     last = r;
   }
   drawBetween(gfx, ctx, last, null);
   if (jkanvas.Canvas.DEBUG_BBOX) {
     final Graphics2D g = (Graphics2D) gfx.create();
     PaintUtil.setAlpha(g, 0.3);
     g.setColor(java.awt.Color.BLUE);
     for (final RenderpassPosition<T> rp : members) {
       final Renderpass r = rp.pass;
       if (!r.isVisible()) {
         continue;
       }
       if (rp.checkBBoxChange()) {
         changed = true;
       }
       final Rectangle2D bbox = rp.getPassBBox();
       if (!view.intersects(bbox)) {
         continue;
       }
       g.fill(bbox);
     }
   }
   gfx.setColor(java.awt.Color.GREEN);
   RenderpassPainter.draw(nlFront, gfx, ctx);
   if (changed) {
     invalidate();
   }
 }