de.dante.extex.color
Class BasicColorConverter

java.lang.Object
  extended byde.dante.extex.color.BasicColorConverter
All Implemented Interfaces:
ColorConverter

public class BasicColorConverter
extends java.lang.Object
implements ColorConverter

This implementation of a color converter is based on the formulas in the color space FAQ.

Version:
$Revision: 1.6 $
Author:
Gerd Neugebauer

Constructor Summary
BasicColorConverter()
          Creates a new object.
 
Method Summary
 CmykColor toCmyk(Color color)
          Convert an arbitrary color to the CMYK model.
 GrayscaleColor toGrayscale(Color color)
          Convert an arbitrary color to the gray-scale model.
 HsvColor toHsv(Color color)
          Convert an arbitrary color to the HSV model.
 RgbColor toRgb(Color color)
          Convert an arbitrary color to the RGB model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicColorConverter

public BasicColorConverter()
Creates a new object.

Method Detail

toCmyk

public CmykColor toCmyk(Color color)
Convert an arbitrary color to the CMYK model. If an conversion is not supported then null is returned.

Specified by:
toCmyk in interface ColorConverter
Parameters:
color - the color to convert
Returns:
the corresponding color in the CMYK model or null if a conversion is not supported.
See Also:
ColorConverter.toCmyk( de.dante.extex.interpreter.context.Color)

toGrayscale

public GrayscaleColor toGrayscale(Color color)
Convert an arbitrary color to the gray-scale model. If an conversion is not supported then null is returned.

Specified by:
toGrayscale in interface ColorConverter
Parameters:
color - the color to convert
Returns:
the corresponding color in the RGB model or null if a conversion is not supported.
See Also:
ColorConverter.toGrayscale( de.dante.extex.interpreter.context.Color)

toHsv

public HsvColor toHsv(Color color)
Convert an arbitrary color to the HSV model. If an conversion is not supported then null is returned.

Specified by:
toHsv in interface ColorConverter
Parameters:
color - the color to convert
Returns:
the corresponding color in the HSV model or null if a conversion is not supported.
See Also:
ColorConverter.toHsv( de.dante.extex.interpreter.context.Color)

toRgb

public RgbColor toRgb(Color color)
Convert an arbitrary color to the RGB model. If an conversion is not supported then null is returned.

Specified by:
toRgb in interface ColorConverter
Parameters:
color - the color to convert
Returns:
the corresponding color in the RGB model or null if a conversion is not supported.
See Also:
ColorConverter.toRgb( de.dante.extex.interpreter.context.Color)