1 7 8 package javax.imageio.plugins.jpeg; 9 10 import javax.imageio.ImageReadParam ; 11 12 64 public class JPEGImageReadParam extends ImageReadParam { 65 66 private JPEGQTable [] qTables = null; 67 private JPEGHuffmanTable [] DCHuffmanTables = null; 68 private JPEGHuffmanTable [] ACHuffmanTables = null; 69 70 73 public JPEGImageReadParam() { 74 super(); 75 } 76 77 82 public boolean areTablesSet() { 83 return (qTables != null); 84 } 85 86 107 public void setDecodeTables(JPEGQTable [] qTables, 108 JPEGHuffmanTable [] DCHuffmanTables, 109 JPEGHuffmanTable [] ACHuffmanTables) { 110 if ((qTables == null) || 111 (DCHuffmanTables == null) || 112 (ACHuffmanTables == null) || 113 (qTables.length > 4) || 114 (DCHuffmanTables.length > 4) || 115 (ACHuffmanTables.length > 4) || 116 (DCHuffmanTables.length != ACHuffmanTables.length)) { 117 throw new IllegalArgumentException 118 ("Invalid JPEG table arrays"); 119 } 120 this.qTables = (JPEGQTable [])qTables.clone(); 121 this.DCHuffmanTables = (JPEGHuffmanTable [])DCHuffmanTables.clone(); 122 this.ACHuffmanTables = (JPEGHuffmanTable [])ACHuffmanTables.clone(); 123 } 124 125 131 public void unsetDecodeTables() { 132 this.qTables = null; 133 this.DCHuffmanTables = null; 134 this.ACHuffmanTables = null; 135 } 136 137 147 public JPEGQTable [] getQTables() { 148 return (qTables != null) ? (JPEGQTable [])qTables.clone() : null; 149 } 150 151 161 public JPEGHuffmanTable [] getDCHuffmanTables() { 162 return (DCHuffmanTables != null) 163 ? (JPEGHuffmanTable [])DCHuffmanTables.clone() 164 : null; 165 } 166 167 177 public JPEGHuffmanTable [] getACHuffmanTables() { 178 return (ACHuffmanTables != null) 179 ? (JPEGHuffmanTable [])ACHuffmanTables.clone() 180 : null; 181 } 182 } 183 | Popular Tags |