RGBfromHSV method (Main Control)

C++ Builder example

Delphi example

 

Builder Syntax

unsigned __fastcall RGBfromHSV (short nH, short nS, short nV);

Delphi Syntax

Function RGBfromHSV (nH: short; nS: short; nV: short): TColorRef;

Overview

Refer to Changing Brightness and Contrast.

Remarks

Returns a COLORREF that is equivalent to the color represented by the HSV values. Each HSV value ranges from 0..255. Traditionally, hue ranges from 0 to 359. For HSV_HfromRGB, the range of 0 to 359 is remapped to a range of 0..255. For example,

 

Color

Hue (0..359)

Hue (0..255)

Red

0

0

Green

120

85

Blue

240

170

Saturation entries range from 0 to 255 where

0:

Contains the "most" white

255

Contains no white

Value entries range from 0 to 255 where

0:

Contains the "most" black

255

Contains the least black

The standard Windows values for COLORREF represent either red, green, and blue color values, or an index into the bitmap's palette. A COLORREF value with the format $00BBGGRR represents the blue, green, and red color values for the specified pixel, where $BB is the blue value, $GG is the green value and $RR is the red value. If $01000000 is set in the COLORREF value ($010000ZZ), the lower 8 bits ($ZZ) represent an index into the bitmap's palette, which holds the color value. You can specify a COLORREF value (the return value of the RGB function), or you can specify a palette index as explained in Using Palette Indexes As Color Values. Please note that just because an image has a palette that does not mean the value returned by this property is a palette index.

See Also

Elements:

HSV_HfromRGB method, HSV_SfromRGB method, HSV_VfromRGB method

Topics:

Raster Images: Doing Color Space Conversions

 

Creating and Using a Bitmap Region

 

Using Color Values in LEADTOOLS