1 7 8 package java.awt.image; 9 10 17 18 public final class DataBufferFloat extends DataBuffer { 19 20 21 float bankdata[][]; 22 23 24 float data[]; 25 26 32 public DataBufferFloat(int size) { 33 super(TYPE_FLOAT, size); 34 data = new float[size]; 35 bankdata = new float[1][]; 36 bankdata[0] = data; 37 } 38 39 49 public DataBufferFloat(int size, int numBanks) { 50 super(TYPE_FLOAT, size, numBanks); 51 bankdata = new float[numBanks][]; 52 for (int i= 0; i < numBanks; i++) { 53 bankdata[i] = new float[size]; 54 } 55 data = bankdata[0]; 56 } 57 58 69 public DataBufferFloat(float dataArray[], int size) { 70 super(TYPE_FLOAT, size); 71 data = dataArray; 72 bankdata = new float[1][]; 73 bankdata[0] = data; 74 } 75 76 90 public DataBufferFloat(float dataArray[], int size, int offset) { 91 super(TYPE_FLOAT, size, 1, offset); 92 data = dataArray; 93 bankdata = new float[1][]; 94 bankdata[0] = data; 95 } 96 97 108 public DataBufferFloat(float dataArray[][], int size) { 109 super(TYPE_FLOAT, size, dataArray.length); 110 bankdata = (float[][]) dataArray.clone(); 111 data = bankdata[0]; 112 } 113 114 127 public DataBufferFloat(float dataArray[][], int size, int offsets[]) { 128 super(TYPE_FLOAT, size,dataArray.length, offsets); 129 bankdata = (float[][]) dataArray.clone(); 130 data = bankdata[0]; 131 } 132 133 137 public float[] getData() { 138 return data; 139 } 140 141 146 public float[] getData(int bank) { 147 return bankdata[bank]; 148 } 149 150 154 public float[][] getBankData() { 155 return (float[][]) bankdata.clone(); 156 } 157 158 168 public int getElem(int i) { 169 return (int)(data[i+offset]); 170 } 171 172 183 public int getElem(int bank, int i) { 184 return (int)(bankdata[bank][i+offsets[bank]]); 185 } 186 187 196 public void setElem(int i, int val) { 197 data[i+offset] = (float)val; 198 } 199 200 210 public void setElem(int bank, int i, int val) { 211 bankdata[bank][i+offsets[bank]] = (float)val; 212 } 213 214 224 public float getElemFloat(int i) { 225 return data[i+offset]; 226 } 227 228 239 public float getElemFloat(int bank, int i) { 240 return bankdata[bank][i+offsets[bank]]; 241 } 242 243 252 public void setElemFloat(int i, float val) { 253 data[i+offset] = val; 254 } 255 256 266 public void setElemFloat(int bank, int i, float val) { 267 bankdata[bank][i+offsets[bank]] = val; 268 } 269 270 280 public double getElemDouble(int i) { 281 return (double)data[i+offset]; 282 } 283 284 295 public double getElemDouble(int bank, int i) { 296 return (double)bankdata[bank][i+offsets[bank]]; 297 } 298 299 308 public void setElemDouble(int i, double val) { 309 data[i+offset] = (float)val; 310 } 311 312 322 public void setElemDouble(int bank, int i, double val) { 323 bankdata[bank][i+offsets[bank]] = (float)val; 324 } 325 } 326 | Popular Tags |