CFx SDK Documentation  2023 SP0
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 78 of file GiProceduralGenerator.h.

Member Enumeration Documentation

◆ AddressMode

Color interval addressing mode.

Remarks
kClampMode Clamp color address coordinates to the [0.0, 1.0] range. kWrapMode Repeat color address on every integer junction.
Enumerator
kClampMode 
kWrapMode 

Definition at line 97 of file GiProceduralGenerator.h.

◆ InterpolationType

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

Enumerator
kLinearInterpolation 
kExpInterpolation 
kInvExpInterpolation 
kCosInterpolation 

Definition at line 84 of file GiProceduralGenerator.h.

Constructor & Destructor Documentation

◆ OdGiGradientGenerator() [1/2]

OdGiGradientGenerator::OdGiGradientGenerator ( )

◆ OdGiGradientGenerator() [2/2]

OdGiGradientGenerator::OdGiGradientGenerator ( const OdGiGradientGenerator other)

◆ ~OdGiGradientGenerator()

OdGiGradientGenerator::~OdGiGradientGenerator ( )

Member Function Documentation

◆ addressMode()

OdGiGradientGenerator::AddressMode OdGiGradientGenerator::addressMode ( ) const

Get addressing mode.

◆ appendGradient()

void OdGiGradientGenerator::appendGradient ( const OdGiGradientGenerator other)

◆ asArray()

const OdUInt32Array& OdGiGradientGenerator::asArray ( ) const

Get reference to array of 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

Get color from gradient colors array.

Parameters
at[in] Color coordinate (0.0 equals 0 in array; 1.0 equals colorsCount() - 1 in array).

◆ colorAt() [2/2]

ODCOLORREF OdGiGradientGenerator::colorAt ( OdUInt32  nColor) const

Get color from gradient colors array.

Parameters
nColor[in] Index of color in array.

◆ colorsCount()

OdUInt32 OdGiGradientGenerator::colorsCount ( ) const

Get count of colors in gradient colors array.

◆ copyGradient() [1/2]

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

Create 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)

Create gradient colors array from other colors array.

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

◆ createColorArray()

void OdGiGradientGenerator::createColorArray ( OdUInt32  nColors)

Create gradient colors array, filled with black color.

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

◆ createColorArrayFilled()

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

Create gradient colors array, filled with 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 
)

Create 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 
)

Create 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 
)

Create 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 
)

Create 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 
)

Create 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 
)

Create 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 
)

Create 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

◆ 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 
)

Fill 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 
)

Fill 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 
)

Fill 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 
)

Fill 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()

Interpolate 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.

◆ isInitialized()

bool OdGiGradientGenerator::isInitialized ( ) const

Test whether gradient is initialized.

◆ linterp()

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

Linear interpolation function.

◆ operator+=()

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

◆ operator=()

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

◆ setAddressMode()

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

Set 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 104 of file GiProceduralGenerator.h.

◆ m_colorGradient

OdUInt32Array OdGiGradientGenerator::m_colorGradient
protected

Definition at line 103 of file GiProceduralGenerator.h.


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