| 77 | } |
| 78 | |
| 79 | void ImageCurve::Init() |
| 80 | { |
| 81 | CubicFuncSpline* curSpline = NULL; |
| 82 | |
| 83 | for (int i = 0; i < (int) mPoints.size(); i++) |
| 84 | { |
| 85 | ImageCurvePoint* pt = &mPoints[i]; |
| 86 | if (pt->mIsCorner) |
| 87 | { |
| 88 | if (curSpline != NULL) |
| 89 | { |
| 90 | curSpline->AddPt(pt->mX, pt->mY); |
| 91 | curSpline = NULL; |
| 92 | } |
| 93 | } |
| 94 | else |
| 95 | { |
| 96 | if (curSpline == NULL) |
| 97 | { |
| 98 | curSpline = new CubicFuncSpline(); |
| 99 | pt->mIsSplineOwner = true; |
| 100 | } |
| 101 | |
| 102 | pt->mSpline = curSpline; |
| 103 | curSpline->AddPt(pt->mX, pt->mY); |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | /*{ |
| 108 | std::fstream stream("c:\\temp\\curve.csv", std::ios::out); |
| 109 | for (int i = 0; i < (int) 255; i++) |
| 110 | { |
| 111 | float aVal = GetVal(i); |
| 112 | stream << aVal << std::endl; |
| 113 | } |
| 114 | BF_ASSERT(stream.is_open()); |
| 115 | stream.flush(); |
| 116 | } |
| 117 | |
| 118 | _asm nop;*/ |
| 119 | } |
| 120 | |
| 121 | float ImageCurve::GetVal(float x) |
| 122 | { |
no test coverage detected