当前位置: 首页>>代码示例>>Java>>正文


Java Raster.createCompatibleWritableRaster方法代码示例

本文整理汇总了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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:TexturePaintContext.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:TexturePaintContext.java

示例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();
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:67,代码来源:JPEGImageWriter.java


注:本文中的java.awt.image.Raster.createCompatibleWritableRaster方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。