本文整理汇总了Java中java.awt.geom.RectangularShape.getMinX方法的典型用法代码示例。如果您正苦于以下问题:Java RectangularShape.getMinX方法的具体用法?Java RectangularShape.getMinX怎么用?Java RectangularShape.getMinX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.geom.RectangularShape
的用法示例。
在下文中一共展示了RectangularShape.getMinX方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: splitVerticalBar
import java.awt.geom.RectangularShape; //导入方法依赖的package包/类
/**
* Splits a bar into subregions (elsewhere, these subregions will have
* different gradients applied to them).
*
* @param bar the bar shape.
* @param a the first division.
* @param b the second division.
* @param c the third division.
*
* @return An array containing four subregions.
*/
private Rectangle2D[] splitVerticalBar(RectangularShape bar, double a,
double b, double c) {
Rectangle2D[] result = new Rectangle2D[4];
double x0 = bar.getMinX();
double x1 = Math.rint(x0 + (bar.getWidth() * a));
double x2 = Math.rint(x0 + (bar.getWidth() * b));
double x3 = Math.rint(x0 + (bar.getWidth() * c));
result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
x1 - x0, bar.getHeight());
result[1] = new Rectangle2D.Double(x1, bar.getMinY(), x2 - x1,
bar.getHeight());
result[2] = new Rectangle2D.Double(x2, bar.getMinY(), x3 - x2,
bar.getHeight());
result[3] = new Rectangle2D.Double(x3, bar.getMinY(),
bar.getMaxX() - x3, bar.getHeight());
return result;
}
示例2: splitHorizontalBar
import java.awt.geom.RectangularShape; //导入方法依赖的package包/类
/**
* Splits a bar into subregions (elsewhere, these subregions will have
* different gradients applied to them).
*
* @param bar the bar shape.
* @param a the first division.
* @param b the second division.
* @param c the third division.
*
* @return An array containing four subregions.
*/
private Rectangle2D[] splitHorizontalBar(RectangularShape bar, double a,
double b, double c) {
Rectangle2D[] result = new Rectangle2D[4];
double y0 = bar.getMinY();
double y1 = Math.rint(y0 + (bar.getHeight() * a));
double y2 = Math.rint(y0 + (bar.getHeight() * b));
double y3 = Math.rint(y0 + (bar.getHeight() * c));
result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
bar.getWidth(), y1 - y0);
result[1] = new Rectangle2D.Double(bar.getMinX(), y1, bar.getWidth(),
y2 - y1);
result[2] = new Rectangle2D.Double(bar.getMinX(), y2, bar.getWidth(),
y3 - y2);
result[3] = new Rectangle2D.Double(bar.getMinX(), y3, bar.getWidth(),
bar.getMaxY() - y3);
return result;
}
示例3: render
import java.awt.geom.RectangularShape; //导入方法依赖的package包/类
/**
* @see prefuse.render.Renderer#render(java.awt.Graphics2D, prefuse.visual.VisualItem)
*/
public void render( Graphics2D g, VisualItem item )
{
RectangularShape shape = (RectangularShape)getShape( item );
if ( shape == null ) return;
// fill the shape, if requested
int type = getRenderType( item );
if ( type == RENDER_TYPE_FILL || type == RENDER_TYPE_DRAW_AND_FILL )
GraphicsLib.paint( g, item, shape, getStroke( item ), RENDER_TYPE_FILL );
// now render the text
String text = m_text;
if ( text == null )
return;
double size = item.getSize();
boolean useInt = 1.5 > Math.max(
g.getTransform().getScaleX(),
g.getTransform().getScaleY()
);
double x = shape.getMinX() + size * m_horizBorder;
double y = shape.getMinY() + size * m_vertBorder;
// render text
int textColor = item.getTextColor();
if ( text != null && ColorLib.alpha( textColor ) > 0 ) {
g.setPaint( ColorLib.getColor( textColor ) );
g.setFont( m_font );
FontMetrics fm = DEFAULT_GRAPHICS.getFontMetrics( m_font );
// compute available width and height
double tw = m_textDim.width;
double th = m_textDim.height;
// compute starting y-coordinate
y += fm.getAscent();
switch ( m_vTextAlign ) {
case Constants.TOP:
break;
case Constants.BOTTOM:
y += th - m_textDim.height;
break;
case Constants.CENTER:
y += ( th - m_textDim.height ) / 2;
}
// render each line of text
int lh = fm.getHeight(); // the line height
int start = 0, end = text.indexOf( m_delim );
for ( ; end >= 0; y += lh ) {
drawString( g, fm, text.substring( start, end ), useInt, x, y, tw );
start = end + 1;
end = text.indexOf( m_delim, start );
}
drawString( g, fm, text.substring( start ), useInt, x, y, tw );
}
// draw border
if ( type == RENDER_TYPE_DRAW || type == RENDER_TYPE_DRAW_AND_FILL ) {
GraphicsLib.paint( g, item, shape, getStroke( item ), RENDER_TYPE_DRAW );
}
}
示例4: createShadow
import java.awt.geom.RectangularShape; //导入方法依赖的package包/类
/**
* Creates a shadow for the bar.
*
* @param bar the bar shape.
* @param xOffset the x-offset for the shadow.
* @param yOffset the y-offset for the shadow.
* @param base the edge that is the base of the bar.
* @param pegShadow peg the shadow to the base?
*
* @return A rectangle for the shadow.
*/
private Rectangle2D createShadow(RectangularShape bar, double xOffset,
double yOffset, RectangleEdge base, boolean pegShadow) {
double x0 = bar.getMinX();
double x1 = bar.getMaxX();
double y0 = bar.getMinY();
double y1 = bar.getMaxY();
if (base == RectangleEdge.TOP) {
x0 += xOffset;
x1 += xOffset;
if (!pegShadow) {
y0 += yOffset;
}
y1 += yOffset;
}
else if (base == RectangleEdge.BOTTOM) {
x0 += xOffset;
x1 += xOffset;
y0 += yOffset;
if (!pegShadow) {
y1 += yOffset;
}
}
else if (base == RectangleEdge.LEFT) {
if (!pegShadow) {
x0 += xOffset;
}
x1 += xOffset;
y0 += yOffset;
y1 += yOffset;
}
else if (base == RectangleEdge.RIGHT) {
x0 += xOffset;
if (!pegShadow) {
x1 += xOffset;
}
y0 += yOffset;
y1 += yOffset;
}
return new Rectangle2D.Double(x0, y0, (x1 - x0), (y1 - y0));
}