本文整理汇总了Java中prefuse.util.GraphicsLib.paint方法的典型用法代码示例。如果您正苦于以下问题:Java GraphicsLib.paint方法的具体用法?Java GraphicsLib.paint怎么用?Java GraphicsLib.paint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类prefuse.util.GraphicsLib
的用法示例。
在下文中一共展示了GraphicsLib.paint方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import prefuse.util.GraphicsLib; //导入方法依赖的package包/类
/**
* @see prefuse.render.Renderer#render(java.awt.Graphics2D, prefuse.visual.VisualItem)
*/
public synchronized void render(AndroidGraphics2D g, VisualItem item) {
Shape s = getShape(item);
GraphicsLib.paint(g, item, m_line, getStroke(item), getRenderType(item));
// check if we have a text label, if so, render it
if ( item.canGetString(VisualItem.LABEL) ) {
float x = (float)m_box.getMinX();
float y = (float)m_box.getMinY() + m_ascent;
// draw label background
GraphicsLib.paint(g, item, s, null, RENDER_TYPE_FILL);
String str = item.getString(VisualItem.LABEL);
AffineTransform origTransform = g.getTransform();
AffineTransform transform = this.getTransform(item);
if ( transform != null ) g.setTransform(transform);
g.setFont(item.getFont());
g.setColor(ColorLib.getColor(item.getTextColor()));
g.drawString(str, x, y);
if ( transform != null ) g.setTransform(origTransform);
}
}
示例2: render
import prefuse.util.GraphicsLib; //导入方法依赖的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 );
}
}
示例3: drawShape
import prefuse.util.GraphicsLib; //导入方法依赖的package包/类
/**
* Draws the specified shape into the provided Graphics context, using
* stroke and fill color values from the specified VisualItem. This method
* can be called by subclasses in custom rendering routines.
*/
protected void drawShape(AndroidGraphics2D g, VisualItem item, Shape shape) {
GraphicsLib.paint(g, item, shape, getStroke(item), getRenderType(item));
}