diff options
Diffstat (limited to 'src/main/print-color.c')
-rw-r--r-- | src/main/print-color.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/main/print-color.c b/src/main/print-color.c index 23ff8cb..793b402 100644 --- a/src/main/print-color.c +++ b/src/main/print-color.c @@ -16,8 +16,7 @@ * for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* @@ -887,6 +886,8 @@ compute_gcr_curve(const stp_vars_t *vars) k_lower = stp_get_float_parameter(vars, "GCRLower"); if (stp_check_float_parameter(vars, "BlackTrans", STP_PARAMETER_DEFAULTED)) k_trans = stp_get_float_parameter(vars, "BlackTrans"); + if (k_lower >= 1) + return NULL; k_upper *= lut->steps; k_lower *= lut->steps; stp_dprintf(STP_DBG_LUT, vars, " k_lower %.3f\n", k_lower); @@ -1392,6 +1393,7 @@ stpi_compute_lut(stp_vars_t *v) { int i; lut_t *lut = (lut_t *)(stp_get_component_data(v, "Color")); + double app_gamma_scale = 4.0; stp_curve_t *curve; stp_dprintf(STP_DBG_LUT, v, "stpi_compute_lut\n"); @@ -1422,9 +1424,11 @@ stpi_compute_lut(stp_vars_t *v) if (stp_check_float_parameter(v, "AppGamma", STP_PARAMETER_ACTIVE)) lut->app_gamma = stp_get_float_parameter(v, "AppGamma"); + if (stp_check_float_parameter(v, "AppGammaScale", STP_PARAMETER_ACTIVE)) + app_gamma_scale = stp_get_float_parameter(v, "AppGammaScale"); if (stp_check_boolean_parameter(v, "SimpleGamma", STP_PARAMETER_ACTIVE)) lut->simple_gamma_correction = stp_get_boolean_parameter(v, "SimpleGamma"); - lut->screen_gamma = lut->app_gamma / 4.0; /* "Empirical" */ + lut->screen_gamma = lut->app_gamma / app_gamma_scale; /* "Empirical" */ curve = stp_curve_create_copy(color_curve_bounds); stp_curve_rescale(curve, 65535.0, STP_CURVE_COMPOSE_MULTIPLY, STP_CURVE_BOUNDS_RESCALE); @@ -1507,9 +1511,17 @@ stpi_color_traditional_init(stp_vars_t *v, size_t total_channel_bits; if (steps != 256 && steps != 65536) - return -1; + { + stp_eprintf(v, + "stpi_color_traditional_init: Invalid color steps %lu (must be 256 or 65536)\n", + (unsigned long) steps); + return -1; + } if (!channel_depth) - return -1; + { + stp_eprintf(v, "stpi_color_traditional_init: ChannelBitDepth not set\n"); + return -1; + } lut = allocate_lut(); lut->input_color_description = @@ -1519,6 +1531,7 @@ stpi_color_traditional_init(stp_vars_t *v, if (!lut->input_color_description || !lut->output_color_description) { + stp_eprintf(v, "stpi_color_traditional_init: input/output types not specified\n"); free_lut(lut); return -1; } @@ -1527,6 +1540,7 @@ stpi_color_traditional_init(stp_vars_t *v, { if (stp_verify_parameter(v, "STPIRawChannels", 1) != PARAMETER_OK) { + stp_eprintf(v, "stpi_color_traditional_init: raw printing requested but STPIRawChannels not set\n"); free_lut(lut); return -1; } |