ok, so after musing i had taken a break from coding since everything i was seeing was far beyond my VERY meager skills, Az sent me a list of tasks he thought might e easy to do. One of them was opacity for the stat sheet, which he wasnt sure was possible, but thought it would. After Doing some research, it does look like it's possible, but i'm still struggling to wrap my head around which sort of graphic the stat sheet is. I'm pretty sure it's NOT a window (extended from a Jpanel), so i dont think http://today.java.net/pub/a/today/2008/ ... ndows.html is what i'm looking for.
Based on more research, it looks like http://www.pushing-pixels.org/?p=260 is the article that i'm needing to use. But i have a few concerns. First and foremost is that since it doesnt LOOK like a "stable" release has been put out before, so the location of the classes could (and quite likely will) change, based on what i'm reading.
Beyond that it seems like it's as simple as setting a new transparency value when the sheet is getting rendered. The final problem i have, is where to put the setting to allow the transparency change. One thought would be to put it in the campaign properties, but that would lock it into a choice by the gm/framework designer. is it preferred to have this as a client side setting?
Feature Request: Opacity on Statsheet help
Moderators: dorpond, trevor, Azhrei
Re: Feature Request: Opacity on Statsheet help
I wouldn't use the pushing-pixels article as it focuses on AWT and MapTool is a Swing beastie.aku wrote:ok, so after musing i had taken a break from coding since everything i was seeing was far beyond my VERY meager skills, Az sent me a list of tasks he thought might e easy to do. One of them was opacity for the stat sheet, which he wasnt sure was possible, but thought it would.
IIRC, Swing provides it's own transparency support.
Look for the location where a constructor is called to create the top-level statsheet object. If it's a custom class, you can adjust the transparency inside the constructor based on a value retrieved from the AppPreferences (I think that's the name). If it's not a custom class, then change the transparency after the object is created, but be sure to do check for other locations that might create the statsheet as well.Beyond that it seems like it's as simple as setting a new transparency value when the sheet is getting rendered. The final problem i have, is where to put the setting to allow the transparency change. One thought would be to put it in the campaign properties, but that would lock it into a choice by the gm/framework designer. is it preferred to have this as a client side setting?
Re: Feature Request: Opacity on Statsheet help
Statsheet is created via PointerTool, IIRC.
Edit: yeah, the sheet is generated in PointerTool; and the background image is in image/panelTexture.jpg. Might need to be changed to a PNG in order to modify its alpha, but I am traveling beyond my depth there. In fact, it might be easier to do a uniform color fill with transparency, rather than putting the background image in.
Edit: yeah, the sheet is generated in PointerTool; and the background image is in image/panelTexture.jpg. Might need to be changed to a PNG in order to modify its alpha, but I am traveling beyond my depth there. In fact, it might be easier to do a uniform color fill with transparency, rather than putting the background image in.
Re: Feature Request: Opacity on Statsheet help
It's not that tough to do.
If the asset doesn't support transparency (a call to an Image method should indicate that), then create a new Image with an alpha layer opacity set as described in the Preferences. Then use Graphics.drawImage() to copy the asset into the new Image. The existing Image can now be released.
All of that can be done when the image is first loaded so that two copies of it don't need to be kept around. (Unless other things use that image, such as the portrait or handouts or something?)
If the asset doesn't support transparency (a call to an Image method should indicate that), then create a new Image with an alpha layer opacity set as described in the Preferences. Then use Graphics.drawImage() to copy the asset into the new Image. The existing Image can now be released.
All of that can be done when the image is first loaded so that two copies of it don't need to be kept around. (Unless other things use that image, such as the portrait or handouts or something?)
- jfrazierjr
- Deity
- Posts: 5176
- Joined: Tue Sep 11, 2007 7:31 pm
Re: Feature Request: Opacity on Statsheet help
From what I have seen the paintOverlay method does a direct paint over the chat panel itself. If you look at the paintOverlay method around line 1285-1296 or so you should see the g.getComposite() call (which makes a copy of the current Composite object for later reuse), followed by creating a new Alpha Composite instance. This is the part that does the alpha.aku wrote:ok, so after musing i had taken a break from coding since everything i was seeing was far beyond my VERY meager skills, Az sent me a list of tasks he thought might e easy to do. One of them was opacity for the stat sheet, which he wasnt sure was possible, but thought it would. After Doing some research, it does look like it's possible, but i'm still struggling to wrap my head around which sort of graphic the stat sheet is. I'm pretty sure it's NOT a window (extended from a Jpanel), so i dont think http://today.java.net/pub/a/today/2008/ ... ndows.html is what i'm looking for.
In order to make the statsheet partially alpha, you would need to use the appropriate AlphaComposite static type variable in the first argument to setComposite() and the value from the preferences cast to a floating point number between 0-100 (good use for a spinner control in the preferences panel!!!) Once you have "drawn" everything you wish to draw with a specific transparency level, you would then set the composite back. It may not hurt to save the composite to a local variable so that you can easily switch back and forth between some things being opaque and transparent depending on needs...
I hope a) that helps and b)thats right!!
I save all my Campaign Files to DropBox. Not only can I access a campaign file from pretty much any OS that will run Maptool(Win,OSX, linux), but each file is versioned, so if something goes crazy wild, I can always roll back to a previous version of the same file.
Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..
Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..
- jfrazierjr
- Deity
- Posts: 5176
- Joined: Tue Sep 11, 2007 7:31 pm
Re: Feature Request: Opacity on Statsheet help
Yep.. fairly easy. Attached is a one line change to PointerTool.paintOverlay. In this case, I hard coded the opacity to 50%, but you would need to modify AppPreferences to store the prerference and modify the Preferences Abeille form to add a control for it. Should take all of 15 minutes or so.
- Attachments
-
- transparent_statsheet.png (424.55 KiB) Viewed 5710 times
I save all my Campaign Files to DropBox. Not only can I access a campaign file from pretty much any OS that will run Maptool(Win,OSX, linux), but each file is versioned, so if something goes crazy wild, I can always roll back to a previous version of the same file.
Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..
Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..
Re: Feature Request: Opacity on Statsheet help
Hmm, I don't think I want the text to become transparent as well, just the background of the statsheet.
- jfrazierjr
- Deity
- Posts: 5176
- Joined: Tue Sep 11, 2007 7:31 pm
Re: Feature Request: Opacity on Statsheet help
heh... well.. I agree too I guess... I was just trying to show aku what needed to be done. If he saves the AlphaComposite to a local variable, he can switch back and forth as much as he wants... heck.. he could even make every other row in the statsheet transparent and the opposite opaque...Azhrei wrote:Hmm, I don't think I want the text to become transparent as well, just the background of the statsheet.
I save all my Campaign Files to DropBox. Not only can I access a campaign file from pretty much any OS that will run Maptool(Win,OSX, linux), but each file is versioned, so if something goes crazy wild, I can always roll back to a previous version of the same file.
Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..
Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..