本文整理汇总了Java中java.awt.BasicStroke.getLineWidth方法的典型用法代码示例。如果您正苦于以下问题:Java BasicStroke.getLineWidth方法的具体用法?Java BasicStroke.getLineWidth怎么用?Java BasicStroke.getLineWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.BasicStroke
的用法示例。
在下文中一共展示了BasicStroke.getLineWidth方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: LineHighlightEffect
import java.awt.BasicStroke; //导入方法依赖的package包/类
/**
*
*/
public LineHighlightEffect(Shape shape, Graphics2D graphics,
int length, ViselPane viselPane, boolean continuous) {
this.shape = shape;
this.length = length;
this.graphics = graphics;
this.viselPane = viselPane;
this.continuous = continuous;
timer = new Timer(length/10, this);
duration = 0;
stroke = (BasicStroke) graphics.getStroke();
currentLineWidth =
initialLineWidth = stroke.getLineWidth();
}
示例2: drawRect
import java.awt.BasicStroke; //导入方法依赖的package包/类
public void drawRect(SunGraphics2D sg2d,
int x, int y, int w, int h)
{
if (w >= 0 && h >= 0) {
if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) {
BasicStroke bs = ((BasicStroke) sg2d.stroke);
if (w > 0 && h > 0) {
if (bs.getLineJoin() == BasicStroke.JOIN_MITER &&
bs.getDashArray() == null)
{
double lw = bs.getLineWidth();
drawRectangle(sg2d, x, y, w, h, lw);
return;
}
} else {
// Note: This calls the integer version which
// will verify that the local drawLine optimizations
// work and call super.drawLine(), if not.
drawLine(sg2d, x, y, x+w, y+h);
return;
}
}
super.drawRect(sg2d, x, y, w, h);
}
}
示例3: strokeTo
import java.awt.BasicStroke; //导入方法依赖的package包/类
void strokeTo(Shape src,
AffineTransform at,
BasicStroke bs,
boolean thin,
NormMode normalize,
boolean antialias,
PathConsumer2D pc2d)
{
float lw;
if (thin) {
if (antialias) {
lw = userSpaceLineWidth(at, 0.5f);
} else {
lw = userSpaceLineWidth(at, 1.0f);
}
} else {
lw = bs.getLineWidth();
}
strokeTo(src,
at,
lw,
normalize,
bs.getEndCap(),
bs.getLineJoin(),
bs.getMiterLimit(),
bs.getDashArray(),
bs.getDashPhase(),
pc2d);
}
示例4: draw
import java.awt.BasicStroke; //导入方法依赖的package包/类
public void draw(SunGraphics2D sg2d, Shape s) {
if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) {
BasicStroke bs = ((BasicStroke) sg2d.stroke);
if (s instanceof Rectangle2D) {
if (bs.getLineJoin() == BasicStroke.JOIN_MITER &&
bs.getDashArray() == null)
{
Rectangle2D r2d = (Rectangle2D) s;
double w = r2d.getWidth();
double h = r2d.getHeight();
double x = r2d.getX();
double y = r2d.getY();
if (w >= 0 && h >= 0) {
double lw = bs.getLineWidth();
drawRectangle(sg2d, x, y, w, h, lw);
}
return;
}
} else if (s instanceof Line2D) {
Line2D l2d = (Line2D) s;
if (drawGeneralLine(sg2d,
l2d.getX1(), l2d.getY1(),
l2d.getX2(), l2d.getY2()))
{
return;
}
}
}
outpipe.draw(sg2d, s);
}
示例5: getStroke
import java.awt.BasicStroke; //导入方法依赖的package包/类
private Stroke getStroke(float thickness) {
float lineThickness = getLineThickness(thickness);
BasicStroke stroke = cachedStroke;
if (stroke == null ||
stroke.getLineWidth() != lineThickness) {
stroke = createStroke(lineThickness);
cachedStroke = stroke;
}
return stroke;
}
示例6: strokeTo
import java.awt.BasicStroke; //导入方法依赖的package包/类
final void strokeTo(final DRendererContext rdrCtx,
Shape src,
AffineTransform at,
BasicStroke bs,
boolean thin,
NormMode normalize,
boolean antialias,
DPathConsumer2D pc2d)
{
double lw;
if (thin) {
if (antialias) {
lw = userSpaceLineWidth(at, MIN_PEN_SIZE);
} else {
lw = userSpaceLineWidth(at, 1.0d);
}
} else {
lw = bs.getLineWidth();
}
strokeTo(rdrCtx,
src,
at,
lw,
normalize,
bs.getEndCap(),
bs.getLineJoin(),
bs.getMiterLimit(),
bs.getDashArray(),
bs.getDashPhase(),
pc2d);
}
示例7: strokeTo
import java.awt.BasicStroke; //导入方法依赖的package包/类
final void strokeTo(final RendererContext rdrCtx,
Shape src,
AffineTransform at,
BasicStroke bs,
boolean thin,
NormMode normalize,
boolean antialias,
PathConsumer2D pc2d)
{
float lw;
if (thin) {
if (antialias) {
lw = userSpaceLineWidth(at, MIN_PEN_SIZE);
} else {
lw = userSpaceLineWidth(at, 1.0f);
}
} else {
lw = bs.getLineWidth();
}
strokeTo(rdrCtx,
src,
at,
lw,
normalize,
bs.getEndCap(),
bs.getLineJoin(),
bs.getMiterLimit(),
bs.getDashArray(),
bs.getDashPhase(),
pc2d);
}