本文整理汇总了Java中sun.awt.image.BufImgSurfaceData类的典型用法代码示例。如果您正苦于以下问题:Java BufImgSurfaceData类的具体用法?Java BufImgSurfaceData怎么用?Java BufImgSurfaceData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BufImgSurfaceData类属于sun.awt.image包,在下文中一共展示了BufImgSurfaceData类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertFrom
import sun.awt.image.BufImgSurfaceData; //导入依赖的package包/类
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;
}
示例2: MaskFill
import sun.awt.image.BufImgSurfaceData; //导入依赖的package包/类
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);
}
示例3: MaskFill
import sun.awt.image.BufImgSurfaceData; //导入依赖的package包/类
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...
int pixel = sg2d.pixel;
sg2d.pixel = tmpData.pixelFor(sg2d.getColor());
fillop.FillRect(sg2d, tmpData, 0, 0, w, h);
sg2d.pixel = pixel;
maskop.MaskBlit(tmpData, sData, comp, null,
0, 0, x, y, w, h,
mask, offset, scan);
}
示例4: BlitBg
import sun.awt.image.BufImgSurfaceData; //导入依赖的package包/类
@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);
}
示例5: compose
import sun.awt.image.BufImgSurfaceData; //导入依赖的package包/类
/**
* This method composes the two source tiles
* and places the result in the destination tile. Note that
* the destination can be the same object as either
* the first or second source.
* @param src1 The first source tile for the compositing operation.
* @param src2 The second source tile for the compositing operation.
* @param dst The tile where the result of the operation is stored.
*/
public void compose(Raster src1, Raster src2, WritableRaster dst) {
WritableRaster src;
int w;
int h;
if (src2 != dst) {
dst.setDataElements(0, 0, src2);
}
// REMIND: We should be able to create a SurfaceData from just
// a non-writable Raster and a ColorModel. Since we need to
// create a SurfaceData from a BufferedImage then we need to
// make a WritableRaster since it is needed to construct a
// BufferedImage.
if (src1 instanceof WritableRaster) {
src = (WritableRaster) src1;
} else {
src = src1.createCompatibleWritableRaster();
src.setDataElements(0, 0, src1);
}
w = Math.min(src.getWidth(), src2.getWidth());
h = Math.min(src.getHeight(), src2.getHeight());
BufferedImage srcImg = new BufferedImage(srcCM, src,
srcCM.isAlphaPremultiplied(),
null);
BufferedImage dstImg = new BufferedImage(dstCM, dst,
dstCM.isAlphaPremultiplied(),
null);
SurfaceData srcData = BufImgSurfaceData.createData(srcImg);
SurfaceData dstData = BufImgSurfaceData.createData(dstImg);
Blit blit = Blit.getFromCache(srcData.getSurfaceType(),
comptype,
dstData.getSurfaceType());
blit.Blit(srcData, dstData, composite, null, 0, 0, 0, 0, w, h);
}
示例6: compose
import sun.awt.image.BufImgSurfaceData; //导入依赖的package包/类
/**
* This method composes the two source tiles
* and places the result in the destination tile. Note that
* the destination can be the same object as either
* the first or second source.
* @param src1 The first source tile for the compositing operation.
* @param src2 The second source tile for the compositing operation.
* @param dst The tile where the result of the operation is stored.
*/
public void compose(Raster srcArg, Raster dstIn, WritableRaster dstOut) {
WritableRaster src;
int w;
int h;
if (dstIn != dstOut) {
dstOut.setDataElements(0, 0, dstIn);
}
// REMIND: We should be able to create a SurfaceData from just
// a non-writable Raster and a ColorModel. Since we need to
// create a SurfaceData from a BufferedImage then we need to
// make a WritableRaster since it is needed to construct a
// BufferedImage.
if (srcArg instanceof WritableRaster) {
src = (WritableRaster) srcArg;
} else {
src = srcArg.createCompatibleWritableRaster();
src.setDataElements(0, 0, srcArg);
}
w = Math.min(src.getWidth(), dstIn.getWidth());
h = Math.min(src.getHeight(), dstIn.getHeight());
BufferedImage srcImg = new BufferedImage(srcCM, src,
srcCM.isAlphaPremultiplied(),
null);
BufferedImage dstImg = new BufferedImage(dstCM, dstOut,
dstCM.isAlphaPremultiplied(),
null);
SurfaceData srcData = BufImgSurfaceData.createData(srcImg);
SurfaceData dstData = BufImgSurfaceData.createData(dstImg);
Blit blit = Blit.getFromCache(srcData.getSurfaceType(),
comptype,
dstData.getSurfaceType());
blit.Blit(srcData, dstData, composite, null, 0, 0, 0, 0, w, h);
}