JHotDraw 7.6

org.jhotdraw.color
Class CIEXYChromaticityDiagramImageProducer

java.lang.Object
  extended by java.awt.image.MemoryImageSource
      extended by org.jhotdraw.color.CIEXYChromaticityDiagramImageProducer
All Implemented Interfaces:
java.awt.image.ImageProducer

public class CIEXYChromaticityDiagramImageProducer
extends java.awt.image.MemoryImageSource

Produces a CIE xy Chromaticity Diagram.

The diagram shows a projection of the CIE XYZ cube on a xy plane. The projection is based on the following equations:

x = X / (X + Y + Z), y = Y / (X + Y + Z), z = 1 - x - y.

The equations can be rewritten as:

X = (x*(Y+Z)/(1-x), Y = (y*(X+Z)/(1-y).

Version:
$Id: CIEXYChromaticityDiagramImageProducer.java 717 2010-11-21 12:30:57Z rawcoder $
Author:
Werner Randelshofer

Nested Class Summary
static class CIEXYChromaticityDiagramImageProducer.OutsideGamutHandling
           
 
Field Summary
protected  int angularIndex
           
protected  java.awt.color.ColorSpace colorSpace
           
protected  int h
           
protected  boolean isLookupValid
           
protected  boolean isPixelsValid
           
protected  int[] pixels
           
protected  int radialIndex
           
protected  int verticalIndex
           
protected  float verticalValue
           
protected  int w
           
 
Constructor Summary
CIEXYChromaticityDiagramImageProducer(int w, int h)
           
 
Method Summary
 void generateImage()
           
 float[] getColorAt(int x, int y)
           
 java.awt.Point getColorLocation(java.awt.Color c)
           
 java.awt.Point getColorLocation(float[] components)
           
 int getHeight()
           
 int getWidth()
           
 boolean needsGeneration()
           
 void regenerateDiagram()
           
 void toRGB(float[] ciexyz, float[] rgb)
           
 
Methods inherited from class java.awt.image.MemoryImageSource
addConsumer, isConsumer, newPixels, newPixels, newPixels, newPixels, newPixels, removeConsumer, requestTopDownLeftRightResend, setAnimated, setFullBufferUpdates, startProduction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pixels

protected int[] pixels

w

protected int w

h

protected int h

colorSpace

protected java.awt.color.ColorSpace colorSpace

radialIndex

protected int radialIndex

angularIndex

protected int angularIndex

verticalIndex

protected int verticalIndex

isPixelsValid

protected boolean isPixelsValid

verticalValue

protected float verticalValue

isLookupValid

protected boolean isLookupValid
Constructor Detail

CIEXYChromaticityDiagramImageProducer

public CIEXYChromaticityDiagramImageProducer(int w,
                                             int h)
Method Detail

needsGeneration

public boolean needsGeneration()

regenerateDiagram

public void regenerateDiagram()

generateImage

public void generateImage()

getColorLocation

@Nullable
public java.awt.Point getColorLocation(java.awt.Color c)

getColorLocation

@Nullable
public java.awt.Point getColorLocation(float[] components)

getColorAt

@Nullable
public float[] getColorAt(int x,
                                   int y)

getWidth

public int getWidth()

getHeight

public int getHeight()

toRGB

public void toRGB(float[] ciexyz,
                  float[] rgb)

Copyright 1996-2010 (c) by the authors and contributors of the JHotDraw project.
Some rights reserved.