本文整理匯總了Java中java.awt.image.Raster.createCompatibleWritableRaster方法的典型用法代碼示例。如果您正苦於以下問題:Java Raster.createCompatibleWritableRaster方法的具體用法?Java Raster.createCompatibleWritableRaster怎麽用?Java Raster.createCompatibleWritableRaster使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt.image.Raster
的用法示例。
在下文中一共展示了Raster.createCompatibleWritableRaster方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: makeByteRaster
import java.awt.image.Raster; //導入方法依賴的package包/類
synchronized static WritableRaster makeByteRaster(Raster srcRas,
int w, int h)
{
if (byteRasRef != null) {
WritableRaster wr = (WritableRaster) byteRasRef.get();
if (wr != null && wr.getWidth() >= w && wr.getHeight() >= h) {
byteRasRef = null;
return wr;
}
}
// If we are going to cache this Raster, make it non-tiny
if (w <= 32 && h <= 32) {
w = h = 32;
}
return srcRas.createCompatibleWritableRaster(w, h);
}
示例2: makeByteRaster
import java.awt.image.Raster; //導入方法依賴的package包/類
static synchronized WritableRaster makeByteRaster(Raster srcRas,
int w, int h)
{
if (byteRasRef != null) {
WritableRaster wr = (WritableRaster) byteRasRef.get();
if (wr != null && wr.getWidth() >= w && wr.getHeight() >= h) {
byteRasRef = null;
return wr;
}
}
// If we are going to cache this Raster, make it non-tiny
if (w <= 32 && h <= 32) {
w = h = 32;
}
return srcRas.createCompatibleWritableRaster(w, h);
}
示例3: grabPixels
import java.awt.image.Raster; //導入方法依賴的package包/類
/**
* Put the scanline y of the source ROI view Raster into the
* 1-line Raster for writing. This handles ROI and band
* rearrangements, and expands indexed images. Subsampling is
* done in the native code.
* This is called by the native code.
*/
private void grabPixels(int y) {
Raster sourceLine = null;
if (indexed) {
sourceLine = srcRas.createChild(sourceXOffset,
sourceYOffset+y,
sourceWidth, 1,
0, 0,
new int [] {0});
// If the image has BITMASK transparency, we need to make sure
// it gets converted to 32-bit ARGB, because the JPEG encoder
// relies upon the full 8-bit alpha channel.
boolean forceARGB =
(indexCM.getTransparency() != Transparency.OPAQUE);
BufferedImage temp = indexCM.convertToIntDiscrete(sourceLine,
forceARGB);
sourceLine = temp.getRaster();
} else {
sourceLine = srcRas.createChild(sourceXOffset,
sourceYOffset+y,
sourceWidth, 1,
0, 0,
srcBands);
}
if (convertTosRGB) {
if (debug) {
System.out.println("Converting to sRGB");
}
// The first time through, converted is null, so
// a new raster is allocated. It is then reused
// on subsequent lines.
converted = convertOp.filter(sourceLine, converted);
sourceLine = converted;
}
if (isAlphaPremultiplied) {
WritableRaster wr = sourceLine.createCompatibleWritableRaster();
int[] data = null;
data = sourceLine.getPixels(sourceLine.getMinX(), sourceLine.getMinY(),
sourceLine.getWidth(), sourceLine.getHeight(),
data);
wr.setPixels(sourceLine.getMinX(), sourceLine.getMinY(),
sourceLine.getWidth(), sourceLine.getHeight(),
data);
srcCM.coerceData(wr, false);
sourceLine = wr.createChild(wr.getMinX(), wr.getMinY(),
wr.getWidth(), wr.getHeight(),
0, 0,
srcBands);
}
raster.setRect(sourceLine);
if ((y > 7) && (y%8 == 0)) { // Every 8 scanlines
cbLock.lock();
try {
processImageProgress((float) y / (float) sourceHeight * 100.0F);
} finally {
cbLock.unlock();
}
}
}