org.faceless.pdf2

## Class DeviceNColorSpace

- java.lang.Object
- - java.awt.color.ColorSpace
  - - org.faceless.pdf2.DeviceNColorSpace

- All Implemented Interfaces:
    Serializable
  Direct Known Subclasses:
    SpotColorSpace

      public class DeviceNColorSpace
      extends ColorSpace

  This class represents a "Device N" ColorSpace, which is a ColorSpace with N individual inks - the `SpotColorSpace` class is a special case of this class where there is only one ink. This class has no public constructor, as it is not normally something that would be created by a user of this API. The class itself is public primarily for preflighting: an instance of this ColorSpace may be passed in to `OutputProfiler.ColorAction.changeColor(org.faceless.pdf2.OutputProfiler, java.awt.color.ColorSpace, float[], float[], boolean, int)`.

  Note that unlike "process" ColorSpaces, colors in this space can be converted from this space to RGB or XYZ, but not the other way - these spaces are not constructed in a way that makes it easy to map an RGB value to a Color in this class (nor would it be useful). Consequently the `fromRGB(float[])` and `fromCIEXYZ(float[])` methods throw an `UnsupportedOperationException`

  Since:
    2.18

- - ### Field Summary

    - ### Fields inherited from class java.awt.color.ColorSpace

      `CS_CIEXYZ, CS_GRAY, CS_LINEAR_RGB, CS_PYCC, CS_sRGB, TYPE_2CLR, TYPE_3CLR, TYPE_4CLR, TYPE_5CLR, TYPE_6CLR, TYPE_7CLR, TYPE_8CLR, TYPE_9CLR, TYPE_ACLR, TYPE_BCLR, TYPE_CCLR, TYPE_CMY, TYPE_CMYK, TYPE_DCLR, TYPE_ECLR, TYPE_FCLR, TYPE_GRAY, TYPE_HLS, TYPE_HSV, TYPE_Lab, TYPE_Luv, TYPE_RGB, TYPE_XYZ, TYPE_YCbCr, TYPE_Yxy`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)`
    `float[]` | `fromCIEXYZ(float[] xyz)` Theoretically transforms a color value assumed to be in the XYZ ColorSpace into values in this ColorSpace.
    `float[]` | `fromRGB(float[] rgb)` Theoretically transforms a color value assumed to be in the sRGB ColorSpace into values in this ColorSpace.
    `ColorSpace` | `getFallbackColorSpace()` Get the ColorSpace which defines the "fallback" color, which must be a process ColorSpace (i.e.
    `String` | `getName(int i)` Returns the name of the specified component
    `int` | `getNumComponents()` Returns the number of components of this ColorSpace.
    `int` | `hashCode()`
    `DeviceNColorSpace` | `remap(ColorSpace newfallback)` Attempt to convert this DeviceNColorSpace to an equavalent one, but with a different fallback ColorSpace.
    `float[]` | `toCIEXYZ(float[] colorvalue)` Transforms a color value assumed to be in this ColorSpace into the CIEXYZ values.
    `float[]` | `toFallback(float[] input)` Convert the color components in this color to the components in the `fallback` ColorSpace
    `float[]` | `toRGB(float[] colorvalue)` Transforms a color value assumed to be in this ColorSpace into a value in the default CS_sRGB color space.
    `String` | `toString()`

    - ### Methods inherited from class java.awt.color.ColorSpace

      `getInstance, getMaxValue, getMinValue, getType, isCS_sRGB`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### getName

          public String getName(int i)

      Returns the name of the specified component
      Overrides:
        `getName` in class `ColorSpace`
      Parameters:
        `i` - the component index
      Returns:
        the name of the component at the specified index
      Since:
        2.11.26

    - #### getNumComponents

          public int getNumComponents()

      Returns the number of components of this ColorSpace.
      Overrides:
        `getNumComponents` in class `ColorSpace`
      Returns:
        the number of components in this ColorSpace

    - #### getFallbackColorSpace

          public ColorSpace getFallbackColorSpace()

      Get the ColorSpace which defines the "fallback" color, which must be a process ColorSpace (i.e. RGB, CMYK etc)

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### toFallback

          public float[] toFallback(float[] input)

      Convert the color components in this color to the components in the `fallback` ColorSpace
      Parameters:
        `input` - the array of components in this ColorSpace
      Returns:
        the array of components in the fallback ColorSpace

    - #### toRGB

          public float[] toRGB(float[] colorvalue)

      Transforms a color value assumed to be in this ColorSpace into a value in the default CS_sRGB color space. Calls `toRGB` on the fallback colorspace.

      Specified by:
        `toRGB` in class `ColorSpace`
      Parameters:
        `colorvalue` - a float array with length of at least the number of components in this ColorSpace
      Returns:
        a float array of length 3

    - #### toCIEXYZ

          public float[] toCIEXYZ(float[] colorvalue)

      Transforms a color value assumed to be in this ColorSpace into the CIEXYZ values. Calls `toCIEXYZ` on the fallback colorspace.

      Specified by:
        `toCIEXYZ` in class `ColorSpace`
      Parameters:
        `colorvalue` - a float array with length of at least the number of components in this ColorSpace
      Returns:
        a float array of length 3

    - #### fromRGB

          public float[] fromRGB(float[] rgb)

      Theoretically transforms a color value assumed to be in the sRGB ColorSpace into values in this ColorSpace. In practice this can't easily be done and isn't useful, so throws an `UnsupportedOperationException`.

      Specified by:
        `fromRGB` in class `ColorSpace`
      Parameters:
        `rgb` - a float array with length of at least 3

    - #### fromCIEXYZ

          public float[] fromCIEXYZ(float[] xyz)

      Theoretically transforms a color value assumed to be in the XYZ ColorSpace into values in this ColorSpace. In practice this can't easily be done and isn't useful, so throws an `UnsupportedOperationException`.

      Specified by:
        `fromCIEXYZ` in class `ColorSpace`
      Parameters:
        `xyz` - a float array with length of at least 3

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### remap

          public DeviceNColorSpace remap(ColorSpace newfallback)

      Attempt to convert this DeviceNColorSpace to an equavalent one, but with a different fallback ColorSpace. The equivalent space will be as close as possible to the original, but may not be identical, as colors may be out of gamut. For some DeviceN spaces this process may not be possible - spaces are remapped with a lookup table function requiring mn samples where n is the number of inks
      Since:
        2.17.1

Copyright © 2001-2015 Big Faceless Organization