| 119 | } |
| 120 | |
| 121 | float ImageCurve::GetVal(float x) |
| 122 | { |
| 123 | ImageCurvePoint* prevPt = NULL; |
| 124 | for (int i = 0; i < (int) mPoints.size(); i++) |
| 125 | { |
| 126 | ImageCurvePoint* nextPt = &mPoints[i]; |
| 127 | |
| 128 | if (x == nextPt->mX) |
| 129 | return nextPt->mY; |
| 130 | |
| 131 | if ((x <= nextPt->mX) && (prevPt != NULL)) |
| 132 | { |
| 133 | if (prevPt->mSpline != NULL) |
| 134 | return prevPt->mSpline->Evaluate(x); |
| 135 | //return BFClamp(prevPt->mSpline->Evaluate(x), 0.0f, 255.0f); |
| 136 | |
| 137 | return prevPt->mY + |
| 138 | ((x - prevPt->mX) / (nextPt->mX - prevPt->mX)) * (nextPt->mY - prevPt->mY); |
| 139 | } |
| 140 | |
| 141 | prevPt = nextPt; |
| 142 | } |
| 143 | |
| 144 | return mPoints.back().mY; |
| 145 | } |
| 146 | |
| 147 | bool ImageCurve::IsDefault() |
| 148 | { |
no test coverage detected