de.dante.extex.color
Interface ColorConverter

All Known Implementing Classes:
BasicColorConverter, NoColorConverter

public interface ColorConverter

This interface describes the possibilities of a color conversion.

Consider the situation that a color is resent which is not in the needed color model; For instance a CMYK color is given and a RGB color is needed. In this situation a color converter can be used to translate between the given color and the needed color.

A color converter can refuse to translate a given color. In this case the conversion method simply returns null. This enables us to define color converters which signal that a translation is not desirable – e.g. because the result might be poor.

Version:
$Revision: 1.3 $
Author:
Gerd Neugebauer

Method Summary
 CmykColor toCmyk(Color color)
          Convert an arbitrary color to the CMYK model.
 GrayscaleColor toGrayscale(Color color)
          Convert an arbitrary color to the RGB 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.
 

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.

Parameters:
color - the color to convert
Returns:
the corresponding color in the CMYK model or null if a conversion is not supported.

toGrayscale

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

Parameters:
color - the color to convert
Returns:
the corresponding color in the RGB model or null if a conversion is not supported.

toHsv

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

Parameters:
color - the color to convert
Returns:
the corresponding color in the HSV model or null if a conversion is not supported.

toRgb

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

Parameters:
color - the color to convert
Returns:
the corresponding color in the RGB model or null if a conversion is not supported.