LEADTOOLS (Leadtools assembly)
LEAD Technologies, Inc

RasterHsvColor Structure

Example 





Members 
Describes a color consisting of relative intensities of hue, saturation, value. .NET support Silverlight support
Object Model
RasterHsvColor StructureRasterHsvColor Structure
Syntax
[SerializableAttribute()]
public struct RasterHsvColor : System.ValueType 
'Declaration
 
<SerializableAttribute()>
Public Structure RasterHsvColor 
   Inherits System.ValueType
'Usage
 
Dim instance As RasterHsvColor
[SerializableAttribute()]
public class RasterHsvColor
JAVASCRIPT_NOSTRUCTS
[SerializableAttribute()]
public value class RasterHsvColor : public System.ValueType 
Remarks

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

This structure does not support signed images.

Example
 
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
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);
}
function RasterHsvColorExamples() {
   with ( Leadtools )
   {
      var rgb1 = RasterColorHelper.create(50, 100, 200);
      console.log("rgb1 = ", rgb1.r, ", ", rgb1.g, ", ", rgb1.b);

      var hsv1 = RasterHsvColorHelper.fromRasterColor(rgb1);
      console.log("hsv1 = ", hsv1.h, ", ", hsv1.s, ", ", hsv1.v);

      var hsv2 = RasterHsvColorHelper.create(hsv1.h, hsv1.s, hsv1.v);
      console.log("hsv2 = ", hsv2.h, ", ", hsv2.s, ", ", hsv2.v);

      var rgb2 = RasterHsvColorHelper.toRasterColor(hsv2);
      console.log("rgb2 = ", rgb2.r, ", ", rgb2.g, ", ", rgb2.b);

      
   }
}
[TestMethod]
public void RasterHsvColorExample()
{
   RasterColor rgb1 = RasterColorHelper.Create(50, 100, 200);
   Debug.WriteLine("rgb1 = {0}, {1}, {2}", rgb1.R, rgb1.G, rgb1.B);
   RasterHsvColor hsv1 = RasterHsvColorHelper.FromRasterColor(rgb1);
   Debug.WriteLine("hsv1 = {0}, {1}, {2}", hsv1.H, hsv1.S, hsv1.V);

   RasterHsvColor hsv2 = RasterHsvColorHelper.Create(hsv1.H, hsv1.S, hsv1.V);
   Debug.WriteLine("hsv2 = {0}, {1}, {2}", hsv2.H, hsv2.S, hsv2.V);

   RasterColor rgb2 = RasterHsvColorHelper.ToRasterColor(hsv2);
   Debug.WriteLine("rgb2 = {0}, {1}, {2}", rgb2.R, rgb2.G, rgb2.B);
}
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);
}
<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
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

RasterHsvColor Members
Leadtools Namespace

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.