當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。