本文整理汇总了Java中de.erichseifert.gral.util.GraphicsUtils类的典型用法代码示例。如果您正苦于以下问题:Java GraphicsUtils类的具体用法?Java GraphicsUtils怎么用?Java GraphicsUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GraphicsUtils类属于de.erichseifert.gral.util包,在下文中一共展示了GraphicsUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
};
}
示例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);
}
};
}
示例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);
}
示例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);
}
};
}
示例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);
}
};
}
示例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);
}
};
}
示例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)
);
}
示例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);
}
示例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);
}
};
}
示例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);
}
};
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}