本文整理汇总了Java中sun.java2d.pipe.AATileGenerator类的典型用法代码示例。如果您正苦于以下问题:Java AATileGenerator类的具体用法?Java AATileGenerator怎么用?Java AATileGenerator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AATileGenerator类属于sun.java2d.pipe包,在下文中一共展示了AATileGenerator类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fillParallelogram
import sun.java2d.pipe.AATileGenerator; //导入依赖的package包/类
@Override
public void fillParallelogram(SunGraphics2D sg,
double ux1, double uy1,
double ux2, double uy2,
double x, double y,
double dx1, double dy1,
double dx2, double dy2) {
final TileState ts = tileStateProvider.acquire();
try {
final int[] abox = ts.abox;
final AATileGenerator aatg
= renderengine.getAATileGenerator(x, y, dx1, dy1, dx2, dy2, 0, 0,
sg.getCompClip(), abox);
if (aatg != null) {
renderTiles(sg, ts.computeBBox(ux1, uy1, ux2, uy2),
aatg, abox, ts);
}
} finally {
tileStateProvider.release(ts);
}
}
示例2: drawParallelogram
import sun.java2d.pipe.AATileGenerator; //导入依赖的package包/类
@Override
public void drawParallelogram(SunGraphics2D sg,
double ux1, double uy1,
double ux2, double uy2,
double x, double y,
double dx1, double dy1,
double dx2, double dy2,
double lw1, double lw2) {
final TileState ts = tileStateProvider.acquire();
try {
final int[] abox = ts.abox;
final AATileGenerator aatg
= renderengine.getAATileGenerator(x, y, dx1, dy1, dx2, dy2, lw1,
lw2, sg.getCompClip(), abox);
if (aatg != null) {
// Note that bbox is of the original shape, not the wide path.
// This is appropriate for handing to Paint methods...
renderTiles(sg, ts.computeBBox(ux1, uy1, ux2, uy2),
aatg, abox, ts);
}
} finally {
tileStateProvider.release(ts);
}
}
示例3: renderPath
import sun.java2d.pipe.AATileGenerator; //导入依赖的package包/类
public void renderPath(SunGraphics2D sg, Shape s, BasicStroke bs) {
final boolean adjust = (bs != null
&& sg.strokeHint != SunHints.INTVAL_STROKE_PURE);
final boolean thin = (sg.strokeState <= SunGraphics2D.STROKE_THINDASHED);
final TileState ts = tileStateProvider.acquire();
try {
final int[] abox = ts.abox;
final AATileGenerator aatg
= renderengine.getAATileGenerator(s, sg.transform, sg.getCompClip(),
bs, thin, adjust, abox);
if (aatg != null) {
renderTiles(sg, s, aatg, abox, ts);
}
} finally {
tileStateProvider.release(ts);
}
}
示例4: getAATileGenerator
import sun.java2d.pipe.AATileGenerator; //导入依赖的package包/类
public AATileGenerator getAATileGenerator(double x, double y,
double dx1, double dy1,
double dx2, double dy2,
double lw1, double lw2,
Region clip,
int bbox[])
{
// REMIND: Deal with large coordinates!
double ldx1, ldy1, ldx2, ldy2;
boolean innerpgram = (lw1 > 0 && lw2 > 0);
if (innerpgram) {
ldx1 = dx1 * lw1;
ldy1 = dy1 * lw1;
ldx2 = dx2 * lw2;
ldy2 = dy2 * lw2;
x -= (ldx1 + ldx2) / 2.0;
y -= (ldy1 + ldy2) / 2.0;
dx1 += ldx1;
dy1 += ldy1;
dx2 += ldx2;
dy2 += ldy2;
if (lw1 > 1 && lw2 > 1) {
// Inner parallelogram was entirely consumed by stroke...
innerpgram = false;
}
} else {
ldx1 = ldy1 = ldx2 = ldy2 = 0;
}
Renderer r = new Renderer(3, 3,
clip.getLoX(), clip.getLoY(),
clip.getWidth(), clip.getHeight(),
PathIterator.WIND_EVEN_ODD);
r.moveTo((float) x, (float) y);
r.lineTo((float) (x+dx1), (float) (y+dy1));
r.lineTo((float) (x+dx1+dx2), (float) (y+dy1+dy2));
r.lineTo((float) (x+dx2), (float) (y+dy2));
r.closePath();
if (innerpgram) {
x += ldx1 + ldx2;
y += ldy1 + ldy2;
dx1 -= 2.0 * ldx1;
dy1 -= 2.0 * ldy1;
dx2 -= 2.0 * ldx2;
dy2 -= 2.0 * ldy2;
r.moveTo((float) x, (float) y);
r.lineTo((float) (x+dx1), (float) (y+dy1));
r.lineTo((float) (x+dx1+dx2), (float) (y+dy1+dy2));
r.lineTo((float) (x+dx2), (float) (y+dy2));
r.closePath();
}
r.pathDone();
r.endRendering();
PiscesTileGenerator ptg = new PiscesTileGenerator(r, r.MAX_AA_ALPHA);
ptg.getBbox(bbox);
return ptg;
}
示例5: getAATileGenerator
import sun.java2d.pipe.AATileGenerator; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public AATileGenerator getAATileGenerator(double x, double y,
double dx1, double dy1,
double dx2, double dy2,
double lw1, double lw2,
Region clip,
int bbox[])
{
// REMIND: Deal with large coordinates!
double ldx1, ldy1, ldx2, ldy2;
boolean innerpgram = (lw1 > 0 && lw2 > 0);
if (innerpgram) {
ldx1 = dx1 * lw1;
ldy1 = dy1 * lw1;
ldx2 = dx2 * lw2;
ldy2 = dy2 * lw2;
x -= (ldx1 + ldx2) / 2.0;
y -= (ldy1 + ldy2) / 2.0;
dx1 += ldx1;
dy1 += ldy1;
dx2 += ldx2;
dy2 += ldy2;
if (lw1 > 1 && lw2 > 1) {
// Inner parallelogram was entirely consumed by stroke...
innerpgram = false;
}
} else {
ldx1 = ldy1 = ldx2 = ldy2 = 0;
}
Rasterizer r = getRasterizer();
r.setUsage(Rasterizer.EOFILL);
r.beginPath();
r.beginSubpath((float) x, (float) y);
r.appendLine((float) (x+dx1), (float) (y+dy1));
r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
r.appendLine((float) (x+dx2), (float) (y+dy2));
r.closedSubpath();
if (innerpgram) {
x += ldx1 + ldx2;
y += ldy1 + ldy2;
dx1 -= 2.0 * ldx1;
dy1 -= 2.0 * ldy1;
dx2 -= 2.0 * ldx2;
dy2 -= 2.0 * ldy2;
r.beginSubpath((float) x, (float) y);
r.appendLine((float) (x+dx1), (float) (y+dy1));
r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
r.appendLine((float) (x+dx2), (float) (y+dy2));
r.closedSubpath();
}
try {
r.endPath();
r.getAlphaBox(bbox);
clip.clipBoxToBounds(bbox);
if (bbox[0] >= bbox[2] || bbox[1] >= bbox[3]) {
dropRasterizer(r);
return null;
}
r.setOutputArea(bbox[0], bbox[1],
bbox[2] - bbox[0],
bbox[3] - bbox[1]);
} catch (PRException e) {
/*
* This exeption is thrown from the native part of the Ductus
* (only in case of a debug build) to indicate that some
* segments of the path have very large coordinates.
* See 4485298 for more info.
*/
System.err.println("DuctusRenderingEngine.getAATileGenerator: "+e);
}
return r;
}
示例6: getAATileGenerator
import sun.java2d.pipe.AATileGenerator; //导入依赖的package包/类
@Override
public final AATileGenerator getAATileGenerator(double x, double y,
double dx1, double dy1,
double dx2, double dy2,
double lw1, double lw2,
Region clip,
int[] bbox)
{
// REMIND: Deal with large coordinates!
double ldx1, ldy1, ldx2, ldy2;
boolean innerpgram = (lw1 > 0.0d && lw2 > 0.0d);
if (innerpgram) {
ldx1 = dx1 * lw1;
ldy1 = dy1 * lw1;
ldx2 = dx2 * lw2;
ldy2 = dy2 * lw2;
x -= (ldx1 + ldx2) / 2.0d;
y -= (ldy1 + ldy2) / 2.0d;
dx1 += ldx1;
dy1 += ldy1;
dx2 += ldx2;
dy2 += ldy2;
if (lw1 > 1.0d && lw2 > 1.0d) {
// Inner parallelogram was entirely consumed by stroke...
innerpgram = false;
}
} else {
ldx1 = ldy1 = ldx2 = ldy2 = 0.0d;
}
MarlinTileGenerator ptg = null;
DRenderer r = null;
final DRendererContext rdrCtx = getRendererContext();
try {
r = rdrCtx.renderer.init(clip.getLoX(), clip.getLoY(),
clip.getWidth(), clip.getHeight(),
DRenderer.WIND_EVEN_ODD);
r.moveTo( x, y);
r.lineTo( (x+dx1), (y+dy1));
r.lineTo( (x+dx1+dx2), (y+dy1+dy2));
r.lineTo( (x+dx2), (y+dy2));
r.closePath();
if (innerpgram) {
x += ldx1 + ldx2;
y += ldy1 + ldy2;
dx1 -= 2.0d * ldx1;
dy1 -= 2.0d * ldy1;
dx2 -= 2.0d * ldx2;
dy2 -= 2.0d * ldy2;
r.moveTo( x, y);
r.lineTo( (x+dx1), (y+dy1));
r.lineTo( (x+dx1+dx2), (y+dy1+dy2));
r.lineTo( (x+dx2), (y+dy2));
r.closePath();
}
r.pathDone();
if (r.endRendering()) {
ptg = rdrCtx.ptg.init();
ptg.getBbox(bbox);
// note: do not returnRendererContext(rdrCtx)
// as it will be called later by MarlinTileGenerator.dispose()
r = null;
}
} finally {
if (r != null) {
// dispose renderer and recycle the RendererContext instance:
r.dispose();
}
}
// Return null to cancel AA tile generation (nothing to render)
return ptg;
}
示例7: getAATileGenerator
import sun.java2d.pipe.AATileGenerator; //导入依赖的package包/类
@Override
public final AATileGenerator getAATileGenerator(double x, double y,
double dx1, double dy1,
double dx2, double dy2,
double lw1, double lw2,
Region clip,
int[] bbox)
{
// REMIND: Deal with large coordinates!
double ldx1, ldy1, ldx2, ldy2;
boolean innerpgram = (lw1 > 0.0d && lw2 > 0.0d);
if (innerpgram) {
ldx1 = dx1 * lw1;
ldy1 = dy1 * lw1;
ldx2 = dx2 * lw2;
ldy2 = dy2 * lw2;
x -= (ldx1 + ldx2) / 2.0d;
y -= (ldy1 + ldy2) / 2.0d;
dx1 += ldx1;
dy1 += ldy1;
dx2 += ldx2;
dy2 += ldy2;
if (lw1 > 1.0d && lw2 > 1.0d) {
// Inner parallelogram was entirely consumed by stroke...
innerpgram = false;
}
} else {
ldx1 = ldy1 = ldx2 = ldy2 = 0.0d;
}
MarlinTileGenerator ptg = null;
Renderer r = null;
final RendererContext rdrCtx = getRendererContext();
try {
r = rdrCtx.renderer.init(clip.getLoX(), clip.getLoY(),
clip.getWidth(), clip.getHeight(),
Renderer.WIND_EVEN_ODD);
r.moveTo((float) x, (float) y);
r.lineTo((float) (x+dx1), (float) (y+dy1));
r.lineTo((float) (x+dx1+dx2), (float) (y+dy1+dy2));
r.lineTo((float) (x+dx2), (float) (y+dy2));
r.closePath();
if (innerpgram) {
x += ldx1 + ldx2;
y += ldy1 + ldy2;
dx1 -= 2.0d * ldx1;
dy1 -= 2.0d * ldy1;
dx2 -= 2.0d * ldx2;
dy2 -= 2.0d * ldy2;
r.moveTo((float) x, (float) y);
r.lineTo((float) (x+dx1), (float) (y+dy1));
r.lineTo((float) (x+dx1+dx2), (float) (y+dy1+dy2));
r.lineTo((float) (x+dx2), (float) (y+dy2));
r.closePath();
}
r.pathDone();
if (r.endRendering()) {
ptg = rdrCtx.ptg.init();
ptg.getBbox(bbox);
// note: do not returnRendererContext(rdrCtx)
// as it will be called later by MarlinTileGenerator.dispose()
r = null;
}
} finally {
if (r != null) {
// dispose renderer and recycle the RendererContext instance:
r.dispose();
}
}
// Return null to cancel AA tile generation (nothing to render)
return ptg;
}
示例8: getAATileGenerator
import sun.java2d.pipe.AATileGenerator; //导入依赖的package包/类
@Override
public final AATileGenerator getAATileGenerator(double x, double y,
double dx1, double dy1,
double dx2, double dy2,
double lw1, double lw2,
Region clip,
int bbox[])
{
// REMIND: Deal with large coordinates!
double ldx1, ldy1, ldx2, ldy2;
boolean innerpgram = (lw1 > 0.0 && lw2 > 0.0);
if (innerpgram) {
ldx1 = dx1 * lw1;
ldy1 = dy1 * lw1;
ldx2 = dx2 * lw2;
ldy2 = dy2 * lw2;
x -= (ldx1 + ldx2) / 2.0;
y -= (ldy1 + ldy2) / 2.0;
dx1 += ldx1;
dy1 += ldy1;
dx2 += ldx2;
dy2 += ldy2;
if (lw1 > 1.0 && lw2 > 1.0) {
// Inner parallelogram was entirely consumed by stroke...
innerpgram = false;
}
} else {
ldx1 = ldy1 = ldx2 = ldy2 = 0.0;
}
MarlinTileGenerator ptg = null;
Renderer r = null;
final RendererContext rdrCtx = getRendererContext();
try {
r = rdrCtx.renderer.init(clip.getLoX(), clip.getLoY(),
clip.getWidth(), clip.getHeight(),
Renderer.WIND_EVEN_ODD);
r.moveTo((float) x, (float) y);
r.lineTo((float) (x+dx1), (float) (y+dy1));
r.lineTo((float) (x+dx1+dx2), (float) (y+dy1+dy2));
r.lineTo((float) (x+dx2), (float) (y+dy2));
r.closePath();
if (innerpgram) {
x += ldx1 + ldx2;
y += ldy1 + ldy2;
dx1 -= 2.0 * ldx1;
dy1 -= 2.0 * ldy1;
dx2 -= 2.0 * ldx2;
dy2 -= 2.0 * ldy2;
r.moveTo((float) x, (float) y);
r.lineTo((float) (x+dx1), (float) (y+dy1));
r.lineTo((float) (x+dx1+dx2), (float) (y+dy1+dy2));
r.lineTo((float) (x+dx2), (float) (y+dy2));
r.closePath();
}
r.pathDone();
if (r.endRendering()) {
ptg = rdrCtx.ptg.init();
ptg.getBbox(bbox);
// note: do not returnRendererContext(rdrCtx)
// as it will be called later by MarlinTileGenerator.dispose()
r = null;
}
} finally {
if (r != null) {
// dispose renderer:
r.dispose();
// recycle the RendererContext instance
MarlinRenderingEngine.returnRendererContext(rdrCtx);
}
}
// Return null to cancel AA tile generation (nothing to render)
return ptg;
}
示例9: getAATileGenerator
import sun.java2d.pipe.AATileGenerator; //导入依赖的package包/类
@Override
public final AATileGenerator getAATileGenerator(double x, double y,
double dx1, double dy1,
double dx2, double dy2,
double lw1, double lw2,
Region clip,
int[] bbox)
{
// REMIND: Deal with large coordinates!
double ldx1, ldy1, ldx2, ldy2;
boolean innerpgram = (lw1 > 0.0 && lw2 > 0.0);
if (innerpgram) {
ldx1 = dx1 * lw1;
ldy1 = dy1 * lw1;
ldx2 = dx2 * lw2;
ldy2 = dy2 * lw2;
x -= (ldx1 + ldx2) / 2.0;
y -= (ldy1 + ldy2) / 2.0;
dx1 += ldx1;
dy1 += ldy1;
dx2 += ldx2;
dy2 += ldy2;
if (lw1 > 1.0 && lw2 > 1.0) {
// Inner parallelogram was entirely consumed by stroke...
innerpgram = false;
}
} else {
ldx1 = ldy1 = ldx2 = ldy2 = 0.0;
}
MarlinTileGenerator ptg = null;
Renderer r = null;
final RendererContext rdrCtx = getRendererContext();
try {
r = rdrCtx.renderer.init(clip.getLoX(), clip.getLoY(),
clip.getWidth(), clip.getHeight(),
Renderer.WIND_EVEN_ODD);
r.moveTo((float) x, (float) y);
r.lineTo((float) (x+dx1), (float) (y+dy1));
r.lineTo((float) (x+dx1+dx2), (float) (y+dy1+dy2));
r.lineTo((float) (x+dx2), (float) (y+dy2));
r.closePath();
if (innerpgram) {
x += ldx1 + ldx2;
y += ldy1 + ldy2;
dx1 -= 2.0 * ldx1;
dy1 -= 2.0 * ldy1;
dx2 -= 2.0 * ldx2;
dy2 -= 2.0 * ldy2;
r.moveTo((float) x, (float) y);
r.lineTo((float) (x+dx1), (float) (y+dy1));
r.lineTo((float) (x+dx1+dx2), (float) (y+dy1+dy2));
r.lineTo((float) (x+dx2), (float) (y+dy2));
r.closePath();
}
r.pathDone();
if (r.endRendering()) {
ptg = rdrCtx.ptg.init();
ptg.getBbox(bbox);
// note: do not returnRendererContext(rdrCtx)
// as it will be called later by MarlinTileGenerator.dispose()
r = null;
}
} finally {
if (r != null) {
// dispose renderer:
r.dispose();
// recycle the RendererContext instance
MarlinRenderingEngine.returnRendererContext(rdrCtx);
}
}
// Return null to cancel AA tile generation (nothing to render)
return ptg;
}
示例10: renderTiles
import sun.java2d.pipe.AATileGenerator; //导入依赖的package包/类
public void renderTiles(SunGraphics2D sg, Shape s,
final AATileGenerator aatg,
final int[] abox, final TileState ts) {
Object context = null;
try {
// reentrance: outpipe may also use AAShapePipe:
context = outpipe.startSequence(sg, s,
ts.computeDevBox(abox),
abox);
// copy of int[] abox as local variables for performance:
final int x0 = abox[0];
final int y0 = abox[1];
final int x1 = abox[2];
final int y1 = abox[3];
final int tw = aatg.getTileWidth();
final int th = aatg.getTileHeight();
// get tile from thread local storage:
final byte[] alpha = ts.getAlphaTile(tw * th);
byte[] atile;
for (int y = y0; y < y1; y += th) {
final int h = Math.min(th, y1 - y);
for (int x = x0; x < x1; x += tw) {
final int w = Math.min(tw, x1 - x);
final int a = aatg.getTypicalAlpha();
if (a == 0x00 || !outpipe.needTile(context, x, y, w, h)) {
aatg.nextTile();
outpipe.skipTile(context, x, y);
continue;
}
if (a == 0xff) {
atile = null;
aatg.nextTile();
} else {
atile = alpha;
aatg.getAlpha(alpha, 0, tw);
}
outpipe.renderPathTile(context, atile, 0, tw, x, y, w, h);
}
}
} finally {
aatg.dispose();
if (context != null) {
outpipe.endSequence(context);
}
}
}