Java 类java.awt.CompositeContext 实例源码

项目:OpenJSharp    文件:Blit.java   
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();
}
项目:SyntheticWSI    文件:ModelMaker.java   
@Override
public final CompositeContext createContext(final ColorModel srcColorModel,
        final ColorModel dstColorModel, final RenderingHints hints) {
    return new CompositeContext() {

        @Override
        public final void dispose() {
            // NOP
        }

        @Override
        public final void compose(final Raster src, final Raster dstIn, final WritableRaster dstOut) {
            final Rectangle inBounds = dstIn.getBounds();
            final Rectangle outBounds = dstOut.getBounds();

            for (int yIn = inBounds.y, yOut = outBounds.y; yIn < inBounds.y + inBounds.height; ++yIn, ++yOut) {
                for (int xIn = inBounds.x, xOut = outBounds.x; xIn < inBounds.x + inBounds.width; ++xIn, ++xOut) {
                    final int[] datum = (int[]) dstIn.getDataElements(xIn, yIn, null);
                    datum[0] = (datum[0] & 0xFF000000) | (~datum[0] & 0x00FFFFFF);
                    dstOut.setDataElements(xOut, yOut, datum);
                }
            }
        }

    };
}
项目:stendhal    文件:Blend.java   
@Override
public CompositeContext createContext(ColorModel srcColorModel,
        ColorModel dstColorModel,
        RenderingHints arg2) {
    switch (mode) {
    case MULTIPLY:
        return new MultiplyContext();
    // Modes with significant creation overhead (lookup tables). Cache those
    case SOFT_LIGHT:
        CompositeContext ctx = cache.get(Mode.SOFT_LIGHT);
        if (ctx == null) {
            ctx = new BlendContext(mode, color);
            cache.put(Mode.SOFT_LIGHT, ctx);
        }
        return ctx;
    default:
        return new BlendContext(mode, color);
    }
}
项目:marlin-renderer    文件:GeneralCompositePipe.java   
@Override
public Object startSequence(SunGraphics2D sg, Shape s, Rectangle devR,
        int[] abox) {
    // warning: clone map:
    RenderingHints hints = sg.getRenderingHints();
    ColorModel model = sg.getDeviceColorModel();
    PaintContext paintContext =
            sg.paint.createContext(model, devR, s.getBounds2D(),
            sg.cloneTransform(),
            hints);
    CompositeContext compositeContext =
            sg.composite.createContext(paintContext.getColorModel(), model,
            hints);

    // BlendComposite matcher: classpath independent so use String.equals()
    boolean blendComposite = "sun.java2d.pipe.BlendComposite".equals(sg.composite.getClass().getName());

    // use ThreadLocal (to reduce memory footprint):
    final TileContext tc = tileContextThreadLocal.get();
    tc.init(sg, paintContext, compositeContext, model, blendComposite);
    return tc;
}
项目:FractalFlameV3    文件:PGraphicsJava2D.java   
/**
 * ( begin auto-generated from blendMode.xml ) This is a new reference entry for Processing 2.0.
 * It will be updated shortly. ( end auto-generated )
 * 
 * @webref Rendering
 * @param mode
 *            the blending mode to use
 */
@Override
public void blendMode(final int mode) {
    if (mode == PConstants.BLEND) {
        g2.setComposite(defaultComposite);

    } else {
        g2.setComposite(new Composite() {

            @Override
            public CompositeContext createContext(final ColorModel srcColorModel, final ColorModel dstColorModel,
                    final RenderingHints hints) {
                return new BlendingContext(mode);
            }
        });
    }
}
项目:OpenJSharp    文件:GeneralCompositePipe.java   
public TileContext(SunGraphics2D sg, PaintContext pCtx,
                   CompositeContext cCtx, ColorModel cModel) {
    sunG2D = sg;
    paintCtxt = pCtx;
    compCtxt = cCtx;
    compModel = cModel;
}
项目:OpenJSharp    文件:GeneralCompositePipe.java   
public Object startSequence(SunGraphics2D sg, Shape s, Rectangle devR,
                            int[] abox) {
    RenderingHints hints = sg.getRenderingHints();
    ColorModel model = sg.getDeviceColorModel();
    PaintContext paintContext =
        sg.paint.createContext(model, devR, s.getBounds2D(),
                               sg.cloneTransform(),
                               hints);
    CompositeContext compositeContext =
        sg.composite.createContext(paintContext.getColorModel(), model,
                                   hints);
    return new TileContext(sg, paintContext, compositeContext, model);
}
项目:jdk8u-jdk    文件:Blit.java   
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();
}
项目:jdk8u-jdk    文件:GeneralCompositePipe.java   
public TileContext(SunGraphics2D sg, PaintContext pCtx,
                   CompositeContext cCtx, ColorModel cModel) {
    sunG2D = sg;
    paintCtxt = pCtx;
    compCtxt = cCtx;
    compModel = cModel;
}
项目:jdk8u-jdk    文件:GeneralCompositePipe.java   
public Object startSequence(SunGraphics2D sg, Shape s, Rectangle devR,
                            int[] abox) {
    RenderingHints hints = sg.getRenderingHints();
    ColorModel model = sg.getDeviceColorModel();
    PaintContext paintContext =
        sg.paint.createContext(model, devR, s.getBounds2D(),
                               sg.cloneTransform(),
                               hints);
    CompositeContext compositeContext =
        sg.composite.createContext(paintContext.getColorModel(), model,
                                   hints);
    return new TileContext(sg, paintContext, compositeContext, model);
}
项目:openjdk-jdk10    文件:Blit.java   
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();
}
项目:openjdk-jdk10    文件:GeneralCompositePipe.java   
public TileContext(SunGraphics2D sg, PaintContext pCtx,
                   CompositeContext cCtx, ColorModel cModel) {
    sunG2D = sg;
    paintCtxt = pCtx;
    compCtxt = cCtx;
    compModel = cModel;
}
项目:openjdk-jdk10    文件:GeneralCompositePipe.java   
public Object startSequence(SunGraphics2D sg, Shape s, Rectangle devR,
                            int[] abox) {
    RenderingHints hints = sg.getRenderingHints();
    ColorModel model = sg.getDeviceColorModel();
    PaintContext paintContext =
        sg.paint.createContext(model, devR, s.getBounds2D(),
                               sg.cloneTransform(),
                               hints);
    CompositeContext compositeContext =
        sg.composite.createContext(paintContext.getColorModel(), model,
                                   hints);
    return new TileContext(sg, paintContext, compositeContext, model);
}
项目:openjdk-jdk10    文件:OpenJDKFillBug.java   
@Override
public CompositeContext createContext(ColorModel srcColorModel,
                                      ColorModel dstColorModel,
                                      RenderingHints hints)
{
    return new CustomCompositeContext();
}
项目:openjdk9    文件:Blit.java   
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();
}
项目:openjdk9    文件:GeneralCompositePipe.java   
public TileContext(SunGraphics2D sg, PaintContext pCtx,
                   CompositeContext cCtx, ColorModel cModel) {
    sunG2D = sg;
    paintCtxt = pCtx;
    compCtxt = cCtx;
    compModel = cModel;
}
项目:openjdk9    文件:GeneralCompositePipe.java   
public Object startSequence(SunGraphics2D sg, Shape s, Rectangle devR,
                            int[] abox) {
    RenderingHints hints = sg.getRenderingHints();
    ColorModel model = sg.getDeviceColorModel();
    PaintContext paintContext =
        sg.paint.createContext(model, devR, s.getBounds2D(),
                               sg.cloneTransform(),
                               hints);
    CompositeContext compositeContext =
        sg.composite.createContext(paintContext.getColorModel(), model,
                                   hints);
    return new TileContext(sg, paintContext, compositeContext, model);
}
项目:openjdk9    文件:OpenJDKFillBug.java   
@Override
public CompositeContext createContext(ColorModel srcColorModel,
                                      ColorModel dstColorModel,
                                      RenderingHints hints)
{
    return new CustomCompositeContext();
}
项目:jdk8u_jdk    文件:Blit.java   
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();
}
项目:jdk8u_jdk    文件:GeneralCompositePipe.java   
public TileContext(SunGraphics2D sg, PaintContext pCtx,
                   CompositeContext cCtx, ColorModel cModel) {
    sunG2D = sg;
    paintCtxt = pCtx;
    compCtxt = cCtx;
    compModel = cModel;
}
项目:jdk8u_jdk    文件:GeneralCompositePipe.java   
public Object startSequence(SunGraphics2D sg, Shape s, Rectangle devR,
                            int[] abox) {
    RenderingHints hints = sg.getRenderingHints();
    ColorModel model = sg.getDeviceColorModel();
    PaintContext paintContext =
        sg.paint.createContext(model, devR, s.getBounds2D(),
                               sg.cloneTransform(),
                               hints);
    CompositeContext compositeContext =
        sg.composite.createContext(paintContext.getColorModel(), model,
                                   hints);
    return new TileContext(sg, paintContext, compositeContext, model);
}
项目:lookaside_java-1.8.0-openjdk    文件:Blit.java   
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();
}
项目:lookaside_java-1.8.0-openjdk    文件:GeneralCompositePipe.java   
public TileContext(SunGraphics2D sg, PaintContext pCtx,
                   CompositeContext cCtx, ColorModel cModel) {
    sunG2D = sg;
    paintCtxt = pCtx;
    compCtxt = cCtx;
    compModel = cModel;
}
项目:lookaside_java-1.8.0-openjdk    文件:GeneralCompositePipe.java   
public Object startSequence(SunGraphics2D sg, Shape s, Rectangle devR,
                            int[] abox) {
    RenderingHints hints = sg.getRenderingHints();
    ColorModel model = sg.getDeviceColorModel();
    PaintContext paintContext =
        sg.paint.createContext(model, devR, s.getBounds2D(),
                               sg.cloneTransform(),
                               hints);
    CompositeContext compositeContext =
        sg.composite.createContext(paintContext.getColorModel(), model,
                                   hints);
    return new TileContext(sg, paintContext, compositeContext, model);
}
项目:iSeleda    文件:BlendComposite.java   
/**
 * {@inheritDoc}
 */
public CompositeContext createContext(ColorModel srcColorModel,
                                      ColorModel dstColorModel,
                                      RenderingHints hints) {
    if (isRgbColorModel(srcColorModel) && isRgbColorModel(dstColorModel)) {
        return new BlendingRgbContext(this);
    } else if (isBgrColorModel(srcColorModel) && isBgrColorModel(dstColorModel)) {
        return new BlendingBgrContext(this);
    }

    throw new RasterFormatException("Incompatible color models");
}
项目:javify    文件:BitwiseXORComposite.java   
/**
 * Creates a context object for performing the compositing
 * operation. Several contexts may co-exist for one composite; each
 * context may simultaneously be called from concurrent threads.
 *
 * @param srcColorModel the color model of the source.
 * @param dstColorModel the color model of the destination.
 * @param hints hints for choosing between rendering alternatives.
 */
public CompositeContext createContext(ColorModel srcColorModel,
                                      ColorModel dstColorModel,
                                      RenderingHints hints)
{
  if (IntContext.isSupported(srcColorModel, dstColorModel, hints))
    return new IntContext(srcColorModel, xorColor);

  return new GeneralContext(srcColorModel, dstColorModel, xorColor);
}
项目:jvm-stm    文件:BitwiseXORComposite.java   
/**
 * Creates a context object for performing the compositing
 * operation. Several contexts may co-exist for one composite; each
 * context may simultaneously be called from concurrent threads.
 *
 * @param srcColorModel the color model of the source.
 * @param dstColorModel the color model of the destination.
 * @param hints hints for choosing between rendering alternatives.
 */
public CompositeContext createContext(ColorModel srcColorModel,
                                      ColorModel dstColorModel,
                                      RenderingHints hints)
{
  if (IntContext.isSupported(srcColorModel, dstColorModel, hints))
    return new IntContext(srcColorModel, xorColor);

  return new GeneralContext(srcColorModel, dstColorModel, xorColor);
}
项目:swingx    文件:FilterComposite.java   
public FilterContext(ColorModel dstModel, CompositeContext ctx, BufferedImageOp filter) {
    Contract.asNotNull(dstModel, "dstModel cannot be null");
    Contract.asNotNull(ctx, "context cannot be null");
    this.dstModel = dstModel;
    this.ctx = ctx;
    this.filter = filter;
}
项目:swingx    文件:BlendComposite.java   
/**
 * {@inheritDoc}
 */
@Override
public CompositeContext createContext(ColorModel srcColorModel,
                                      ColorModel dstColorModel,
                                      RenderingHints hints) {
    if (isRgbColorModel(srcColorModel) && isRgbColorModel(dstColorModel)) {
        return new BlendingRgbContext(this);
    } else if (isBgrColorModel(srcColorModel) && isBgrColorModel(dstColorModel)) {
        return new BlendingBgrContext(this);
    }

    throw new RasterFormatException("Incompatible color models:\n  " + srcColorModel + "\n  " + dstColorModel);
}
项目:marlin-graphics    文件:GammaCompositePipe.java   
void init(SunGraphics2D sg, PaintContext pCtx,
          CompositeContext cCtx, ColorModel cModel,
          boolean blendComposite, boolean extraAlpha)
{
    sunG2D = sg;
    paintCtxt = pCtx;
    compCtxt = cCtx;
    compModel = cModel;
    isBlendComposite = blendComposite;
    hasExtraAlpha = extraAlpha;
}
项目:marlin-graphics    文件:BlendComposite.java   
@Override
public CompositeContext createContext(ColorModel srcColorModel,
                                      ColorModel dstColorModel, RenderingHints hints) {

    // use ThreadLocal (to reduce memory footprint):
    final BlendingContext bc = blendContextThreadLocal.get();
    bc.init(this);
    return bc;

}
项目:filthy-rich-clients    文件:BlendComposite.java   
/**
 * {@inheritDoc}
 */
public CompositeContext createContext(ColorModel srcColorModel,
                                      ColorModel dstColorModel,
                                      RenderingHints hints) {
    if (!checkComponentsOrder(srcColorModel) ||
            !checkComponentsOrder(dstColorModel)) {
        throw new RasterFormatException("Incompatible color models");
    }

    return new BlendingContext(this);
}
项目:filthy-rich-clients    文件:BlendComposite.java   
/**
 * {@inheritDoc}
 */
public CompositeContext createContext(ColorModel srcColorModel,
                                      ColorModel dstColorModel,
                                      RenderingHints hints) {
    if (!checkComponentsOrder(srcColorModel) ||
            !checkComponentsOrder(dstColorModel)) {
        throw new RasterFormatException("Incompatible color models");
    }

    return new BlendingContext(this);
}
项目:infobip-open-jdk-8    文件:Blit.java   
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();
}
项目:infobip-open-jdk-8    文件:GeneralCompositePipe.java   
public TileContext(SunGraphics2D sg, PaintContext pCtx,
                   CompositeContext cCtx, ColorModel cModel) {
    sunG2D = sg;
    paintCtxt = pCtx;
    compCtxt = cCtx;
    compModel = cModel;
}
项目:infobip-open-jdk-8    文件:GeneralCompositePipe.java   
public Object startSequence(SunGraphics2D sg, Shape s, Rectangle devR,
                            int[] abox) {
    RenderingHints hints = sg.getRenderingHints();
    ColorModel model = sg.getDeviceColorModel();
    PaintContext paintContext =
        sg.paint.createContext(model, devR, s.getBounds2D(),
                               sg.cloneTransform(),
                               hints);
    CompositeContext compositeContext =
        sg.composite.createContext(paintContext.getColorModel(), model,
                                   hints);
    return new TileContext(sg, paintContext, compositeContext, model);
}
项目:jdk8u-dev-jdk    文件:Blit.java   
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();
}
项目:jdk8u-dev-jdk    文件:GeneralCompositePipe.java   
public TileContext(SunGraphics2D sg, PaintContext pCtx,
                   CompositeContext cCtx, ColorModel cModel) {
    sunG2D = sg;
    paintCtxt = pCtx;
    compCtxt = cCtx;
    compModel = cModel;
}
项目:jdk8u-dev-jdk    文件:GeneralCompositePipe.java   
public Object startSequence(SunGraphics2D sg, Shape s, Rectangle devR,
                            int[] abox) {
    RenderingHints hints = sg.getRenderingHints();
    ColorModel model = sg.getDeviceColorModel();
    PaintContext paintContext =
        sg.paint.createContext(model, devR, s.getBounds2D(),
                               sg.cloneTransform(),
                               hints);
    CompositeContext compositeContext =
        sg.composite.createContext(paintContext.getColorModel(), model,
                                   hints);
    return new TileContext(sg, paintContext, compositeContext, model);
}
项目:aibench-project    文件:BlendComposite.java   
/**
 * {@inheritDoc}
 */
public CompositeContext createContext(ColorModel srcColorModel,
                                      ColorModel dstColorModel,
                                      RenderingHints hints) {
    if (isRgbColorModel(srcColorModel) && isRgbColorModel(dstColorModel)) {
        return new BlendingRgbContext(this);
    } else if (isBgrColorModel(srcColorModel) && isBgrColorModel(dstColorModel)) {
        return new BlendingBgrContext(this);
    }

    throw new RasterFormatException("Incompatible color models");
}