• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java GraphicsUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getArea

import de.erichseifert.gral.util.GraphicsUtils; //导入依赖的package包/类
/**
 * Returns the graphical representation to be drawn for the specified
 * data points.
 * @param points Points to be used for creating the area.
 * @param shape Geometric shape of the area.
 * @return Representation of the area.
 */
public Drawable getArea(final List<DataPoint> points, final Shape shape) {
	return new AbstractDrawable() {
		/** Version id for serialization. */
		private static final long serialVersionUID = -3659798228877496727L;

		/**
		 * Draws the {@code Drawable} with the specified drawing context.
		 * @param context Environment used for drawing
		 */
		public void draw(DrawingContext context) {
			Paint paint = DefaultAreaRenderer2D.this.getColor();
			GraphicsUtils.fillPaintedShape(context.getGraphics(),
				shape, paint, null);
		}
	};
}
 
开发者ID:eseifert,项目名称:gral,代码行数:24,代码来源:DefaultAreaRenderer2D.java


示例2: getArea

import de.erichseifert.gral.util.GraphicsUtils; //导入依赖的package包/类
/**
 * Returns the graphical representation to be drawn for the specified data
 * points.
 * @param points Points that define the shape of the area.
 * @param shape Geometric shape of the area.
 * @return Representation of the area.
 */
public Drawable getArea(final List<DataPoint> points, final Shape shape) {
	return new AbstractDrawable() {
		/** Version id for serialization. */
		private static final long serialVersionUID = 5492321759151727458L;

		/**
		 * Draws the {@code Drawable} with the specified drawing context.
		 * @param context Environment used for drawing
		 */
		public void draw(DrawingContext context) {
			Paint paint = LineAreaRenderer2D.this.getColor();
			GraphicsUtils.fillPaintedShape(context.getGraphics(),
				shape, paint, null);
		}
	};
}
 
开发者ID:eseifert,项目名称:gral,代码行数:24,代码来源:LineAreaRenderer2D.java


示例3: 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


示例4: getLine

import de.erichseifert.gral.util.GraphicsUtils; //导入依赖的package包/类
/**
 * Returns a graphical representation for the line defined by
 * {@code e points}.
 * @param points Points used for creating the line.
 * @param shape Geometric shape for this line.
 * @return Representation of the line.
 */
public Drawable getLine(final List<DataPoint> points, final Shape shape) {
	return new AbstractDrawable() {
		/** Version id for serialization. */
		private static final long serialVersionUID1 = 7995515716470892483L;

		/**
		 * Draws the {@code Drawable} with the specified drawing context.
		 * @param context Environment used for drawing
		 */
		public void draw(DrawingContext context) {
			// Draw line
			Paint paint = DefaultLineRenderer2D.this.getColor();
			GraphicsUtils.fillPaintedShape(
				context.getGraphics(), shape, paint, null);
		}
	};
}
 
开发者ID:eseifert,项目名称:gral,代码行数:25,代码来源:DefaultLineRenderer2D.java


示例5: getLine

import de.erichseifert.gral.util.GraphicsUtils; //导入依赖的package包/类
/**
 * Returns a graphical representation for the line defined by
 * {@code points}.
 * @param points Points to be used for creating the line.
 * @param shape Geometric shape for this line.
 * @return Representation of the line.
 */
public Drawable getLine(final List<DataPoint> points, final Shape shape) {
	return new AbstractDrawable() {
		/** Version id for serialization. */
		private static final long serialVersionUID1 = 3641589240264518755L;

		/**
		 * Draws the {@code Drawable} with the specified drawing context.
		 * @param context Environment used for drawing
		 */
		public void draw(DrawingContext context) {
			// Draw path
			Paint paint = SmoothLineRenderer2D.this.getColor();
			GraphicsUtils.fillPaintedShape(
				context.getGraphics(), shape, paint, null);
		}
	};
}
 
开发者ID:eseifert,项目名称:gral,代码行数:25,代码来源:SmoothLineRenderer2D.java


示例6: getLine

import de.erichseifert.gral.util.GraphicsUtils; //导入依赖的package包/类
/**
 * Returns a graphical representation for the line defined by
 * {@code points}.
 * @param points Points to be used for creating the line.
 * @param shape Geometric shape for this line.
 * @return Representation of the line.
 */
public Drawable getLine(final List<DataPoint> points, final Shape shape) {
	return new AbstractDrawable() {
		/** Version id for serialization. */
		private static final long serialVersionUID1 = -1686744943386843195L;

		/**
		 * Draws the {@code Drawable} with the specified drawing context.
		 * @param context Environment used for drawing
		 */
		public void draw(DrawingContext context) {
			// Draw path
			Paint paint = DiscreteLineRenderer2D.this.getColor();
			GraphicsUtils.fillPaintedShape(
				context.getGraphics(), shape, paint, null);
		}
	};
}
 
开发者ID:eseifert,项目名称:gral,代码行数:25,代码来源:DiscreteLineRenderer2D.java


示例7: get

import de.erichseifert.gral.util.GraphicsUtils; //导入依赖的package包/类
/**
 * Returns the Paint object according to the specified value.
 * @param value Value of color.
 * @return Paint object.
 */
@Override
public Paint get(double value) {
	Double v = scale(value);
	v = applyMode(v, 0.0, 1.0);
	if (!MathUtils.isCalculatable(v)) {
		return null;
	}
	double lightness = 100.0*v;
	double[] rgb = GraphicsUtils.luv2rgb(new double[] {lightness, 0.0, 0.0}, null);
	return new Color(
		(float) MathUtils.limit(rgb[0], 0.0, 1.0),
		(float) MathUtils.limit(rgb[1], 0.0, 1.0),
		(float) MathUtils.limit(rgb[2], 0.0, 1.0)
	);
}
 
开发者ID:eseifert,项目名称:gral,代码行数:21,代码来源:Grayscale.java


示例8: formatFilledArea

import de.erichseifert.gral.util.GraphicsUtils; //导入依赖的package包/类
private static void formatFilledArea(XYPlot plot, DataSource data, Color color) {
	PointRenderer point = new DefaultPointRenderer2D();
       point.setShape(new Ellipse2D.Double(-3,-3,6,6));
	point.setColor(color);
	plot.setPointRenderer(data, point);

	LineRenderer line = new DefaultLineRenderer2D();
	line.setColor(color);
       float[] DOT_DOT = {4.0f, 4.0f};
       line.setStroke(new BasicStroke(4.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.f, DOT_DOT, 0.f));
	line.setGap(3.0);
	line.setGapRounded(true);
	plot.setLineRenderer(data, line);

       AreaRenderer area = new DefaultAreaRenderer2D();
	area.setColor(GraphicsUtils.deriveWithAlpha(color, 64));
	plot.setAreaRenderer(data, area);
}
 
开发者ID:Arnauld,项目名称:cucumber-contrib,代码行数:19,代码来源:AreaPlot.java


示例9: getArea

import de.erichseifert.gral.util.GraphicsUtils; //导入依赖的package包/类
/**
 * Returns the graphical representation to be drawn for the specified
 * data points.
 * @param points Points to be used for creating the area.
 * @param shape Geometric shape of the area.
 * @return Representation of the area.
 */
public Drawable getArea(final List<DataPoint> points, final Shape shape) {
	return new AbstractDrawable() {
		/** Version id for serialization. */
		private static final long serialVersionUID = -3659798228877496727L;

		/**
		 * Draws the {@code Drawable} with the specified drawing context.
		 * @param context Environment used for drawing
		 */
		public void draw(DrawingContext context) {
			Paint paint = DefaultAreaRenderer2D.this.getSetting(COLOR);
			GraphicsUtils.fillPaintedShape(context.getGraphics(),
				shape, paint, null);
		}
	};
}
 
开发者ID:charles-cooper,项目名称:idylfin,代码行数:24,代码来源:DefaultAreaRenderer2D.java


示例10: getArea

import de.erichseifert.gral.util.GraphicsUtils; //导入依赖的package包/类
/**
 * Returns the graphical representation to be drawn for the specified data
 * points.
 * @param points Points that define the shape of the area.
 * @param shape Geometric shape of the area.
 * @return Representation of the area.
 */
public Drawable getArea(final List<DataPoint> points, final Shape shape) {
	return new AbstractDrawable() {
		/** Version id for serialization. */
		private static final long serialVersionUID = 5492321759151727458L;

		/**
		 * Draws the {@code Drawable} with the specified drawing context.
		 * @param context Environment used for drawing
		 */
		public void draw(DrawingContext context) {
			Paint paint = LineAreaRenderer2D.this.getSetting(COLOR);
			GraphicsUtils.fillPaintedShape(context.getGraphics(),
				shape, paint, null);
		}
	};
}
 
开发者ID:charles-cooper,项目名称:idylfin,代码行数:24,代码来源:LineAreaRenderer2D.java


示例11: getOutline

import de.erichseifert.gral.util.GraphicsUtils; //导入依赖的package包/类
/**
 * Returns an outline shape for this label.
 * @param wordWrap Wrap the words of the text to fit the current size.
 * @return Outline for this label.
 */
protected Shape getOutline(boolean wordWrap) {
	Font font = this.<Font>getSetting(FONT);
	float wrappingWidth = 0f;
	if (wordWrap) {
		double rotation = Math.toRadians(this.<Number>getSetting(
			ROTATION).doubleValue());
		wrappingWidth = (float) (
			Math.abs(Math.cos(rotation))*getWidth() +
			Math.abs(Math.sin(rotation))*getHeight());
	}
	double alignment = this.<Number>getSetting(
		ALIGNMENT_TEXT).doubleValue();
	Shape outline = GraphicsUtils.getOutline(
		getText(), font, wrappingWidth, alignment);
	return outline;
}
 
开发者ID:charles-cooper,项目名称:idylfin,代码行数:22,代码来源:Label.java


示例12: 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


示例13: getLine

import de.erichseifert.gral.util.GraphicsUtils; //导入依赖的package包/类
/**
 * Returns a graphical representation for the line defined by
 * {@code e points}.
 * @param points Points used for creating the line.
 * @param shape Geometric shape for this line.
 * @return Representation of the line.
 */
public Drawable getLine(final List<DataPoint> points, final Shape shape) {
	Drawable d = new AbstractDrawable() {
		/** Version id for serialization. */
		private static final long serialVersionUID = 7995515716470892483L;

		/**
		 * Draws the {@code Drawable} with the specified drawing context.
		 * @param context Environment used for drawing
		 */
		public void draw(DrawingContext context) {
			// Draw line
			Paint paint = DefaultLineRenderer2D.this
				.getSetting(LineRenderer.COLOR);
			GraphicsUtils.fillPaintedShape(
				context.getGraphics(), shape, paint, null);
		}
	};
	return d;
}
 
开发者ID:charles-cooper,项目名称:idylfin,代码行数:27,代码来源:DefaultLineRenderer2D.java


示例14: getLine

import de.erichseifert.gral.util.GraphicsUtils; //导入依赖的package包/类
/**
 * Returns a graphical representation for the line defined by
 * {@code points}.
 * @param points Points to be used for creating the line.
 * @param shape Geometric shape for this line.
 * @return Representation of the line.
 */
public Drawable getLine(final List<DataPoint> points, final Shape shape) {
	Drawable d = new AbstractDrawable() {
		/** Version id for serialization. */
		private static final long serialVersionUID = 3641589240264518755L;

		/**
		 * Draws the {@code Drawable} with the specified drawing context.
		 * @param context Environment used for drawing
		 */
		public void draw(DrawingContext context) {
			// Draw path
			Paint paint = SmoothLineRenderer2D.this
				.getSetting(LineRenderer.COLOR);
			GraphicsUtils.fillPaintedShape(
				context.getGraphics(), shape, paint, null);
		}
	};
	return d;
}
 
开发者ID:charles-cooper,项目名称:idylfin,代码行数:27,代码来源:SmoothLineRenderer2D.java


示例15: getLine

import de.erichseifert.gral.util.GraphicsUtils; //导入依赖的package包/类
/**
 * Returns a graphical representation for the line defined by
 * {@code points}.
 * @param points Points to be used for creating the line.
 * @param shape Geometric shape for this line.
 * @return Representation of the line.
 */
public Drawable getLine(final List<DataPoint> points, final Shape shape) {
	Drawable d = new AbstractDrawable() {
		/** Version id for serialization. */
		private static final long serialVersionUID = -1686744943386843195L;

		/**
		 * Draws the {@code Drawable} with the specified drawing context.
		 * @param context Environment used for drawing
		 */
		public void draw(DrawingContext context) {
			// Draw path
			Paint paint = DiscreteLineRenderer2D.this
				.getSetting(LineRenderer.COLOR);
			GraphicsUtils.fillPaintedShape(
				context.getGraphics(), shape, paint, null);
		}
	};
	return d;
}
 
开发者ID:charles-cooper,项目名称:idylfin,代码行数:27,代码来源:DiscreteLineRenderer2D.java


示例16: get

import de.erichseifert.gral.util.GraphicsUtils; //导入依赖的package包/类
/**
 * Returns the Paint object according to the specified value.
 * @param value Value of color.
 * @return Paint object.
 */
@Override
public Paint get(double value) {
	Double v = scale(value);
	v = applyMode(v, 0.0, 1.0);
	if (!MathUtils.isCalculatable(v)) {
		return null;
	}
	double lightness = 100.0*v.doubleValue();
	double[] rgb = GraphicsUtils.luv2rgb(new double[] {lightness, 0.0, 0.0}, null);
	return new Color(
		(float) MathUtils.limit(rgb[0], 0.0, 1.0),
		(float) MathUtils.limit(rgb[1], 0.0, 1.0),
		(float) MathUtils.limit(rgb[2], 0.0, 1.0)
	);
}
 
开发者ID:charles-cooper,项目名称:idylfin,代码行数:21,代码来源:Grayscale.java


示例17: AreaPlot

import de.erichseifert.gral.util.GraphicsUtils; //导入依赖的package包/类
public AreaPlot() {
	// Generate data
	DataTable data = new DataTable(Double.class, Double.class, Double.class, Double.class);
	for (double x = 0.0; x < 50; x ++) {
		double y1 = Double.NaN, y2 = Double.NaN, y3 = Double.NaN;
		y1 = random.nextGaussian();
		y2 = random.nextGaussian();
		y3 = random.nextGaussian();
		data.add(x, y1, y2, y3);
	}

	// Create data series
	DataSeries data1 = new DataSeries("series 1", data, 0, 1);
	DataSeries data2 = new DataSeries("series 2", data, 0, 2);
	DataSeries data3 = new DataSeries("series 3", data, 0, 3);

	// Create new xy-plot
	XYPlot plot = new XYPlot(data1, data2, data3);
	plot.setLegendVisible(true);
	plot.setInsets(new Insets2D.Double(20.0, 40.0, 20.0, 20.0));

	// Format data series
	formatFilledArea(plot, data1, COLOR2);
	formatFilledArea(plot, data2, COLOR1);
	formatLineArea(plot, data3, GraphicsUtils.deriveDarker(COLOR1));

	// Add plot to Swing component
	add(new InteractivePanel(plot));
}
 
开发者ID:PacktPublishing,项目名称:Java-Data-Science-Cookbook,代码行数:30,代码来源:AreaPlot.java


示例18: formatFilledArea

import de.erichseifert.gral.util.GraphicsUtils; //导入依赖的package包/类
private static void formatFilledArea(XYPlot plot, DataSource data, Color color) {
	PointRenderer point = new DefaultPointRenderer2D();
	point.setColor(color);
	plot.setPointRenderer(data, point);
	LineRenderer line = new DefaultLineRenderer2D();
	line.setColor(color);
	line.setGap(3.0);
	line.setGapRounded(true);
	plot.setLineRenderer(data, line);
	AreaRenderer area = new DefaultAreaRenderer2D();
	area.setColor(GraphicsUtils.deriveWithAlpha(color, 64));
	plot.setAreaRenderer(data, area);
}
 
开发者ID:PacktPublishing,项目名称:Java-Data-Science-Cookbook,代码行数:14,代码来源:AreaPlot.java


示例19: getOutline

import de.erichseifert.gral.util.GraphicsUtils; //导入依赖的package包/类
/**
 * Returns an outline shape for this label.
 * @param wordWrap Wrap the words of the text to fit the current size.
 * @return Outline for this label.
 */
protected Shape getOutline(boolean wordWrap) {
	Font font = getFont();
	float wrappingWidth = 0f;
	if (wordWrap) {
		double rotation = Math.toRadians(getRotation());
		wrappingWidth = (float) (
			Math.abs(Math.cos(rotation))*getWidth() +
			Math.abs(Math.sin(rotation))*getHeight());
	}
	double alignment = getTextAlignment();
	return GraphicsUtils.getOutline(
		getText(), font, wrappingWidth, alignment);
}
 
开发者ID:eseifert,项目名称:gral,代码行数:19,代码来源:Label.java


示例20: getPointShape

import de.erichseifert.gral.util.GraphicsUtils; //导入依赖的package包/类
@Override
public Shape getPointShape(PointData data) {
	Row row = data.row;
	int colLabel = getColumn();
	if (colLabel >= row.size()) {
		return null;
	}

	Comparable<?> labelValue = row.get(colLabel);
	if (labelValue == null) {
		return null;
	}

	Format format = getFormat();
	Font font = getFont();
	String text = format.format(labelValue);
	double alignment = getAlignmentX();
	Shape shape = GraphicsUtils.getOutline(text, font, 0f, alignment);

	double alignX = getAlignmentX();
	double alignY = getAlignmentY();
	Rectangle2D bounds = shape.getBounds2D();
	AffineTransform tx = AffineTransform.getTranslateInstance(
		-alignX*bounds.getWidth(), alignY*bounds.getHeight());
	shape = tx.createTransformedShape(shape);

	return shape;
}
 
开发者ID:eseifert,项目名称:gral,代码行数:29,代码来源:LabelPointRenderer.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java UnregisteredNodeException类代码示例发布时间:2022-05-22
下一篇:
Java AbstractFSContract类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap