+void ColorCurve::set_gamma(float g)
+{
+ if(g<0.1 || g>10)
+ throw invalid_argument("ColorCurve::set_gamma");
+
+ unsigned char curve_data[256];
+ for(unsigned i=0; i<256; ++i)
+ curve_data[i] = pow(i/255.0f, 1/g)*255+0.5f;
+ curve.image(0, LUMINANCE, UNSIGNED_BYTE, curve_data);
+}
+
+void ColorCurve::set_srgb()
+{
+ unsigned char curve_data[256];
+ curve_data[0] = 0;
+ for(unsigned i=1; i<256; ++i)
+ curve_data[i] = to_srgb(i/255.0f)*255+0.5f;
+ curve.image(0, LUMINANCE, UNSIGNED_BYTE, curve_data);
+}
+
+void ColorCurve::set_linear()
+{
+ unsigned char curve_data[256];
+ for(unsigned i=0; i<256; ++i)
+ curve_data[i] = i;
+ curve.image(0, LUMINANCE, UNSIGNED_BYTE, curve_data);
+}
+