LEADTOOLS (Leadtools assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.29
RasterHsvColor Structure
See Also  Members   Example
Leadtools Namespace : RasterHsvColor Structure



Describes a color consisting of relative intensities of hue, saturation, value. Supported in Silverlight, Windows Phone 7

Object Model

RasterHsvColor StructureRasterHsvColor Structure

Syntax

Visual Basic (Declaration) 
<SerializableAttribute()>
Public Structure RasterHsvColor 
   Inherits System.ValueType
Visual Basic (Usage)Copy Code
Dim instance As RasterHsvColor
C# 
[SerializableAttribute()]
public struct RasterHsvColor : System.ValueType 
C++/CLI 
[SerializableAttribute()]
public value class RasterHsvColor : public System.ValueType 

Example

This example converts between HSV and RGB colors and back.

Visual BasicCopy Code
Public Sub Example()
   Dim rgb1 As RasterColor = New RasterColor(50, 100, 200)
   Console.WriteLine("rgb1 = {0}, {1}, {2}", rgb1.R, rgb1.G, rgb1.B)

   Dim hsv1 As RasterHsvColor = RasterHsvColor.FromRasterColor(rgb1)
   Console.WriteLine("hsv1 = {0}, {1}, {2}", hsv1.H, hsv1.S, hsv1.V)

   Dim hsv2 As RasterHsvColor = New RasterHsvColor(hsv1.H, hsv1.S, hsv1.V)
   Console.WriteLine("hsv2 = {0}, {1}, {2}", hsv2.H, hsv2.S, hsv2.V)

   Dim rgb2 As RasterColor = hsv2.ToRasterColor()
   Console.WriteLine("rgb2 = {0}, {1}, {2}", rgb2.R, rgb2.G, rgb2.B)
End Sub
C#Copy Code
public void Example()
{
   RasterColor rgb1 = new RasterColor(50, 100, 200);
   Console.WriteLine("rgb1 = {0}, {1}, {2}", rgb1.R, rgb1.G, rgb1.B);

   RasterHsvColor hsv1 = RasterHsvColor.FromRasterColor(rgb1);
   Console.WriteLine("hsv1 = {0}, {1}, {2}", hsv1.H, hsv1.S, hsv1.V);

   RasterHsvColor hsv2 = new RasterHsvColor(hsv1.H, hsv1.S, hsv1.V);
   Console.WriteLine("hsv2 = {0}, {1}, {2}", hsv2.H, hsv2.S, hsv2.V);

   RasterColor rgb2 = hsv2.ToRasterColor();
   Console.WriteLine("rgb2 = {0}, {1}, {2}", rgb2.R, rgb2.G, rgb2.B);
}
SilverlightCSharpCopy Code
[TestMethod]
public void Example()
{
   RasterColor rgb1 = new RasterColor(50, 100, 200);
   Console.WriteLine("rgb1 = {0}, {1}, {2}", rgb1.R, rgb1.G, rgb1.B);
   RasterHsvColor hsv1 = RasterHsvColor.FromRasterColor(rgb1);
   Console.WriteLine("hsv1 = {0}, {1}, {2}", hsv1.H, hsv1.S, hsv1.V);

   RasterHsvColor hsv2 = new RasterHsvColor(hsv1.H, hsv1.S, hsv1.V);
   Console.WriteLine("hsv2 = {0}, {1}, {2}", hsv2.H, hsv2.S, hsv2.V);

   RasterColor rgb2 = hsv2.ToRasterColor();
   Console.WriteLine("rgb2 = {0}, {1}, {2}", rgb2.R, rgb2.G, rgb2.B);
}
SilverlightVBCopy Code
<TestMethod> _
Public Sub Example()
   Dim rgb1 As RasterColor = New RasterColor(50, 100, 200)
   Console.WriteLine("rgb1 = {0}, {1}, {2}", rgb1.R, rgb1.G, rgb1.B)
   Dim hsv1 As RasterHsvColor = RasterHsvColor.FromRasterColor(rgb1)
   Console.WriteLine("hsv1 = {0}, {1}, {2}", hsv1.H, hsv1.S, hsv1.V)

   Dim hsv2 As RasterHsvColor = New RasterHsvColor(hsv1.H, hsv1.S, hsv1.V)
   Console.WriteLine("hsv2 = {0}, {1}, {2}", hsv2.H, hsv2.S, hsv2.V)

   Dim rgb2 As RasterColor = hsv2.ToRasterColor()
   Console.WriteLine("rgb2 = {0}, {1}, {2}", rgb2.R, rgb2.G, rgb2.B)
End Sub

Remarks

For more information on how to use this structure, refer to the RasterImage.AddColorHsvRangeToRegion method.

This structure does not support signed images.

Inheritance Hierarchy

System.Object
   System.ValueType
      Leadtools.RasterHsvColor

Requirements

Target Platforms: Silverlight, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7, MAC OS/X (Intel Only), Windows Phone 7

See Also