本文整理汇总了Java中java.awt.geom.Arc2D.Float方法的典型用法代码示例。如果您正苦于以下问题:Java Arc2D.Float方法的具体用法?Java Arc2D.Float怎么用?Java Arc2D.Float使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.geom.Arc2D
的用法示例。
在下文中一共展示了Arc2D.Float方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: plotXY
import java.awt.geom.Arc2D; //导入方法依赖的package包/类
public void plotXY( Graphics2D g,
Rectangle2D bounds,
double xScale, double yScale ) {
g.setColor( Color.blue );
float x0 = (float)bounds.getX();
float y0 = (float)bounds.getY();
float sy = (float)yScale;
float sx = (float)xScale;
Arc2D.Float arc = new Arc2D.Float(0f, 0f, 5f, 5f, 0f, 360f,
Arc2D.CHORD);
for(int k=0 ; k<xyd.length ; k++) {
float x = (xyd[k][4]-x0)*sx;
float y = (xyd[k][3]-y0)*sy;
arc.x = x-2.5f;
arc.y = y-2.5f;
g.draw(arc);
}
}
示例2: paintArc
import java.awt.geom.Arc2D; //导入方法依赖的package包/类
private void paintArc(Graphics2D g,JComponent jc,float f,float w,float h,float multiplier,float angleOffset,float a) {
float z = f*f*f*f;
float r = f * w / 2f;
float arcX = w/2f - r;
float arcY = h/2f - r;
float arcW = 2*r;
float arcH = 2*r;
float arcStart = (float)( multiplier*Math.sqrt(f)*360 + angleOffset );
float arcExtent = (1-f)*(1-f)*360/3;
Arc2D arc = new Arc2D.Float( arcX, arcY, arcW, arcH, arcStart, arcExtent, Arc2D.OPEN);
g.setStroke(new BasicStroke(4*(1-z)));
Color c = jc==null ? getDefaultForeground() : jc.getForeground();
int alpha = (int)( 255*(1-f)*a );
g.setColor(new Color( c.getRed(), c.getGreen(), c.getBlue(), Math.min(alpha, 255) ));
g.draw(arc);
}
示例3: drawTimerOnTrap
import java.awt.geom.Arc2D; //导入方法依赖的package包/类
/**
* Draws a timer on a given trap.
*
* @param graphics
* @param trap The trap on which the timer needs to be drawn
* @param fill The fill color of the timer
* @param border The border color of the timer
* @param fillTimeLow The fill color of the timer when it is low
* @param borderTimeLow The border color of the timer when it is low
*/
private void drawTimerOnTrap(Graphics2D graphics, HunterTrap trap, Color fill, Color border, Color fillTimeLow, Color borderTimeLow)
{
net.runelite.api.Point loc = trap.getGameObject().getCanvasLocation();
//Construct the arc
Arc2D.Float arc = new Arc2D.Float(Arc2D.PIE);
arc.setAngleStart(90);
double timeLeft = 1 - trap.getTrapTimeRelative();
arc.setAngleExtent(timeLeft * 360);
arc.setFrame(loc.getX() - TIMER_SIZE / 2, loc.getY() - TIMER_SIZE / 2, TIMER_SIZE, TIMER_SIZE);
//Draw the inside of the arc
graphics.setColor(timeLeft > TIMER_LOW ? fill : fillTimeLow);
graphics.fill(arc);
//Draw the outlines of the arc
graphics.setStroke(new BasicStroke(TIMER_BORDER_WIDTH));
graphics.setColor(timeLeft > TIMER_LOW ? border : borderTimeLow);
graphics.drawOval(loc.getX() - TIMER_SIZE / 2, loc.getY() - TIMER_SIZE / 2, TIMER_SIZE, TIMER_SIZE);
}
示例4: getDoorOrWindowSashShape
import java.awt.geom.Arc2D; //导入方法依赖的package包/类
/**
* Returns the shape of a sash of a door or a window.
*/
private GeneralPath getDoorOrWindowSashShape(HomeDoorOrWindow doorOrWindow, Sash sash)
{
float modelMirroredSign = doorOrWindow.isModelMirrored() ? -1 : 1;
float xAxis = modelMirroredSign * sash.getXAxis() * doorOrWindow.getWidth();
float yAxis = sash.getYAxis() * doorOrWindow.getDepth();
float sashWidth = sash.getWidth() * doorOrWindow.getWidth();
float startAngle = (float) Math.toDegrees(sash.getStartAngle());
if (doorOrWindow.isModelMirrored())
{
startAngle = 180 - startAngle;
}
float extentAngle = modelMirroredSign * (float) Math.toDegrees(sash.getEndAngle() - sash.getStartAngle());
Arc2D arc = new Arc2D.Float(xAxis - sashWidth, yAxis - sashWidth, 2 * sashWidth, 2 * sashWidth, startAngle,
extentAngle, Arc2D.PIE);
AffineTransform transformation = AffineTransform.getTranslateInstance(doorOrWindow.getX(), doorOrWindow.getY());
transformation.rotate(doorOrWindow.getAngle());
transformation.translate(modelMirroredSign * -doorOrWindow.getWidth() / 2, -doorOrWindow.getDepth() / 2);
PathIterator it = arc.getPathIterator(transformation);
GeneralPath sashShape = new GeneralPath();
sashShape.append(it, false);
return sashShape;
}
示例5: drawArc
import java.awt.geom.Arc2D; //导入方法依赖的package包/类
/** Calls <code>draw(Arc2D)</code>
*/
@Override
public void drawArc(int x, int y, int w, int h, int startAngle,
int endAngle) {
Arc2D a = new Arc2D.Float(x,y,w,h,startAngle,endAngle,Arc2D.OPEN);
draw(a);
}
示例6: fillArc
import java.awt.geom.Arc2D; //导入方法依赖的package包/类
/** Calls <code>fill(Arc2D)</code>
*/
@Override
public void fillArc(int x, int y, int w, int h, int startAngle,
int endAngle) {
Arc2D a = new Arc2D.Float(x,y,w,h,startAngle,endAngle,Arc2D.OPEN);
fill(a);
}
示例7: drawArc
import java.awt.geom.Arc2D; //导入方法依赖的package包/类
/**
* Draws an arc.
*/
public void drawArc(int x, int y, int width, int height, int arcStart,
int arcAngle)
{
ShapeCache sc = shapeCache;
if (sc.arc == null)
sc.arc = new Arc2D.Float();
sc.arc.setArc(x, y, width, height, arcStart, arcAngle, Arc2D.OPEN);
draw(sc.arc);
}
示例8: fillArc
import java.awt.geom.Arc2D; //导入方法依赖的package包/类
/**
* Fills an arc.
*/
public void fillArc(int x, int y, int width, int height, int arcStart,
int arcAngle)
{
ShapeCache sc = shapeCache;
if (sc.arc == null)
sc.arc = new Arc2D.Float();
sc.arc.setArc(x, y, width, height, arcStart, arcAngle, Arc2D.PIE);
draw(sc.arc);
}
示例9: MeterMarker
import java.awt.geom.Arc2D; //导入方法依赖的package包/类
/** Create a new ramp meter marker */
public MeterMarker() {
super(4);
float size = MARKER_SIZE_PIX;
moveTo(0, 0);
Arc2D.Float arc = new Arc2D.Float(0, -size, size, size,
-90, 270, Arc2D.OPEN);
append(arc, true);
closePath();
lineTo(size / 2, -size / 2);
}
示例10: draw
import java.awt.geom.Arc2D; //导入方法依赖的package包/类
public void draw(Graphics2D g) {
// if(!display) return;
int yr1 = 1900;
int yr2 = 2005;
try {
long[] interval = timeInterval();
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
if( db.before.isSelected() ) {
cal.setTimeInMillis(interval[0]);
yr1 = cal.get(cal.YEAR);
}
if( db.after.isSelected() ) {
cal.setTimeInMillis(interval[1]);
yr2 = cal.get(cal.YEAR);
}
} catch(Exception e) {
}
// System.out.println( yr1 +"\t"+ yr2);
float size = 2.0f + 6f/(float)map.getZoom();
Arc2D.Float dot = new Arc2D.Float(-size/2f, -size/2f, size, size, 0f, 360f, Arc2D.CHORD);
float size1 = 2.0f + 7f/(float)map.getZoom();
GeneralPath triangle = new GeneralPath();
triangle.moveTo(0f, size1/2f );
triangle.lineTo(size1/2f, -size1/2f );
triangle.lineTo(-size1/2f, -size1/2f );
triangle.closePath();
// Rectangle2D.Float square = new Rectangle2D.Float(-size1/2f, -size1/2f, size1, size1);
AffineTransform at = g.getTransform();
g.setStroke( new BasicStroke( .5f/(float)map.getZoom() ) );
RenderingHints hints = g.getRenderingHints();
g.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g.setRenderingHint( RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
Shape shape = dot;
for(int k=0 ; k<xyd.length ; k++) {
// Shape shape = triangle;
// if( xyd[k][5]<=1991f ) shape = dot;
if( xyd[k][5]>yr2 )continue;
if( xyd[k][5]<yr1 )continue;
g.translate( (double)xyd[k][0], (double)xyd[k][1] );
// g.setColor( Color.black );
// g.draw(shape);
g.setColor( color[k] );
g.fill(shape);
g.setColor( Color.black );
g.draw(shape);
g.setTransform( at );
}
g.setFont( (new Font("Serif", Font.BOLD, 1)).deriveFont( size1*1.5f));
Rectangle2D rect = map.getClipRect2D();
double s = (double) size1;
double x = rect.getX() + s;
double y = rect.getY() + 2.*s;
// g.translate( x, y );
// g.setColor( Color.white );
// g.fill( dot );
// g.setColor( Color.black );
// g.draw( dot );
// g.translate( s, s/2.);
// String year = db.startF.getText();
// String dateString = db.before.isSelected()
// ? "before 1/1/"+year
// : "after 1/1/"+year;
// g.drawString( dateString, 0, 0);
// g.drawString( "before 1/1/1991", 0, 0);
// g.setTransform(at);
// g.translate( x, y+s*2.0 );
// g.setColor( Color.white );
// g.fill( triangle );
// g.setColor( Color.black );
// g.draw( triangle );
// g.translate( s, s/2.);
// g.drawString( "after 1/1/1991", 0, 0);
g.setTransform(at);
g.setRenderingHints( hints);
}
示例11: makeArc
import java.awt.geom.Arc2D; //导入方法依赖的package包/类
/** Make an arc */
static private Arc2D.Float makeArc(int s, int st, int ex) {
return new Arc2D.Float(fscale(-s), fscale(-s),
fscale(s * 2), fscale(s * 2), st, ex, Arc2D.OPEN);
}
示例12: addButton
import java.awt.geom.Arc2D; //导入方法依赖的package包/类
/** Add a button to the marker */
protected void addButton(float w, float h) {
Arc2D.Float arc = new Arc2D.Float(w - H24, h,
H12, H12, 0, 360, Arc2D.OPEN);
append(arc, false);
}
示例13: addCircle
import java.awt.geom.Arc2D; //导入方法依赖的package包/类
protected void addCircle(float w, float h) {
Arc2D.Float arc = new Arc2D.Float(w - H24, h - H24,
H12, H12, 0, 360, Arc2D.OPEN);
path.append(arc, false);
}
示例14: drawArc
import java.awt.geom.Arc2D; //导入方法依赖的package包/类
/**
* Draws the outline of a circular or elliptical arc
* covering the specified rectangle.
* <p>
* The resulting arc begins at <code>startAngle</code> and extends
* for <code>arcAngle</code> degrees, using the current color.
* Angles are interpreted such that 0 degrees
* is at the 3 o'clock position.
* A positive value indicates a counter-clockwise rotation
* while a negative value indicates a clockwise rotation.
* <p>
* The center of the arc is the center of the rectangle whose origin
* is (<i>x</i>, <i>y</i>) and whose size is specified by the
* <code>width</code> and <code>height</code> arguments.
* <p>
* The resulting arc covers an area
* <code>width + 1</code> pixels wide
* by <code>height + 1</code> pixels tall.
* <p>
* The angles are specified relative to the non-square extents of
* the bounding rectangle such that 45 degrees always falls on the
* line from the center of the ellipse to the upper right corner of
* the bounding rectangle. As a result, if the bounding rectangle is
* noticeably longer in one axis than the other, the angles to the
* start and end of the arc segment will be skewed farther along the
* longer axis of the bounds.
* @param x the <i>x</i> coordinate of the
* upper-left corner of the arc to be drawn.
* @param y the <i>y</i> coordinate of the
* upper-left corner of the arc to be drawn.
* @param width the width of the arc to be drawn.
* @param height the height of the arc to be drawn.
* @param startAngle the beginning angle.
* @param arcAngle the angular extent of the arc,
* relative to the start angle.
* @see java.awt.Graphics#fillArc
*/
public void drawArc(int x, int y, int width, int height,
int startAngle, int arcAngle){
Arc2D arc = new Arc2D.Float(x, y, width, height, startAngle, arcAngle, Arc2D.OPEN);
draw(arc);
}
示例15: fillArc
import java.awt.geom.Arc2D; //导入方法依赖的package包/类
/**
* Fills a circular or elliptical arc covering the specified rectangle.
* <p>
* The resulting arc begins at <code>startAngle</code> and extends
* for <code>arcAngle</code> degrees.
* Angles are interpreted such that 0 degrees
* is at the 3 o'clock position.
* A positive value indicates a counter-clockwise rotation
* while a negative value indicates a clockwise rotation.
* <p>
* The center of the arc is the center of the rectangle whose origin
* is (<i>x</i>, <i>y</i>) and whose size is specified by the
* <code>width</code> and <code>height</code> arguments.
* <p>
* The resulting arc covers an area
* <code>width + 1</code> pixels wide
* by <code>height + 1</code> pixels tall.
* <p>
* The angles are specified relative to the non-square extents of
* the bounding rectangle such that 45 degrees always falls on the
* line from the center of the ellipse to the upper right corner of
* the bounding rectangle. As a result, if the bounding rectangle is
* noticeably longer in one axis than the other, the angles to the
* start and end of the arc segment will be skewed farther along the
* longer axis of the bounds.
* @param x the <i>x</i> coordinate of the
* upper-left corner of the arc to be filled.
* @param y the <i>y</i> coordinate of the
* upper-left corner of the arc to be filled.
* @param width the width of the arc to be filled.
* @param height the height of the arc to be filled.
* @param startAngle the beginning angle.
* @param arcAngle the angular extent of the arc,
* relative to the start angle.
* @see java.awt.Graphics#drawArc
*/
public void fillArc(int x, int y, int width, int height,
int startAngle, int arcAngle){
Arc2D arc = new Arc2D.Float(x, y, width, height, startAngle, arcAngle, Arc2D.PIE);
fill(arc);
}