本文整理汇总了Java中sun.java2d.SurfaceData类的典型用法代码示例。如果您正苦于以下问题:Java SurfaceData类的具体用法?Java SurfaceData怎么用?Java SurfaceData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SurfaceData类属于sun.java2d包,在下文中一共展示了SurfaceData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doDrawPoly
import sun.java2d.SurfaceData; //导入依赖的package包/类
static void doDrawPoly(SurfaceData sData, PixelWriter pw,
int xPoints[], int yPoints[], int off, int nPoints,
Region clip, int transx, int transy, boolean close)
{
int mx, my, x1, y1;
int[] tmp = null;
if (nPoints <= 0) {
return;
}
mx = x1 = xPoints[off] + transx;
my = y1 = yPoints[off] + transy;
while (--nPoints > 0) {
++off;
int x2 = xPoints[off] + transx;
int y2 = yPoints[off] + transy;
tmp = GeneralRenderer.doDrawLine(sData, pw, tmp, clip,
x1, y1, x2, y2);
x1 = x2;
y1 = y2;
}
if (close && (x1 != mx || y1 != my)) {
tmp = GeneralRenderer.doDrawLine(sData, pw, tmp, clip,
x1, y1, mx, my);
}
}
示例2: displayChanged
import sun.java2d.SurfaceData; //导入依赖的package包/类
/**
* Called from SunGraphicsEnv when there has been a display mode change.
* Note that we simply invalidate hardware surfaces here; we do not
* attempt to recreate or re-render them. This is to avoid threading
* conflicts with the native toolkit and associated threads. Instead,
* we just nullify the old surface data object and wait for a future
* method in the rendering process to recreate the surface.
*/
public void displayChanged() {
if (!isAccelerationEnabled()) {
return;
}
lostSurface = true;
if (sdAccel != null) {
// First, nullify the software surface. This guards against
// using a SurfaceData that was created in a different
// display mode.
sdBackup = null;
// Now, invalidate the old hardware-based SurfaceData
// Note that getBackupSurface may set sdAccel to null so we have to invalidate it before
SurfaceData oldData = sdAccel;
sdAccel = null;
oldData.invalidate();
sdCurrent = getBackupSurface();
}
// Update graphicsConfig for the vImg in case it changed due to
// this display change event
vImg.updateGraphicsConfig();
}
示例3: getBackupSurface
import sun.java2d.SurfaceData; //导入依赖的package包/类
/**
* Creates a software-based surface (of type BufImgSurfaceData).
* The software representation is only created when needed, which
* is only during some situation in which the hardware surface
* cannot be allocated. This allows apps to at least run,
* albeit more slowly than they would otherwise.
*/
protected SurfaceData getBackupSurface() {
if (sdBackup == null) {
GraphicsConfiguration gc = vImg.getGraphicsConfig();
AffineTransform tx = gc.getDefaultTransform();
double scaleX = tx.getScaleX();
double scaleY = tx.getScaleY();
BufferedImage bImg = vImg.getBackupImage(scaleX, scaleY);
// Sabotage the acceleration capabilities of the BufImg surface
SunWritableRaster.stealTrackable(bImg
.getRaster()
.getDataBuffer()).setUntrackable();
sdBackup = BufImgSurfaceData.createData(bImg, scaleX, scaleY);
}
return sdBackup;
}
示例4: DrawPath
import sun.java2d.SurfaceData; //导入依赖的package包/类
public void DrawPath(SunGraphics2D sg2d, SurfaceData sData,
int transx, int transy, Path2D.Float p2df)
{
PixelWriter pw = GeneralRenderer.createXorPixelWriter(sg2d, sData);
ProcessPath.drawPath(
new PixelWriterDrawHandler(sData, pw, sg2d.getCompClip(),
sg2d.strokeHint),
p2df, transx, transy
);
}
示例5: initAcceleratedSurface
import sun.java2d.SurfaceData; //导入依赖的package包/类
/**
* Create a pixmap-based SurfaceData object
*/
protected SurfaceData initAcceleratedSurface() {
SurfaceData sData;
try {
XRGraphicsConfig gc = (XRGraphicsConfig) vImg.getGraphicsConfig();
ColorModel cm = gc.getColorModel();
long drawable = 0;
if (context instanceof Long) {
drawable = ((Long)context).longValue();
}
sData = XRSurfaceData.createData(gc,
vImg.getWidth(),
vImg.getHeight(),
cm, vImg, drawable,
vImg.getTransparency());
} catch (NullPointerException ex) {
sData = null;
} catch (OutOfMemoryError er) {
sData = null;
}
return sData;
}
示例6: Blit
import sun.java2d.SurfaceData; //导入依赖的package包/类
public void Blit(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
int sx, int sy,
int dx, int dy,
int w, int h)
{
SunToolkit.awtLock();
try {
X11SurfaceData x11sd = (X11SurfaceData)dst;
// pass null clip region here since we clip manually in native code
// also use false for needExposures since we clip to the pixmap
long xgc = x11sd.getBlitGC(null, false);
nativeBlit(src.getNativeOps(), dst.getNativeOps(), xgc, clip,
sx, sy, dx, dy, w, h);
} finally {
SunToolkit.awtUnlock();
}
}
示例7: DrawPolygons
import sun.java2d.SurfaceData; //导入依赖的package包/类
public void DrawPolygons(SunGraphics2D sg2d, SurfaceData sData,
int xPoints[], int yPoints[],
int nPoints[], int numPolys,
int transx, int transy,
boolean close)
{
PixelWriter pw = GeneralRenderer.createXorPixelWriter(sg2d, sData);
int off = 0;
Region clip = sg2d.getCompClip();
for (int i = 0; i < numPolys; i++) {
int numpts = nPoints[i];
GeneralRenderer.doDrawPoly(sData, pw,
xPoints, yPoints, off, numpts,
clip, transx, transy, close);
off += numpts;
}
}
示例8: initAcceleratedSurface
import sun.java2d.SurfaceData; //导入依赖的package包/类
/**
* Create a pixmap-based SurfaceData object
*/
protected SurfaceData initAcceleratedSurface() {
SurfaceData sData;
try {
X11GraphicsConfig gc = (X11GraphicsConfig)vImg.getGraphicsConfig();
ColorModel cm = gc.getColorModel();
long drawable = 0;
if (context instanceof Long) {
drawable = ((Long)context).longValue();
}
sData = X11SurfaceData.createData(gc,
vImg.getWidth(),
vImg.getHeight(),
cm, vImg, drawable,
Transparency.OPAQUE);
} catch (NullPointerException ex) {
sData = null;
} catch (OutOfMemoryError er) {
sData = null;
}
return sData;
}
示例9: setElem
import sun.java2d.SurfaceData; //导入依赖的package包/类
protected void setElem(final int x, final int y, final int pixel,
final SurfaceData sData)
{
if (sData.isSurfaceLost()) {
return;
}
D3DRenderQueue rq = D3DRenderQueue.getInstance();
rq.lock();
try {
rq.flushAndInvokeNow(new Runnable() {
public void run() {
dbSetPixelNative(sData.getNativeOps(), x, y, pixel);
}
});
sData.markDirty();
} finally {
rq.unlock();
}
}
示例10: Transform
import sun.java2d.SurfaceData; //导入依赖的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);
}
}
示例11: getElem
import sun.java2d.SurfaceData; //导入依赖的package包/类
protected int getElem(final int x, final int y,
final SurfaceData sData)
{
if (sData.isSurfaceLost()) {
return 0;
}
int retPixel;
D3DRenderQueue rq = D3DRenderQueue.getInstance();
rq.lock();
try {
rq.flushAndInvokeNow(new Runnable() {
public void run() {
pixel = dbGetPixelNative(sData.getNativeOps(), x, y);
}
});
} finally {
retPixel = pixel;
rq.unlock();
}
return retPixel;
}
示例12: FillRect
import sun.java2d.SurfaceData; //导入依赖的package包/类
public void FillRect(SunGraphics2D sg2d, SurfaceData sData,
int x, int y, int w, int h)
{
PixelWriter pw = GeneralRenderer.createSolidPixelWriter(sg2d, sData);
Region r = sg2d.getCompClip().getBoundsIntersectionXYWH(x, y, w, h);
GeneralRenderer.doSetRect(sData, pw,
r.getLoX(), r.getLoY(),
r.getHiX(), r.getHiY());
}
示例13: PixelWriterDrawHandler
import sun.java2d.SurfaceData; //导入依赖的package包/类
public PixelWriterDrawHandler(SurfaceData sData, PixelWriter pw,
Region clip, int strokeHint) {
super(clip.getLoX(), clip.getLoY(),
clip.getHiX(), clip.getHiY(),
strokeHint);
this.sData = sData;
this.pw = pw;
this.clip = clip;
}
示例14: Blit
import sun.java2d.SurfaceData; //导入依赖的package包/类
public void Blit(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
int sx, int sy, int dx, int dy, int w, int h)
{
D3DBlitLoops.Blit(src, dst,
comp, clip, null,
AffineTransformOp.TYPE_NEAREST_NEIGHBOR,
sx, sy, sx+w, sy+h,
dx, dy, dx+w, dy+h,
typeval, true);
}
示例15: FillParallelogram
import sun.java2d.SurfaceData; //导入依赖的package包/类
public void FillParallelogram(SunGraphics2D sg2d, SurfaceData dest,
double x0, double y0,
double dx1, double dy1,
double dx2, double dy2)
{
tracePrimitive(target);
target.FillParallelogram(sg2d, dest, x0, y0, dx1, dy1, dx2, dy2);
}