本文整理汇总了Java中sun.java2d.loops.Blit.getFromCache方法的典型用法代码示例。如果您正苦于以下问题:Java Blit.getFromCache方法的具体用法?Java Blit.getFromCache怎么用?Java Blit.getFromCache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.java2d.loops.Blit
的用法示例。
在下文中一共展示了Blit.getFromCache方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Transform
import sun.java2d.loops.Blit; //导入方法依赖的package包/类
@Override
public synchronized void Transform(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
AffineTransform at, int hint, int srcx,
int srcy, int dstx, int dsty, int width,
int height){
Blit convertsrc = Blit.getFromCache(src.getSurfaceType(),
CompositeType.SrcNoEa,
SurfaceType.IntArgbPre);
// use cached intermediate surface, if available
final SurfaceData cachedSrc = srcTmp != null ? srcTmp.get() : null;
// convert source to IntArgbPre
src = convertFrom(convertsrc, src, srcx, srcy, width, height, cachedSrc,
BufferedImage.TYPE_INT_ARGB_PRE);
// transform IntArgbPre intermediate surface to D3D surface
performop.Transform(src, dst, comp, clip, at, hint, 0, 0, dstx, dsty,
width, height);
if (src != cachedSrc) {
// cache the intermediate surface
srcTmp = new WeakReference<>(src);
}
}
示例2: Transform
import sun.java2d.loops.Blit; //导入方法依赖的package包/类
@Override
public synchronized void Transform(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
AffineTransform at, int hint, int srcx,
int srcy, int dstx, int dsty, int width,
int height){
Blit convertsrc = Blit.getFromCache(src.getSurfaceType(),
CompositeType.SrcNoEa,
SurfaceType.IntArgbPre);
// use cached intermediate surface, if available
final SurfaceData cachedSrc = srcTmp != null ? srcTmp.get() : null;
// convert source to IntArgbPre
src = convertFrom(convertsrc, src, srcx, srcy, width, height, cachedSrc,
BufferedImage.TYPE_INT_ARGB_PRE);
// transform IntArgbPre intermediate surface to OpenGL surface
performop.Transform(src, dst, comp, clip, at, hint, 0, 0, dstx, dsty,
width, height);
if (src != cachedSrc) {
// cache the intermediate surface
srcTmp = new WeakReference<>(src);
}
}
示例3: complexClipBlit
import sun.java2d.loops.Blit; //导入方法依赖的package包/类
private synchronized void complexClipBlit(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
int sx, int sy, int dx, int dy,
int w, int h) {
SurfaceData cachedSrc = null;
if (srcTmp != null) {
// use cached intermediate surface, if available
cachedSrc = srcTmp.get();
}
// We can convert argb_pre data from OpenGL surface in two places:
// - During OpenGL surface -> SW blit
// - During SW -> SW blit
// The first one is faster when we use opaque OGL surface, because in
// this case we simply skip conversion and use color components as is.
// Because of this we align intermediate buffer type with type of
// destination not source.
final int type = typeval == OGLSurfaceData.PF_INT_ARGB_PRE ?
BufferedImage.TYPE_INT_ARGB_PRE :
BufferedImage.TYPE_INT_ARGB;
src = convertFrom(this, src, sx, sy, w, h, cachedSrc, type);
// copy intermediate SW to destination SW using complex clip
final Blit performop = Blit.getFromCache(src.getSurfaceType(),
CompositeType.SrcNoEa,
dst.getSurfaceType());
performop.Blit(src, dst, comp, clip, 0, 0, dx, dy, w, h);
if (src != cachedSrc) {
// cache the intermediate surface
srcTmp = new WeakReference<>(src);
}
}
示例4: Blit
import sun.java2d.loops.Blit; //导入方法依赖的package包/类
public void Blit(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
int sx, int sy, int dx, int dy, int w, int h)
{
Blit blit = Blit.getFromCache(src.getSurfaceType(),
CompositeType.SrcNoEa,
dstType);
blit.Blit(src, dst, comp, clip, sx, sy, dx, dy, w, h);
updateBitmask(src, dst,
src.getColorModel() instanceof IndexColorModel);
}
示例5: updateSurfaceData
import sun.java2d.loops.Blit; //导入方法依赖的package包/类
/**
* This is the default implementation for updating the cached
* SurfaceData from the source (primary) SurfaceData.
* A simple Blit is used to copy the pixels from the source to
* the destination SurfaceData.
* A subclass can override this implementation if a more complex
* operation is required to update its cached copies.
*/
public void updateSurfaceData(SurfaceData srcData,
SurfaceData dstData,
int w, int h)
{
SurfaceType srcType = srcData.getSurfaceType();
SurfaceType dstType = dstData.getSurfaceType();
Blit blit = Blit.getFromCache(srcType,
CompositeType.SrcNoEa,
dstType);
blit.Blit(srcData, dstData,
AlphaComposite.Src, null,
0, 0, 0, 0, w, h);
dstData.markDirty();
}
示例6: Blit
import sun.java2d.loops.Blit; //导入方法依赖的package包/类
public synchronized void Blit(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
int sx, int sy, int dx, int dy,
int w, int h)
{
Blit convertsrc = Blit.getFromCache(src.getSurfaceType(),
CompositeType.SrcNoEa,
SurfaceType.IntArgbPre);
SurfaceData cachedSrc = null;
if (srcTmp != null) {
// use cached intermediate surface, if available
cachedSrc = srcTmp.get();
}
// convert source to IntArgbPre
src = convertFrom(convertsrc, src, sx, sy, w, h,
cachedSrc, BufferedImage.TYPE_INT_ARGB_PRE);
// copy IntArgbPre intermediate surface to D3D surface
performop.Blit(src, dst, comp, clip,
0, 0, dx, dy, w, h);
if (src != cachedSrc) {
// cache the intermediate surface
srcTmp = new WeakReference<>(src);
}
}
示例7: Blit
import sun.java2d.loops.Blit; //导入方法依赖的package包/类
public synchronized void Blit(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
int sx, int sy, int dx, int dy,
int w, int h)
{
Blit convertsrc = Blit.getFromCache(src.getSurfaceType(),
CompositeType.SrcNoEa,
SurfaceType.IntArgbPre);
SurfaceData cachedSrc = null;
if (srcTmp != null) {
// use cached intermediate surface, if available
cachedSrc = srcTmp.get();
}
// convert source to IntArgbPre
src = convertFrom(convertsrc, src, sx, sy, w, h,
cachedSrc, BufferedImage.TYPE_INT_ARGB_PRE);
// copy IntArgbPre intermediate surface to OpenGL surface
performop.Blit(src, dst, comp, clip,
0, 0, dx, dy, w, h);
if (src != cachedSrc) {
// cache the intermediate surface
srcTmp = new WeakReference<>(src);
}
}
示例8: complexClipBlit
import sun.java2d.loops.Blit; //导入方法依赖的package包/类
private synchronized void complexClipBlit(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
int sx, int sy, int dx, int dy,
int w, int h) {
SurfaceData cachedSrc = null;
if (srcTmp != null) {
// use cached intermediate surface, if available
cachedSrc = srcTmp.get();
}
// Type- indicates the pixel format of Sysmem based BufferedImage.
// Native d3d interfaces support on the fly conversion of pixels from
// d3d surface to destination sysmem memory of type IntARGB only.
final int type = BufferedImage.TYPE_INT_ARGB;
src = convertFrom(this, src, sx, sy, w, h, cachedSrc, type);
// copy intermediate SW to destination SW using complex clip
final Blit performop = Blit.getFromCache(src.getSurfaceType(),
CompositeType.SrcNoEa,
dst.getSurfaceType());
performop.Blit(src, dst, comp, clip, 0, 0, dx, dy, w, h);
if (src != cachedSrc) {
// cache the intermediate surface
srcTmp = new WeakReference<>(src);
}
}
示例9: compose
import sun.java2d.loops.Blit; //导入方法依赖的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);
}
示例10: compose
import sun.java2d.loops.Blit; //导入方法依赖的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);
}
示例11: Blit
import sun.java2d.loops.Blit; //导入方法依赖的package包/类
public synchronized void Blit(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
int sx, int sy, int dx, int dy,
int w, int h)
{
Blit convertsrc = Blit.getFromCache(src.getSurfaceType(),
CompositeType.SrcNoEa,
SurfaceType.IntArgbPre);
SurfaceData cachedSrc = null;
if (srcTmp != null) {
// use cached intermediate surface, if available
cachedSrc = (SurfaceData)srcTmp.get();
}
// convert source to IntArgbPre
src = convertFrom(convertsrc, src, sx, sy, w, h,
cachedSrc, BufferedImage.TYPE_INT_ARGB_PRE);
// copy IntArgbPre intermediate surface to OpenGL surface
performop.Blit(src, dst, comp, clip,
0, 0, dx, dy, w, h);
if (src != cachedSrc) {
// cache the intermediate surface
srcTmp = new WeakReference(src);
}
}
示例12: Blit
import sun.java2d.loops.Blit; //导入方法依赖的package包/类
public synchronized void Blit(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
int sx, int sy, int dx, int dy,
int w, int h)
{
Blit convertsrc = Blit.getFromCache(src.getSurfaceType(),
CompositeType.SrcNoEa,
SurfaceType.IntArgbPre);
SurfaceData cachedSrc = null;
if (srcTmp != null) {
// use cached intermediate surface, if available
cachedSrc = (SurfaceData)srcTmp.get();
}
// convert source to IntArgbPre
src = convertFrom(convertsrc, src, sx, sy, w, h,
cachedSrc, BufferedImage.TYPE_INT_ARGB_PRE);
// copy IntArgbPre intermediate surface to D3D surface
performop.Blit(src, dst, comp, clip,
0, 0, dx, dy, w, h);
if (src != cachedSrc) {
// cache the intermediate surface
srcTmp = new WeakReference(src);
}
}
示例13: MaskBlit
import sun.java2d.loops.Blit; //导入方法依赖的package包/类
@Override
public void MaskBlit(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
int srcx, int srcy,
int dstx, int dsty,
int width, int height,
byte[] mask, int maskoff, int maskscan)
{
if (width <= 0 || height <= 0) {
return;
}
if (mask == null) {
// no mask involved; delegate to regular blit loop
if (blitop == null) {
blitop = Blit.getFromCache(src.getSurfaceType(),
CompositeType.AnyAlpha,
this.getDestType());
}
blitop.Blit(src, dst,
comp, clip,
srcx, srcy, dstx, dsty,
width, height);
return;
}
AlphaComposite acomp = (AlphaComposite)comp;
if (acomp.getRule() != AlphaComposite.SRC_OVER) {
comp = AlphaComposite.SrcOver;
}
rq.lock();
try {
validateContext(dst, comp, clip);
RenderBuffer buf = rq.getBuffer();
int totalBytesRequired = 20 + (width * height * 4);
/*
* REMIND: we should fix this so that it works with tiles that
* are larger than the entire buffer, but the native
* OGL/D3DMaskBlit isn't even prepared for tiles larger
* than 32x32 pixels, so there's no urgency here...
*/
rq.ensureCapacity(totalBytesRequired);
// enqueue parameters and tile pixels
int newpos = enqueueTile(buf.getAddress(), buf.position(),
src, src.getNativeOps(), srcTypeVal,
mask, mask.length, maskoff, maskscan,
srcx, srcy, dstx, dsty,
width, height);
buf.position(newpos);
} finally {
rq.unlock();
}
}
示例14: Blit
import sun.java2d.loops.Blit; //导入方法依赖的package包/类
public synchronized void Blit(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
int sx, int sy, int dx, int dy,
int w, int h)
{
if (convertsrc != null) {
SurfaceData cachedSrc = null;
if (srcTmp != null) {
// use cached intermediate surface, if available
cachedSrc = srcTmp.get();
}
// convert source to IntArgbPre
src = convertFrom(convertsrc, src, sx, sy, w, h, cachedSrc,
BufferedImage.TYPE_INT_ARGB_PRE);
if (src != cachedSrc) {
// cache the intermediate surface
srcTmp = new WeakReference<>(src);
}
}
SurfaceData cachedDst = null;
if (dstTmp != null) {
// use cached intermediate surface, if available
cachedDst = dstTmp.get();
}
// convert destination to IntArgbPre
SurfaceData dstBuffer = convertFrom(convertdst, dst, dx, dy, w, h,
cachedDst, BufferedImage.TYPE_INT_ARGB_PRE);
Region bufferClip =
clip == null ? null : clip.getTranslatedRegion(-dx, -dy);
Blit performop = Blit.getFromCache(src.getSurfaceType(),
CompositeType.Any, dstBuffer.getSurfaceType());
performop.Blit(src, dstBuffer, comp, bufferClip, sx, sy, 0, 0, w, h);
if (dstBuffer != cachedDst) {
// cache the intermediate surface
dstTmp = new WeakReference(dstBuffer);
}
// now blit the buffer back to the destination
convertresult.Blit(dstBuffer, dst, AlphaComposite.Src, clip, 0, 0, dx,
dy, w, h);
}