CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
OdGiGradientGenerator Class Reference

#include <GiProceduralGenerator.h>

Public Types

enum  InterpolationType { kLinearInterpolation = 0 , kExpInterpolation , kInvExpInterpolation , kCosInterpolation }
 
enum  AddressMode { kClampMode = 0 , kWrapMode }
 

Public Member Functions

 OdGiGradientGenerator ()
 
 OdGiGradientGenerator (const OdGiGradientGenerator &other)
 
 ~OdGiGradientGenerator ()
 
void createColorArray (OdUInt32 nColors)
 
void createColorArrayFilled (ODCOLORREF color, OdUInt32 nColors)
 
void copyGradient (const OdUInt32Array &other)
 
void copyGradient (const ODCOLORREF *colors, OdUInt32 nColors)
 
void createGradient (ODCOLORREF color1, ODCOLORREF color2, OdUInt32 nColors, OdGiGradientGenerator::InterpolationType ipl=OdGiGradientGenerator::kLinearInterpolation)
 
void createGradient (ODCOLORREF color1, ODCOLORREF color2, ODCOLORREF color3, OdUInt32 nColors, OdGiGradientGenerator::InterpolationType ipl=OdGiGradientGenerator::kLinearInterpolation)
 
void createGradient (ODCOLORREF color1, ODCOLORREF color2, ODCOLORREF color3, OdUInt32 nColors, OdGiGradientGenerator::InterpolationType ipl1, OdGiGradientGenerator::InterpolationType ipl2)
 
void createGradient (ODCOLORREF color1, ODCOLORREF color2, ODCOLORREF color3, ODCOLORREF color4, OdUInt32 nColors, OdGiGradientGenerator::InterpolationType ipl=OdGiGradientGenerator::kLinearInterpolation)
 
void createGradient (ODCOLORREF color1, ODCOLORREF color2, ODCOLORREF color3, ODCOLORREF color4, OdUInt32 nColors, OdGiGradientGenerator::InterpolationType ipl1, OdGiGradientGenerator::InterpolationType ipl2, OdGiGradientGenerator::InterpolationType ipl3)
 
void createGradient (ODCOLORREF color1, ODCOLORREF color2, ODCOLORREF color3, ODCOLORREF color4, ODCOLORREF color5, OdUInt32 nColors, OdGiGradientGenerator::InterpolationType ipl=OdGiGradientGenerator::kLinearInterpolation)
 
void createGradient (ODCOLORREF color1, ODCOLORREF color2, ODCOLORREF color3, ODCOLORREF color4, ODCOLORREF color5, OdUInt32 nColors, OdGiGradientGenerator::InterpolationType ipl1, OdGiGradientGenerator::InterpolationType ipl2, OdGiGradientGenerator::InterpolationType ipl3, OdGiGradientGenerator::InterpolationType ipl4)
 
void fillInterval (ODCOLORREF color, double from=0.0, double to=1.0)
 
void fillInterval (ODCOLORREF color, OdUInt32 from, OdUInt32 to)
 
void generateInterval (ODCOLORREF color1, ODCOLORREF color2, double from=0.0, double to=1.0, OdGiGradientGenerator::InterpolationType ipl=OdGiGradientGenerator::kLinearInterpolation)
 
void generateInterval (ODCOLORREF color1, ODCOLORREF color2, OdUInt32 from, OdUInt32 to, OdGiGradientGenerator::InterpolationType ipl=OdGiGradientGenerator::kLinearInterpolation)
 
OdUInt32 colorsCount () const
 
ODCOLORREF colorAt (OdUInt32 nColor) const
 
ODCOLORREF colorAt (double at) const
 
bool isInitialized () const
 
const OdUInt32ArrayasArray () const
 
void setAddressMode (OdGiGradientGenerator::AddressMode mode)
 
OdGiGradientGenerator::AddressMode addressMode () const
 
const OdGiGradientGeneratoroperator= (const OdGiGradientGenerator &other)
 
void appendGradient (const OdGiGradientGenerator &other)
 
void operator+= (const OdGiGradientGenerator &other)
 

Static Public Member Functions

static ODCOLORREF interpolateColor (ODCOLORREF color1, ODCOLORREF color2, double at, OdGiGradientGenerator::InterpolationType ipl=OdGiGradientGenerator::kLinearInterpolation, OdGiGradientGenerator::AddressMode mode=OdGiGradientGenerator::kWrapMode)
 
static OdGiGradientGenerator createSpectrumGradient (OdUInt32 nColors, OdUInt8 alpha=0)
 

Protected Member Functions

OdUInt32 clampToRange (OdUInt32 inVal) const
 
OdUInt32 clampToRange (double inVal) const
 
double toDoubleRange (OdUInt32 inVal) const
 

Static Protected Member Functions

static double linterp (double a, double b, double t)
 
static double einterp (double a, double b, double t)
 
static double cinterp (double a, double b, double t)
 
static double ieinterp (double a, double b, double t)
 

Protected Attributes

OdUInt32Array m_colorGradient
 
AddressMode m_addressMode
 

Friends

OdGiGradientGenerator operator+ (const OdGiGradientGenerator &g1, const OdGiGradientGenerator &g2)
 

Detailed Description

Color gradient generator.

See also
TD_Gi

<group OdGi_Classes>

Definition at line 79 of file GiProceduralGenerator.h.

Member Enumeration Documentation

◆ AddressMode

Color interval addressing mode.

Enumerator
kClampMode 

kClampMode clamp color address coordinates to the [0.0, 1.0] range.

kWrapMode 

kWrapMode Repeat color address on every integer junction.

Definition at line 99 of file GiProceduralGenerator.h.

◆ InterpolationType

Type of color interpolation function (linear, exponential, inverted exponential, cosine).

Enumerator
kLinearInterpolation 

Linear interpolation.

kExpInterpolation 

Exponential interpolation.

kInvExpInterpolation 

Inverted exponential interpolation.

kCosInterpolation 

Cosine interpolation.

Definition at line 85 of file GiProceduralGenerator.h.

Constructor & Destructor Documentation

◆ OdGiGradientGenerator() [1/2]

OdGiGradientGenerator::OdGiGradientGenerator ( )

Default constructor for OdGiGradientGenerator class.

◆ OdGiGradientGenerator() [2/2]

OdGiGradientGenerator::OdGiGradientGenerator ( const OdGiGradientGenerator other)

Copy constructor for OdGiGradientGenerator class.

Parameters
other[in] Other gradient generator to copy.

◆ ~OdGiGradientGenerator()

OdGiGradientGenerator::~OdGiGradientGenerator ( )

Member Function Documentation

◆ addressMode()

OdGiGradientGenerator::AddressMode OdGiGradientGenerator::addressMode ( ) const

Retrieves color addressing mode which is used for this gradient generator.

Returns
color addressing mode as a value from the OdGiGradientGenerator::AddressMode enumeration.

◆ appendGradient()

void OdGiGradientGenerator::appendGradient ( const OdGiGradientGenerator other)

Appends colors of the passed gradient generator to colors of this gradient generator.

Parameters
other[in] Other gradient generator.

◆ asArray()

const OdUInt32Array & OdGiGradientGenerator::asArray ( ) const

Retrieves reference to array of gradient colors.

Returns
reference to an array that stores gradient colors.

◆ cinterp()

static double OdGiGradientGenerator::cinterp ( double  a,
double  b,
double  t 
)
staticprotected

Cosine interpolation function.

◆ clampToRange() [1/2]

OdUInt32 OdGiGradientGenerator::clampToRange ( double  inVal) const
protected

inVal addressing.

◆ clampToRange() [2/2]

OdUInt32 OdGiGradientGenerator::clampToRange ( OdUInt32  inVal) const
protected

inVal addressing.

◆ colorAt() [1/2]

ODCOLORREF OdGiGradientGenerator::colorAt ( double  at) const

Retrieves color from gradient colors array.

Parameters
at[in] Color coordinate (0.0 equals 0 in array; 1.0 equals colorsCount() - 1 in array).
Returns
Color as ODCOLORREF (OdUInt32 value).

◆ colorAt() [2/2]

ODCOLORREF OdGiGradientGenerator::colorAt ( OdUInt32  nColor) const

Retrieves color from gradient colors array.

Parameters
nColor[in] Index of color in array.
Returns
Color as ODCOLORREF (OdUInt32 value).

◆ colorsCount()

OdUInt32 OdGiGradientGenerator::colorsCount ( ) const

Retrieves count of colors in gradient colors array.

Returns
count of colors as OdUInt32 value.

◆ copyGradient() [1/2]

void OdGiGradientGenerator::copyGradient ( const ODCOLORREF colors,
OdUInt32  nColors 
)

Creates gradient colors array from other colors array.

Parameters
colors[in] Linear array of colors.
nColors[in] Count of colors in colors linear array.

◆ copyGradient() [2/2]

void OdGiGradientGenerator::copyGradient ( const OdUInt32Array other)

Creates gradient colors array from other colors array.

Parameters
other[in] Input colors array for copy from.

◆ createColorArray()

void OdGiGradientGenerator::createColorArray ( OdUInt32  nColors)

Creates gradient colors array, filled with black color.

Parameters
nColors[in] Count of colors in gradient array.

◆ createColorArrayFilled()

void OdGiGradientGenerator::createColorArrayFilled ( ODCOLORREF  color,
OdUInt32  nColors 
)

Creates gradient colors array, filled with the specified color.

Parameters
color[in] Color for all elements in array.
nColors[in] Count of colors in gradient array.

◆ createGradient() [1/7]

void OdGiGradientGenerator::createGradient ( ODCOLORREF  color1,
ODCOLORREF  color2,
ODCOLORREF  color3,
ODCOLORREF  color4,
ODCOLORREF  color5,
OdUInt32  nColors,
OdGiGradientGenerator::InterpolationType  ipl1,
OdGiGradientGenerator::InterpolationType  ipl2,
OdGiGradientGenerator::InterpolationType  ipl3,
OdGiGradientGenerator::InterpolationType  ipl4 
)

Creates gradient from five input colors.

Parameters
color1[in] First color.
color2[in] Second color.
color3[in] Third color.
color4[in] Fourth color.
color5[in] Fifth color.
nColors[in] Number of color entries to be created in gradient colors array.
ipl1[in] Interpolation function for interval between color1 and color2.
ipl2[in] Interpolation function for interval between color2 and color3.
ipl3[in] Interpolation function for interval between color3 and color4.
ipl4[in] Interpolation function for interval between color4 and color5.

◆ createGradient() [2/7]

void OdGiGradientGenerator::createGradient ( ODCOLORREF  color1,
ODCOLORREF  color2,
ODCOLORREF  color3,
ODCOLORREF  color4,
ODCOLORREF  color5,
OdUInt32  nColors,
OdGiGradientGenerator::InterpolationType  ipl = OdGiGradientGenerator::kLinearInterpolation 
)

Creates gradient from five input colors.

Parameters
color1[in] First color.
color2[in] Second color.
color3[in] Third color.
color4[in] Fourth color.
color5[in] Fifth color.
nColors[in] Number of color entries to be created in gradient colors array.
ipl[in] Interpolation function.

◆ createGradient() [3/7]

void OdGiGradientGenerator::createGradient ( ODCOLORREF  color1,
ODCOLORREF  color2,
ODCOLORREF  color3,
ODCOLORREF  color4,
OdUInt32  nColors,
OdGiGradientGenerator::InterpolationType  ipl1,
OdGiGradientGenerator::InterpolationType  ipl2,
OdGiGradientGenerator::InterpolationType  ipl3 
)

Creates gradient from four input colors.

Parameters
color1[in] First color.
color2[in] Second color.
color3[in] Third color.
color4[in] Fourth color.
nColors[in] Number of color entries to be created in gradient colors array.
ipl1[in] Interpolation function for interval between color1 and color2.
ipl2[in] Interpolation function for interval between color2 and color3.
ipl3[in] Interpolation function for interval between color3 and color4.

◆ createGradient() [4/7]

void OdGiGradientGenerator::createGradient ( ODCOLORREF  color1,
ODCOLORREF  color2,
ODCOLORREF  color3,
ODCOLORREF  color4,
OdUInt32  nColors,
OdGiGradientGenerator::InterpolationType  ipl = OdGiGradientGenerator::kLinearInterpolation 
)

Creates gradient from four input colors.

Parameters
color1[in] First color.
color2[in] Second color.
color3[in] Third color.
color4[in] Four color.
nColors[in] Number of color entries to be created in gradient colors array.
ipl[in] Interpolation function.

◆ createGradient() [5/7]

void OdGiGradientGenerator::createGradient ( ODCOLORREF  color1,
ODCOLORREF  color2,
ODCOLORREF  color3,
OdUInt32  nColors,
OdGiGradientGenerator::InterpolationType  ipl1,
OdGiGradientGenerator::InterpolationType  ipl2 
)

Creates gradient from three input colors.

Parameters
color1[in] First color.
color2[in] Second color.
color3[in] Third color.
nColors[in] Number of color entries to be created in gradient colors array.
ipl1[in] Interpolation function for interval between color1 and color2.
ipl2[in] Interpolation function for interval between color2 and color3.

◆ createGradient() [6/7]

void OdGiGradientGenerator::createGradient ( ODCOLORREF  color1,
ODCOLORREF  color2,
ODCOLORREF  color3,
OdUInt32  nColors,
OdGiGradientGenerator::InterpolationType  ipl = OdGiGradientGenerator::kLinearInterpolation 
)

Creates gradient from three input colors.

Parameters
color1[in] First color.
color2[in] Second color.
color3[in] Third color.
nColors[in] Number of color entries to be created in gradient colors array.
ipl[in] Interpolation function.

◆ createGradient() [7/7]

void OdGiGradientGenerator::createGradient ( ODCOLORREF  color1,
ODCOLORREF  color2,
OdUInt32  nColors,
OdGiGradientGenerator::InterpolationType  ipl = OdGiGradientGenerator::kLinearInterpolation 
)

Creates gradient from two input colors.

Parameters
color1[in] First color.
color2[in] Second color.
nColors[in] Number of color entries to be created in gradient colors array.
ipl[in] Interpolation function.

◆ createSpectrumGradient()

static OdGiGradientGenerator OdGiGradientGenerator::createSpectrumGradient ( OdUInt32  nColors,
OdUInt8  alpha = 0 
)
static

Creates a spectrum gradient.

Parameters
nColors[in] Number of colors in gradient.
alpha[in] Alpha value for all spectrum colors.
Returns
spectrum gradient generator.

◆ einterp()

static double OdGiGradientGenerator::einterp ( double  a,
double  b,
double  t 
)
staticprotected

Exponential interpolation function.

◆ fillInterval() [1/2]

void OdGiGradientGenerator::fillInterval ( ODCOLORREF  color,
double  from = 0.0,
double  to = 1.0 
)

Fills gradient range between from and to.

Parameters
color[in] Fill color.
from[in] Start of range for fill.
to[in] End of range for fill.

◆ fillInterval() [2/2]

void OdGiGradientGenerator::fillInterval ( ODCOLORREF  color,
OdUInt32  from,
OdUInt32  to 
)

Fills gradient range between from and to.

Parameters
color[in] Fill color.
from[in] Start of range for fill.
to[in] End of range for fill.

◆ generateInterval() [1/2]

void OdGiGradientGenerator::generateInterval ( ODCOLORREF  color1,
ODCOLORREF  color2,
double  from = 0.0,
double  to = 1.0,
OdGiGradientGenerator::InterpolationType  ipl = OdGiGradientGenerator::kLinearInterpolation 
)

Fills range of gradient colors array with another gradient.

Parameters
color1[in] First color.
color2[in] Second color.
from[in] Start of range for fill.
to[in] End of range for fill.
ipl[in] Interpolation function.

◆ generateInterval() [2/2]

void OdGiGradientGenerator::generateInterval ( ODCOLORREF  color1,
ODCOLORREF  color2,
OdUInt32  from,
OdUInt32  to,
OdGiGradientGenerator::InterpolationType  ipl = OdGiGradientGenerator::kLinearInterpolation 
)

Fills range of gradient colors array by another gradient.

Parameters
color1[in] First color.
color2[in] Second color.
from[in] Start of range for fill.
to[in] End of range for fill.
ipl[in] Interpolation function.

◆ ieinterp()

static double OdGiGradientGenerator::ieinterp ( double  a,
double  b,
double  t 
)
staticprotected

Inverted exponential interpolation function.

◆ interpolateColor()

Interpolates color between color1 and color2.

Parameters
color1[in] First color.
color2[in] Second color.
at[in] Interpolation coordinate (0.0 - 1.0 for range without additional addressing).
to[in] End of range for fill.
ipl[in] Interpolation function.
mode[in] Addressing mode.
Returns
interpolated color as ODCOLORREF (OdUInt32 value).

◆ isInitialized()

bool OdGiGradientGenerator::isInitialized ( ) const

Tests whether gradient is initialized.

Returns
true if gradient is initialized, false otherwise.

◆ linterp()

static double OdGiGradientGenerator::linterp ( double  a,
double  b,
double  t 
)
staticprotected

Linear interpolation function.

◆ operator+=()

void OdGiGradientGenerator::operator+= ( const OdGiGradientGenerator other)

Appends colors of the passed gradient generator to colors of this gradient generator.

Parameters
other[in] Other gradient generator.

◆ operator=()

const OdGiGradientGenerator & OdGiGradientGenerator::operator= ( const OdGiGradientGenerator other)

Assignment operator for OdGiGradientGenerator class.

Parameters
other[in] Gradient generator to assign.
Returns
reference to this OdGiGradientGenerator.

◆ setAddressMode()

void OdGiGradientGenerator::setAddressMode ( OdGiGradientGenerator::AddressMode  mode)

Sets addressing mode.

Parameters
mode[in] New addressing mode.

◆ toDoubleRange()

double OdGiGradientGenerator::toDoubleRange ( OdUInt32  inVal) const
protected

Convert inVal to [0.0 - 1.0] range.

Friends And Related Function Documentation

◆ operator+

OdGiGradientGenerator operator+ ( const OdGiGradientGenerator g1,
const OdGiGradientGenerator g2 
)
friend

Member Data Documentation

◆ m_addressMode

AddressMode OdGiGradientGenerator::m_addressMode
protected

Definition at line 108 of file GiProceduralGenerator.h.

◆ m_colorGradient

OdUInt32Array OdGiGradientGenerator::m_colorGradient
protected

Definition at line 107 of file GiProceduralGenerator.h.


The documentation for this class was generated from the following file: