Describes a color consisting of relative intensities of alpha, red, green, and blue.
Syntax
Visual Basic (Usage) |
Copy Code |
Dim instance As RasterColor
|
Example
Converts a .NET color to a RasterColor and back.
Visual Basic |
Copy Code |
Public Sub Example() Dim rand As Random = New Random()
Dim clr1 As Color = Color.FromArgb(rand.Next(256), rand.Next(256), rand.Next(256), rand.Next(256))
Dim clr2 As RasterColor = RasterColor.FromGdiPlusColor(clr1)
Debug.Assert(clr1.A = clr2.A) Debug.Assert(clr1.R = clr2.R) Debug.Assert(clr1.G = clr2.G) Debug.Assert(clr1.B = clr2.B)
clr1 = clr2.ToGdiPlusColor()
Debug.Assert(clr1.A = clr2.A) Debug.Assert(clr1.R = clr2.R) Debug.Assert(clr1.G = clr2.G) Debug.Assert(clr1.B = clr2.B) End Sub |
C# |
Copy Code |
public void Example() { Random rand = new Random(); // Create a random .NET color Color clr1 = Color.FromArgb(rand.Next(256), rand.Next(256), rand.Next(256), rand.Next(256)); // Convert this color to a LEADTOOLS color RasterColor clr2 = RasterColor.FromGdiPlusColor(clr1); // Make sure both colors are equal Debug.Assert(clr1.A == clr2.A); Debug.Assert(clr1.R == clr2.R); Debug.Assert(clr1.G == clr2.G); Debug.Assert(clr1.B == clr2.B); // Convert the LEADTOOLS color back to .NET clr1 = clr2.ToGdiPlusColor(); // Make sure both colors are equal Debug.Assert(clr1.A == clr2.A); Debug.Assert(clr1.R == clr2.R); Debug.Assert(clr1.G == clr2.G); Debug.Assert(clr1.B == clr2.B); } |
Remarks
Inheritance Hierarchy
Requirements
Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family
See Also