L_HSVtoRGB

#include "l_bitmap.h"

COLORREF EXT_FUNCTION L_HSVtoRGB(hsvColor)

HSVREF hsvColor;

/* HSV input value */

Returns a COLORREF value that is an equivalent representation of the specified HSV value.

Parameter

Description

hsvColor

The HSV input value.

Returns

A COLORREF that contains the RGB equivalent of the specified HSV value.

Comments

The HSV value is the Hue ,Saturation, Value color space. Traditionally, hue ranges from 0 to 359. However, the hue component of the HSVREF is represented by an unsigned byte. Therefore, 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 ranges from 0 to 255 where 0 means the highest amount of white and 255 means no white.

Value ranges from 0 to 255 where 0 means highest amount of black and 255 means no black.

Required DLLs and Libraries

LTDIS

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Windows 95 / 98 / Me, Windows 2000 / XP, Windows CE.

See Also

Functions:

L_RemapBitmapHue, L_SetBitmapRgnColorHSVRange, L_SetBitmapRgnColorRGBRange, L_RGBtoHSV, L_SetBitmapRgnEllipse, L_SetBitmapRgnPolygon, L_SetBitmapRgnRect, L_SetBitmapRgnRoundRect

Topics:

Raster Image Functions: Creating and Using a Region

 

Raster Image Functions: Doing Color Space Conversion

 

Working with an Existing Bitmap Region

 

Changing Brightness and Contrast

 

Raster Image Functions: Changing Brightness and Contrast

 

Using Color Values in LEADTOOLS

Example

//This example takes displays the H,S,V value of a HSVREF
//and the equivalent RGB components
void ExampleHSVtoRGB(HSVREF hsvColor)
{
   L_TCHAR szMsg[100];
   COLORREF cr;

   wsprintf(szMsg, TEXT("Hue[%d] Saturation[%d] Value[%d]\n"), hsvColor.uH, hsvColor.uS, hsvColor.uV);
   MessageBox(NULL, szMsg, TEXT(""), MB_OK);

   cr = L_HSVtoRGB(hsvColor);

   wsprintf(szMsg, TEXT("R[%d] G[%d] B[%d]\n"), GetRValue(cr), GetBValue(cr), GetGValue(cr));
   MessageBox(NULL, szMsg, TEXT(""), MB_OK);
}