1 /* Copyright (C) 2005-2011 Fabio Riccardi */
2 
3 package com.lightcrafts.model;
4 
5 /**
6  * A kind of Operation that performs the zone-mapping transformation.
7  */
8 
9 public interface ZoneOperation extends Operation {
10 
11     /**
12      * In setScale(), specify that zones are defined as ranges of
13      * RGB values.  This is the default.
14      */
15     final static int RgbScale = 0;
16 
17     /**
18      * In setScale(), specify that zones are defined as ranges of
19      * luminosity values.
20      */
21     final static int LuminosityScale = 1;
22 
23     /**
24      * In setScale(), specify that zones are defined as ranges of
25      * chrominmance values.
26      */
27     final static int ChromaScale = 2;
28 
29     /**
30      * Specify whether this ZoneOperation should act on zones defined as
31      * intervals of RGB values or as intervals of luminosity.  The default
32      * is RGB.
33      * @param scale Either RgbScale or LuminosityScale.
34      * @throws IllegalArgumentException If the given scale is not equal
35      * to either of these constants.
36      */
setScale(int scale)37     void setScale(int scale);
38 
39     /**
40      * The action of this Operation is determined by a transfer function on
41      * the unit interval.  This transfer function is defined by an array of
42      * doubles, interpreted like this:
43      * <ol>
44      * <li>The length of the array defines control points along the ordinate
45      * at zero, one, and uniformly spaced in between.  (The array must have
46      * at least two elements.)</li>
47      * <li>Each value in the array is either between 0 and 1 inclusive, or
48      * negative.  If it is negative, then the corresponding control point is
49      * inactive.  If the value is in the unit interval, then the control
50      * point is active.</li>
51      * </ol>
52      * @param points An array of numbers between 0 and 1 or negative, to be
53      * interpreted as values of a transfer function on the interval.
54      */
setControlPoints(double[] points)55     void setControlPoints(double[] points);
56 
57     /**
58      * Get the interpolated value of the transfer function at the given
59      * index.  If the most recent value in a points array submitted to
60      * setControlPoints() at the given index was nonnegative, then the
61      * submitted value is returned.  If it was negative, then a computed
62      * interpolating value is returned.
63      * <p>
64      * If setControlPoints() has never been called, the result of this method
65      * is undefined.
66      * @param index A pointer into the most recent array submitted to
67      * setControlPoints().
68      */
getControlPoint(int index)69     double getControlPoint(int index);
70 
71     /** Notify this ZoneOperation that a particular control point has gained
72       * focus in the user interface.  This is provided specifically to
73       * allow interactive repainting of the zone-finder Preview feature.
74       * @param index The index of a control point to focus, or if negative,
75       * an indication that no point currently has focus.
76       */
setFocusPoint(int index)77     void setFocusPoint(int index);
78 }
79