33 double myPixelValue = theValue;
47 if (( myPixelValue >= mClassBreakMin1 ) && ( myPixelValue < mClassBreakMax1 ) )
49 *theReturnRedValue = 0;
50 *theReturnGreenValue = static_cast <
int >((( 255 /
mMinimumMaximumRange ) * ( myPixelValue - mClassBreakMin1 ) ) * 3 );
51 *theReturnBlueValue = 255;
54 else if (( myPixelValue >= mClassBreakMin2 ) && ( myPixelValue < mClassBreakMax2 ) )
56 *theReturnRedValue = static_cast <
int >((( 255 /
mMinimumMaximumRange ) * (( myPixelValue - mClassBreakMin2 ) / 1 ) ) * 3 );
57 *theReturnGreenValue = 255;
58 *theReturnBlueValue = static_cast <
int >( 255 - ((( 255 /
mMinimumMaximumRange ) * (( myPixelValue - mClassBreakMin2 ) / 1 ) ) * 3 ) );
63 *theReturnRedValue = 255;
64 *theReturnGreenValue = static_cast <
int >( 255 - ((( 255 /
mMinimumMaximumRange ) * (( myPixelValue - mClassBreakMin3 ) / 1 ) * 3 ) ) );
65 *theReturnBlueValue = 0;
71 bool QgsPseudoColorShader::shade(
double theRedValue,
double theGreenValue,
double theBlueValue,
int* theReturnRedValue,
int* theReturnGreenValue,
int* theReturnBlueValue )
73 Q_UNUSED( theRedValue );
74 Q_UNUSED( theGreenValue );
75 Q_UNUSED( theBlueValue );
77 *theReturnRedValue = 0;
78 *theReturnGreenValue = 0;
79 *theReturnBlueValue = 0;
84 void QgsPseudoColorShader::setClassBreaks()
89 mClassBreakMax1 = mClassBreakMin1 + mBreakSize;
90 mClassBreakMin2 = mClassBreakMax1;
91 mClassBreakMax2 = mClassBreakMin2 + mBreakSize;
92 mClassBreakMin3 = mClassBreakMax2;
QgsPseudoColorShader(double theMinimumValue=0.0, double theMaximumValue=255.0)
double mMinimumValue
User defineable minimum value for the shading function.
void setMinimumValue(double) override
Return the minimum value.
double mMaximumValue
User defineable maximum value for the shading function.
The raster shade function applies a shader to a pixel at render time - typically used to render grays...
bool shade(double, int *, int *, int *)
generates and new RGB value based on one input value
void setMaximumValue(double) override
Set the maximum value.
double mMinimumMaximumRange
Minimum maximum range for the shading function.