Support transparency in icons

Discussion in 'Weather Watcher - Suggestions' started by Flügger, Mar 31, 2011.

  1. Flügger

    Flügger Well-Known Member

    Joined:
    Dec 18, 2005
    Messages:
    115
    Likes Received:
    0
    Hi Mike
    I don't know why I have never seen this before, but I just saw that the icons i use don't have transparent backgrounds even though the PNG files have transparency - I don't know if it's like that in the main interface, because I haven't looked through the code to see if the white background are put behind it manually, but I do see white backgrounds in the tooltip as well, and would think they would have to be like that...
    Could you maybe fix or add this in a future version..?
     
  2. msinger

    msinger Administrator
    Staff Member

    Joined:
    Nov 6, 2002
    Messages:
    4,668
    Likes Received:
    0
    The image background colors are transparent in the main window, but the color behind the image has been set to white. That's just a choice I made when I designed the Splendid skin. There is not an easy way to add PNG transparency to the tooltip, so I'm defaulting to a white background. The language that Weather Watcher Live is written in does not not have good support for PNG transparency.
     
  3. Flügger

    Flügger Well-Known Member

    Joined:
    Dec 18, 2005
    Messages:
    115
    Likes Received:
    0
    For the main window it's pretty much what I expected because it is web interface and you've got other transparent stuff in it...
    As for the tooltip, I didn't say that I think it would be easy, I just think that it would be a very nice feature and maybe even extending the skinning capabilities to include an optional background for icons in the tooltip? I'm pretty sure transparency is possible in most modern programming languages - what are you using? VB.net or something like that..?
     
  4. msinger

    msinger Administrator
    Staff Member

    Joined:
    Nov 6, 2002
    Messages:
    4,668
    Likes Received:
    0
    Transparency is probably possible in any language... depending on how much work you want to put into it and how many hoops you want to jump through. Weather Watcher Live is written in VB6.
     
  5. Flügger

    Flügger Well-Known Member

    Joined:
    Dec 18, 2005
    Messages:
    115
    Likes Received:
    0
    Well, of course it depends how much you want it and what you're willing to do for it... That being said I did a little googling, and it seems there are several ways to get PNG files to show their alpha transparency in VB6 programs without doing to much yourself..:

    A class you can use freely:
    http://planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=56537&lngWId=1

    A guy with a problem and, as far as I can see, a solution:
    http://www.xtremevbtalk.com/showthread.php?t=166764

    A guy that says "If you're using GDI+ to load the PNG, you might as well draw it with DrawImage, then it will have the correct transparency.":
    http://www.xtremevbtalk.com/showthread.php?t=77960
    http://www.xtremevbtalk.com/showthread.php?t=98285
    http://www.xtremevbtalk.com/showthread.php?t=144696
    http://www.xtremevbtalk.com/showpost.php?p=469709&postcount=4
    http://www.xtremevbtalk.com/showthread.php?t=144696

    And then a couple of other links, which may say another thing...
    http://www.codeguru.com/forum/showthread.php?t=365821
    http://freeimage.sourceforge.net/download.html


    But all in all it looks very much possible using one of the mentioned classes, or maybe even gdi+ straight out - then nothin extra would be needed, as it's a system dll since WinXP and runs on all 32 bit windows except Win95...

    Also, I totally get if you don't wanna put in the work, but I'd just like if you keep it in mind for sometime when you feel like it, as it would give just that little extra to the finish of the program...

    Otherwise you could make the whole tooltip skinnable or provide means of adding a background to the icons, ie. using a picture supplied in the tooltip skin..?
     
  6. msinger

    msinger Administrator
    Staff Member

    Joined:
    Nov 6, 2002
    Messages:
    4,668
    Likes Received:
    0
    Did you have any luck implementing any of the above code samples?


    It's not that I don't want to do it -- I just haven't found a solution that provides consistent results on all versions of Windows.


    Since the tooltip window is currently skinnable, you could use a solid background image and then create an icon set that uses that same background color.
     
  7. Flügger

    Flügger Well-Known Member

    Joined:
    Dec 18, 2005
    Messages:
    115
    Likes Received:
    0
    I'm sorry, no, I haven't had the opportunity to play with VB6 for a very long time... I once did and I kinda missed it... Then I had to learn C# and got Visual Studio.NET so it's mostly been those flavors I tasted ever since... And for the past year I've had to do Java and Android instead of any 'real' programming...
    I did however look at quite a bit of proposed solutions, and chose some that represented the most widely accepted ways of dealing with the problem, as far as I could tell...

    What I meant was not that you didn't want to do it, but that I can see it's not the biggest of problems, so just about anything would come before it - at least in my book... But that's not to say that I wouldn't like to see it done :)

    I know the tooltip is skinnable, I must have been tired when writing this... What I meant was 'skinnable like the main interface' or in some way where you can provide an image that will be be set as a background/frame for each icon, so the tooltip background don't have to be one solid color... Even just adding a small frame would make it look much better, in my opinion - personally I like a double border of two lines of the same, each with a width of 1 pixel and a space of 1 pixel between them :)

    I also just tried making the icons in different formats - I thought transparency might be implemented for something other than png's, but to my big surprise gif's weren't transparent either and ico's weren't even supported... Both of those formats should be quite a bit easier to get working, and using ico's each icon could even have several versions in the file, according to color depth, transparency and even size, which could bring a couple of somewhat interesting new possibilities :D
     
  8. msinger

    msinger Administrator
    Staff Member

    Joined:
    Nov 6, 2002
    Messages:
    4,668
    Likes Received:
    0
    I'm mostly working with C# and VB.NET myself. I haven't done any Android development. I recently bought a Droid X, so the thought of having Weather Watcher on it does interest me. However, with the low price of mobile apps, I doubt I could recoup the cost that would go into developing that app.


    What do you think about adding a Tray Tooltip Skin setting to set the background color of the icons? The background color currently defaults to white, but you could use a color that matches the background image of the tray tooltip window. That would really only work well if the background image was a solid color though.


    Agreed, and that is on my to-do list.
     
  9. Flügger

    Flügger Well-Known Member

    Joined:
    Dec 18, 2005
    Messages:
    115
    Likes Received:
    0
    Ohh you are, I just figured you were using VB6 for other things too and that's why you chose it for WWL... Or is it just for better backwards compatibility?
    I'm not sure either if there's a market for WW on Android, but I really like working with the environment and it's pretty easy once you learn a few basic things... I'm doing a lot of geo-positioning and other types of location-aware stuff right now, so maybe that could be an angle for AndroidWW?

    If you mean changing the background, where the icons are transparent, I can't see how that can be done easily if making it fully transparent is so hard? Which controls do you use for displaying the icons?
    Anyways, I think it would be better, as you can come closer to the color of the background image... And with a border around the icon it would be as perfect as it will get without having actual transparent backgrounds :)


    Or maybe someone out there knows how to do this best? Have you tried asking on stackoverflow.com or someplace similar? There are pretty many users who know quite a lot...