473,800 Members | 2,615 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.GetSatur ation() + 0.1F;
float fNewBrightness = oColor.GetBrigh tnes() + 0.1F;

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

Color oNewColor = Color.FromHSV(f NewHue, 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 19683
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&r num=6&prev=/groups%3Fhl%3De n%26lr%3D%26ie% 3DUTF-8%26q%3D.net%
2Bcolor%2Bconve rt%2Brgb%2Bto%2 Bhsb

#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.m icrosoft.com> wrote in message
news:iU******** ******@cpmsftng xa06.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&r num=6&prev=/groups%3Fhl%3De n%26lr%3D%26ie% 3DUTF-8%26q%3D.net% 2Bcolor%2Bconve rt%2Brgb%2Bto%2 Bhsb

#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
3066
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 sure what it is doing. The code is below: public void adjustLight(int ipParam){ // ipParam = 18 pb = new ParameterBlock();
19
3252
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 background color The second will have text color. I want to validate if background color is dark then only light colors should
2
6994
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 H/W. Is anyway can adjust the screen brightness without driver?
3
7323
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?? thanks -- AdamPC@hotmail.com
1
2008
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 Application) My File Name: Dim.vb (Standard class module) Namespace ' Class to manipulate brightness in VB
7
10851
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 tried to use the colormatrix and even down to the pixel using GetPixel and SetPixel in system.drawing, but I'm really not up on using gdi+ and haven't really gotten anywhere. I've seen some examples for VB6, but I need vb.net. I know that all...
10
5563
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, if I take a pixel at point (50,75), and find that the colours are FF00FF and FF0000 respectively, is there a way to determine that the residual colour is 0000FF ? Thanks in advance!
0
1376
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' brightness. How do I get such info? I guess that requires some special PixelFormat argument. Thanks in in advance for all hints.
2
1704
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): http://stats.math.uni-augsburg.de/Manet/plots.html#plots Does someone have an idea on how to do that in c#? Thanks
0
9690
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10504
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10274
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10033
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.