本文整理汇总了Java中java.awt.BasicStroke.getLineJoin方法的典型用法代码示例。如果您正苦于以下问题:Java BasicStroke.getLineJoin方法的具体用法?Java BasicStroke.getLineJoin怎么用?Java BasicStroke.getLineJoin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.BasicStroke
的用法示例。
在下文中一共展示了BasicStroke.getLineJoin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例2: getStroke
import java.awt.BasicStroke; //导入方法依赖的package包/类
public BasicStroke getStroke() {
BasicStroke stroke = style.getStroke();
if (stroke != null) {
float[] scaledDashArray = getScaledDashArray();
BasicStroke scaledStroke = new BasicStroke(this.getWidth(), stroke.getEndCap(), stroke.getLineJoin(),
stroke.getMiterLimit(), scaledDashArray, stroke.getDashPhase());
return scaledStroke;
} else {
return null;
}
}
示例3: 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);
}
示例4: setStroke
import java.awt.BasicStroke; //导入方法依赖的package包/类
public void setStroke(Stroke stroke) {
if (stroke instanceof BasicStroke) {
BasicStroke bs = (BasicStroke) stroke;
// linewidth
gc.setLineWidth((int) bs.getLineWidth());
// line join
switch (bs.getLineJoin()) {
case BasicStroke.JOIN_BEVEL :
gc.setLineJoin(SWT.JOIN_BEVEL);
break;
case BasicStroke.JOIN_MITER :
gc.setLineJoin(SWT.JOIN_MITER);
break;
case BasicStroke.JOIN_ROUND :
gc.setLineJoin(SWT.JOIN_ROUND);
break;
}
// line cap
switch (bs.getEndCap()) {
case BasicStroke.CAP_BUTT :
gc.setLineCap(SWT.CAP_FLAT);
break;
case BasicStroke.CAP_ROUND :
gc.setLineCap(SWT.CAP_ROUND);
break;
case BasicStroke.CAP_SQUARE :
gc.setLineCap(SWT.CAP_SQUARE);
break;
}
// set the line style to solid by default
gc.setLineStyle(SWT.LINE_SOLID);
// apply dash style if any
float[] dashes = bs.getDashArray();
if (dashes != null) {
int[] swtDashes = new int[dashes.length];
for (int i = 0; i < swtDashes.length; i++) {
swtDashes[i] = (int) dashes[i];
}
gc.setLineDash(swtDashes);
}
}
else {
throw new RuntimeException(
"Can only handle 'Basic Stroke' at present.");
}
}