本文整理汇总了Java中sun.java2d.SunGraphics2D.STROKE_THIN属性的典型用法代码示例。如果您正苦于以下问题:Java SunGraphics2D.STROKE_THIN属性的具体用法?Java SunGraphics2D.STROKE_THIN怎么用?Java SunGraphics2D.STROKE_THIN使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类sun.java2d.SunGraphics2D
的用法示例。
在下文中一共展示了SunGraphics2D.STROKE_THIN属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: draw
public void draw(SunGraphics2D sg2d, Shape s) {
if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
if (s instanceof Polygon) {
if (sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
Polygon p = (Polygon)s;
drawPolygon(sg2d, p.xpoints, p.ypoints, p.npoints);
return;
}
}
Path2D.Float p2df;
int transx, transy;
if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
if (s instanceof Path2D.Float) {
p2df = (Path2D.Float)s;
} else {
p2df = new Path2D.Float(s);
}
transx = sg2d.transX;
transy = sg2d.transY;
} else {
p2df = new Path2D.Float(s, sg2d.transform);
transx = 0;
transy = 0;
}
drawPath(sg2d, p2df, transx, transy);
} else if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) {
ShapeSpanIterator si = LoopPipe.getStrokeSpans(sg2d, s);
try {
fillSpans(sg2d, si, 0, 0);
} finally {
si.dispose();
}
} else {
fill(sg2d, sg2d.stroke.createStrokedShape(s));
}
}
示例2: draw
public void draw(SunGraphics2D sg2d, Shape s) {
if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
Path2D.Float p2df;
int transX;
int transY;
if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
if (s instanceof Path2D.Float) {
p2df = (Path2D.Float)s;
} else {
p2df = new Path2D.Float(s);
}
transX = sg2d.transX;
transY = sg2d.transY;
} else {
p2df = new Path2D.Float(s, sg2d.transform);
transX = 0;
transY = 0;
}
sg2d.loops.drawPathLoop.DrawPath(sg2d, sg2d.getSurfaceData(),
transX, transY, p2df);
return;
}
if (sg2d.strokeState == SunGraphics2D.STROKE_CUSTOM) {
fill(sg2d, sg2d.stroke.createStrokedShape(s));
return;
}
ShapeSpanIterator sr = getStrokeSpans(sg2d, s);
try {
fillSpans(sg2d, sr);
} finally {
sr.dispose();
}
}
示例3: fill
public void fill(SunGraphics2D sg2d, Shape s) {
if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
Path2D.Float p2df;
int transX;
int transY;
if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
if (s instanceof Path2D.Float) {
p2df = (Path2D.Float)s;
} else {
p2df = new Path2D.Float(s);
}
transX = sg2d.transX;
transY = sg2d.transY;
} else {
p2df = new Path2D.Float(s, sg2d.transform);
transX = 0;
transY = 0;
}
sg2d.loops.fillPathLoop.FillPath(sg2d, sg2d.getSurfaceData(),
transX, transY, p2df);
return;
}
ShapeSpanIterator sr = getFillSSI(sg2d);
try {
sr.setOutputArea(sg2d.getCompClip());
AffineTransform at =
((sg2d.transformState == SunGraphics2D.TRANSFORM_ISIDENT)
? null
: sg2d.transform);
sr.appendPath(s.getPathIterator(at));
fillSpans(sg2d, sr);
} finally {
sr.dispose();
}
}
示例4: draw
public void draw(SunGraphics2D sg2d, Shape s) {
if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
// Delegate to drawPolygon() if possible...
if (s instanceof Polygon &&
sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE)
{
Polygon p = (Polygon) s;
drawPolygon(sg2d, p.xpoints, p.ypoints, p.npoints);
return;
}
// Otherwise we will use drawPath() for
// high-quality thin paths.
doPath(sg2d, s, false);
} else if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) {
// REMIND: X11 can handle uniform scaled wide lines
// and dashed lines itself if we set the appropriate
// XGC attributes (TBD).
ShapeSpanIterator si = LoopPipe.getStrokeSpans(sg2d, s);
try {
SunToolkit.awtLock();
try {
long xgc = validate(sg2d);
XFillSpans(sg2d.surfaceData.getNativeOps(), xgc,
si, si.getNativeIterator(),
0, 0);
} finally {
SunToolkit.awtUnlock();
}
} finally {
si.dispose();
}
} else {
fill(sg2d, sg2d.stroke.createStrokedShape(s));
}
}
示例5: draw
public void draw(SunGraphics2D sg2d, Shape s) {
if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
Path2D.Float p2df;
int transx, transy;
if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
if (s instanceof Path2D.Float) {
p2df = (Path2D.Float) s;
} else {
p2df = new Path2D.Float(s);
}
transx = sg2d.transX;
transy = sg2d.transY;
} else {
p2df = new Path2D.Float(s, sg2d.transform);
transx = 0;
transy = 0;
}
drawPath(sg2d, p2df, transx, transy);
} else if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) {
ShapeSpanIterator si = LoopPipe.getStrokeSpans(sg2d, s);
try {
fillSpans(sg2d, si, 0, 0);
} finally {
si.dispose();
}
} else {
fill(sg2d, sg2d.stroke.createStrokedShape(s));
}
}
示例6: fill
public void fill(SunGraphics2D sg2d, Shape s) {
int transx, transy;
if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
// Here we are able to use fillPath() for
// high-quality fills.
Path2D.Float p2df;
if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
if (s instanceof Path2D.Float) {
p2df = (Path2D.Float)s;
} else {
p2df = new Path2D.Float(s);
}
transx = sg2d.transX;
transy = sg2d.transY;
} else {
p2df = new Path2D.Float(s, sg2d.transform);
transx = 0;
transy = 0;
}
fillPath(sg2d, p2df, transx, transy);
return;
}
AffineTransform at;
if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
// Transform (translation) will be done by FillSpans (we could
// delegate to fillPolygon() here, but most hardware accelerated
// libraries cannot handle non-convex polygons, so we will use
// the FillSpans approach by default)
at = null;
transx = sg2d.transX;
transy = sg2d.transY;
} else {
// Transform will be done by the PathIterator
at = sg2d.transform;
transx = transy = 0;
}
ShapeSpanIterator ssi = LoopPipe.getFillSSI(sg2d);
try {
// Subtract transx/y from the SSI clip to match the
// (potentially untranslated) geometry fed to it
Region clip = sg2d.getCompClip();
ssi.setOutputAreaXYXY(clip.getLoX() - transx,
clip.getLoY() - transy,
clip.getHiX() - transx,
clip.getHiY() - transy);
ssi.appendPath(s.getPathIterator(at));
fillSpans(sg2d, ssi, transx, transy);
} finally {
ssi.dispose();
}
}
示例7: validatePipe
@Override
public void validatePipe(SunGraphics2D sg2d) {
TextPipe textpipe;
boolean validated = false;
/*
* The textpipe for now can't handle TexturePaint when extra-alpha is
* specified nore XOR mode
*/
if ((textpipe = getTextPipe(sg2d)) == null)
{
super.validatePipe(sg2d);
textpipe = sg2d.textpipe;
validated = true;
}
PixelToShapeConverter txPipe = null;
XRRenderer nonTxPipe = null;
/*
* TODO: Can we rely on the GC for ARGB32 surfaces?
*/
if (sg2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON) {
if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR) {
if (sg2d.compositeState <= SunGraphics2D.COMP_XOR) {
txPipe = xrtxpipe;
nonTxPipe = xrpipe;
}
} else if (sg2d.compositeState <= SunGraphics2D.COMP_ALPHA) {
if (XRPaints.isValid(sg2d)) {
txPipe = xrtxpipe;
nonTxPipe = xrpipe;
}
// custom paints handled by super.validatePipe() below
}
}
if (sg2d.antialiasHint == SunHints.INTVAL_ANTIALIAS_ON &&
JulesPathBuf.isCairoAvailable())
{
sg2d.shapepipe = aaShapePipe;
sg2d.drawpipe = aaPixelToShapeConv;
sg2d.fillpipe = aaPixelToShapeConv;
} else {
if (txPipe != null) {
if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
sg2d.drawpipe = txPipe;
sg2d.fillpipe = txPipe;
} else if (sg2d.strokeState != SunGraphics2D.STROKE_THIN) {
sg2d.drawpipe = txPipe;
sg2d.fillpipe = nonTxPipe;
} else {
sg2d.drawpipe = nonTxPipe;
sg2d.fillpipe = nonTxPipe;
}
sg2d.shapepipe = nonTxPipe;
} else {
if (!validated) {
super.validatePipe(sg2d);
}
}
}
// install the text pipe based on our earlier decision
sg2d.textpipe = textpipe;
// always override the image pipe with the specialized XRender pipe
sg2d.imagepipe = xrDrawImage;
}
示例8: fill
public void fill(SunGraphics2D sg2d, Shape s) {
if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
// Delegate to fillPolygon() if possible...
if (s instanceof Polygon &&
sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE)
{
Polygon p = (Polygon) s;
fillPolygon(sg2d, p.xpoints, p.ypoints, p.npoints);
return;
}
// Otherwise we will use fillPath() for
// high-quality fills.
doPath(sg2d, s, true);
return;
}
AffineTransform at;
int transx, transy;
if (sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
// Transform (translation) will be done by XFillSpans
at = null;
transx = sg2d.transX;
transy = sg2d.transY;
} else {
// Transform will be done by the PathIterator
at = sg2d.transform;
transx = transy = 0;
}
ShapeSpanIterator ssi = LoopPipe.getFillSSI(sg2d);
try {
// Subtract transx/y from the SSI clip to match the
// (potentially untranslated) geometry fed to it
Region clip = sg2d.getCompClip();
ssi.setOutputAreaXYXY(clip.getLoX() - transx,
clip.getLoY() - transy,
clip.getHiX() - transx,
clip.getHiY() - transy);
ssi.appendPath(s.getPathIterator(at));
SunToolkit.awtLock();
try {
long xgc = validate(sg2d);
XFillSpans(sg2d.surfaceData.getNativeOps(), xgc,
ssi, ssi.getNativeIterator(),
transx, transy);
} finally {
SunToolkit.awtUnlock();
}
} finally {
ssi.dispose();
}
}
示例9: fill
public void fill(SunGraphics2D sg2d, Shape s) {
int transx, transy;
if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
// Here we are able to use fillPath() for
// high-quality fills.
Path2D.Float p2df;
if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
if (s instanceof Path2D.Float) {
p2df = (Path2D.Float) s;
} else {
p2df = new Path2D.Float(s);
}
transx = sg2d.transX;
transy = sg2d.transY;
} else {
p2df = new Path2D.Float(s, sg2d.transform);
transx = 0;
transy = 0;
}
fillPath(sg2d, p2df, transx, transy);
return;
}
AffineTransform at;
if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
// Transform (translation) will be done by FillSpans
at = null;
transx = sg2d.transX;
transy = sg2d.transY;
} else {
// Transform will be done by the PathIterator
at = sg2d.transform;
transx = transy = 0;
}
ShapeSpanIterator ssi = LoopPipe.getFillSSI(sg2d);
try {
// Subtract transx/y from the SSI clip to match the
// (potentially untranslated) geometry fed to it
Region clip = sg2d.getCompClip();
ssi.setOutputAreaXYXY(clip.getLoX() - transx,
clip.getLoY() - transy,
clip.getHiX() - transx,
clip.getHiY() - transy);
ssi.appendPath(s.getPathIterator(at));
fillSpans(sg2d, ssi, transx, transy);
} finally {
ssi.dispose();
}
}
示例10: validatePipe
public void validatePipe(SunGraphics2D sg2d) {
if (sg2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON &&
sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR &&
(sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY ||
sg2d.compositeState == SunGraphics2D.COMP_XOR))
{
if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
// Do this to init textpipe correctly; we will override the
// other non-text pipes below
// REMIND: we should clean this up eventually instead of
// having this work duplicated.
super.validatePipe(sg2d);
} else {
switch (sg2d.textAntialiasHint) {
case SunHints.INTVAL_TEXT_ANTIALIAS_DEFAULT:
/* equate DEFAULT to OFF which it is for us */
case SunHints.INTVAL_TEXT_ANTIALIAS_OFF:
sg2d.textpipe = solidTextRenderer;
break;
case SunHints.INTVAL_TEXT_ANTIALIAS_ON:
sg2d.textpipe = aaTextRenderer;
break;
default:
switch (sg2d.getFontInfo().aaHint) {
case SunHints.INTVAL_TEXT_ANTIALIAS_LCD_HRGB:
case SunHints.INTVAL_TEXT_ANTIALIAS_LCD_VRGB:
sg2d.textpipe = lcdTextRenderer;
break;
case SunHints.INTVAL_TEXT_ANTIALIAS_ON:
sg2d.textpipe = aaTextRenderer;
break;
default:
sg2d.textpipe = solidTextRenderer;
}
}
}
sg2d.imagepipe = imagepipe;
if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
sg2d.drawpipe = gdiTxPipe;
sg2d.fillpipe = gdiTxPipe;
} else if (sg2d.strokeState != SunGraphics2D.STROKE_THIN){
sg2d.drawpipe = gdiTxPipe;
sg2d.fillpipe = gdiPipe;
} else {
sg2d.drawpipe = gdiPipe;
sg2d.fillpipe = gdiPipe;
}
sg2d.shapepipe = gdiPipe;
// This is needed for AA text.
// Note that even a SolidTextRenderer can dispatch AA text
// if a GlyphVector overrides the AA setting.
// We use getRenderLoops() rather than setting solidloops
// directly so that we get the appropriate loops in XOR mode.
if (sg2d.loops == null) {
// assert(some pipe will always be a LoopBasedPipe)
sg2d.loops = getRenderLoops(sg2d);
}
} else {
super.validatePipe(sg2d);
}
}