use of java.awt.Stroke in project smile by haifengl.
the class Line method paint.
@Override
public void paint(Graphics g) {
Color c = g.getColor();
g.setColor(getColor());
Stroke s = g.getStroke();
if (stroke != null) {
g.setStroke(stroke);
}
g.drawLine(points);
if (stroke != null) {
g.setStroke(s);
}
g.setColor(c);
}
use of java.awt.Stroke in project android_frameworks_base by ParanoidAndroid.
the class Paint_Delegate method native_getFillPath.
@LayoutlibDelegate
static /*package*/
boolean native_getFillPath(int native_object, int src, int dst) {
Paint_Delegate paint = sManager.getDelegate(native_object);
if (paint == null) {
return false;
}
Path_Delegate srcPath = Path_Delegate.getDelegate(src);
if (srcPath == null) {
return true;
}
Path_Delegate dstPath = Path_Delegate.getDelegate(dst);
if (dstPath == null) {
return true;
}
Stroke stroke = paint.getJavaStroke();
Shape strokeShape = stroke.createStrokedShape(srcPath.getJavaShape());
dstPath.setJavaShape(strokeShape);
// FIXME figure out the return value?
return true;
}
use of java.awt.Stroke in project Activiti by Activiti.
the class DefaultProcessDiagramCanvas method drawInclusiveGateway.
public void drawInclusiveGateway(GraphicInfo graphicInfo, double scaleFactor) {
// rhombus
drawGateway(graphicInfo);
int x = (int) graphicInfo.getX();
int y = (int) graphicInfo.getY();
int width = (int) graphicInfo.getWidth();
int height = (int) graphicInfo.getHeight();
int diameter = width / 2;
if (scaleFactor == 1.0) {
// circle inside rhombus
Stroke orginalStroke = g.getStroke();
g.setStroke(GATEWAY_TYPE_STROKE);
Ellipse2D.Double circle = new Ellipse2D.Double(((width - diameter) / 2) + x, ((height - diameter) / 2) + y, diameter, diameter);
g.draw(circle);
g.setStroke(orginalStroke);
}
}
use of java.awt.Stroke in project Activiti by Activiti.
the class DefaultProcessDiagramCanvas method drawMultiInstanceMarker.
public void drawMultiInstanceMarker(boolean sequential, int x, int y, int width, int height) {
int rectangleWidth = MARKER_WIDTH;
int rectangleHeight = MARKER_WIDTH;
int lineX = x + (width - rectangleWidth) / 2;
int lineY = y + height - rectangleHeight - 3;
Stroke orginalStroke = g.getStroke();
g.setStroke(MULTI_INSTANCE_STROKE);
if (sequential) {
g.draw(new Line2D.Double(lineX, lineY, lineX + rectangleWidth, lineY));
g.draw(new Line2D.Double(lineX, lineY + rectangleHeight / 2, lineX + rectangleWidth, lineY + rectangleHeight / 2));
g.draw(new Line2D.Double(lineX, lineY + rectangleHeight, lineX + rectangleWidth, lineY + rectangleHeight));
} else {
g.draw(new Line2D.Double(lineX, lineY, lineX, lineY + rectangleHeight));
g.draw(new Line2D.Double(lineX + rectangleWidth / 2, lineY, lineX + rectangleWidth / 2, lineY + rectangleHeight));
g.draw(new Line2D.Double(lineX + rectangleWidth, lineY, lineX + rectangleWidth, lineY + rectangleHeight));
}
g.setStroke(orginalStroke);
}
use of java.awt.Stroke in project cubrid-manager by CUBRID.
the class CombinedBarTimeSeriesChart method createBarChart.
/**
* Create a bar chart instance.
*
* @return a bar chart instance
*/
private JFreeChart createBarChart() {
bardataset = new DefaultCategoryDataset();
if (valueMap != null) {
for (String key : valueMap.keySet()) {
bardataset.addValue(0D, key, "");
}
}
bardataset.addValue(barMax, "100", "");
JFreeChart chart = ChartFactory.createStackedBarChart("", "", "", bardataset, PlotOrientation.VERTICAL, false, false, false);
chart.setBorderVisible(false);
chart.setBorderStroke(new BasicStroke(0.0f));
chart.setBackgroundPaint(Color.BLACK);
//plot
CategoryPlot categoryplot = (CategoryPlot) chart.getPlot();
categoryplot.setOutlineVisible(false);
RectangleInsets rectangleInsets = new RectangleInsets();
categoryplot.setAxisOffset(rectangleInsets);
categoryplot.setBackgroundPaint(Color.BLACK);
categoryplot.setDomainGridlinesVisible(false);
categoryplot.setRangeGridlinesVisible(false);
//renderer
StackedBarRenderer stackedbarrenderer = (StackedBarRenderer) categoryplot.getRenderer(0);
stackedbarrenderer.setDrawBarOutline(false);
stackedbarrenderer.setMaximumBarWidth(0.6);
stackedbarrenderer.setItemMargin(0);
//painter
StandardBarPainter painter = new StandardBarPainter() {
private static final long serialVersionUID = -3124115075260902181L;
public void paintBar(Graphics2D g2, BarRenderer renderer, int row, int column, RectangularShape bar, RectangleEdge base) {
Paint itemPaint = renderer.getItemPaint(row, column);
GradientPaintTransformer t = renderer.getGradientPaintTransformer();
if (t != null && itemPaint instanceof GradientPaint) {
itemPaint = t.transform((GradientPaint) itemPaint, bar);
}
g2.setPaint(itemPaint);
double height = bar.getHeight();
double width = bar.getWidth();
double x = bar.getBounds2D().getX();
double y = bar.getBounds2D().getY();
int barNumber = (int) (height / 2 + 0.5);
if (height < 1 && height > 0.5) {
barNumber = 1;
}
for (int i = 0; i < barNumber; i++) {
RectangularShape subBarLeft = new Rectangle2D.Double(x, y, width / 2, 0.8);
g2.fill(subBarLeft);
RectangularShape subBarRight = new Rectangle2D.Double(x + width / 2 + 1, y, width / 2, 0.8);
g2.fill(subBarRight);
y += 2;
}
if (renderer.isDrawBarOutline()) {
Stroke stroke = renderer.getItemOutlineStroke(row, column);
Paint paint = renderer.getItemOutlinePaint(row, column);
if (stroke != null && paint != null) {
g2.setStroke(stroke);
g2.setPaint(paint);
g2.draw(bar);
}
}
}
};
stackedbarrenderer.setBarPainter(painter);
stackedbarrenderer.setSeriesPaint(0, Color.GREEN);
stackedbarrenderer.setSeriesPaint(1, Color.RED);
int backPaintOrder = 1;
if (valueMap != null) {
backPaintOrder = valueMap.size();
}
stackedbarrenderer.setSeriesPaint(backPaintOrder, new Color(136, 200, 135));
stackedbarrenderer.setShadowVisible(false);
stackedbarrenderer.setDrawBarOutline(false);
//categoryAxis
categoryAxis = categoryplot.getDomainAxis();
categoryAxis.setAxisLineVisible(false);
// categoryAxis.setCategoryMargin(0);
categoryAxis.setMinorTickMarksVisible(false);
categoryAxis.setTickLabelsVisible(false);
categoryAxis.setTickMarksVisible(false);
categoryAxis.setLabelPaint(Color.GREEN);
categoryAxis.setLabelFont(new Font("", 0, 10));
//valueAxis
ValueAxis valueAxis = categoryplot.getRangeAxis();
valueAxis.setVisible(false);
return chart;
}
Aggregations