What to paint when a non-image Board has no background?

I’m trying to fix Bug 2659577 right now:

sourceforge.net/tracker/?func=d … tid=594231

What it amounts to is that Boards with no image and no background color
end up painted black (not unlike my formerly red door) by the Image Saver.
The code which is the culprit is here, in Board.java:

  if (color != null) {
    g.setColor(color);
    g.fillRect(visibleRect.x, visibleRect.y,
               visibleRect.width, visibleRect.height);
  }
  else {
     g.clearRect(visibleRect.x, visibleRect.y,
                 visibleRect.width, visibleRect.height);
  } 

Since the default background color for offscreen images is apparently black,
calling clearRect() when the board has no background color set (color ==
null) means that the snapshot ends up with a black background—which will
generally not be the way the board looks on-screen.

So, here’s the $64k question: Can I just remove the clearRect() call? I know
this will give us the correct behavior for the Image Saver. Will this screw
up anything else? (The limited testing I’ve done shows me that on-screen
painting without clearRect() here seems ok.)

Try testing it with a map that has a non-empty buffer area around the boards. As I recall, this clearRect() call is necessary in that case if you’re scrolling around and have pieces offboard in the buffer area.

rk

Post generated using Mail2Forum (mail2forum.com)

Thus spake Rodney Kinney:

I’ll try that, but I think that area will be painted by Map to it’s
background color. (It is is possible to give Map a null background
color, in which case you do get weirdness.)

J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Thus spake Joel Uckelman:

I added a 100px border to a map and put some pieces there; there were
no drawing artefacts that I noticed. I think this is ok.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)