473,385 Members | 1,769 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,385 software developers and data experts.

changing color brightness

Hello,

I am trying to change brightness of a color at run-time. I can get all the
components: Hue, Saturation, Brightness from Color object, and I can
obviously change these values but how can I create a new color based on
these new values?

Color oColor = Color.FromArgb(129, 129, 129);

float fNewHue = oColor.GetHue() + 10;
float fNewSaturation = oColor.GetSaturation() + 0.1F;
float fNewBrightness = oColor.GetBrightnes() + 0.1F;

// how can I build a new color based on these values?

Color oNewColor = Color.FromHSV(fNewHue, fNewSaturation, fNewBrightness); //
DOESN'T EXIST

Does anybody have a source for HSV to RGB (C# preferably), or is there a
work-around in .NET?

Thanks,
VR
Nov 16 '05 #1
2 19620
Hi Vr,

As for the converting HSV/HSB format color to RGB format problem, currently
there hasn't been any buildin interfaces in the .net framework to do this.
But we can do it via our own function according to the convert algorithm.
Here is a kb article discussing on the convertion (which is using C++)

#How To Converting Colors Between RGB and HLS (HBS)
http://support.microsoft.com/?id=29240

Also, there is some other former threads and tech articles related to this
problem:

#Subject: Re: convert HSB color to RGB,
http://groups.google.com/groups?hl=e...6gVDUCHA.1676%
40tkmsftngp12&rnum=6&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26q%3D.net%
2Bcolor%2Bconvert%2Brgb%2Bto%2Bhsb

#Interactive Color Wheel
http://r0k.us/graphics/SIHwheel.html

Hope also helps. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Nov 16 '05 #2
Steven.

Thanks a lot for your post. I found it very helpful.

Vic

"Steven Cheng[MSFT]" <v-******@online.microsoft.com> wrote in message
news:iU**************@cpmsftngxa06.phx.gbl...
Hi Vr,

As for the converting HSV/HSB format color to RGB format problem, currently there hasn't been any buildin interfaces in the .net framework to do this. But we can do it via our own function according to the convert algorithm.
Here is a kb article discussing on the convertion (which is using C++)

#How To Converting Colors Between RGB and HLS (HBS)
http://support.microsoft.com/?id=29240

Also, there is some other former threads and tech articles related to this problem:

#Subject: Re: convert HSB color to RGB,
http://groups.google.com/groups?hl=e...6gVDUCHA.1676% 40tkmsftngp12&rnum=6&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26q%3D.net% 2Bcolor%2Bconvert%2Brgb%2Bto%2Bhsb

#Interactive Color Wheel
http://r0k.us/graphics/SIHwheel.html

Hope also helps. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 16 '05 #3

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

Similar topics

0
by: Amy | last post by:
Hi, I have written a program using JAI for a project I am doing which can be used to adjust the brightness of an image. It all works fine but I now need to write it all up and am not entirely...
19
by: Vinod | last post by:
Hi, I have got a peculiar requirement. I want to distinquish between the color codes. I have got two text fields and i will enter the color codes there. The first text field will have ...
2
by: Steve | last post by:
I have a project, and would like to support screen brightness up/down in C#, anyone can help me about this issue, I know one possibility is write a driver, and AP through driver to control the...
3
by: ACaunter | last post by:
Hi there, I was wondering how i could have a slider bar or something on my ASP.Net page to control the image quality.. like change it's sharpness, brightness, and contrast?? is that possible??...
1
by: psuedonym | last post by:
Can someone please explain to me how the complier can manage to make sense out of the following bit of nonsense ;-) My Solution Name: Dim.sln My Project Name: Dim.vbproj (Standard Console...
7
by: marfi95 | last post by:
I'm trying to implement some code in vb.net to allow the user to adjust the brightness or contrast on an image (through the use of a slider) that is already black & white in the bitmap. I have...
10
by: paul | last post by:
Hi, I have two bitmaps that look the same, except in color. Is there a simple way to "subtract" the color of one bitmap, pixel by pixel so that only the difference in colour remains. For instance,...
0
by: Iwanow | last post by:
Hello! I'm using Bitmap->LockBits method to copy its pixels into an array according to example found on http://msdn2.microsoft.com/en-us/library/5ey6h79d.aspx . Now I need to use pixels'...
2
by: amberti | last post by:
To make excellent and useful scatter plot with huge dataset this is a stunning feature: brightness sum and transparency. look at (half of the page near Scatter plot Heading):...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.