3636package java .awt .color ;
3737
3838import java .io .IOException ;
39+ import java .io .ObjectInputStream ;
3940import java .io .Serial ;
4041
4142import sun .java2d .cmm .CMSManager ;
@@ -130,18 +131,18 @@ public class ICC_ColorSpace extends ColorSpace {
130131 * @throws IllegalArgumentException if profile is inappropriate for
131132 * representing a {@code ColorSpace}
132133 */
133- public ICC_ColorSpace (ICC_Profile profile ) {
134- super (profile .getColorSpaceType (), profile .getNumComponents ());
134+ public ICC_ColorSpace (ICC_Profile profile ) {
135+ super (profile .getColorSpaceType (), profile .getNumComponents ());
135136
136137 int profileClass = profile .getProfileClass ();
137138
138139 /* REMIND - is NAMEDCOLOR OK? */
139- if (( profileClass != ICC_Profile .CLASS_INPUT ) &&
140- ( profileClass != ICC_Profile .CLASS_DISPLAY ) &&
141- ( profileClass != ICC_Profile .CLASS_OUTPUT ) &&
142- ( profileClass != ICC_Profile .CLASS_COLORSPACECONVERSION ) &&
143- ( profileClass != ICC_Profile .CLASS_NAMEDCOLOR ) &&
144- ( profileClass != ICC_Profile .CLASS_ABSTRACT ) ) {
140+ if (profileClass != ICC_Profile .CLASS_INPUT
141+ && profileClass != ICC_Profile .CLASS_DISPLAY
142+ && profileClass != ICC_Profile .CLASS_OUTPUT
143+ && profileClass != ICC_Profile .CLASS_COLORSPACECONVERSION
144+ && profileClass != ICC_Profile .CLASS_NAMEDCOLOR
145+ && profileClass != ICC_Profile .CLASS_ABSTRACT ) {
145146 throw new IllegalArgumentException ("Invalid profile type" );
146147 }
147148
@@ -158,9 +159,8 @@ public ICC_ColorSpace (ICC_Profile profile) {
158159 * @throws IOException if an I/O error occurs
159160 */
160161 @ Serial
161- private void readObject (java .io .ObjectInputStream s )
162- throws ClassNotFoundException , java .io .IOException {
163-
162+ private void readObject (ObjectInputStream s )
163+ throws ClassNotFoundException , IOException {
164164 s .defaultReadObject ();
165165 if (thisProfile == null ) {
166166 thisProfile = ICC_Profile .getInstance (ColorSpace .CS_sRGB );
@@ -222,7 +222,7 @@ public float[] toRGB(float[] colorvalue) {
222222 ((colorvalue [i ] - minVal [i ]) * invDiffMinMax [i ] + 0.5f );
223223 }
224224 tmp = this2srgb .colorConvert (tmp , null );
225- float [] result = new float [3 ];
225+ float [] result = new float [3 ];
226226 for (int i = 0 ; i < 3 ; i ++) {
227227 result [i ] = ((float ) (tmp [i ] & 0xffff )) / 65535.0f ;
228228 }
@@ -273,7 +273,7 @@ public float[] fromRGB(float[] rgbvalue) {
273273 }
274274 tmp = srgb2this .colorConvert (tmp , null );
275275 int nc = this .getNumComponents ();
276- float [] result = new float [nc ];
276+ float [] result = new float [nc ];
277277 for (int i = 0 ; i < nc ; i ++) {
278278 result [i ] = (((float ) (tmp [i ] & 0xffff )) / 65535.0f ) *
279279 diffMinMax [i ] + minVal [i ];
@@ -414,7 +414,7 @@ public float[] toCIEXYZ(float[] colorvalue) {
414414 tmp = this2xyz .colorConvert (tmp , null );
415415 float ALMOST_TWO = 1.0f + (32767.0f / 32768.0f );
416416 // For CIEXYZ, min = 0.0, max = ALMOST_TWO for all components
417- float [] result = new float [3 ];
417+ float [] result = new float [3 ];
418418 for (int i = 0 ; i < 3 ; i ++) {
419419 result [i ] = (((float ) (tmp [i ] & 0xffff )) / 65535.0f ) * ALMOST_TWO ;
420420 }
@@ -554,7 +554,7 @@ public float[] fromCIEXYZ(float[] colorvalue) {
554554 }
555555 tmp = xyz2this .colorConvert (tmp , null );
556556 int nc = this .getNumComponents ();
557- float [] result = new float [nc ];
557+ float [] result = new float [nc ];
558558 for (int i = 0 ; i < nc ; i ++) {
559559 result [i ] = (((float ) (tmp [i ] & 0xffff )) / 65535.0f ) *
560560 diffMinMax [i ] + minVal [i ];
@@ -621,7 +621,7 @@ private void setMinMax() {
621621 maxVal [2 ] = 127.0f ;
622622 } else if (type == ColorSpace .TYPE_XYZ ) {
623623 minVal [0 ] = minVal [1 ] = minVal [2 ] = 0.0f ; // X, Y, Z
624- maxVal [0 ] = maxVal [1 ] = maxVal [2 ] = 1.0f + (32767.0f / 32768.0f );
624+ maxVal [0 ] = maxVal [1 ] = maxVal [2 ] = 1.0f + (32767.0f / 32768.0f );
625625 } else {
626626 for (int i = 0 ; i < nc ; i ++) {
627627 minVal [i ] = 0.0f ;
@@ -642,5 +642,4 @@ private void setComponentScaling() {
642642 }
643643 needScaleInit = false ;
644644 }
645-
646645}
0 commit comments