348 |
{ |
{ |
349 |
return getComponents(getPixelFromArray(pixel), components, offset); |
return getComponents(getPixelFromArray(pixel), components, offset); |
350 |
} |
} |
351 |
|
|
352 |
|
/** |
353 |
|
* Creates a <code>WriteableRaster</code> that has a <code>SampleModel</code> |
354 |
|
* that is compatible with this <code>ColorModel</code>. |
355 |
|
* |
356 |
|
* @param w the width of the writeable raster to create |
357 |
|
* @param h the height of the writeable raster to create |
358 |
|
* |
359 |
|
* @throws IllegalArgumentException if <code>w</code> or <code>h</code> |
360 |
|
* is less than or equal to zero |
361 |
|
*/ |
362 |
public final WritableRaster createCompatibleWritableRaster(int w, int h) |
public final WritableRaster createCompatibleWritableRaster(int w, int h) |
363 |
{ |
{ |
364 |
|
// Sun also makes this check here. |
365 |
|
if(w <= 0 || h <= 0) |
366 |
|
throw new IllegalArgumentException("width (=" + w + ") and height (=" |
367 |
|
+ h + ") must be > 0"); |
368 |
|
|
369 |
SampleModel sm = createCompatibleSampleModel(w, h); |
SampleModel sm = createCompatibleSampleModel(w, h); |
370 |
Point origin = new Point(0, 0); |
Point origin = new Point(0, 0); |
371 |
return Raster.createWritableRaster(sm, origin); |
return Raster.createWritableRaster(sm, origin); |
433 |
return super.toString(); |
return super.toString(); |
434 |
} |
} |
435 |
} |
} |
436 |
|
|