45 private static final String[] names = { "png", "PNG" };
46
47 private static final String[] suffixes = { "png" };
48
49 private static final String[] MIMETypes = { "image/png", "image/x-png" };
50
51 private static final String writerClassName =
52 "com.sun.imageio.plugins.png.PNGImageWriter";
53
54 private static final String[] readerSpiNames = {
55 "com.sun.imageio.plugins.png.PNGImageReaderSpi"
56 };
57
58 public PNGImageWriterSpi() {
59 super(vendorName,
60 version,
61 names,
62 suffixes,
63 MIMETypes,
64 writerClassName,
65 new Class[] { ImageOutputStream.class },
66 readerSpiNames,
67 false,
68 null, null,
69 null, null,
70 true,
71 PNGMetadata.nativeMetadataFormatName,
72 "com.sun.imageio.plugins.png.PNGMetadataFormat",
73 null, null
74 );
75 }
76
77 public boolean canEncodeImage(ImageTypeSpecifier type) {
78 SampleModel sampleModel = type.getSampleModel();
79 ColorModel colorModel = type.getColorModel();
80
81 // Find the maximum bit depth across all channels
82 int[] sampleSize = sampleModel.getSampleSize();
83 int bitDepth = sampleSize[0];
84 for (int i = 1; i < sampleSize.length; i++) {
85 if (sampleSize[i] > bitDepth) {
|
45 private static final String[] names = { "png", "PNG" };
46
47 private static final String[] suffixes = { "png" };
48
49 private static final String[] MIMETypes = { "image/png", "image/x-png" };
50
51 private static final String writerClassName =
52 "com.sun.imageio.plugins.png.PNGImageWriter";
53
54 private static final String[] readerSpiNames = {
55 "com.sun.imageio.plugins.png.PNGImageReaderSpi"
56 };
57
58 public PNGImageWriterSpi() {
59 super(vendorName,
60 version,
61 names,
62 suffixes,
63 MIMETypes,
64 writerClassName,
65 new Class<?>[] { ImageOutputStream.class },
66 readerSpiNames,
67 false,
68 null, null,
69 null, null,
70 true,
71 PNGMetadata.nativeMetadataFormatName,
72 "com.sun.imageio.plugins.png.PNGMetadataFormat",
73 null, null
74 );
75 }
76
77 public boolean canEncodeImage(ImageTypeSpecifier type) {
78 SampleModel sampleModel = type.getSampleModel();
79 ColorModel colorModel = type.getColorModel();
80
81 // Find the maximum bit depth across all channels
82 int[] sampleSize = sampleModel.getSampleSize();
83 int bitDepth = sampleSize[0];
84 for (int i = 1; i < sampleSize.length; i++) {
85 if (sampleSize[i] > bitDepth) {
|