529 530 /** 531 * Returns the minimum normalized color component value for the 532 * specified component. For TYPE_XYZ spaces, this method returns 533 * minimum values of 0.0 for all components. For TYPE_Lab spaces, 534 * this method returns 0.0 for L and -128.0 for a and b components. 535 * This is consistent with the encoding of the XYZ and Lab Profile 536 * Connection Spaces in the ICC specification. For all other types, this 537 * method returns 0.0 for all components. When using an ICC_ColorSpace 538 * with a profile that requires different minimum component values, 539 * it is necessary to subclass this class and override this method. 540 * @param component The component index. 541 * @return The minimum normalized component value. 542 * @throws IllegalArgumentException if component is less than 0 or 543 * greater than numComponents - 1. 544 * @since 1.4 545 */ 546 public float getMinValue(int component) { 547 if ((component < 0) || (component > this.getNumComponents() - 1)) { 548 throw new IllegalArgumentException( 549 "Component index out of range: + component"); 550 } 551 return minVal[component]; 552 } 553 554 /** 555 * Returns the maximum normalized color component value for the 556 * specified component. For TYPE_XYZ spaces, this method returns 557 * maximum values of 1.0 + (32767.0 / 32768.0) for all components. 558 * For TYPE_Lab spaces, 559 * this method returns 100.0 for L and 127.0 for a and b components. 560 * This is consistent with the encoding of the XYZ and Lab Profile 561 * Connection Spaces in the ICC specification. For all other types, this 562 * method returns 1.0 for all components. When using an ICC_ColorSpace 563 * with a profile that requires different maximum component values, 564 * it is necessary to subclass this class and override this method. 565 * @param component The component index. 566 * @return The maximum normalized component value. 567 * @throws IllegalArgumentException if component is less than 0 or 568 * greater than numComponents - 1. 569 * @since 1.4 570 */ 571 public float getMaxValue(int component) { 572 if ((component < 0) || (component > this.getNumComponents() - 1)) { 573 throw new IllegalArgumentException( 574 "Component index out of range: + component"); 575 } 576 return maxVal[component]; 577 } 578 579 private void setMinMax() { 580 int nc = this.getNumComponents(); 581 int type = this.getType(); 582 minVal = new float[nc]; 583 maxVal = new float[nc]; 584 if (type == ColorSpace.TYPE_Lab) { 585 minVal[0] = 0.0f; // L 586 maxVal[0] = 100.0f; 587 minVal[1] = -128.0f; // a 588 maxVal[1] = 127.0f; 589 minVal[2] = -128.0f; // b 590 maxVal[2] = 127.0f; 591 } else if (type == ColorSpace.TYPE_XYZ) { 592 minVal[0] = minVal[1] = minVal[2] = 0.0f; // X, Y, Z 593 maxVal[0] = maxVal[1] = maxVal[2] = 1.0f + (32767.0f/ 32768.0f); 594 } else { | 529 530 /** 531 * Returns the minimum normalized color component value for the 532 * specified component. For TYPE_XYZ spaces, this method returns 533 * minimum values of 0.0 for all components. For TYPE_Lab spaces, 534 * this method returns 0.0 for L and -128.0 for a and b components. 535 * This is consistent with the encoding of the XYZ and Lab Profile 536 * Connection Spaces in the ICC specification. For all other types, this 537 * method returns 0.0 for all components. When using an ICC_ColorSpace 538 * with a profile that requires different minimum component values, 539 * it is necessary to subclass this class and override this method. 540 * @param component The component index. 541 * @return The minimum normalized component value. 542 * @throws IllegalArgumentException if component is less than 0 or 543 * greater than numComponents - 1. 544 * @since 1.4 545 */ 546 public float getMinValue(int component) { 547 if ((component < 0) || (component > this.getNumComponents() - 1)) { 548 throw new IllegalArgumentException( 549 "Component index out of range: " + component); 550 } 551 return minVal[component]; 552 } 553 554 /** 555 * Returns the maximum normalized color component value for the 556 * specified component. For TYPE_XYZ spaces, this method returns 557 * maximum values of 1.0 + (32767.0 / 32768.0) for all components. 558 * For TYPE_Lab spaces, 559 * this method returns 100.0 for L and 127.0 for a and b components. 560 * This is consistent with the encoding of the XYZ and Lab Profile 561 * Connection Spaces in the ICC specification. For all other types, this 562 * method returns 1.0 for all components. When using an ICC_ColorSpace 563 * with a profile that requires different maximum component values, 564 * it is necessary to subclass this class and override this method. 565 * @param component The component index. 566 * @return The maximum normalized component value. 567 * @throws IllegalArgumentException if component is less than 0 or 568 * greater than numComponents - 1. 569 * @since 1.4 570 */ 571 public float getMaxValue(int component) { 572 if ((component < 0) || (component > this.getNumComponents() - 1)) { 573 throw new IllegalArgumentException( 574 "Component index out of range: " + component); 575 } 576 return maxVal[component]; 577 } 578 579 private void setMinMax() { 580 int nc = this.getNumComponents(); 581 int type = this.getType(); 582 minVal = new float[nc]; 583 maxVal = new float[nc]; 584 if (type == ColorSpace.TYPE_Lab) { 585 minVal[0] = 0.0f; // L 586 maxVal[0] = 100.0f; 587 minVal[1] = -128.0f; // a 588 maxVal[1] = 127.0f; 589 minVal[2] = -128.0f; // b 590 maxVal[2] = 127.0f; 591 } else if (type == ColorSpace.TYPE_XYZ) { 592 minVal[0] = minVal[1] = minVal[2] = 0.0f; // X, Y, Z 593 maxVal[0] = maxVal[1] = maxVal[2] = 1.0f + (32767.0f/ 32768.0f); 594 } else { |