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 » Draw, Display, Images, Bitmaps, Icons » Any function to draw gradient color?
Re: Any function to draw gradient color? [message #12043 is a reply to message #12039] Tue, 09 October 2007 15:23 Go to previous messageGo to previous message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
I obviously don't know as much about this as Mirek, but in the interests of a quick answer I'll tell you what I know and he can correct me later Smile

As I understand the only way of drawing to the alpha channel is using DrawImage. You can create an image in the usual ways or, if you want to draw primitives with an alpha channel Mirek suggests something like:
	virtual void Paint(Draw& draw)
	{
		draw.DrawRect(GetSize(), SColorFace());

		ImageDraw img(200, 100);	
		img.Alpha().DrawRect(0, 0, 200, 100, Color(128, 0, 0));
		img.Alpha().DrawText(0, 0, "This is the alpha channel", StdFont(), Color(0, 0, 0));
		img.DrawRect(0, 0, 200, 100, Red());

		draw.DrawImage(1, 1, img);
	}

Note that:
- The alpha channel is initially all 0 (hence the first DrawRect above)
- When drawing to Alpha(), only the red channel is used for the alpha value.

If you only want alpha gradients you may want to look at CreateHorzFadeOut/HorzFadeOut (I believe the second caches the created image).

James
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Image zoom widget?
Next Topic: Bug in Picture Class
Goto Forum:
  


Current Time: Mon Apr 29 14:36:48 CEST 2024

Total time taken to generate the page: 0.02135 seconds