本文整理汇总了Java中java.awt.BasicStroke.JOIN_BEVEL属性的典型用法代码示例。如果您正苦于以下问题:Java BasicStroke.JOIN_BEVEL属性的具体用法?Java BasicStroke.JOIN_BEVEL怎么用?Java BasicStroke.JOIN_BEVEL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.BasicStroke
的用法示例。
在下文中一共展示了BasicStroke.JOIN_BEVEL属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initDefaultValues
private void initDefaultValues() {
setRenderingOptimized(true);
Color systemSelection = Utils.getSystemSelection();
setLineStroke(new BasicStroke(1));
setLinePaint(systemSelection);
setFillPaint(new Color(systemSelection.getRed(),
systemSelection.getGreen(),
systemSelection.getBlue(), 80));
oddPerfStroke = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[] { 6, 6 }, 6);
evenPerfStroke = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[] { 6, 6 }, 0);
setLineMode(true, true, true, true);
}
示例2: initDefaultValues
private void initDefaultValues() {
sMarkPaint = new Color(120, 120, 120);
sOddPerfPaint = new Color(120, 120, 120);
sEvenPerfPaint = Color.WHITE;
hMarkPaint = new Color(80, 80, 80);
hOddPerfPaint = Color.BLACK;
hEvenPerfPaint = Color.WHITE;
markStroke = new BasicStroke(2.8f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
oddPerfStroke = new BasicStroke(1f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL, 0, new float[] { 1.0f, 3.0f }, 0);
evenPerfStroke = new BasicStroke(1f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL, 0, new float[] { 1.0f, 3.0f }, 2);
selectionExtent = 3;
}
示例3: initDefaultValues
private void initDefaultValues() {
markPaint = new Color(80, 80, 80);
oddPerfPaint = Color.BLACK;
evenPerfPaint = Color.WHITE;
markStroke = new BasicStroke(2.8f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
oddPerfStroke = new BasicStroke(1f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL, 0, new float[] { 1.0f, 3.0f }, 0);
evenPerfStroke = new BasicStroke(1f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL, 0, new float[] { 1.0f, 3.0f }, 2);
selectionExtent = 3;
}
示例4: selectStylePen
protected boolean selectStylePen(int cap, int join, float width,
Color color) {
long endCap;
long lineJoin;
float[] rgb = color.getRGBColorComponents(null);
switch(cap) {
case BasicStroke.CAP_BUTT: endCap = PS_ENDCAP_FLAT; break;
case BasicStroke.CAP_ROUND: endCap = PS_ENDCAP_ROUND; break;
default:
case BasicStroke.CAP_SQUARE: endCap = PS_ENDCAP_SQUARE; break;
}
switch(join) {
case BasicStroke.JOIN_BEVEL:lineJoin = PS_JOIN_BEVEL; break;
default:
case BasicStroke.JOIN_MITER:lineJoin = PS_JOIN_MITER; break;
case BasicStroke.JOIN_ROUND:lineJoin = PS_JOIN_ROUND; break;
}
return (selectStylePen(getPrintDC(), endCap, lineJoin, width,
(int) (rgb[0] * MAX_WCOLOR),
(int) (rgb[1] * MAX_WCOLOR),
(int) (rgb[2] * MAX_WCOLOR)));
}
示例5: Pin
/**
* Creates a new instance.
*
* @param datasetIndex the dataset index.
*/
public Pin(int datasetIndex) {
super(datasetIndex);
this.paint = Color.red;
this.stroke = new BasicStroke(3.0f, BasicStroke.CAP_ROUND,
BasicStroke.JOIN_BEVEL);
}
示例6: main
public static void main(String[] args) {
GeneralPath shape = new GeneralPath();
int[] pointTypes = {0, 0, 1, 1, 0, 1, 1, 0};
double[] xpoints = {428, 420, 400, 400, 400, 400, 420, 733};
double[] ypoints = {180, 180, 180, 160, 30, 10, 10, 10};
shape.moveTo(xpoints[0], ypoints[0]);
for (int i = 1; i < pointTypes.length; i++) {
if (pointTypes[i] == 1 && i < pointTypes.length - 1) {
shape.quadTo(xpoints[i], ypoints[i],
xpoints[i + 1], ypoints[i + 1]);
} else {
shape.lineTo(xpoints[i], ypoints[i]);
}
}
BufferedImage image = new
BufferedImage(1000, 1000, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = image.createGraphics();
Color color = new Color(124, 0, 124, 255);
g2.setColor(color);
Stroke stroke = new BasicStroke(1.0f,
BasicStroke.CAP_BUTT,
BasicStroke.JOIN_BEVEL,
10.0f, new float[] {9, 6}, 0.0f);
g2.setStroke(stroke);
g2.draw(shape);
}
示例7: paint
/** Renders the caret */
public @Override void paint(Graphics g) {
JTextComponent c = component;
if (c == null) return;
// #70915 Check whether the caret was moved but the component was not
// validated yet and therefore the caret bounds are still null
// and if so compute the bounds and scroll the view if necessary.
if (getDot() != 0 && caretBounds == null) {
update(true);
}
if (LOG.isLoggable(Level.FINEST)) {
LOG.finest("BaseCaret.paint(): caretBounds=" + caretBounds + dumpVisibility() + '\n');
}
if (caretBounds != null && isVisible() && blinkVisible) {
paintCustomCaret(g);
}
if (rectangularSelection && rsPaintRect != null && g instanceof Graphics2D) {
Graphics2D g2d = (Graphics2D) g;
Stroke stroke = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[] {4, 2}, 0);
Stroke origStroke = g2d.getStroke();
Color origColor = g2d.getColor();
try {
// Render translucent rectangle
Color selColor = c.getSelectionColor();
g2d.setColor(selColor);
Composite origComposite = g2d.getComposite();
try {
g2d.setComposite(AlphaComposite.SrcOver.derive(0.2f));
g2d.fill(rsPaintRect);
} finally {
g2d.setComposite(origComposite);
}
// Paint stroked line around rectangular selection rectangle
g.setColor(c.getCaretColor());
g2d.setStroke(stroke);
Rectangle onePointSmallerRect = new Rectangle(rsPaintRect);
onePointSmallerRect.width--;
onePointSmallerRect.height--;
g2d.draw(onePointSmallerRect);
} finally {
g2d.setStroke(origStroke);
g2d.setColor(origColor);
}
}
}
示例8: paintComponent
@Override
public void paintComponent(Graphics g) {
if (getModel().isArmed()) {
((Graphics2D) g).translate(1.1, 1.1);
}
((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Graphics2D g2 = (Graphics2D) g.create();
// the default background is transparent
if (hovered || customBackgroundColor != null) {
// fill background
g2.setColor(customBackgroundColor != null ? customBackgroundColor : BACKGROUND_COLOR);
g2.fillRect(0, 0, getWidth() - 6, getHeight() - 6);
}
if (hovered) {
// draw border which complements the DropShadow
g2.setColor(customBorderColor != null ? customBorderColor : BORDER_LIGHTEST_GRAY);
g2.drawRect(0, 0, getWidth() - 6, getHeight() - 6);
} else if (customBorderColor != null) {
g2.setColor(customBorderColor);
g2.drawRect(0, 0, getWidth() - 6, getHeight() - 6);
}
if (hovered) {
if (drawArrow) {
// draw arrow
GeneralPath path = new GeneralPath();
path.moveTo(getWidth() * 0.82, getHeight() * 0.3);
path.lineTo(getWidth() * 0.92, getHeight() * 0.5);
path.lineTo(getWidth() * 0.82, getHeight() * 0.7);
Stroke arrowStroke = new BasicStroke(5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL);
g2.setStroke(arrowStroke);
g2.setColor(HOVERED_TEXTCOLOR);
g2.draw(path);
}
// cut off arrow ends so the cut looks like an imaginary vertical line
g2.setColor(customBackgroundColor != null ? customBackgroundColor : BACKGROUND_COLOR);
g2.fillRect((int) (getWidth() * 0.81), (int) (getHeight() * 0.29), 7, (int) (getHeight() * 0.5));
}
g2.dispose();
super.paintComponent(g);
}
示例9: drawOverlay
/**
* Called from another thread, must be synchronized
*/
@Override
public synchronized void drawOverlay(Graphics g, LevelScene levelScene, int playerIndex) {
if(agent.getMouseInput().isOverlayActive()) {
// determine current x,y pos
int x,y;
int tileSize = 16*GlobalOptions.resolution_factor;
Graphics2D g2d = (Graphics2D)g;
if(!selectedTile.toGlobalCoarse().equals(new GlobalCoarse(-1,-1))){
x = (int) (selectedTile.x - levelScene.cameras.get(playerIndex)[0]) * GlobalOptions.resolution_factor;
y = (int) (selectedTile.y - levelScene.cameras.get(playerIndex)[1]) * GlobalOptions.resolution_factor;
switch(agent.getPlayerIndex()) {
case 0:
g2d.setColor(Color.RED);
break;
case 1:
g2d.setColor(Color.BLUE);
break;
case 2:
g2d.setColor(Color.GREEN);
break;
}
Stroke tmp = g2d.getStroke();
Stroke dashed = new BasicStroke(2.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 10, new float[]{5}, agent.getPlayerIndex()*1.5f);
g2d.setStroke(dashed);
g2d.drawRect(x-tileSize/2,y-tileSize/2, tileSize, tileSize);
// SpriteSheet icon = Art.waiting;
// int frameNumber = time % icon.xImages();
// g.drawImage(icon.getImage(frameNumber,0), x, y, null);
g2d.setStroke(tmp);
}
}
}
示例10: setStroke
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.");
}
}