Describes a color consisting of relative intensities of hue, saturation, value.
[SerializableAttribute()]
public struct RasterHsvColor
<SerializableAttribute()>
Public Structure RasterHsvColor
Inherits System.ValueType
@interface LTRasterHsvColor : NSObject<NSCopying>
public final class RasterHsvColor
[SerializableAttribute()]
public value class RasterHsvColor : public System.ValueType
For more information on how to use this structure, refer to the AddColorHsvRangeToRegion method.
This structure does not support signed images.
This example converts between HSV and RGB colors and back.
using Leadtools;
public void Example()
{
const int R = 50;
const int G = 100;
const int B = 200;
// Expected HSV values based on RGB(50,100,200)
const int H = 149;
const int S = 191;
const int V = 200;
RasterColor rgb1 = new RasterColor(R, G, B);
Assert.IsTrue(rgb1.R == R && rgb1.G == G && rgb1.B == B);
Console.WriteLine("rgb1 = {0}, {1}, {2}", rgb1.R, rgb1.G, rgb1.B);
RasterHsvColor hsv1 = RasterHsvColor.FromRasterColor(rgb1);
Assert.IsTrue(hsv1.H == H && hsv1.S == S && hsv1.V == V);
Console.WriteLine("hsv1 = {0}, {1}, {2}", hsv1.H, hsv1.S, hsv1.V);
RasterHsvColor hsv2 = new RasterHsvColor(hsv1.H, hsv1.S, hsv1.V);
Assert.IsTrue(hsv2.H == H && hsv2.S == S && hsv2.V == V);
Console.WriteLine("hsv2 = {0}, {1}, {2}", hsv2.H, hsv2.S, hsv2.V);
RasterColor rgb2 = hsv2.ToRasterColor();
Assert.IsTrue(rgb2.R == R && rgb2.G == G && rgb2.B == B); //rgb2.G = 102 ??
Console.WriteLine("rgb2 = {0}, {1}, {2}", rgb2.R, rgb2.G, rgb2.B);
}
Imports Leadtools
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#[Silverlight C# Example]
using Leadtools;
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);
}
vb[Silverlight VB Example]
Imports Leadtools
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
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document