371 */ 372 public boolean isCS_sRGB () { 373 /* REMIND - make sure we know sRGBspace exists already */ 374 return (this == sRGBspace); 375 } 376 377 /** 378 * Transforms a color value assumed to be in this ColorSpace 379 * into a value in the default CS_sRGB color space. 380 * <p> 381 * This method transforms color values using algorithms designed 382 * to produce the best perceptual match between input and output 383 * colors. In order to do colorimetric conversion of color values, 384 * you should use the <code>toCIEXYZ</code> 385 * method of this color space to first convert from the input 386 * color space to the CS_CIEXYZ color space, and then use the 387 * <code>fromCIEXYZ</code> method of the CS_sRGB color space to 388 * convert from CS_CIEXYZ to the output color space. 389 * See {@link #toCIEXYZ(float[]) toCIEXYZ} and 390 * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information. 391 * <p> 392 * @param colorvalue a float array with length of at least the number 393 * of components in this ColorSpace 394 * @return a float array of length 3 395 * @throws ArrayIndexOutOfBoundsException if array length is not 396 * at least the number of components in this ColorSpace 397 */ 398 public abstract float[] toRGB(float[] colorvalue); 399 400 401 /** 402 * Transforms a color value assumed to be in the default CS_sRGB 403 * color space into this ColorSpace. 404 * <p> 405 * This method transforms color values using algorithms designed 406 * to produce the best perceptual match between input and output 407 * colors. In order to do colorimetric conversion of color values, 408 * you should use the <code>toCIEXYZ</code> 409 * method of the CS_sRGB color space to first convert from the input 410 * color space to the CS_CIEXYZ color space, and then use the 411 * <code>fromCIEXYZ</code> method of this color space to 412 * convert from CS_CIEXYZ to the output color space. 413 * See {@link #toCIEXYZ(float[]) toCIEXYZ} and 414 * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information. 415 * <p> 416 * @param rgbvalue a float array with length of at least 3 417 * @return a float array with length equal to the number of 418 * components in this ColorSpace 419 * @throws ArrayIndexOutOfBoundsException if array length is not 420 * at least 3 421 */ 422 public abstract float[] fromRGB(float[] rgbvalue); 423 424 425 /** 426 * Transforms a color value assumed to be in this ColorSpace 427 * into the CS_CIEXYZ conversion color space. 428 * <p> 429 * This method transforms color values using relative colorimetry, 430 * as defined by the International Color Consortium standard. This 431 * means that the XYZ values returned by this method are represented 432 * relative to the D50 white point of the CS_CIEXYZ color space. 433 * This representation is useful in a two-step color conversion 434 * process in which colors are transformed from an input color 435 * space to CS_CIEXYZ and then to an output color space. This 436 * representation is not the same as the XYZ values that would 437 * be measured from the given color value by a colorimeter. 438 * A further transformation is necessary to compute the XYZ values 439 * that would be measured using current CIE recommended practices. 440 * See the {@link ICC_ColorSpace#toCIEXYZ(float[]) toCIEXYZ} method of 441 * <code>ICC_ColorSpace</code> for further information. 442 * <p> 443 * @param colorvalue a float array with length of at least the number 444 * of components in this ColorSpace 445 * @return a float array of length 3 446 * @throws ArrayIndexOutOfBoundsException if array length is not 447 * at least the number of components in this ColorSpace. 448 */ 449 public abstract float[] toCIEXYZ(float[] colorvalue); 450 451 452 /** 453 * Transforms a color value assumed to be in the CS_CIEXYZ conversion 454 * color space into this ColorSpace. 455 * <p> 456 * This method transforms color values using relative colorimetry, 457 * as defined by the International Color Consortium standard. This 458 * means that the XYZ argument values taken by this method are represented 459 * relative to the D50 white point of the CS_CIEXYZ color space. 460 * This representation is useful in a two-step color conversion 461 * process in which colors are transformed from an input color 462 * space to CS_CIEXYZ and then to an output color space. The color 463 * values returned by this method are not those that would produce 464 * the XYZ value passed to the method when measured by a colorimeter. 465 * If you have XYZ values corresponding to measurements made using 466 * current CIE recommended practices, they must be converted to D50 467 * relative values before being passed to this method. 468 * See the {@link ICC_ColorSpace#fromCIEXYZ(float[]) fromCIEXYZ} method of 469 * <code>ICC_ColorSpace</code> for further information. 470 * <p> 471 * @param colorvalue a float array with length of at least 3 472 * @return a float array with length equal to the number of 473 * components in this ColorSpace 474 * @throws ArrayIndexOutOfBoundsException if array length is not 475 * at least 3 476 */ 477 public abstract float[] fromCIEXYZ(float[] colorvalue); 478 479 /** 480 * Returns the color space type of this ColorSpace (for example 481 * TYPE_RGB, TYPE_XYZ, ...). The type defines the 482 * number of components of the color space and the interpretation, 483 * e.g. TYPE_RGB identifies a color space with three components - red, 484 * green, and blue. It does not define the particular color 485 * characteristics of the space, e.g. the chromaticities of the 486 * primaries. 487 * 488 * @return the type constant that represents the type of this 489 * <CODE>ColorSpace</CODE> 490 */ | 371 */ 372 public boolean isCS_sRGB () { 373 /* REMIND - make sure we know sRGBspace exists already */ 374 return (this == sRGBspace); 375 } 376 377 /** 378 * Transforms a color value assumed to be in this ColorSpace 379 * into a value in the default CS_sRGB color space. 380 * <p> 381 * This method transforms color values using algorithms designed 382 * to produce the best perceptual match between input and output 383 * colors. In order to do colorimetric conversion of color values, 384 * you should use the <code>toCIEXYZ</code> 385 * method of this color space to first convert from the input 386 * color space to the CS_CIEXYZ color space, and then use the 387 * <code>fromCIEXYZ</code> method of the CS_sRGB color space to 388 * convert from CS_CIEXYZ to the output color space. 389 * See {@link #toCIEXYZ(float[]) toCIEXYZ} and 390 * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information. 391 * 392 * @param colorvalue a float array with length of at least the number 393 * of components in this ColorSpace 394 * @return a float array of length 3 395 * @throws ArrayIndexOutOfBoundsException if array length is not 396 * at least the number of components in this ColorSpace 397 */ 398 public abstract float[] toRGB(float[] colorvalue); 399 400 401 /** 402 * Transforms a color value assumed to be in the default CS_sRGB 403 * color space into this ColorSpace. 404 * <p> 405 * This method transforms color values using algorithms designed 406 * to produce the best perceptual match between input and output 407 * colors. In order to do colorimetric conversion of color values, 408 * you should use the <code>toCIEXYZ</code> 409 * method of the CS_sRGB color space to first convert from the input 410 * color space to the CS_CIEXYZ color space, and then use the 411 * <code>fromCIEXYZ</code> method of this color space to 412 * convert from CS_CIEXYZ to the output color space. 413 * See {@link #toCIEXYZ(float[]) toCIEXYZ} and 414 * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information. 415 * 416 * @param rgbvalue a float array with length of at least 3 417 * @return a float array with length equal to the number of 418 * components in this ColorSpace 419 * @throws ArrayIndexOutOfBoundsException if array length is not 420 * at least 3 421 */ 422 public abstract float[] fromRGB(float[] rgbvalue); 423 424 425 /** 426 * Transforms a color value assumed to be in this ColorSpace 427 * into the CS_CIEXYZ conversion color space. 428 * <p> 429 * This method transforms color values using relative colorimetry, 430 * as defined by the International Color Consortium standard. This 431 * means that the XYZ values returned by this method are represented 432 * relative to the D50 white point of the CS_CIEXYZ color space. 433 * This representation is useful in a two-step color conversion 434 * process in which colors are transformed from an input color 435 * space to CS_CIEXYZ and then to an output color space. This 436 * representation is not the same as the XYZ values that would 437 * be measured from the given color value by a colorimeter. 438 * A further transformation is necessary to compute the XYZ values 439 * that would be measured using current CIE recommended practices. 440 * See the {@link ICC_ColorSpace#toCIEXYZ(float[]) toCIEXYZ} method of 441 * <code>ICC_ColorSpace</code> for further information. 442 * 443 * @param colorvalue a float array with length of at least the number 444 * of components in this ColorSpace 445 * @return a float array of length 3 446 * @throws ArrayIndexOutOfBoundsException if array length is not 447 * at least the number of components in this ColorSpace. 448 */ 449 public abstract float[] toCIEXYZ(float[] colorvalue); 450 451 452 /** 453 * Transforms a color value assumed to be in the CS_CIEXYZ conversion 454 * color space into this ColorSpace. 455 * <p> 456 * This method transforms color values using relative colorimetry, 457 * as defined by the International Color Consortium standard. This 458 * means that the XYZ argument values taken by this method are represented 459 * relative to the D50 white point of the CS_CIEXYZ color space. 460 * This representation is useful in a two-step color conversion 461 * process in which colors are transformed from an input color 462 * space to CS_CIEXYZ and then to an output color space. The color 463 * values returned by this method are not those that would produce 464 * the XYZ value passed to the method when measured by a colorimeter. 465 * If you have XYZ values corresponding to measurements made using 466 * current CIE recommended practices, they must be converted to D50 467 * relative values before being passed to this method. 468 * See the {@link ICC_ColorSpace#fromCIEXYZ(float[]) fromCIEXYZ} method of 469 * <code>ICC_ColorSpace</code> for further information. 470 * 471 * @param colorvalue a float array with length of at least 3 472 * @return a float array with length equal to the number of 473 * components in this ColorSpace 474 * @throws ArrayIndexOutOfBoundsException if array length is not 475 * at least 3 476 */ 477 public abstract float[] fromCIEXYZ(float[] colorvalue); 478 479 /** 480 * Returns the color space type of this ColorSpace (for example 481 * TYPE_RGB, TYPE_XYZ, ...). The type defines the 482 * number of components of the color space and the interpretation, 483 * e.g. TYPE_RGB identifies a color space with three components - red, 484 * green, and blue. It does not define the particular color 485 * characteristics of the space, e.g. the chromaticities of the 486 * primaries. 487 * 488 * @return the type constant that represents the type of this 489 * <CODE>ColorSpace</CODE> 490 */ |