Page 7 of 22

Re: General UI support

PostPosted: 16 Feb 2012, 02:54
by Chris H.
Rev 14095 replaces Sloth's earlier temp fix and I no longer get an error preventing a build. Looks good here. Thank you.

Re: General UI support

PostPosted: 16 Feb 2012, 04:56
by Doublestrike
Great, thanks for that - not sure what happened there, I didn't change anything on the fix, just re-committed :/

====

Composited graphics will not work for these darn round corners. This functionality is important to the global look of the UI, but is apparently tricky to get right, so I apologize for the delay.

The alternative is square corners on the panels (boo). My internet is flaky right now so I can't get a virtual machine up to develop on. The problem lies directly in setClip on a graphics object.

I have committed r14097 as a last gasp effort to fix this. If a dev who is having troubles wanted to have a look at the problem, it's in FPanel$drawBackgroundTexture (around line 245) in forge.view.toolbox. The code looks like this (I've added extra comments, starting with FLAG for the parts to experiment with):

Code: Select all
// FLAG: SAVE OLD CLIP FOR RESET
Rectangle oldClipBounds = g2d0.getClipBounds();

// FLAG: CLIP THE MASK OUT OF GRAPHICS
clip = new Area(new RoundRectangle2D.Float(0, 0, pnlW, pnlH, cornerDiameter, cornerDiameter));
g2d0.setClip(clip);

// Texture tiling algorithm, no need to change this, is painted inside clip
this.tempX = 0;
this.tempY = 0;

  while (this.tempX < this.pnlW) {
    while (this.tempY < this.pnlH) {
      g2d0.drawImage(this.backgroundTexture, (int) this.tempX, (int) this.tempY, null);
      this.tempY += this.textureH;
    }
  this.tempX += this.textureW;
  this.tempY = 0;
  }
  this.tempX = 0;
  // End tiling algorithm
       
  // FLAG:RESET TO OLD CLIP - NOT HAPPENING, OR SOMETHING
  g2d0.setClip(oldClipBounds);
If you can get this working without the repaint problem, the rest is finished. It's these few lines that are causing that trouble. So, if someone could play with this a bit, I would greatly appreciate it. If not, I'll just put square corners on everything.

====

On the outside chance this last thing worked, background textures should be returned.

Re: General UI support

PostPosted: 16 Feb 2012, 06:39
by moomarc
Well, things are working on my side, but that doesn't help I guess seeing as I never had any of the issues.

I have come across something else though (it might already be on the list for post-current situation). Avatar selections don't take effect until the next restart of Forge.

Another weird one to do with avatar selection: selecting any avatar after the djinn (left column, sixth row) and assuming left-to-right top-down pattern, the avatar image's in the prefs selection don't match the battlefield avatar. Looking at the actual sprite image the battlefield loads the correct order, so there's something about how the selection screen loads/orders them.

Re: General UI support

PostPosted: 16 Feb 2012, 06:53
by Doublestrike
moomarc wrote:Well, things are working on my side, but that doesn't help I guess seeing as I never had any of the issues.
Thanks and yep, that's the rub, right there :wink:

moomarc wrote:...avatars...
Will have a look. I'm actually working on that section right now, trying to get the avatars to flow across the full area that's allowed them. (The 3-per-row thing is to accomodate the smallest screen setting without the dreaded horizontal scrollbar.)

Re: General UI support

PostPosted: 16 Feb 2012, 09:17
by Sloth
Doublestrike wrote:I have committed r14097 as a last gasp effort to fix this.
The problem is back, sorry Doublestrike. I will take a look at the code though.

Re: General UI support

PostPosted: 16 Feb 2012, 10:44
by Doublestrike
Thanks Sloth! It's really just a problem with the clip - apparently completely possible...

Re: General UI support

PostPosted: 16 Feb 2012, 11:48
by Sloth
Doublestrike wrote:I have committed r14097 as a last gasp effort to fix this. If a dev who is having troubles wanted to have a look at the problem, it's in FPanel$drawBackgroundTexture (around line 245) in forge.view.toolbox. The code looks like this (I've added extra comments, starting with FLAG for the parts to experiment with):

Code: Select all
// FLAG: SAVE OLD CLIP FOR RESET
Rectangle oldClipBounds = g2d0.getClipBounds();

// FLAG: CLIP THE MASK OUT OF GRAPHICS
clip = new Area(new RoundRectangle2D.Float(0, 0, pnlW, pnlH, cornerDiameter, cornerDiameter));
g2d0.setClip(clip);

// Texture tiling algorithm, no need to change this, is painted inside clip
this.tempX = 0;
this.tempY = 0;

  while (this.tempX < this.pnlW) {
    while (this.tempY < this.pnlH) {
      g2d0.drawImage(this.backgroundTexture, (int) this.tempX, (int) this.tempY, null);
      this.tempY += this.textureH;
    }
  this.tempX += this.textureW;
  this.tempY = 0;
  }
  this.tempX = 0;
  // End tiling algorithm
       
  // FLAG:RESET TO OLD CLIP - NOT HAPPENING, OR SOMETHING
  g2d0.setClip(oldClipBounds);
If you can get this working without the repaint problem, the rest is finished. It's these few lines that are causing that trouble. So, if someone could play with this a bit, I would greatly appreciate it. If not, I'll just put square corners on everything.
I don't know what it should look like, but when i remove the following part, i don't have problems anymore:

Code: Select all
// FLAG: CLIP THE MASK OUT OF GRAPHICS
clip = new Area(new RoundRectangle2D.Float(0, 0, pnlW, pnlH, cornerDiameter, cornerDiameter));
g2d0.setClip(clip);

Re: General UI support

PostPosted: 16 Feb 2012, 12:25
by Chris H.
just for the heck of it, I modified line 248 from:

Code: Select all
g2d0.setClip(clip);
`
to:

Code: Select all
g2d0.create().setClip(clip);
`
and it looks better, I get a similar result as the one from Sloth. Granted, the battlefield is missing the picture.

Re: General UI support

PostPosted: 16 Feb 2012, 12:34
by slapshot5
What happened to the red-colored mage avatar we used to have for the computer? It's no an option on the Settings > Avatars panel.

-slapshot5

Re: General UI support

PostPosted: 16 Feb 2012, 12:53
by Sloth
Chris H. wrote:just for the heck of it, I modified line 248 from:

Code: Select all
g2d0.setClip(clip);
`
to:

Code: Select all
g2d0.create().setClip(clip);
`
and it looks better, I get a similar result as the one from Sloth. Granted, the battlefield is missing the picture.
I toyed around with the code and i find several versions that prevents the artifacts from appearing. Now i wonder what else could be wrong. Should the battlefield background image be visible?

Re: General UI support

PostPosted: 16 Feb 2012, 13:17
by moomarc
slapshot5 wrote:What happened to the red-colored mage avatar we used to have for the computer? It's no an option on the Settings > Avatars panel.

-slapshot5
I'll add it to the avatars sprite. Look for it soon... :)

EDIT: Done! Its the last avatar in the list.

Re: General UI support

PostPosted: 16 Feb 2012, 14:07
by Chris H.
Sloth wrote:I toyed around with the code and i find several versions that prevents the artifacts from appearing. Now i wonder what else could be wrong. Should the battlefield background image be visible?
`
Yeah, my lack of knowledge is holding me back. :mrgreen:

The setClip() javadoc states:

Sets the current clipping area to an arbitrary clip shape. Not all objects that implement the Shape interface can be used to set the clip. The only Shape objects that are guaranteed to be supported are Shape objects that are obtained via the getClip method and via Rectangle objects. This method sets the user clip, which is independent of the clipping associated with device bounds and window visibility.
`
So the RoundRectangle2D might be a problem under some OS' and look OK on others?


Edit:

I do not think that the battleground image should be visible at this time. There are a few methods in this class that are not used locally at this time. It looks like drawForegroundScaled() might be responsible for drawing the image.

Re: General UI support

PostPosted: 17 Feb 2012, 00:25
by Doublestrike
Chris H. wrote:I do not think that the battleground image should be visible at this time. There are a few methods in this class that are not used locally at this time. It looks like drawForegroundScaled() might be responsible for drawing the image.
Thanks fellas - that's exactly right. Currently, only the background texture should be drawn. If that's OK, then the same method can be applied elsewhere.

Yeah, not too hard a problem to solve - unless you can't see the artifacts :lol:

Chris H wrote:g2d0.create().setClip(clip);
Actually, g2d0 is already created from the root graphics, so that would be introducing another graphics canvas, just so you know (performance!). But that may be the only way to solve the problem...

===

So, if background texture is OK, I'll have a chance to rebuild the draw methods in about 24 hours. If someone could commit the preferred version of FPanel (for the background texture only) I'll get to work. Thanks for the help!

Re: General UI support

PostPosted: 17 Feb 2012, 00:33
by Doublestrike
Sloth wrote:I toyed around with the code and i find several versions that prevents the artifacts from appearing. Now i wonder what else could be wrong. Should the battlefield background image be visible?
Was re-reading this - do these versions have rounded corners? That's the whole problem here.

Nothing else is wrong, just commented out. The code is built so multiple backgrounds won't be painted if it's not necessary. It's all been fully tested and works great, except for those blasted radii.

Re: General UI support

PostPosted: 17 Feb 2012, 01:01
by Chris H.
Doublestrike wrote:Actually, g2d0 is already created from the root graphics, so that would be introducing another graphics canvas, just so you know (performance!). But that may be the only way to solve the problem...
`
I built a local copy with Maven using my attempt and played for awhile. It got to the point where things were starting to slow down during one of the matches. I checked my Activity Monitor and forge was using less than 700 MB at that time.

So my solution may need additional testing. :(