Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » How to set transparency level for static rectangle?
How to set transparency level for static rectangle? [message #909] Wed, 08 February 2006 02:22 Go to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
How to set transparency level for static rectangle or other controls?

I have this code(one rect semi-covers the other):

#include <CtrlLib/CtrlLib.h>


GUI_APP_MAIN
{
	TopWindow w;
	Array<StaticRect> fr;

	fr.Add();
	fr[0].SetRect(50,50,100,100);
	fr[0].Color(SRed);
	fr.Add();
	fr[1].SetRect(100,100,100,100);
	fr[1].Color(SBlue);
		
	
	w.Add(fr[0]);
	w.Add(fr[1]);
	
	
	w.Run();
}
Re: How to set transparency level for static rectangle? [message #912 is a reply to message #909] Wed, 08 February 2006 08:06 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13976
Registered: November 2005
Ultimate Member
SetColor(Null);
Transparent();

Not that "Transparent" is in fact just painting hint - in theory, all would work with this flag ON for all Ctrls. However, to avoid flickering, only Ctrls that really are transparent should have this activated.

Also, if what you need is StaticRect that is always transparent, rather use ParentCtrl.

Mirek
Re: How to set transparency level for static rectangle? [message #913 is a reply to message #912] Wed, 08 February 2006 09:01 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
luzr wrote on Wed, 08 February 2006 02:06

SetColor(Null);
Transparent();

Not that "Transparent" is in fact just painting hint - in theory, all would work with this flag ON for all Ctrls. However, to avoid flickering, only Ctrls that really are transparent should have this activated.

Also, if what you need is StaticRect that is always transparent, rather use ParentCtrl.

Mirek


Where is THE LEVEL? I can't see any numbers.
I want:
SetColor(SRed, alpha=50%);
Re: How to set transparency level for static rectangle? [message #914 is a reply to message #913] Wed, 08 February 2006 09:04 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13976
Registered: November 2005
Ultimate Member
I see... Well, alpha-blended drawing is not supported.

You can SetAlpha for top-level Ctrl - it it will work on WinXP, but that is all for the moment.

(The problem is that alpha-blending is not supported by base platforms).

Mirek
Re: How to set transparency level for static rectangle? [message #915 is a reply to message #909] Wed, 08 February 2006 09:12 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
do you suggest to use primitive DC and bitblt? Smile
Re: How to set transparency level for static rectangle? [message #916 is a reply to message #915] Wed, 08 February 2006 09:42 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13976
Registered: November 2005
Ultimate Member
Actually, what I suggest is that DC/BitBlt (and its X11 equivalents) do not support alpha-blending (AFAIK).

However, it is possible that I misundestood what you really need...

What kind of operation do you want to do with BitBlt?

Mirek
Re: How to set transparency level for static rectangle? [message #997 is a reply to message #916] Mon, 13 February 2006 12:05 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
luzr wrote on Wed, 08 February 2006 03:42

Actually, what I suggest is that DC/BitBlt (and its X11 equivalents) do not support alpha-blending (AFAIK).

However, it is possible that I misundestood what you really need...

What kind of operation do you want to do with BitBlt?

Mirek


I'd like this kind
index.php?t=getfile&id=65&private=0

also you can check more at:
http://www.blitzbasic.com/bpdocs/command_list_gui_cat.php?sh ow=HTML%20Views
Re: How to set transparency level for static rectangle? [message #998 is a reply to message #997] Mon, 13 February 2006 12:29 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13976
Registered: November 2005
Ultimate Member
Well, you can have this: it is window-level alpha blending, supported by Ctrl::SetAlpha.

The only problem you have to be aware of is that unlike all other things, you can use SetAlpha just for windows that are open at the moment (this is not U++ way, perhaps I should fix that..)

Try (untested):

GUI_APP_MAIN
{
TopWindow win;
win.Open();
win.SetAlpha(100);
win.Run();
}

Another thing to know is that it does not work before Win2000 or in Linux (is NOP).

BTW, what you cannot have is alpha blending of shapes in your view area (this requires GDI+ on Win32, which is not implicit on all platforms we want to support...)

Mirek
Re: How to set transparency level for static rectangle? [message #1083 is a reply to message #998] Sun, 19 February 2006 23:59 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
Yes, it is working. My mistake was that I had missed win.Open().
Then, experimenting with U++ Ctrl DC's, I realised that in U++ you get hwnd after you open the window.
But now I can't believe that the semi-transparent window is soooo slow comparing to what I get with "pure" win32 API's on my 1.5 Ghz. Could you give some hints about the reason?
Re: How to set transparency level for static rectangle? [message #1084 is a reply to message #916] Mon, 20 February 2006 00:04 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
luzr wrote on Wed, 08 February 2006 03:42

Actually, what I suggest is that DC/BitBlt (and its X11 equivalents) do not support alpha-blending (AFAIK).

However, it is possible that I misundestood what you really need...

What kind of operation do you want to do with BitBlt?

Mirek


Actually, I want to use not only bitblt but I need hDC's for win32 api's, like SetDIBitsToDevice, StretchDIBits, AlphaBlend etc.
Re: How to set transparency level for static rectangle? [message #1086 is a reply to message #1083] Mon, 20 February 2006 01:17 Go to previous message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
fudadmin wrote on Sun, 19 February 2006 17:59


But now I can't believe that the semi-transparent window is soooo slow comparing to what I get with "pure" win32 API's on my 1.5 Ghz. Could you give some hints about the reason?

There was something strange... It's ok now after I recompiled.

Previous Topic: Qtf and drawing
Next Topic: RemoveFullRefresh(), how?
Goto Forum:
  


Current Time: Sat May 11 23:10:03 CEST 2024

Total time taken to generate the page: 0.02121 seconds