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

Print this page




 377      *       WritableRaster dstRaster;
 378      *       for (int b = 0; b < srcRaster.getNumBands(); b++) {
 379      *           dstRaster.setSample(x, y, b, srcRaster.getSample(x, y, b));
 380      *       }
 381      * }</pre>
 382      * Thus, when copying an integral type source to an integral type
 383      * destination, if the source sample size is greater than the destination
 384      * sample size for a particular band, the high order bits of the source
 385      * sample are truncated.  If the source sample size is less than the
 386      * destination size for a particular band, the high order bits of the
 387      * destination are zero-extended or sign-extended depending on whether
 388      * srcRaster's SampleModel treats the sample as a signed or unsigned
 389      * quantity.
 390      * <p>
 391      * When copying a float or double source to an integral type destination,
 392      * each source sample is cast to the destination type.  When copying an
 393      * integral type source to a float or double destination, the source
 394      * is first converted to a 32-bit int (if necessary), using the above
 395      * rules for integral types, and then the int is cast to float or
 396      * double.
 397      * <p>
 398      * @param srcRaster  The  Raster from which to copy pixels.
 399      *
 400      * @throws NullPointerException if srcRaster is null.
 401      */
 402     public void setRect(Raster srcRaster) {
 403         setRect(0,0,srcRaster);
 404     }
 405 
 406     /**
 407      * Copies pixels from Raster srcRaster to this WritableRaster.
 408      * For each (x, y) address in srcRaster, the corresponding pixel
 409      * is copied to address (x+dx, y+dy) in this WritableRaster,
 410      * unless (x+dx, y+dy) falls outside the bounds of this raster.
 411      * srcRaster must have the same number of bands as this WritableRaster.
 412      * The copy is a simple copy of source samples to the corresponding
 413      * destination samples.  For details, see
 414      * {@link WritableRaster#setRect(Raster)}.
 415      *
 416      * @param dx        The X translation factor from src space to dst space
 417      *                  of the copy.




 377      *       WritableRaster dstRaster;
 378      *       for (int b = 0; b < srcRaster.getNumBands(); b++) {
 379      *           dstRaster.setSample(x, y, b, srcRaster.getSample(x, y, b));
 380      *       }
 381      * }</pre>
 382      * Thus, when copying an integral type source to an integral type
 383      * destination, if the source sample size is greater than the destination
 384      * sample size for a particular band, the high order bits of the source
 385      * sample are truncated.  If the source sample size is less than the
 386      * destination size for a particular band, the high order bits of the
 387      * destination are zero-extended or sign-extended depending on whether
 388      * srcRaster's SampleModel treats the sample as a signed or unsigned
 389      * quantity.
 390      * <p>
 391      * When copying a float or double source to an integral type destination,
 392      * each source sample is cast to the destination type.  When copying an
 393      * integral type source to a float or double destination, the source
 394      * is first converted to a 32-bit int (if necessary), using the above
 395      * rules for integral types, and then the int is cast to float or
 396      * double.
 397      *
 398      * @param srcRaster  The  Raster from which to copy pixels.
 399      *
 400      * @throws NullPointerException if srcRaster is null.
 401      */
 402     public void setRect(Raster srcRaster) {
 403         setRect(0,0,srcRaster);
 404     }
 405 
 406     /**
 407      * Copies pixels from Raster srcRaster to this WritableRaster.
 408      * For each (x, y) address in srcRaster, the corresponding pixel
 409      * is copied to address (x+dx, y+dy) in this WritableRaster,
 410      * unless (x+dx, y+dy) falls outside the bounds of this raster.
 411      * srcRaster must have the same number of bands as this WritableRaster.
 412      * The copy is a simple copy of source samples to the corresponding
 413      * destination samples.  For details, see
 414      * {@link WritableRaster#setRect(Raster)}.
 415      *
 416      * @param dx        The X translation factor from src space to dst space
 417      *                  of the copy.