RawColor Class

Summary: Raw Color Class helps to store colors with any channels count, any color mode and any bit depth
Please note, some internal classes can have issues with converting RawColor to its’ native format,
so if API provides for you CMYK color, it’s more reliable to use the provided format.
Also, there are can be some cases when Raw Color can be converted

Module: aspose.psd.fileformats.psd.core.rawcolor

Full Name: aspose.psd.fileformats.psd.core.rawcolor.RawColor

Aspose.PSD Version: 24.4.0

Constructors

NameDescription
RawColor(components)Initializes a new instance of the RawColor class.
RawColor(pixel_data_format, color_mode)Initializes a new instance of the RawColor class from pixel data format using predefined color modes

Properties

NameTypeAccessDescription
color_modeshortr/wMode for the color to follow.
componentsColorComponent[]rGets the components of color. Each component is separate channel, and if you use not popular
color scheme, it’s better to work with each channel separately.

Methods

NameDescription
get_as_int()Gets the color as int in case it’s possible to get it.
get_as_long()Gets the color as long in case it’s possible to get it.
get_bit_depth()Gets the bit depth of Raw Color.
For example for ARGB color with 8 bits per channel/component is 32
Bit Depth of full ARGB color with 16 bits per channel/component is 64.
Bit depth is accumulated from the sum of channels’ bit depths.
It’s possible if different channels will have different bit depths.
get_color_mode_name()Gets the name of the color mode. Color mode name accumulated from channels/components names
set_as_int(value)Sets data to all channels from int argument if it’s possible
set_as_long(value)Sets data to all channels from int argument if it’s possible

Constructor: RawColor(components)

 RawColor(components) 

Initializes a new instance of the RawColor class.

Parameters:

ParameterTypeDescription
componentsColorComponent[]The custom color components.

Constructor: RawColor(pixel_data_format, color_mode)

 RawColor(pixel_data_format, color_mode) 

Initializes a new instance of the RawColor class from pixel data format using predefined color modes

Parameters:

ParameterTypeDescription
pixel_data_formatPixelDataFormatThe pixel data format.
color_modeshortMode for the color to follow.

Method: get_as_int()

 get_as_int() 

Gets the color as int in case it’s possible to get it.

Returns

TypeDescription
intChannels data stored in Int

Method: get_as_long()

 get_as_long() 

Gets the color as long in case it’s possible to get it.

Returns

TypeDescription
longChannels data stored in Int

Method: get_bit_depth()

 get_bit_depth() 

Gets the bit depth of Raw Color.
For example for ARGB color with 8 bits per channel/component is 32
Bit Depth of full ARGB color with 16 bits per channel/component is 64.
Bit depth is accumulated from the sum of channels’ bit depths.
It’s possible if different channels will have different bit depths.

Returns

TypeDescription
intThe sum of all channels bit depths

Method: get_color_mode_name()

 get_color_mode_name() 

Gets the name of the color mode. Color mode name accumulated from channels/components names

Returns

TypeDescription
stringString with the color mode name

Method: set_as_int(value)

 set_as_int(value) 

Sets data to all channels from int argument if it’s possible

Parameters:

ParameterTypeDescription
valueintThe int value that contains component data

Method: set_as_long(value)

 set_as_long(value) 

Sets data to all channels from int argument if it’s possible

Parameters:

ParameterTypeDescription
valuelongThe int value that contains component data