Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

gnu.java.awt.color
Class ToneReproductionCurve  view ToneReproductionCurve download ToneReproductionCurve.java

java.lang.Object
  extended bygnu.java.awt.color.ToneReproductionCurve

public class ToneReproductionCurve
extends java.lang.Object

ToneReproductionCurve - TRCs are used to describe RGB and Grayscale profiles. The TRC is essentially the gamma function of the color space. For example, Apple RGB has a gamma of 1.8, most monitors are ~2.2, sRGB is 2.4 with a small linear part near 0. Linear spaces are of course 1.0. (The exact function is implemented in SrgbConverter) The ICC specification allows the TRC to be described as a single Gamma value, where the function is thus out = in**gamma. Alternatively, the gamma function may be represented by a lookup table of values, in which case linear interpolation is used.


Field Summary
private  float gamma
           
private  float[] reverseTrc
           
private  float[] trc
           
 
Constructor Summary
ToneReproductionCurve(float gamma)
          Constructs a TRC from a gamma values
ToneReproductionCurve(float[] trcValues)
          Constructs a TRC from a set of float values
ToneReproductionCurve(short[] trcValues)
          Constructs a TRC from a set of short values normalized to the 0-65535 range (as in the ICC profile file).
 
Method Summary
 float lookup(float in)
          Performs a TRC lookup
 float reverseLookup(float in)
          Performs an reverse lookup
 void setupReverseTrc()
          Calculates a reverse-lookup table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

trc

private float[] trc

gamma

private float gamma

reverseTrc

private float[] reverseTrc
Constructor Detail

ToneReproductionCurve

public ToneReproductionCurve(float gamma)
Constructs a TRC from a gamma values


ToneReproductionCurve

public ToneReproductionCurve(float[] trcValues)
Constructs a TRC from a set of float values


ToneReproductionCurve

public ToneReproductionCurve(short[] trcValues)
Constructs a TRC from a set of short values normalized to the 0-65535 range (as in the ICC profile file). (Note the values are treated as unsigned)

Method Detail

lookup

public float lookup(float in)
Performs a TRC lookup


reverseLookup

public float reverseLookup(float in)
Performs an reverse lookup


setupReverseTrc

public void setupReverseTrc()
Calculates a reverse-lookup table. We use a whopping 10,000 entries.. This is should be more than any real-life TRC table (typically around 256-1024) so we won't be losing any precision. This will of course generate completely invalid results if the curve is not monotonic and invertable. But what's the alternative?