473,230 Members | 1,366 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,230 software developers and data experts.

Programmatic rainbows

This probably isn't the best newsgroup for this question, but it's
something I've always been curious about. A while back, I wanted to
programmatically create a rainbow-like status bar. One end would be
red and the far end would be blue. Depending on the status percentage,
only a certain amount of color would be draw (from left-edge red all
the way up to right-edge blue). I wanted to create it programmatically
so that the dimensions of the image could change. However, I could
never figure out the correct RGB/x-coord formula to generate a
nice-looking rainbow. So, assuming a width of 100 pixels at x=0 I'd
use RGB(255,0,0) and for x=99 RGB(0,0,255). Any clue how to solve this?

Jul 11 '06 #1
2 2267
go*************@yahoo.com wrote:
This probably isn't the best newsgroup for this question, but it's
something I've always been curious about. A while back, I wanted to
programmatically create a rainbow-like status bar. One end would be
red and the far end would be blue. Depending on the status
percentage, only a certain amount of color would be draw (from
left-edge red all the way up to right-edge blue). I wanted to create
it programmatically so that the dimensions of the image could change.
However, I could never figure out the correct RGB/x-coord formula to
generate a nice-looking rainbow. So, assuming a width of 100 pixels
at x=0 I'd use RGB(255,0,0) and for x=99 RGB(0,0,255). Any clue how
to solve this?
Post to 'comp.graphics.algorithms', please. Your question has nothing
to do with C++ language.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jul 11 '06 #2
godfatherofsoul wrote:
This probably isn't the best newsgroup for this question
Nope. Could you have googled-up a better one?
but it's
something I've always been curious about. A while back, I wanted to
programmatically create a rainbow-like status bar. One end would be red
and the far end would be blue. Depending on the status percentage, only a
certain amount of color would be draw (from left-edge red all the way up
to right-edge blue). I wanted to create it programmatically so that the
dimensions of the image could change. However, I could never figure out
the correct RGB/x-coord formula to generate a nice-looking rainbow. So,
assuming a width of 100 pixels at x=0 I'd use RGB(255,0,0) and for x=99
RGB(0,0,255). Any clue how to solve this?
You are asking how to declare a color ramp in HVS, which is Hue Value
Saturation. Look up a system to change your Hue while clamping the VS, and
a system to convert HVS to RGB.

--
Phlip

Jul 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Dave Boyd | last post by:
Are there arguments for the built-in commands called via RunCommand such as acCmdNewObjectReport or do they always require interactive input? Is the code behind the built-in commands exposed...
3
by: MikeM | last post by:
I've been trying to locate some property or method that will allow programmatic access to the "loginUrl" attribute in the web.config file in the <system.web> -> <authentication> element when the...
0
by: Daniel | last post by:
programmatic to ftp virtual directories when i connect to an ftp server and i only have access to a few of the ftp virtual directories, do i just change directory to them after connecting and...
6
by: Blaine Manyluk | last post by:
I have a very unusual request. I need to be able to generate reports and save them as TIF files, with full programmatic control. The application will provide the filenames. Each page of the...
2
by: williamphenryjr | last post by:
This is a long post. If you have answers I'm ready. If you have web links, that'd be great too. I'm a Junior/Senior in Computer Science at Washington State University, so you can make some...
2
by: myzm | last post by:
I want to provide a menu for user to log out system after they logged in using the Login control. Nowhere I can find information about programmatic logout. Any help? Thanks.
2
by: matt.delvecchio | last post by:
hello, i have a user control that works great, when its used as a design-time controls. however, when i try to use it as a programmtic control, im running into troubles. the control is pretty...
0
by: tvaughan77 | last post by:
True or false: In Windows 2000, the user account that runs IIS (typically ASPNET) *must* be allowed to "Act as part of the operating system" in order for impersonation to work? Is that also...
9
by: Axxe | last post by:
I have searched high and low for cogent, well-explained coding to complete a project on which I have spent six months of work. I stumbled across something on this site that is close to what I...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.