Java Code Examples for sun.awt.image.BufImgSurfaceData#createData()

The following examples show how to use sun.awt.image.BufImgSurfaceData#createData() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MaskFill.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public void MaskFill(SunGraphics2D sg2d,
                     SurfaceData sData,
                     Composite comp,
                     int x, int y, int w, int h,
                     byte mask[], int offset, int scan)
{
    BufferedImage dstBI =
        new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
    SurfaceData tmpData = BufImgSurfaceData.createData(dstBI);

    // REMIND: This is not pretty.  It would be nicer if we
    // passed a "FillData" object to the Pixel loops, instead
    // of a SunGraphics2D parameter...
    Region clip = sg2d.clipRegion;
    sg2d.clipRegion = null;
    int pixel = sg2d.pixel;
    sg2d.pixel = tmpData.pixelFor(sg2d.getColor());
    fillop.FillRect(sg2d, tmpData, 0, 0, w, h);
    sg2d.pixel = pixel;
    sg2d.clipRegion = clip;

    maskop.MaskBlit(tmpData, sData, comp, null,
                    0, 0, x, y, w, h,
                    mask, offset, scan);
}
 
Example 2
Source File: MaskFill.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void MaskFill(SunGraphics2D sg2d,
                     SurfaceData sData,
                     Composite comp,
                     int x, int y, int w, int h,
                     byte mask[], int offset, int scan)
{
    BufferedImage dstBI =
        new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
    SurfaceData tmpData = BufImgSurfaceData.createData(dstBI);

    // REMIND: This is not pretty.  It would be nicer if we
    // passed a "FillData" object to the Pixel loops, instead
    // of a SunGraphics2D parameter...
    Region clip = sg2d.clipRegion;
    sg2d.clipRegion = null;
    int pixel = sg2d.pixel;
    sg2d.pixel = tmpData.pixelFor(sg2d.getColor());
    fillop.FillRect(sg2d, tmpData, 0, 0, w, h);
    sg2d.pixel = pixel;
    sg2d.clipRegion = clip;

    maskop.MaskBlit(tmpData, sData, comp, null,
                    0, 0, x, y, w, h,
                    mask, offset, scan);
}
 
Example 3
Source File: GraphicsPrimitive.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
protected static SurfaceData convertFrom(Blit ob, SurfaceData srcData,
                                         int srcX, int srcY, int w, int h,
                                         SurfaceData dstData, int type)
{
    if (dstData != null) {
        Rectangle r = dstData.getBounds();
        if (w > r.width || h > r.height) {
            dstData = null;
        }
    }
    if (dstData == null) {
        BufferedImage dstBI = new BufferedImage(w, h, type);
        dstData = BufImgSurfaceData.createData(dstBI);
    }
    ob.Blit(srcData, dstData, AlphaComposite.Src, null,
            srcX, srcY, 0, 0, w, h);
    return dstData;
}
 
Example 4
Source File: MaskFill.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public void MaskFill(SunGraphics2D sg2d,
                     SurfaceData sData,
                     Composite comp,
                     int x, int y, int w, int h,
                     byte mask[], int offset, int scan)
{
    BufferedImage dstBI =
        new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
    SurfaceData tmpData = BufImgSurfaceData.createData(dstBI);

    // REMIND: This is not pretty.  It would be nicer if we
    // passed a "FillData" object to the Pixel loops, instead
    // of a SunGraphics2D parameter...
    Region clip = sg2d.clipRegion;
    sg2d.clipRegion = null;
    int pixel = sg2d.pixel;
    sg2d.pixel = tmpData.pixelFor(sg2d.getColor());
    fillop.FillRect(sg2d, tmpData, 0, 0, w, h);
    sg2d.pixel = pixel;
    sg2d.clipRegion = clip;

    maskop.MaskBlit(tmpData, sData, comp, null,
                    0, 0, x, y, w, h,
                    mask, offset, scan);
}
 
Example 5
Source File: MaskFill.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public void MaskFill(SunGraphics2D sg2d,
                     SurfaceData sData,
                     Composite comp,
                     int x, int y, int w, int h,
                     byte mask[], int offset, int scan)
{
    BufferedImage dstBI =
        new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
    SurfaceData tmpData = BufImgSurfaceData.createData(dstBI);

    // REMIND: This is not pretty.  It would be nicer if we
    // passed a "FillData" object to the Pixel loops, instead
    // of a SunGraphics2D parameter...
    Region clip = sg2d.clipRegion;
    sg2d.clipRegion = null;
    int pixel = sg2d.pixel;
    sg2d.pixel = tmpData.pixelFor(sg2d.getColor());
    fillop.FillRect(sg2d, tmpData, 0, 0, w, h);
    sg2d.pixel = pixel;
    sg2d.clipRegion = clip;

    maskop.MaskBlit(tmpData, sData, comp, null,
                    0, 0, x, y, w, h,
                    mask, offset, scan);
}
 
Example 6
Source File: MaskFill.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public void MaskFill(SunGraphics2D sg2d,
                     SurfaceData sData,
                     Composite comp,
                     int x, int y, int w, int h,
                     byte mask[], int offset, int scan)
{
    BufferedImage dstBI =
        new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
    SurfaceData tmpData = BufImgSurfaceData.createData(dstBI);

    // REMIND: This is not pretty.  It would be nicer if we
    // passed a "FillData" object to the Pixel loops, instead
    // of a SunGraphics2D parameter...
    Region clip = sg2d.clipRegion;
    sg2d.clipRegion = null;
    int pixel = sg2d.pixel;
    sg2d.pixel = tmpData.pixelFor(sg2d.getColor());
    fillop.FillRect(sg2d, tmpData, 0, 0, w, h);
    sg2d.pixel = pixel;
    sg2d.clipRegion = clip;

    maskop.MaskBlit(tmpData, sData, comp, null,
                    0, 0, x, y, w, h,
                    mask, offset, scan);
}
 
Example 7
Source File: GraphicsPrimitive.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
protected static SurfaceData convertFrom(Blit ob, SurfaceData srcData,
                                         int srcX, int srcY, int w, int h,
                                         SurfaceData dstData, int type)
{
    if (dstData != null) {
        Rectangle r = dstData.getBounds();
        if (w > r.width || h > r.height) {
            dstData = null;
        }
    }
    if (dstData == null) {
        BufferedImage dstBI = new BufferedImage(w, h, type);
        dstData = BufImgSurfaceData.createData(dstBI);
    }
    ob.Blit(srcData, dstData, AlphaComposite.Src, null,
            srcX, srcY, 0, 0, w, h);
    return dstData;
}
 
Example 8
Source File: GraphicsPrimitive.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
protected static SurfaceData convertFrom(Blit ob, SurfaceData srcData,
                                         int srcX, int srcY, int w, int h,
                                         SurfaceData dstData, int type)
{
    if (dstData != null) {
        Rectangle r = dstData.getBounds();
        if (w > r.width || h > r.height) {
            dstData = null;
        }
    }
    if (dstData == null) {
        BufferedImage dstBI = new BufferedImage(w, h, type);
        dstData = BufImgSurfaceData.createData(dstBI);
    }
    ob.Blit(srcData, dstData, AlphaComposite.Src, null,
            srcX, srcY, 0, 0, w, h);
    return dstData;
}
 
Example 9
Source File: MaskFill.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public void MaskFill(SunGraphics2D sg2d,
                     SurfaceData sData,
                     Composite comp,
                     int x, int y, int w, int h,
                     byte mask[], int offset, int scan)
{
    BufferedImage dstBI =
        new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
    SurfaceData tmpData = BufImgSurfaceData.createData(dstBI);

    // REMIND: This is not pretty.  It would be nicer if we
    // passed a "FillData" object to the Pixel loops, instead
    // of a SunGraphics2D parameter...
    Region clip = sg2d.clipRegion;
    sg2d.clipRegion = null;
    int pixel = sg2d.pixel;
    sg2d.pixel = tmpData.pixelFor(sg2d.getColor());
    fillop.FillRect(sg2d, tmpData, 0, 0, w, h);
    sg2d.pixel = pixel;
    sg2d.clipRegion = clip;

    maskop.MaskBlit(tmpData, sData, comp, null,
                    0, 0, x, y, w, h,
                    mask, offset, scan);
}
 
Example 10
Source File: GraphicsPrimitive.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
protected static SurfaceData convertFrom(Blit ob, SurfaceData srcData,
                                         int srcX, int srcY, int w, int h,
                                         SurfaceData dstData, int type)
{
    if (dstData != null) {
        Rectangle r = dstData.getBounds();
        if (w > r.width || h > r.height) {
            dstData = null;
        }
    }
    if (dstData == null) {
        BufferedImage dstBI = new BufferedImage(w, h, type);
        dstData = BufImgSurfaceData.createData(dstBI);
    }
    ob.Blit(srcData, dstData, AlphaComposite.Src, null,
            srcX, srcY, 0, 0, w, h);
    return dstData;
}
 
Example 11
Source File: GraphicsPrimitive.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
protected static SurfaceData convertFrom(Blit ob, SurfaceData srcData,
                                         int srcX, int srcY, int w, int h,
                                         SurfaceData dstData, int type)
{
    if (dstData != null) {
        Rectangle r = dstData.getBounds();
        if (w > r.width || h > r.height) {
            dstData = null;
        }
    }
    if (dstData == null) {
        BufferedImage dstBI = new BufferedImage(w, h, type);
        dstData = BufImgSurfaceData.createData(dstBI);
    }
    ob.Blit(srcData, dstData, AlphaComposite.Src, null,
            srcX, srcY, 0, 0, w, h);
    return dstData;
}
 
Example 12
Source File: GraphicsPrimitive.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
protected static SurfaceData convertFrom(Blit ob, SurfaceData srcData,
                                         int srcX, int srcY, int w, int h,
                                         SurfaceData dstData, int type)
{
    if (dstData != null) {
        Rectangle r = dstData.getBounds();
        if (w > r.width || h > r.height) {
            dstData = null;
        }
    }
    if (dstData == null) {
        BufferedImage dstBI = new BufferedImage(w, h, type);
        dstData = BufImgSurfaceData.createData(dstBI);
    }
    ob.Blit(srcData, dstData, AlphaComposite.Src, null,
            srcX, srcY, 0, 0, w, h);
    return dstData;
}
 
Example 13
Source File: BlitBg.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void BlitBg(SurfaceData srcData,
                   SurfaceData dstData,
                   Composite comp,
                   Region clip,
                   int bgArgb,
                   int srcx, int srcy,
                   int dstx, int dsty,
                   int width, int height)
{
    ColorModel dstModel = dstData.getColorModel();
    boolean bgHasAlpha = (bgArgb >>> 24) != 0xff;
    if (!dstModel.hasAlpha() && bgHasAlpha) {
        dstModel = ColorModel.getRGBdefault();
    }
    WritableRaster wr =
        dstModel.createCompatibleWritableRaster(width, height);
    boolean isPremult = dstModel.isAlphaPremultiplied();
    BufferedImage bimg =
        new BufferedImage(dstModel, wr, isPremult, null);
    SurfaceData tmpData = BufImgSurfaceData.createData(bimg);
    Color bgColor = new Color(bgArgb, bgHasAlpha);
    SunGraphics2D sg2d = new SunGraphics2D(tmpData, bgColor, bgColor,
                                           defaultFont);
    FillRect fillop = FillRect.locate(SurfaceType.AnyColor,
                                      CompositeType.SrcNoEa,
                                      tmpData.getSurfaceType());
    Blit combineop = Blit.getFromCache(srcData.getSurfaceType(),
                                       CompositeType.SrcOverNoEa,
                                       tmpData.getSurfaceType());
    Blit blitop = Blit.getFromCache(tmpData.getSurfaceType(), compositeType,
                                    dstData.getSurfaceType());
    fillop.FillRect(sg2d, tmpData, 0, 0, width, height);
    combineop.Blit(srcData, tmpData, AlphaComposite.SrcOver, null,
                   srcx, srcy, 0, 0, width, height);
    blitop.Blit(tmpData, dstData, comp, clip,
                0, 0, dstx, dsty, width, height);
}
 
Example 14
Source File: BlitBg.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void BlitBg(SurfaceData srcData,
                   SurfaceData dstData,
                   Composite comp,
                   Region clip,
                   int bgArgb,
                   int srcx, int srcy,
                   int dstx, int dsty,
                   int width, int height)
{
    ColorModel dstModel = dstData.getColorModel();
    boolean bgHasAlpha = (bgArgb >>> 24) != 0xff;
    if (!dstModel.hasAlpha() && bgHasAlpha) {
        dstModel = ColorModel.getRGBdefault();
    }
    WritableRaster wr =
        dstModel.createCompatibleWritableRaster(width, height);
    boolean isPremult = dstModel.isAlphaPremultiplied();
    BufferedImage bimg =
        new BufferedImage(dstModel, wr, isPremult, null);
    SurfaceData tmpData = BufImgSurfaceData.createData(bimg);
    Color bgColor = new Color(bgArgb, bgHasAlpha);
    SunGraphics2D sg2d = new SunGraphics2D(tmpData, bgColor, bgColor,
                                           defaultFont);
    FillRect fillop = FillRect.locate(SurfaceType.AnyColor,
                                      CompositeType.SrcNoEa,
                                      tmpData.getSurfaceType());
    Blit combineop = Blit.getFromCache(srcData.getSurfaceType(),
                                       CompositeType.SrcOverNoEa,
                                       tmpData.getSurfaceType());
    Blit blitop = Blit.getFromCache(tmpData.getSurfaceType(), compositeType,
                                    dstData.getSurfaceType());
    fillop.FillRect(sg2d, tmpData, 0, 0, width, height);
    combineop.Blit(srcData, tmpData, AlphaComposite.SrcOver, null,
                   srcx, srcy, 0, 0, width, height);
    blitop.Blit(tmpData, dstData, comp, clip,
                0, 0, dstx, dsty, width, height);
}
 
Example 15
Source File: BlitBg.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void BlitBg(SurfaceData srcData,
                   SurfaceData dstData,
                   Composite comp,
                   Region clip,
                   int bgArgb,
                   int srcx, int srcy,
                   int dstx, int dsty,
                   int width, int height)
{
    ColorModel dstModel = dstData.getColorModel();
    boolean bgHasAlpha = (bgArgb >>> 24) != 0xff;
    if (!dstModel.hasAlpha() && bgHasAlpha) {
        dstModel = ColorModel.getRGBdefault();
    }
    WritableRaster wr =
        dstModel.createCompatibleWritableRaster(width, height);
    boolean isPremult = dstModel.isAlphaPremultiplied();
    BufferedImage bimg =
        new BufferedImage(dstModel, wr, isPremult, null);
    SurfaceData tmpData = BufImgSurfaceData.createData(bimg);
    Color bgColor = new Color(bgArgb, bgHasAlpha);
    SunGraphics2D sg2d = new SunGraphics2D(tmpData, bgColor, bgColor,
                                           defaultFont);
    FillRect fillop = FillRect.locate(SurfaceType.AnyColor,
                                      CompositeType.SrcNoEa,
                                      tmpData.getSurfaceType());
    Blit combineop = Blit.getFromCache(srcData.getSurfaceType(),
                                       CompositeType.SrcOverNoEa,
                                       tmpData.getSurfaceType());
    Blit blitop = Blit.getFromCache(tmpData.getSurfaceType(), compositeType,
                                    dstData.getSurfaceType());
    fillop.FillRect(sg2d, tmpData, 0, 0, width, height);
    combineop.Blit(srcData, tmpData, AlphaComposite.SrcOver, null,
                   srcx, srcy, 0, 0, width, height);
    blitop.Blit(tmpData, dstData, comp, clip,
                0, 0, dstx, dsty, width, height);
}
 
Example 16
Source File: BlitBg.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void BlitBg(SurfaceData srcData,
                   SurfaceData dstData,
                   Composite comp,
                   Region clip,
                   int bgArgb,
                   int srcx, int srcy,
                   int dstx, int dsty,
                   int width, int height)
{
    ColorModel dstModel = dstData.getColorModel();
    boolean bgHasAlpha = (bgArgb >>> 24) != 0xff;
    if (!dstModel.hasAlpha() && bgHasAlpha) {
        dstModel = ColorModel.getRGBdefault();
    }
    WritableRaster wr =
        dstModel.createCompatibleWritableRaster(width, height);
    boolean isPremult = dstModel.isAlphaPremultiplied();
    BufferedImage bimg =
        new BufferedImage(dstModel, wr, isPremult, null);
    SurfaceData tmpData = BufImgSurfaceData.createData(bimg);
    Color bgColor = new Color(bgArgb, bgHasAlpha);
    SunGraphics2D sg2d = new SunGraphics2D(tmpData, bgColor, bgColor,
                                           defaultFont);
    FillRect fillop = FillRect.locate(SurfaceType.AnyColor,
                                      CompositeType.SrcNoEa,
                                      tmpData.getSurfaceType());
    Blit combineop = Blit.getFromCache(srcData.getSurfaceType(),
                                       CompositeType.SrcOverNoEa,
                                       tmpData.getSurfaceType());
    Blit blitop = Blit.getFromCache(tmpData.getSurfaceType(), compositeType,
                                    dstData.getSurfaceType());
    fillop.FillRect(sg2d, tmpData, 0, 0, width, height);
    combineop.Blit(srcData, tmpData, AlphaComposite.SrcOver, null,
                   srcx, srcy, 0, 0, width, height);
    blitop.Blit(tmpData, dstData, comp, clip,
                0, 0, dstx, dsty, width, height);
}
 
Example 17
Source File: BlitBg.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void BlitBg(SurfaceData srcData,
                   SurfaceData dstData,
                   Composite comp,
                   Region clip,
                   int bgArgb,
                   int srcx, int srcy,
                   int dstx, int dsty,
                   int width, int height)
{
    ColorModel dstModel = dstData.getColorModel();
    boolean bgHasAlpha = (bgArgb >>> 24) != 0xff;
    if (!dstModel.hasAlpha() && bgHasAlpha) {
        dstModel = ColorModel.getRGBdefault();
    }
    WritableRaster wr =
        dstModel.createCompatibleWritableRaster(width, height);
    boolean isPremult = dstModel.isAlphaPremultiplied();
    BufferedImage bimg =
        new BufferedImage(dstModel, wr, isPremult, null);
    SurfaceData tmpData = BufImgSurfaceData.createData(bimg);
    Color bgColor = new Color(bgArgb, bgHasAlpha);
    SunGraphics2D sg2d = new SunGraphics2D(tmpData, bgColor, bgColor,
                                           defaultFont);
    FillRect fillop = FillRect.locate(SurfaceType.AnyColor,
                                      CompositeType.SrcNoEa,
                                      tmpData.getSurfaceType());
    Blit combineop = Blit.getFromCache(srcData.getSurfaceType(),
                                       CompositeType.SrcOverNoEa,
                                       tmpData.getSurfaceType());
    Blit blitop = Blit.getFromCache(tmpData.getSurfaceType(), compositeType,
                                    dstData.getSurfaceType());
    fillop.FillRect(sg2d, tmpData, 0, 0, width, height);
    combineop.Blit(srcData, tmpData, AlphaComposite.SrcOver, null,
                   srcx, srcy, 0, 0, width, height);
    blitop.Blit(tmpData, dstData, comp, clip,
                0, 0, dstx, dsty, width, height);
}
 
Example 18
Source File: BlitBg.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void BlitBg(SurfaceData srcData,
                   SurfaceData dstData,
                   Composite comp,
                   Region clip,
                   int bgArgb,
                   int srcx, int srcy,
                   int dstx, int dsty,
                   int width, int height)
{
    ColorModel dstModel = dstData.getColorModel();
    boolean bgHasAlpha = (bgArgb >>> 24) != 0xff;
    if (!dstModel.hasAlpha() && bgHasAlpha) {
        dstModel = ColorModel.getRGBdefault();
    }
    WritableRaster wr =
        dstModel.createCompatibleWritableRaster(width, height);
    boolean isPremult = dstModel.isAlphaPremultiplied();
    BufferedImage bimg =
        new BufferedImage(dstModel, wr, isPremult, null);
    SurfaceData tmpData = BufImgSurfaceData.createData(bimg);
    Color bgColor = new Color(bgArgb, bgHasAlpha);
    SunGraphics2D sg2d = new SunGraphics2D(tmpData, bgColor, bgColor,
                                           defaultFont);
    FillRect fillop = FillRect.locate(SurfaceType.AnyColor,
                                      CompositeType.SrcNoEa,
                                      tmpData.getSurfaceType());
    Blit combineop = Blit.getFromCache(srcData.getSurfaceType(),
                                       CompositeType.SrcOverNoEa,
                                       tmpData.getSurfaceType());
    Blit blitop = Blit.getFromCache(tmpData.getSurfaceType(), compositeType,
                                    dstData.getSurfaceType());
    fillop.FillRect(sg2d, tmpData, 0, 0, width, height);
    combineop.Blit(srcData, tmpData, AlphaComposite.SrcOver, null,
                   srcx, srcy, 0, 0, width, height);
    blitop.Blit(tmpData, dstData, comp, clip,
                0, 0, dstx, dsty, width, height);
}
 
Example 19
Source File: BlitBg.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public void BlitBg(SurfaceData srcData,
                   SurfaceData dstData,
                   Composite comp,
                   Region clip,
                   int bgArgb,
                   int srcx, int srcy,
                   int dstx, int dsty,
                   int width, int height)
{
    ColorModel dstModel = dstData.getColorModel();
    boolean bgHasAlpha = (bgArgb >>> 24) != 0xff;
    if (!dstModel.hasAlpha() && bgHasAlpha) {
        dstModel = ColorModel.getRGBdefault();
    }
    WritableRaster wr =
        dstModel.createCompatibleWritableRaster(width, height);
    boolean isPremult = dstModel.isAlphaPremultiplied();
    BufferedImage bimg =
        new BufferedImage(dstModel, wr, isPremult, null);
    SurfaceData tmpData = BufImgSurfaceData.createData(bimg);
    Color bgColor = new Color(bgArgb, bgHasAlpha);
    SunGraphics2D sg2d = new SunGraphics2D(tmpData, bgColor, bgColor,
                                           defaultFont);
    FillRect fillop = FillRect.locate(SurfaceType.AnyColor,
                                      CompositeType.SrcNoEa,
                                      tmpData.getSurfaceType());
    Blit combineop = Blit.getFromCache(srcData.getSurfaceType(),
                                       CompositeType.SrcOverNoEa,
                                       tmpData.getSurfaceType());
    Blit blitop = Blit.getFromCache(tmpData.getSurfaceType(), compositeType,
                                    dstData.getSurfaceType());
    fillop.FillRect(sg2d, tmpData, 0, 0, width, height);
    combineop.Blit(srcData, tmpData, AlphaComposite.SrcOver, null,
                   srcx, srcy, 0, 0, width, height);
    blitop.Blit(tmpData, dstData, comp, clip,
                0, 0, dstx, dsty, width, height);
}
 
Example 20
Source File: BlitBg.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void BlitBg(SurfaceData srcData,
                   SurfaceData dstData,
                   Composite comp,
                   Region clip,
                   int bgArgb,
                   int srcx, int srcy,
                   int dstx, int dsty,
                   int width, int height)
{
    ColorModel dstModel = dstData.getColorModel();
    boolean bgHasAlpha = (bgArgb >>> 24) != 0xff;
    if (!dstModel.hasAlpha() && bgHasAlpha) {
        dstModel = ColorModel.getRGBdefault();
    }
    WritableRaster wr =
        dstModel.createCompatibleWritableRaster(width, height);
    boolean isPremult = dstModel.isAlphaPremultiplied();
    BufferedImage bimg =
        new BufferedImage(dstModel, wr, isPremult, null);
    SurfaceData tmpData = BufImgSurfaceData.createData(bimg);
    Color bgColor = new Color(bgArgb, bgHasAlpha);
    SunGraphics2D sg2d = new SunGraphics2D(tmpData, bgColor, bgColor,
                                           defaultFont);
    FillRect fillop = FillRect.locate(SurfaceType.AnyColor,
                                      CompositeType.SrcNoEa,
                                      tmpData.getSurfaceType());
    Blit combineop = Blit.getFromCache(srcData.getSurfaceType(),
                                       CompositeType.SrcOverNoEa,
                                       tmpData.getSurfaceType());
    Blit blitop = Blit.getFromCache(tmpData.getSurfaceType(), compositeType,
                                    dstData.getSurfaceType());
    fillop.FillRect(sg2d, tmpData, 0, 0, width, height);
    combineop.Blit(srcData, tmpData, AlphaComposite.SrcOver, null,
                   srcx, srcy, 0, 0, width, height);
    blitop.Blit(tmpData, dstData, comp, clip,
                0, 0, dstx, dsty, width, height);
}