src/share/classes/java/awt/image/DataBufferDouble.java

Print this page




 137     }
 138 
 139     /**
 140      * Constructs a <code>double</code>-based <code>DataBuffer</code>
 141      * with the specified data arrays.  Only the first
 142      * <code>size</code> elements of each array are available for use
 143      * by this <code>DataBuffer</code>.  The number of banks will be
 144      * equal <code>to dataArray.length</code>.
 145      * <p>
 146      * Note that {@code DataBuffer} objects created by this constructor
 147      * may be incompatible with <a href="#optimizations">performance
 148      * optimizations</a> used by some implementations (such as caching
 149      * an associated image in video memory).
 150      *
 151      * @param dataArray An array of arrays of <code>double</code>s to be
 152      *        used as the banks of this <code>DataBuffer</code>.
 153      * @param size The number of elements of each array to be used.
 154      */
 155     public DataBufferDouble(double dataArray[][], int size) {
 156         super(UNTRACKABLE, TYPE_DOUBLE, size, dataArray.length);
 157         bankdata = (double[][]) dataArray.clone();
 158         data = bankdata[0];
 159     }
 160 
 161     /**
 162      * Constructs a <code>double</code>-based <code>DataBuffer</code>
 163      * with the specified data arrays, size, and per-bank offsets.
 164      * The number of banks is equal to dataArray.length.  Each array
 165      * must be at least as large as <code>size</code> plus the
 166      * corresponding offset.  There must be an entry in the
 167      * <code>offsets</code> array for each data array.
 168      * <p>
 169      * Note that {@code DataBuffer} objects created by this constructor
 170      * may be incompatible with <a href="#optimizations">performance
 171      * optimizations</a> used by some implementations (such as caching
 172      * an associated image in video memory).
 173      *
 174      * @param dataArray An array of arrays of <code>double</code>s to be
 175      *        used as the banks of this <code>DataBuffer</code>.
 176      * @param size The number of elements of each array to be used.
 177      * @param offsets An array of integer offsets, one for each bank.
 178      */
 179     public DataBufferDouble(double dataArray[][], int size, int offsets[]) {
 180         super(UNTRACKABLE, TYPE_DOUBLE, size, dataArray.length, offsets);
 181         bankdata = (double[][]) dataArray.clone();
 182         data = bankdata[0];
 183     }
 184 
 185     /**
 186      * Returns the default (first) <code>double</code> data array.
 187      * <p>
 188      * Note that calling this method may cause this {@code DataBuffer}
 189      * object to be incompatible with <a href="#optimizations">performance
 190      * optimizations</a> used by some implementations (such as caching
 191      * an associated image in video memory).
 192      *
 193      * @return the first double data array.
 194      */
 195     public double[] getData() {
 196         theTrackable.setUntrackable();
 197         return data;
 198     }
 199 
 200     /**
 201      * Returns the data array for the specified bank.


 208      * @param bank the data array
 209      * @return the data array specified by <code>bank</code>.
 210      */
 211     public double[] getData(int bank) {
 212         theTrackable.setUntrackable();
 213         return bankdata[bank];
 214     }
 215 
 216     /**
 217      * Returns the data array for all banks.
 218      * <p>
 219      * Note that calling this method may cause this {@code DataBuffer}
 220      * object to be incompatible with <a href="#optimizations">performance
 221      * optimizations</a> used by some implementations (such as caching
 222      * an associated image in video memory).
 223      *
 224      * @return all data arrays from this data buffer.
 225      */
 226     public double[][] getBankData() {
 227         theTrackable.setUntrackable();
 228         return (double[][]) bankdata.clone();
 229     }
 230 
 231     /**
 232      * Returns the requested data array element from the first
 233      * (default) bank as an <code>int</code>.
 234      *
 235      * @param i The desired data array element.
 236      * @return The data entry as an <code>int</code>.
 237      * @see #setElem(int, int)
 238      * @see #setElem(int, int, int)
 239      */
 240     public int getElem(int i) {
 241         return (int)(data[i+offset]);
 242     }
 243 
 244     /**
 245      * Returns the requested data array element from the specified
 246      * bank as an <code>int</code>.
 247      *
 248      * @param bank The bank number.




 137     }
 138 
 139     /**
 140      * Constructs a <code>double</code>-based <code>DataBuffer</code>
 141      * with the specified data arrays.  Only the first
 142      * <code>size</code> elements of each array are available for use
 143      * by this <code>DataBuffer</code>.  The number of banks will be
 144      * equal <code>to dataArray.length</code>.
 145      * <p>
 146      * Note that {@code DataBuffer} objects created by this constructor
 147      * may be incompatible with <a href="#optimizations">performance
 148      * optimizations</a> used by some implementations (such as caching
 149      * an associated image in video memory).
 150      *
 151      * @param dataArray An array of arrays of <code>double</code>s to be
 152      *        used as the banks of this <code>DataBuffer</code>.
 153      * @param size The number of elements of each array to be used.
 154      */
 155     public DataBufferDouble(double dataArray[][], int size) {
 156         super(UNTRACKABLE, TYPE_DOUBLE, size, dataArray.length);
 157         bankdata = dataArray.clone();
 158         data = bankdata[0];
 159     }
 160 
 161     /**
 162      * Constructs a <code>double</code>-based <code>DataBuffer</code>
 163      * with the specified data arrays, size, and per-bank offsets.
 164      * The number of banks is equal to dataArray.length.  Each array
 165      * must be at least as large as <code>size</code> plus the
 166      * corresponding offset.  There must be an entry in the
 167      * <code>offsets</code> array for each data array.
 168      * <p>
 169      * Note that {@code DataBuffer} objects created by this constructor
 170      * may be incompatible with <a href="#optimizations">performance
 171      * optimizations</a> used by some implementations (such as caching
 172      * an associated image in video memory).
 173      *
 174      * @param dataArray An array of arrays of <code>double</code>s to be
 175      *        used as the banks of this <code>DataBuffer</code>.
 176      * @param size The number of elements of each array to be used.
 177      * @param offsets An array of integer offsets, one for each bank.
 178      */
 179     public DataBufferDouble(double dataArray[][], int size, int offsets[]) {
 180         super(UNTRACKABLE, TYPE_DOUBLE, size, dataArray.length, offsets);
 181         bankdata = dataArray.clone();
 182         data = bankdata[0];
 183     }
 184 
 185     /**
 186      * Returns the default (first) <code>double</code> data array.
 187      * <p>
 188      * Note that calling this method may cause this {@code DataBuffer}
 189      * object to be incompatible with <a href="#optimizations">performance
 190      * optimizations</a> used by some implementations (such as caching
 191      * an associated image in video memory).
 192      *
 193      * @return the first double data array.
 194      */
 195     public double[] getData() {
 196         theTrackable.setUntrackable();
 197         return data;
 198     }
 199 
 200     /**
 201      * Returns the data array for the specified bank.


 208      * @param bank the data array
 209      * @return the data array specified by <code>bank</code>.
 210      */
 211     public double[] getData(int bank) {
 212         theTrackable.setUntrackable();
 213         return bankdata[bank];
 214     }
 215 
 216     /**
 217      * Returns the data array for all banks.
 218      * <p>
 219      * Note that calling this method may cause this {@code DataBuffer}
 220      * object to be incompatible with <a href="#optimizations">performance
 221      * optimizations</a> used by some implementations (such as caching
 222      * an associated image in video memory).
 223      *
 224      * @return all data arrays from this data buffer.
 225      */
 226     public double[][] getBankData() {
 227         theTrackable.setUntrackable();
 228         return bankdata.clone();
 229     }
 230 
 231     /**
 232      * Returns the requested data array element from the first
 233      * (default) bank as an <code>int</code>.
 234      *
 235      * @param i The desired data array element.
 236      * @return The data entry as an <code>int</code>.
 237      * @see #setElem(int, int)
 238      * @see #setElem(int, int, int)
 239      */
 240     public int getElem(int i) {
 241         return (int)(data[i+offset]);
 242     }
 243 
 244     /**
 245      * Returns the requested data array element from the specified
 246      * bank as an <code>int</code>.
 247      *
 248      * @param bank The bank number.