Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: afb on November 03, 2006, 09:49:50 pm

Title: Transparent splash screen
Post by: afb on November 03, 2006, 09:49:50 pm
The transparent splash screen (splash_new.png) doesn't work on Mac OS X:

(http://www.algonet.se/~afb/wx/codeblocks-alphasplash.png)

Should we default it to "off", or should we use the old splash ? (splash.png)
Title: Re: Transparent splash screen
Post by: thomas on November 03, 2006, 10:16:42 pm
There sure is a way to implement it under MacOS, I just don't happen to know one.
Probably, it even supports hardware transparency and doesn't need that screengrab-blit-hack we're using because of Windows 98.
Title: Re: Transparent splash screen
Post by: afb on November 03, 2006, 10:18:26 pm
Fixing it would be best, of course. Just that this was easier... :-)
I take it that we don't want to use the old one then, good riddance.

Can always have it default to "hidden" on wxMac, until it is fixed.
Title: Re: Transparent splash screen
Post by: Ceniza on November 04, 2006, 01:41:04 am
Hmmm... the screengrab-blit-hack was to get it working on Linux...

afb: could you check the splash screen demo included in wxWidgets' sources and see if it works correctly there?
Title: Re: Transparent splash screen
Post by: afb on November 04, 2006, 01:56:36 am
wxFRAME_SHAPED class window "works", but since it seems wx 2.6.3 uses QuickDraw and the Window Manager it is limited to a single "transparent color" type of alpha, and not the full alpha channel that the splash uses (need CoreGraphics for that).

So the best is probably to turn it off for now, and perhaps try again later with wx 2.7.x ?
Title: Re: Transparent splash screen
Post by: takeshimiya on November 04, 2006, 02:02:55 am
So the best is probably to turn it off for now, and perhaps try again later with wx 2.7.x ?
Yes, I actually turn it off now; for wx 2.7 CoreGraphics is enabled by default, and there's a chance that QuickDraw will be deprecated, so better we wait.
Title: Re: Transparent splash screen
Post by: afb on November 04, 2006, 03:07:04 am
Here were the end results, when using SHAPED=1 (wxFRAME_SHAPED):

ALPHA=0 (i.e. using a white color)
(http://www.algonet.se/~afb/wx/codeblocks-shapedalpha0.png)

ALPHA=1 (it doesn't work on wxMac)
(http://www.algonet.se/~afb/wx/codeblocks-shapedalpha1.png)

I'll upload the patch with SHAPED=0, in case it starts to work later on...

Code
#if 0 // defined(__WXMAC__)
#define CBSPLASH_SHAPED 1
#define CBSPLASH_STYLE wxFRAME_SHAPED
#define CBSPLASH_ALPHA 0
#else
#define CBSPLASH_SHAPED 0
#define CBSPLASH_STYLE 0
#define CBSPLASH_ALPHA 1
#endif
Title: Re: Transparent splash screen
Post by: afb on November 04, 2006, 03:10:44 am
http://www.algonet.se/~afb/wx/codeblocks-shapedsplash.patch
Title: Re: Transparent splash screen
Post by: thomas on November 04, 2006, 04:45:18 am
Here were the end results, when using SHAPED=1 (wxFRAME_SHAPED)
ALPHA=0 (i.e. using a white color)
Hey, that doesn't even look entirely bad! Different, yes... but not really bad. If one added a bit more border on the left and top-left to the image, it would look like it's actually intended to be that way (though I doubt it's worth the effort). What do you think, should I have a try?

Why don't you just commit it that way and leave it until they update wxMAC :)
Title: Re: Transparent splash screen
Post by: afb on November 04, 2006, 11:28:26 am
Here were the end results, when using SHAPED=1 (wxFRAME_SHAPED)
ALPHA=0 (i.e. using a white color)
Hey, that doesn't even look entirely bad! Different, yes... but not really bad. If one added a bit more border on the left and top-left to the image, it would look like it's actually intended to be that way (though I doubt it's worth the effort). What do you think, should I have a try?

If it's not too much work and don't disturb the other platforms, then by all means do...
Title: Re: Transparent splash screen
Post by: afb on November 07, 2006, 03:21:37 pm
Why don't you just commit it that way and leave it until they update wxMAC :)

No change in wx 2.7.2, so this is going in as-is. Maybe tweak the image a little ?
Title: Re: Transparent splash screen
Post by: thomas on November 07, 2006, 06:31:42 pm
Try if that one works out better, it should have a border contour with alpha = 0.01 (i.e. should be invisible under Windows, but white using your method).

[attachment deleted by admin]
Title: Re: Transparent splash screen
Post by: afb on November 07, 2006, 10:57:55 pm
Not sure if it made that much of a difference:
(http://www.algonet.se/~afb/wx/codeblocks-new_splash.png)

If we want good results, I think we need a separate black/white mask ?
(which does require some extra coding work, and another parameter, but)
Title: Re: Transparent splash screen
Post by: thomas on November 08, 2006, 12:43:02 am
Hmm.... surprised that the top left corner looks so meek... is the window's size hardcoded?
There should actually be an equally-sized border around it everywhere.

Hmph... hate it when things look so cheap. Might think of a contour that works nicely with CSG, then we can do Windows98/X11/MacOS with hardware region support and without any hacks.
Title: Re: Transparent splash screen
Post by: Der Meister on November 17, 2006, 06:27:14 pm
Although I like the new design of the splash screen, is it really supposed to look like that?  :D
(http://img372.imageshack.us/img372/1232/splashqe4.png)
Testet on Linux with wxGTK 2.6.2, gcc 4.1.1 and revision, well, you probably can see that. :P
Title: Re: Transparent splash screen
Post by: PsYhLo on November 17, 2006, 06:45:26 pm
yes just like my
I was thinking this is because gtk-qt engine
It looks like some kind of bug to me :D


Sorry for my bad english
Title: Re: Transparent splash screen
Post by: sethjackson on November 17, 2006, 07:09:32 pm
It looks sorta like that in the about dialog on Windows....... :P
Title: Re: Transparent splash screen
Post by: thomas on November 17, 2006, 07:38:59 pm
Although I like the new design of the splash screen, is it really supposed to look like that?  :D
What the hell, I replied to your post 10 minutes ago, where did it go???
Anyway: No, I had hoped it would look better after 3221  :?

The idea behind this screen (you get it) is to have a less fuzzy outline that can be region-skinned with simple CSG (4 rectangles, available on every platform). Unluckily, in reality, region skinning did nothing at all under Windows, so I emulated it with setting the DC's clip region.
As Yiannis later reported, this does not work for Linux, so I added region-skinning on top (both methods used now). Unluckily, I still have acute Linux shortage, so I can't test :(

Quote
Testet on Linux with wxGTK 2.6.2, gcc 4.1.1 and revision, well, you probably can see that. :P
Lol, was about to ask "what version" :)

Could you give it a try please? If nothing helps, one could GetHandle() on the window and use GTK's native function to apply the region. However, it might be that SetBackgroundStyle() in line 121, which used to be the "GTK enabling hack" is the actual cause of this. Or, one might skip OnEraseBackground() entirely, maybe that grey is really some background drawing (which, for some reason draws outside the region?).


It looks sorta like that in the about dialog on Windows....... :P
Yes, but that's unrelated.
Title: Re: Transparent splash screen
Post by: Der Meister on November 17, 2006, 08:01:48 pm
Could you give it a try please? If nothing helps, one could GetHandle() on the window and use GTK's native function to apply the region. However, it might be that SetBackgroundStyle() in line 121, which used to be the "GTK enabling hack" is the actual cause of this. Or, one might skip OnEraseBackground() entirely, maybe that grey is really some background drawing (which, for some reason draws outside the region?).
I will have a look at it. Let's hope I find something usefull ;)
Title: Re: Transparent splash screen
Post by: Der Meister on November 17, 2006, 09:27:47 pm
(http://img111.imageshack.us/img111/8361/splashqf2.png)
Got it!  :D

Here is the patch that works for me:
Code
Index: src/src/splashscreen.cpp
===================================================================
--- src/src/splashscreen.cpp    (revision 3230)
+++ src/src/splashscreen.cpp    (working copy)
@@ -22,7 +22,7 @@
   static const wxString release(wxT(RELEASE));
   static const wxString revision(wxT(SVN_REVISION));
 
-  dc.SetClippingRegion(r);
+  dc.DestroyClippingRegion();
   dc.DrawBitmap(m_label, 0, 0, false);
 
   wxFont largeFont(16, wxSWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);

Anyway, I noticed that removing the code in OnEraseBackground does not change anything for me. It seems not necessary, at least on my system.

Another strange thing is that SetRegion always returns FALSE here, even with a simple rectangular region. Seems as wxGTK does not implement this function. (As the documentation says, it only works if the platform supports it.)
Title: Re: Transparent splash screen
Post by: MortenMacFly on November 18, 2006, 10:58:21 am
Got it!  :D
Thomas: Is this also something we had forgotten to test for the about dialog??? Should I start over again and loose another 3 hours? ;-)
With regards, Morten.
Title: Re: Transparent splash screen
Post by: thomas on November 18, 2006, 12:01:14 pm
Got it!  :D

Here is the patch that works for me:
Great, thank you :)
Hmm... instead of destroying the clip region right after creating one, shouldn't it work to never create one, too? I'll try that approach (so, only use clip for Windows). Please complain if it doesn't work nicely.  :)

Quote
Another strange thing is that SetRegion always returns FALSE here, even with a simple rectangular region. Seems as wxGTK does not implement this function. (As the documentation says, it only works if the platform supports it.)
Isn't that what Window::shape_combine_region does?
It says: "Makes pixels in window outside shape_region be transparent, so that the window may be nonrectangular.". Strange... but whatever... if we got it to work, it's fine either way:)

Thomas: Is this also something we had forgotten to test for the about dialog??? Should I start over again and loose another 3 hours? ;-)
With regards, Morten.
No, that's a different issue, I think. Why don't you just commit the version you had which worked (without all the double-buffering and stuff). We can always add the overlay stacking another control onto it later (less work).

Title: Re: Transparent splash screen
Post by: MortenMacFly on November 18, 2006, 12:24:10 pm
Why don't you just commit the version you had which worked (without all the double-buffering and stuff).
Well... erm... because did that already some days ago?! ;-) Anyway: The version that "worked" was nothing else than changing the XRC and pointing to the other image in the code. Everything else I tried didn't work. As soon as I used wxMemoryDC and consorts I ran into trouble.
With regards, Morten.
Title: Re: Transparent splash screen
Post by: Der Meister on November 18, 2006, 02:47:09 pm
Hmm... instead of destroying the clip region right after creating one, shouldn't it work to never create one, too? I'll try that approach (so, only use clip for Windows). Please complain if it doesn't work nicely.  :)
Just tested with revision 3234 and it seems to work as it should. :)
Title: Re: Transparent splash screen
Post by: afb on November 22, 2006, 09:48:10 pm
This splash window doesn't work OK in wxMac, and seems to be crashing under wx 2.8.0 so I'm going back to the wxFRAME_SHAPED on wxMac. It's pretty much the same, just set's a different window style and avoids the "copy from screen" hack (that crashes). http://www.algonet.se/~afb/wx/codeblocks-shapedsplash-new.patch

After patching:
(http://www.algonet.se/~afb/wx/codeblocks-shapedsplash-new.png)
Title: Re: Transparent splash screen
Post by: afb on November 27, 2006, 09:47:32 pm
I've patched for wxMac now, so only little issues remain:

Too bad that wxWidgets doesn't do alpha windows on wxMac yet, but maybe in wx 2.8.1 or so ?
Title: Re: Transparent splash screen
Post by: thomas on November 27, 2006, 11:01:43 pm
t's drawn with a black background, so it looks a little "grey". Maybe clear to white first ?
Yes, please do :)

Quote
It's centered against the parent window in the Finder, and not against the entire screen...
Does it matter so much? I figure center on screen is similarly nasty to do as on other platforms... but if you can fix it, sure :)
Title: Re: Transparent splash screen
Post by: afb on November 27, 2006, 11:16:05 pm
Does it matter so much?

In a word: no :-)