当前位置: 首页>>代码示例>>Java>>正文


Java GraphicsUtils.drawPaintedShape方法代码示例

本文整理汇总了Java中de.erichseifert.gral.util.GraphicsUtils.drawPaintedShape方法的典型用法代码示例。如果您正苦于以下问题:Java GraphicsUtils.drawPaintedShape方法的具体用法?Java GraphicsUtils.drawPaintedShape怎么用?Java GraphicsUtils.drawPaintedShape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在de.erichseifert.gral.util.GraphicsUtils的用法示例。


在下文中一共展示了GraphicsUtils.drawPaintedShape方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: draw

import de.erichseifert.gral.util.GraphicsUtils; //导入方法依赖的package包/类
/**
 * Draws the {@code Drawable} with the specified drawing context.
 * @param context Environment used for drawing
 */
@Override
public void draw(DrawingContext context) {
	Graphics2D graphics = context.getGraphics();

	Paint bg = getBackground();
	if (bg != null) {
		GraphicsUtils.fillPaintedShape(graphics, getBounds(), bg, null);
	}

	Stroke stroke = getBorderStroke();
	if (stroke != null) {
		Paint fg = getBorderColor();
		GraphicsUtils.drawPaintedShape(
				graphics, getBounds(), fg, null, stroke);
	}

	drawComponents(context);
}
 
开发者ID:eseifert,项目名称:gral,代码行数:23,代码来源:AbstractPlot.java

示例2: draw

import de.erichseifert.gral.util.GraphicsUtils; //导入方法依赖的package包/类
/**
 * Draws the {@code Drawable} with the specified drawing context.
 * @param context Environment used for drawing
 */
@Override
public void draw(DrawingContext context) {
	Graphics2D graphics = context.getGraphics();

	Boolean antialiasing = getSetting(ANTIALISING);

	graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
			(antialiasing != null && antialiasing.booleanValue())
				? RenderingHints.VALUE_ANTIALIAS_ON
				: RenderingHints.VALUE_ANTIALIAS_OFF);

	Paint bg = getSetting(BACKGROUND);
	if (bg != null) {
		GraphicsUtils.fillPaintedShape(graphics, getBounds(), bg, null);
	}

	Stroke stroke = getSetting(BORDER);
	if (stroke != null) {
		Paint fg = getSetting(COLOR);
		GraphicsUtils.drawPaintedShape(
				graphics, getBounds(), fg, null, stroke);
	}

	drawComponents(context);
}
 
开发者ID:charles-cooper,项目名称:idylfin,代码行数:30,代码来源:AbstractPlot.java

示例3: getPoint

import de.erichseifert.gral.util.GraphicsUtils; //导入方法依赖的package包/类
@Override
public Drawable getPoint(final PointData data, final Shape shape) {
	return new AbstractDrawable() {
		/** Version id for serialization. */
		private static final long serialVersionUID = -3145112034673683520L;

		public void draw(DrawingContext context) {
			BarRenderer renderer = BarRenderer.this;

			Rectangle2D paintBoundaries = null;
			Graphics2D graphics = context.getGraphics();

			ColorMapper colors = renderer.getColor();
			Paint paint = colors.get(data.index);

			if (plot.isPaintAllBars()) {
				AffineTransform txOld = graphics.getTransform();
				Rectangle2D shapeBounds = shape.getBounds2D();
				paintBoundaries = new Rectangle2D.Double();//plot.getPlotArea().getBounds();
				paintBoundaries = new Rectangle2D.Double(
					shapeBounds.getX(), paintBoundaries.getY() - txOld.getTranslateY(),
					shapeBounds.getWidth(), paintBoundaries.getHeight()
				);
			}

			GraphicsUtils.fillPaintedShape(
				graphics, shape, paint, paintBoundaries);

			Stroke stroke = renderer.getBorderStroke();
			Paint strokePaint = renderer.getBorderColor();
			if (stroke != null && strokePaint != null) {
				GraphicsUtils.drawPaintedShape(
					graphics, shape, strokePaint, null, stroke);
			}
		}
	};
}
 
开发者ID:eseifert,项目名称:gral,代码行数:38,代码来源:BarPlot.java

示例4: draw

import de.erichseifert.gral.util.GraphicsUtils; //导入方法依赖的package包/类
@Override
public void draw(DrawingContext context) {
	double width = getPreferredSize().getWidth();
	double height = getPreferredSize().getHeight();
	Shape shape = barRenderer.getBarShape(0.0, 0.0, width, height);

	Graphics2D graphics = context.getGraphics();
	AffineTransform txOrig = graphics.getTransform();
	graphics.translate(getX(), getY());
	GraphicsUtils.fillPaintedShape(
			context.getGraphics(), shape, barRenderer.getColor().get(0), null);
	GraphicsUtils.drawPaintedShape(
			context.getGraphics(), shape, barRenderer.getBorderColor(), null, barRenderer.getBorderStroke());
	graphics.setTransform(txOrig);
}
 
开发者ID:eseifert,项目名称:gral,代码行数:16,代码来源:BarPlot.java

示例5: draw

import de.erichseifert.gral.util.GraphicsUtils; //导入方法依赖的package包/类
@Override
public void draw(DrawingContext context) {
	Shape shape = new Rectangle2D.Double(0.0, 0.0, getBounds().getWidth(), getBounds().getHeight());

	Graphics2D graphics = context.getGraphics();
	AffineTransform txOrig = graphics.getTransform();
	graphics.translate(getX(), getY());
	GraphicsUtils.fillPaintedShape(context.getGraphics(), shape,
			boxWhiskerRenderer.getBoxBackground().get(row.getIndex()), null);
	GraphicsUtils.drawPaintedShape(context.getGraphics(), shape, boxWhiskerRenderer.getBoxBorderColor(),
			null, boxWhiskerRenderer.getBoxBorderStroke());
	graphics.setTransform(txOrig);
}
 
开发者ID:eseifert,项目名称:gral,代码行数:14,代码来源:BoxPlot.java

示例6: drawBorder

import de.erichseifert.gral.util.GraphicsUtils; //导入方法依赖的package包/类
/**
 * Draws the border of this Legend with the specified drawing context.
 * @param context Environment used for drawing.
 */
protected void drawBorder(DrawingContext context) {
	// FIXME duplicate code! See de.erichseifert.gral.Legend
	Stroke stroke = getBorderStroke();
	if (stroke != null) {
		Paint borderColor = getBorderColor();
		GraphicsUtils.drawPaintedShape(context.getGraphics(),
				getBounds(), borderColor, null, stroke);
	}
}
 
开发者ID:eseifert,项目名称:gral,代码行数:14,代码来源:PlotArea.java

示例7: drawBorder

import de.erichseifert.gral.util.GraphicsUtils; //导入方法依赖的package包/类
/**
 * Draws the border of this legend with the specified drawing context.
 * @param context Environment used for drawing.
 */
protected void drawBorder(DrawingContext context) {
	Stroke stroke = getBorderStroke();
	if (stroke != null) {
		Paint borderColor = getBorderColor();
		GraphicsUtils.drawPaintedShape(
			context.getGraphics(), getBounds(), borderColor, null, stroke);
	}
}
 
开发者ID:eseifert,项目名称:gral,代码行数:13,代码来源:AbstractLegend.java

示例8: drawBorder

import de.erichseifert.gral.util.GraphicsUtils; //导入方法依赖的package包/类
/**
 * Draws the border of this legend with the specified drawing context.
 * @param context Environment used for drawing.
 */
protected void drawBorder(DrawingContext context) {
	Stroke stroke = getSetting(BORDER);
	if (stroke != null) {
		Paint fg = getSetting(COLOR);
		GraphicsUtils.drawPaintedShape(
			context.getGraphics(), getBounds(), fg, null, stroke);
	}
}
 
开发者ID:charles-cooper,项目名称:idylfin,代码行数:13,代码来源:AbstractLegend.java

示例9: drawBorder

import de.erichseifert.gral.util.GraphicsUtils; //导入方法依赖的package包/类
/**
 * Draws the border of this Legend with the specified Graphics2D
 * object.
 * @param context Environment used for drawing.
 */
protected void drawBorder(DrawingContext context) {
	// FIXME duplicate code! See de.erichseifert.gral.Legend
	Stroke stroke = getSetting(BORDER);
	if (stroke != null) {
		Paint paint = getSetting(COLOR);
		GraphicsUtils.drawPaintedShape(context.getGraphics(),
				getBounds(), paint, null, stroke);
	}
}
 
开发者ID:charles-cooper,项目名称:idylfin,代码行数:15,代码来源:PlotArea.java

示例10: drawErrorBars

import de.erichseifert.gral.util.GraphicsUtils; //导入方法依赖的package包/类
/**
 * Draws error bars.
 * @param context Environment used for drawing.
 * @param point Shape of the point.
 * @param row Data row containing the point.
 * @param rowIndex Index of the row.
 * @param col Index of the column that will be projected on the axis.
 * @param colErrorTop Index of the column that contains the upper error value.
 * @param colErrorBottom Index of the column that contains the lower error value.
 * @param axis Axis.
 * @param axisRenderer Axis renderer.
 */
protected void drawErrorBars(DrawingContext context, Shape point,
		Row row, int rowIndex, int col, int colErrorTop, int colErrorBottom,
		Axis axis, AxisRenderer axisRenderer) {
	if (axisRenderer == null) {
		return;
	}

	if (colErrorTop < 0 || colErrorTop >= row.size() ||
			!row.isColumnNumeric(colErrorTop) ||
			colErrorBottom < 0 || colErrorBottom >= row.size() ||
			!row.isColumnNumeric(colErrorBottom)) {
		return;
	}

	Number value = (Number) row.get(col);
	Number errorTop = (Number) row.get(colErrorTop);
	Number errorBottom = (Number) row.get(colErrorBottom);
	if (!MathUtils.isCalculatable(value) ||
			!MathUtils.isCalculatable(errorTop) ||
			!MathUtils.isCalculatable(errorBottom)) {
		return;
	}

	Graphics2D graphics = context.getGraphics();
	AffineTransform txOld = graphics.getTransform();

	// Calculate positions
	PointND<Double> pointValue = axisRenderer.getPosition(axis,
		value, true, false);
	PointND<Double> pointTop = axisRenderer.getPosition(axis,
			value.doubleValue() + errorTop.doubleValue(), true, false);
		PointND<Double> pointBottom = axisRenderer.getPosition(axis,
				value.doubleValue() - errorBottom.doubleValue(), true, false);
	if (pointValue == null || pointTop == null || pointBottom == null) {
		return;
	}
	double posY = pointValue.get(PointND.Y);
	double posYTop = pointTop.get(PointND.Y) - posY;
	double posYBottom = pointBottom.get(PointND.Y) - posY;

	// Draw the error bar
	Line2D errorBar = new Line2D.Double(0.0, posYTop, 0.0, posYBottom);
	ColorMapper colors = getErrorColor();
	Paint errorPaint = colors.get(rowIndex);
	Stroke errorStroke = getErrorStroke();
	GraphicsUtils.drawPaintedShape(
		graphics, errorBar, errorPaint, null, errorStroke);

	// Draw the shapes at the end of the error bars
	Shape endShape = getErrorShape();
	graphics.translate(0.0, posYTop);
	Stroke endShapeStroke = new BasicStroke(1f);
	GraphicsUtils.drawPaintedShape(
		graphics, endShape, errorPaint, null, endShapeStroke);
	graphics.setTransform(txOld);
	graphics.translate(0.0, posYBottom);
	GraphicsUtils.drawPaintedShape(
		graphics, endShape, errorPaint, null, endShapeStroke);
	graphics.setTransform(txOld);
}
 
开发者ID:eseifert,项目名称:gral,代码行数:73,代码来源:DefaultPointRenderer2D.java

示例11: drawErrorBars

import de.erichseifert.gral.util.GraphicsUtils; //导入方法依赖的package包/类
/**
 * Draws error bars.
 * @param context Environment used for drawing.
 * @param point Shape of the point.
 * @param row Data row containing the point.
 * @param col Index of the column that will be projected on the axis.
 * @param colErrorTop Index of the column that contains the upper error value.
 * @param colErrorBottom Index of the column that contains the lower error value.
 * @param axis Axis.
 * @param axisRenderer Axis renderer.
 */
protected void drawErrorBars(DrawingContext context, Shape point,
		Row row, int col, int colErrorTop, int colErrorBottom,
		Axis axis, AxisRenderer axisRenderer) {
	if (axisRenderer == null) {
		return;
	}

	if (colErrorTop < 0 || colErrorTop >= row.size() ||
			!row.isColumnNumeric(colErrorTop) ||
			colErrorBottom < 0 || colErrorBottom >= row.size() ||
			!row.isColumnNumeric(colErrorBottom)) {
		return;
	}

	Number value = (Number) row.get(col);
	Number errorTop = (Number) row.get(colErrorTop);
	Number errorBottom = (Number) row.get(colErrorBottom);
	if (!MathUtils.isCalculatable(value) ||
			!MathUtils.isCalculatable(errorTop) ||
			!MathUtils.isCalculatable(errorBottom)) {
		return;
	}

	Graphics2D graphics = context.getGraphics();
	AffineTransform txOld = graphics.getTransform();

	// Calculate positions
	PointND<Double> pointValue = axisRenderer.getPosition(axis,
		value, true, false);
	PointND<Double> pointTop = axisRenderer.getPosition(axis,
			value.doubleValue() + errorTop.doubleValue(), true, false);
		PointND<Double> pointBottom = axisRenderer.getPosition(axis,
				value.doubleValue() - errorBottom.doubleValue(), true, false);
	if (pointValue == null || pointTop == null || pointBottom == null) {
		return;
	}
	double posY = pointValue.get(PointND.Y);
	double posYTop = pointTop.get(PointND.Y) - posY;
	double posYBottom = pointBottom.get(PointND.Y) - posY;

	// Draw the error bar
	Line2D errorBar = new Line2D.Double(0.0, posYTop, 0.0, posYBottom);
	ColorMapper colors = getSetting(ERROR_COLOR);
	Paint errorPaint = colors.get(row.getIndex());
	Stroke errorStroke = getSetting(ERROR_STROKE);
	GraphicsUtils.drawPaintedShape(
		graphics, errorBar, errorPaint, null, errorStroke);

	// Draw the shapes at the end of the error bars
	Shape endShape = getSetting(ERROR_SHAPE);
	graphics.translate(0.0, posYTop);
	Stroke endShapeStroke = new BasicStroke(1f);
	GraphicsUtils.drawPaintedShape(
		graphics, endShape, errorPaint, null, endShapeStroke);
	graphics.setTransform(txOld);
	graphics.translate(0.0, posYBottom);
	GraphicsUtils.drawPaintedShape(
		graphics, endShape, errorPaint, null, endShapeStroke);
	graphics.setTransform(txOld);
}
 
开发者ID:charles-cooper,项目名称:idylfin,代码行数:72,代码来源:DefaultPointRenderer2D.java

示例12: getPoint

import de.erichseifert.gral.util.GraphicsUtils; //导入方法依赖的package包/类
/**
 * Returns the graphical representation to be drawn for the specified data
 * value.
 * @param data Information on axes, renderers, and values.
 * @param shape Outline that describes the point's shape.
 * @return Component that can be used to draw the point
 */
@Override
public Drawable getPoint(final PointData data, final Shape shape) {
	return new AbstractDrawable() {
		/** Version id for serialization. */
		private static final long serialVersionUID = -3145112034673683520L;

		public void draw(DrawingContext context) {
			PointRenderer renderer = BarRenderer.this;

			Row row = data.row;

			Rectangle2D paintBoundaries = null;
			Graphics2D graphics = context.getGraphics();

			ColorMapper colors = renderer.<ColorMapper>getSetting(COLOR);
			Paint paint = colors.get(row.getIndex());

			Boolean paintAllBars = plotSettings.getSetting(PAINT_ALL_BARS);
			if (paintAllBars != null && paintAllBars.booleanValue()) {
				AffineTransform txOld = graphics.getTransform();
				Rectangle2D shapeBounds = shape.getBounds2D();
				paintBoundaries = new Rectangle2D.Double();//plot.getPlotArea().getBounds();
				paintBoundaries = new Rectangle2D.Double(
					shapeBounds.getX(), paintBoundaries.getY() - txOld.getTranslateY(),
					shapeBounds.getWidth(), paintBoundaries.getHeight()
				);
			}

			GraphicsUtils.fillPaintedShape(
				graphics, shape, paint, paintBoundaries);

			Stroke stroke = renderer.<Stroke>getSetting(STROKE);
			Paint strokePaint = renderer.<Paint>getSetting(STROKE_COLOR);
			if (stroke != null && strokePaint != null) {
				GraphicsUtils.drawPaintedShape(
					graphics, shape, strokePaint, null, stroke);
			}

			if (renderer.<Boolean>getSetting(VALUE_DISPLAYED)) {
				int colValue = renderer.<Integer>getSetting(VALUE_COLUMN);
				drawValueLabel(context, shape, row, colValue);
			}
		}
	};
}
 
开发者ID:charles-cooper,项目名称:idylfin,代码行数:53,代码来源:BarPlot.java


注:本文中的de.erichseifert.gral.util.GraphicsUtils.drawPaintedShape方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。