I've been playing with J2D for a few weeks and Batik for a few days and
this is what I'm trying to do and not succeeding.  The root of the problem
is I've got a SVGGraphics2D object with objects already drawn in it and I
want to get it drawn to the screen.  The branches of the problem are that
I have other things I want to draw on the screen as well, so I can't
simply call paintComponent(mySVG2D).  Here's the pseudo code:

// Store my objects
fillSVG () {
  mySVG2D.setColor(color.Red);
  mySVG2D.draw(myRect);
}

paintComponent (Graphics g) {
  // Cast
  g2_paint = (Graphics2D) g;

  // fill in custom background (current just one color but could be a tile
or custom Paint)
  g2_biBackground = bi_background.createGraphics();
  g2_biBackground.setColor(getBackground());
  g2_biBackground.fillRect(0, 0, w, h);
  g2_biBackground.dispose();

  // Draw the background
  g2_paint.drawImage(bi_background, 0, 0, this);

  /***
    Now I need to draw the objects in mySVG2D ???????????
  ***/

  // draw the animation layer, or objects that are currently moving.
  g2_paint.drawImage(bi_animation, 0, 0, this);
}


The reason I'm using SVGGraphics2D is it already stores the style data for
each object, so it's easy to change colors, remove objects, etc. outside
of the drawing function, plus I want to load and save in SVG.  I can write
an SVGImageBuffer that wraps the SVGGraphics2D object in a BufferImage,
and thus draw that, but I was wondering, in general, when you've got two
Graphics objects, is there a way to combine them together?

I've looked at the slideshow demo, but I couldn't get it to work in this
context--it would only draw the very first time and would return a null
BufferedImage every time after.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to