473,382 Members | 1,809 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,382 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 19619
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.