| 27 | |
| 28 | |
| 29 | void GetLutImageSize(int & width, int & height, |
| 30 | int cubesize, int maxwidth) |
| 31 | { |
| 32 | // Compute the image width / height |
| 33 | width = cubesize*cubesize; |
| 34 | if (maxwidth>0 && width>=maxwidth) |
| 35 | { |
| 36 | // TODO: Do something smarter here to find a better multiple, |
| 37 | // to create a more pleasing gradient rendition. |
| 38 | // Use prime divisors / lowest common denominator, if possible? |
| 39 | width = std::min(maxwidth, width); |
| 40 | } |
| 41 | |
| 42 | int numpixels = cubesize*cubesize*cubesize; |
| 43 | height = (int)(ceilf((float)numpixels/(float)width)); |
| 44 | } |
| 45 | |
| 46 | |
| 47 | void Generate(int cubesize, int maxwidth, |