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


Java WritableRaster.createWritableChild方法代码示例

本文整理汇总了Java中java.awt.image.WritableRaster.createWritableChild方法的典型用法代码示例。如果您正苦于以下问题:Java WritableRaster.createWritableChild方法的具体用法?Java WritableRaster.createWritableChild怎么用?Java WritableRaster.createWritableChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.image.WritableRaster的用法示例。


在下文中一共展示了WritableRaster.createWritableChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Blit

import java.awt.image.WritableRaster; //导入方法依赖的package包/类
public void Blit(SurfaceData srcData,
                 SurfaceData dstData,
                 Composite comp,
                 Region clip,
                 int srcx, int srcy,
                 int dstx, int dsty,
                 int width, int height)
{
    ColorModel srcCM = srcData.getColorModel();
    ColorModel dstCM = dstData.getColorModel();
    // REMIND: Should get RenderingHints from sg2d
    CompositeContext ctx = comp.createContext(srcCM, dstCM,
                                              new RenderingHints(null));
    Raster srcRas = srcData.getRaster(srcx, srcy, width, height);
    WritableRaster dstRas =
        (WritableRaster) dstData.getRaster(dstx, dsty, width, height);

    if (clip == null) {
        clip = Region.getInstanceXYWH(dstx, dsty, width, height);
    }
    int span[] = {dstx, dsty, dstx+width, dsty+height};
    SpanIterator si = clip.getSpanIterator(span);
    srcx -= dstx;
    srcy -= dsty;
    while (si.nextSpan(span)) {
        int w = span[2] - span[0];
        int h = span[3] - span[1];
        Raster tmpSrcRas = srcRas.createChild(srcx + span[0], srcy + span[1],
                                              w, h, 0, 0, null);
        WritableRaster tmpDstRas = dstRas.createWritableChild(span[0], span[1],
                                                              w, h, 0, 0, null);
        ctx.compose(tmpSrcRas, tmpDstRas, tmpDstRas);
    }
    ctx.dispose();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:36,代码来源:Blit.java

示例2: read

import java.awt.image.WritableRaster; //导入方法依赖的package包/类
public synchronized WritableRaster read(Rectangle rect) {
    tileParam.setSourceRegion(isSubsampling ?
                              new Rectangle(subsampleX*rect.x,
                                            subsampleY*rect.y,
                                            subsampleX*rect.width,
                                            subsampleY*rect.height) :
                              rect);

    try {
        BufferedImage bi = reader.read(imageIndex, tileParam);
        WritableRaster ras = bi.getRaster();
        return ras.createWritableChild(0, 0,
                                       ras.getWidth(), ras.getHeight(),
                                       rect.x, rect.y,
                                       null);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:TIFFRenderedImage.java


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