| 13 | #include <iostream> |
| 14 | |
| 15 | int Test(ostream& strm) |
| 16 | { |
| 17 | int i, j, k; |
| 18 | vtkColorTransferFunction* ctf1 = vtkColorTransferFunction::New(); |
| 19 | |
| 20 | // actual test |
| 21 | strm << "Test vtkColorTransferFunction Start" << std::endl; |
| 22 | |
| 23 | ctf1->AddRGBPoint(0.0, 1, 0, 0); |
| 24 | ctf1->AddHSVPoint(1.0, 1, 1, .6); |
| 25 | ctf1->AddRGBSegment(2.0, 1, 1, 1, 10.0, 0, 0, 0); |
| 26 | ctf1->AddHSVSegment(11.0, 1, 1, .6, 15.0, .1, .2, .3); |
| 27 | strm << *ctf1; |
| 28 | |
| 29 | double rgb[3]; |
| 30 | ctf1->GetColor(.5, rgb); |
| 31 | strm << "GetColor(.5) = " << rgb[0] << ", " << rgb[1] << ", " << rgb[2] << std::endl; |
| 32 | |
| 33 | strm << "GetRedValue(.5) = " << ctf1->GetRedValue(.5) << std::endl; |
| 34 | strm << "GetGreenValue(.5) = " << ctf1->GetGreenValue(.5) << std::endl; |
| 35 | strm << "GetBlueValue(.5) = " << ctf1->GetBlueValue(.5) << std::endl; |
| 36 | |
| 37 | strm << "MapValue(12) = " << (int)ctf1->MapValue(12)[0] << ", " << (int)ctf1->MapValue(12)[1] |
| 38 | << ", " << (int)ctf1->MapValue(12)[2] << std::endl; |
| 39 | |
| 40 | strm << "GetRange = " << ctf1->GetRange()[0] << "," << ctf1->GetRange()[1] << std::endl; |
| 41 | |
| 42 | double table[3][256]; |
| 43 | |
| 44 | ctf1->GetTable(0, 15, 256, &table[0][0]); |
| 45 | strm << "GetTable(0, 15, 256, &table[0][0])" << std::endl; |
| 46 | for (i = 0; i < 256; i++) |
| 47 | { |
| 48 | for (j = 0; j < 3; j++) |
| 49 | { |
| 50 | strm << table[j][i] << " "; |
| 51 | } |
| 52 | strm << std::endl; |
| 53 | } |
| 54 | |
| 55 | strm << "BuildFunctionFrom(0, 15, 256, &table[0][0])" << std::endl; |
| 56 | vtkColorTransferFunction* ctf2 = vtkColorTransferFunction::New(); |
| 57 | ctf2->BuildFunctionFromTable(0, 15, 256, &table[0][0]); |
| 58 | |
| 59 | ctf2->SetColorSpaceToRGB(); |
| 60 | ctf2->GetTable(0, 15, 512); |
| 61 | |
| 62 | ctf2->SetColorSpaceToHSV(); |
| 63 | ctf2->GetTable(0, 15, 512); |
| 64 | |
| 65 | ctf1->DeepCopy(ctf2); |
| 66 | strm << "ctf1->DeepCopy(ctf2)" << std::endl; |
| 67 | strm << *ctf1; |
| 68 | |
| 69 | ctf1->RemovePoint(10); |
| 70 | strm << *ctf1; |
| 71 | |
| 72 | ctf1->RemoveAllPoints(); |
no test coverage detected