本文整理汇总了Java中prefuse.util.ColorLib类的典型用法代码示例。如果您正苦于以下问题:Java ColorLib类的具体用法?Java ColorLib怎么用?Java ColorLib使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ColorLib类属于prefuse.util包,在下文中一共展示了ColorLib类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import prefuse.util.ColorLib; //导入依赖的package包/类
public void render(Graphics2D g, VisualItem item) {
// render the edge line
super.render(g, item);
// Add label:
Shape s = getShape(item);
if (s != null) {
Rectangle2D r = s.getBounds2D();
boolean useInt = 1.5 > Math.max(g.getTransform().getScaleX(), g.getTransform().getScaleY());
if (m_font == null)
m_font = item.getFont();
// scale the font as needed
FontMetrics fm = DEFAULT_GRAPHICS.getFontMetrics(m_font);
if (item.canGetString("name")) {
g.setFont(m_font);
g.setPaint(ColorLib.getColor(item.getTextColor()));
drawString(g, fm, item.getString("name"), useInt, r.getX(), r.getY(), r.getWidth(), r.getHeight());
}
}
}
示例2: getColor
import prefuse.util.ColorLib; //导入依赖的package包/类
@Override
public int getColor( VisualItem item )
{
if( item instanceof NodeItem )
{
NodeItem nItem = (NodeItem) item;
if( m_vis.isInGroup( nItem, Visualization.FOCUS_ITEMS ) )
{
int c = CMAP.getColor( nItem.getDepth() );
return ColorLib.darker( c );
}
return CMAP.getColor( nItem.getDepth() );
}
else
{
return CMAP.getColor( 0 );
}
}
示例3: getColor
import prefuse.util.ColorLib; //导入依赖的package包/类
@Override
public int getColor( VisualItem item )
{
if( m_vis.isInGroup( item, Visualization.SEARCH_ITEMS ) )
{
return ColorLib.rgb( 255, 190, 190 );
}
else if( m_vis.isInGroup( item, Visualization.FOCUS_ITEMS ) )
{
return ColorLib.rgb( 198, 229, 229 );
}
else if( item.getDOI() > -1 )
{
return ColorLib.rgb( 164, 193, 193 );
}
else
{
return ColorLib.rgba( 255, 255, 255, 0 );
}
}
示例4: editText
import prefuse.util.ColorLib; //导入依赖的package包/类
/**
* Edit text for the given VisualItem and field. Presents a text editing widget spaning the given bounding box. Use stopEditing() to hide the text widget. When stopEditing() is called, the field
* will automatically be updated with the VisualItem.
*
* @param item
* the VisualItem to edit
* @param attribute
* the attribute to edit
* @param r
* Rectangle representing the desired bounding box of the text editing widget
*/
public void editText(VisualItem item, String attribute, Rectangle r)
{
if (m_editing)
{
stopEditing();
}
String txt = item.getString(attribute);
m_editItem = item;
m_editAttribute = attribute;
Color tc = ColorLib.getColor(item.getTextColor());
Color fc = ColorLib.getColor(item.getFillColor());
m_editor.setTextColor(tc.getAndroidColorRepresentation());
m_editor.setBackgroundColor(fc.getAndroidColorRepresentation());
editText(txt, r);
}
示例5: render
import prefuse.util.ColorLib; //导入依赖的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);
}
}
示例6: process
import prefuse.util.ColorLib; //导入依赖的package包/类
/**
* @see prefuse.action.ItemAction#process(prefuse.visual.VisualItem, double)
*/
public void process(VisualItem item, double frac) {
double v = item.getStartX();
item.setX(v + frac*(item.getEndX()-v));
v = item.getStartY();
item.setY(v + frac*(item.getEndY()-v));
v = item.getDouble(VisualItem.STARTX2);
v = v + frac*(item.getDouble(VisualItem.ENDX2)-v);
item.setDouble(VisualItem.X2, v);
v = item.getDouble(VisualItem.STARTY2);
v = v + frac*(item.getDouble(VisualItem.ENDY2)-v);
item.setDouble(VisualItem.Y2, v);
int c = ColorLib.interp(item.getStartStrokeColor(),
item.getEndStrokeColor(), frac);
item.setStrokeColor(c);
int tc = ColorLib.interp(item.getStartTextColor(),
item.getEndTextColor(), frac);
item.setTextColor(tc);
int fc = ColorLib.interp(item.getStartFillColor(),
item.getEndFillColor(), frac);
item.setFillColor(fc);
}
示例7: run
import prefuse.util.ColorLib; //导入依赖的package包/类
@Override
public void run(double frac) {
Iterator<?> iter = m_vis.items(m_group);
while ( iter.hasNext() ) {
DecoratorItem item = (DecoratorItem)iter.next();
VisualItem node = item.getDecoratedItem();
//Dbg.printMsg("--> " + node, LogLvl.Normal);
Rectangle2D bounds = node.getBounds();
setX(item, null, bounds.getCenterX());
setY(item, null, bounds.getCenterY());
if (((String)node.get(m_group)).equals("FAKE")) {
item.setTextColor(ColorLib.alpha(0));
}
else if (((String)node.get(m_group)).equals("LBUB")) {
item.setTextColor(ColorLib.alpha(0));
}
}
}
示例8: getColor
import prefuse.util.ColorLib; //导入依赖的package包/类
@Override
public int getColor(VisualItem item) {
Object o = lookup(item);
if (o != null) {
if (o instanceof ColorAction) {
return ((ColorAction) o).getColor(item);
} else if (o instanceof Integer) {
return ((Integer) o).intValue();
} else {
Logger.getLogger(this.getClass().getName()).warning(
"Unrecognized Object from predicate chain.");
}
}
// 处理外部分析单元颜色
if (item.getTable().getBoolean(item.getRow(), "isInner")) {
return this.getDefaultColor();
} else {
return ColorLib.gray(150);
}
}
示例9: render
import prefuse.util.ColorLib; //导入依赖的package包/类
/**
* Draws a filled rectangle as fast as possible.
* @see prefuse.render.Renderer#render(java.awt.Graphics2D, prefuse.visual.VisualItem)
*/
public void render(Graphics2D g, VisualItem item) {
if(item.isHover() || item.isHighlighted()) {
item.setStrokeColor(item.getStartFillColor());
} else {
item.setStrokeColor(item.getFillColor());
}
g.setColor(ColorLib.getColor(item.getFillColor()));
g.fillRect((int)item.getStartX(), (int)item.getStartY(), (int)(item.getEndX()-item.getStartX()+1), (int)(item.getEndY()-item.getStartY()+1));
g.setColor(ColorLib.getColor(item.getStrokeColor()));
if(item.isHighlighted())
g.setStroke(new BasicStroke(5));
else
g.setStroke(new BasicStroke(1));
g.drawRect((int)item.getStartX(), (int)item.getStartY(), (int)(item.getEndX()-item.getStartX()+1), (int)(item.getEndY()-item.getStartY()+1));
}
示例10: isBoxItem
import prefuse.util.ColorLib; //导入依赖的package包/类
public boolean isBoxItem(VisualItem item) {
if (BOX_ITEM_LABEL.equals(item.getString("label"))) {
boxItem = item;
item.setFillColor(ColorLib.rgba(150, 150, 255, 100));
return true;
}
return false;
}
示例11: setInfoPanel
import prefuse.util.ColorLib; //导入依赖的package包/类
/**
* set info Panel
*
* @param infoPanel panel with the information
* @param id viewManagerID
*/
public void setInfoPanel(JTable infoPanel, String id) {
// background color very light grey F2F2F2
infoPanel.setBackground(ColorLib.getColor(242, 242, 242));
if (_infoPanel == null) {
_infoPanel = new HashMap<String, JTable>();
}
if (!_infoPanel.containsKey(id)) {
_infoPanel.put(id, infoPanel);
}
}
示例12: getColor
import prefuse.util.ColorLib; //导入依赖的package包/类
public int getColor(VisualItem item) {
if ( m_vis.isInGroup(item, Visualization.SEARCH_ITEMS) )
return ColorLib.rgb(255,190,190);
else if ( m_vis.isInGroup(item, Visualization.FOCUS_ITEMS) )
return ColorLib.rgb(198,229,229);
else if ( item.getDOI() > -1 )
return ColorLib.rgb(164,193,193);
else
return ColorLib.rgba(100,100,100,0);
}
示例13: getColor
import prefuse.util.ColorLib; //导入依赖的package包/类
public int getColor(VisualItem item) {
if ( m_vis.isInGroup(item, Visualization.SEARCH_ITEMS) )
return ColorLib.rgb(255,190,190);
else if ( m_vis.isInGroup(item, Visualization.FOCUS_ITEMS) )
return ColorLib.rgb(198,229,229);
else if ( item.getDOI() > -1 )
return ColorLib.rgb(164,193,193);
else
return ColorLib.rgba(255,255,255,0);
}
示例14: canParse
import prefuse.util.ColorLib; //导入依赖的package包/类
/**
* @see prefuse.data.parser.DataParser#canParse(java.lang.String)
*/
public boolean canParse(String text) {
try {
if ( text.charAt(0) == ColorLib.HEX_PREFIX ) {
parseInt(text);
} else {
return false;
}
return true;
} catch ( Exception e ) {
return false;
}
}
示例15: parseInt
import prefuse.util.ColorLib; //导入依赖的package包/类
/**
* Parse an int value from a text string.
* @param text the text string to parse
* @return the parsed int value
* @throws DataParseException if an error occurs during parsing
*/
public static int parseInt(String text) throws DataParseException {
try {
return ColorLib.hex(text);
} catch ( Exception e ) {
throw new DataParseException(e);
}
}