←Select platform

FromRgb Method

Summary
Creates a RasterColor from an rgb value.
Syntax
C#
C++/CLI
Java
Python
public static RasterColor FromRgb( 
   int rgb 
) 
public static RasterColor fromRgb( 
   int rgb 
); 
public: 
static RasterColor FromRgb(  
   int rgb 
)  
def FromRgb(self,rgb): 

Parameters

rgb
The rgb value.

Return Value

The RasterColor structure that this method creates.

Example

This example will create an array of RasterColor containing 256 shades of gray.

C#
using Leadtools; 
 
 
public void FromRgbExample() 
{ 
	RasterColor[] colors = new RasterColor[RasterColor.MaximumComponent - RasterColor.MinimumComponent + 1]; 
	for (int i = RasterColor.MinimumComponent; i < RasterColor.MaximumComponent; i++) 
	{ 
		colors[i] = RasterColor.FromRgb(i); 
	} 
 
	for (int i = RasterColor.MinimumComponent; i < RasterColor.MaximumComponent; i++) 
	{ 
		Assert.IsTrue(colors[i].ToRgb() == i); 
	} 
} 
Requirements

Target Platforms

Help Version 22.0.2023.5.16
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.