931 list.add(getImageType(JPEG.JCS_RGB)); |
931 list.add(getImageType(JPEG.JCS_RGB)); |
932 break; |
932 break; |
933 case JPEG.JCS_RGB: |
933 case JPEG.JCS_RGB: |
934 list.add(raw); |
934 list.add(raw); |
935 list.add(getImageType(JPEG.JCS_GRAYSCALE)); |
935 list.add(getImageType(JPEG.JCS_GRAYSCALE)); |
936 list.add(getImageType(JPEG.JCS_YCC)); |
|
937 break; |
|
938 case JPEG.JCS_RGBA: |
|
939 list.add(raw); |
|
940 break; |
|
941 case JPEG.JCS_YCC: |
|
942 if (raw != null) { // Might be null if PYCC.pf not installed |
|
943 list.add(raw); |
|
944 list.add(getImageType(JPEG.JCS_RGB)); |
|
945 } |
|
946 break; |
|
947 case JPEG.JCS_YCCA: |
|
948 if (raw != null) { // Might be null if PYCC.pf not installed |
|
949 list.add(raw); |
|
950 } |
|
951 break; |
936 break; |
952 case JPEG.JCS_YCbCr: |
937 case JPEG.JCS_YCbCr: |
953 // As there is no YCbCr ColorSpace, we can't support |
938 // As there is no YCbCr ColorSpace, we can't support |
954 // the raw type. |
939 // the raw type. |
955 |
940 |
1061 (cm.getNumComponents() == numComponents)) { |
1040 (cm.getNumComponents() == numComponents)) { |
1062 // Target isn't sRGB, so convert from sRGB to the target |
1041 // Target isn't sRGB, so convert from sRGB to the target |
1063 convert = new ColorConvertOp(JPEG.JCS.sRGB, cs, null); |
1042 convert = new ColorConvertOp(JPEG.JCS.sRGB, cs, null); |
1064 } else if (csType != ColorSpace.TYPE_RGB) { |
1043 } else if (csType != ColorSpace.TYPE_RGB) { |
1065 throw new IIOException("Incompatible color conversion"); |
1044 throw new IIOException("Incompatible color conversion"); |
1066 } |
|
1067 break; |
|
1068 case JPEG.JCS_RGBA: |
|
1069 // No conversions available; image must be RGBA |
|
1070 if ((csType != ColorSpace.TYPE_RGB) || |
|
1071 (cm.getNumComponents() != numComponents)) { |
|
1072 throw new IIOException("Incompatible color conversion"); |
|
1073 } |
|
1074 break; |
|
1075 case JPEG.JCS_YCC: |
|
1076 { |
|
1077 ColorSpace YCC = JPEG.JCS.getYCC(); |
|
1078 if (YCC == null) { // We can't do YCC at all |
|
1079 throw new IIOException("Incompatible color conversion"); |
|
1080 } |
|
1081 if ((cs != YCC) && |
|
1082 (cm.getNumComponents() == numComponents)) { |
|
1083 convert = new ColorConvertOp(YCC, cs, null); |
|
1084 } |
|
1085 } |
|
1086 break; |
|
1087 case JPEG.JCS_YCCA: |
|
1088 { |
|
1089 ColorSpace YCC = JPEG.JCS.getYCC(); |
|
1090 // No conversions available; image must be YCCA |
|
1091 if ((YCC == null) || // We can't do YCC at all |
|
1092 (cs != YCC) || |
|
1093 (cm.getNumComponents() != numComponents)) { |
|
1094 throw new IIOException("Incompatible color conversion"); |
|
1095 } |
|
1096 } |
1045 } |
1097 break; |
1046 break; |
1098 default: |
1047 default: |
1099 // Anything else we can't handle at all |
1048 // Anything else we can't handle at all |
1100 throw new IIOException("Incompatible color conversion"); |
1049 throw new IIOException("Incompatible color conversion"); |
1927 return ImageTypeSpecifier.createInterleaved(JPEG.JCS.sRGB, |
1876 return ImageTypeSpecifier.createInterleaved(JPEG.JCS.sRGB, |
1928 JPEG.bOffsRGB, |
1877 JPEG.bOffsRGB, |
1929 DataBuffer.TYPE_BYTE, |
1878 DataBuffer.TYPE_BYTE, |
1930 false, |
1879 false, |
1931 false); |
1880 false); |
1932 case JPEG.JCS_RGBA: |
|
1933 return ImageTypeSpecifier.createPacked(JPEG.JCS.sRGB, |
|
1934 0xff000000, |
|
1935 0x00ff0000, |
|
1936 0x0000ff00, |
|
1937 0x000000ff, |
|
1938 DataBuffer.TYPE_INT, |
|
1939 false); |
|
1940 case JPEG.JCS_YCC: |
|
1941 if (JPEG.JCS.getYCC() != null) { |
|
1942 return ImageTypeSpecifier.createInterleaved( |
|
1943 JPEG.JCS.getYCC(), |
|
1944 JPEG.bandOffsets[2], |
|
1945 DataBuffer.TYPE_BYTE, |
|
1946 false, |
|
1947 false); |
|
1948 } else { |
|
1949 return null; |
|
1950 } |
|
1951 case JPEG.JCS_YCCA: |
|
1952 if (JPEG.JCS.getYCC() != null) { |
|
1953 return ImageTypeSpecifier.createInterleaved( |
|
1954 JPEG.JCS.getYCC(), |
|
1955 JPEG.bandOffsets[3], |
|
1956 DataBuffer.TYPE_BYTE, |
|
1957 true, |
|
1958 false); |
|
1959 } else { |
|
1960 return null; |
|
1961 } |
|
1962 default: |
1881 default: |
1963 return null; |
1882 return null; |
1964 } |
1883 } |
1965 } |
1884 } |
1966 } |
1885 } |