本文整理汇总了Java中edu.mit.blocks.codeblockutil.GraphicsManager.recycleGCCompatibleImage方法的典型用法代码示例。如果您正苦于以下问题:Java GraphicsManager.recycleGCCompatibleImage方法的具体用法?Java GraphicsManager.recycleGCCompatibleImage怎么用?Java GraphicsManager.recycleGCCompatibleImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.mit.blocks.codeblockutil.GraphicsManager
的用法示例。
在下文中一共展示了GraphicsManager.recycleGCCompatibleImage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hierarchyChanged
import edu.mit.blocks.codeblockutil.GraphicsManager; //导入方法依赖的package包/类
/*************************************************************
* HierarchyListener method for the RB is added to or removed
* from a parent component
*************************************************************/
@Override
public void hierarchyChanged(HierarchyEvent he) {
if (rb.getParent() == null) {
this.removeFromParent();
GraphicsManager.recycleGCCompatibleImage(hImage);
hImage = null;
}
}
示例2: clearBufferedImage
import edu.mit.blocks.codeblockutil.GraphicsManager; //导入方法依赖的package包/类
/**
* Clears the BufferedImage of this
*/
public void clearBufferedImage() {
GraphicsManager.recycleGCCompatibleImage(buffImg);
buffImg = null;
}
示例3: updateBuffImg
import edu.mit.blocks.codeblockutil.GraphicsManager; //导入方法依赖的package包/类
/**
* Redraws the entire buffer on a Graphics2D, called by paintCompnent() only
* if the buffer has been cleared.
*/
private void updateBuffImg() {
if (GraphicsEnvironment.isHeadless()) {
return;
}
// if label text has changed, then resync labels/sockets and reform
// shape
if (!synchronizeLabelsAndSockets()) {
reformBlockShape();// if updateLabels is true, we don't need to
// reform AGAIN
}
// create image
// note: need to add twice the highlight stroke width so that the
// highlight does not get cut off
GraphicsManager.recycleGCCompatibleImage(buffImg);
buffImg = GraphicsManager.getGCCompatibleImage(
blockArea.getBounds().width, blockArea.getBounds().height);
Graphics2D buffImgG2 = (Graphics2D) buffImg.getGraphics();
// update bounds of this renderableBlock as bounds of the shape
Dimension updatedDimensionRect = new Dimension(blockArea.getBounds()
.getSize());
// get size of block to determine size needed for bevel image
Image bevelImage = BlockShapeUtil.getBevelImage(
updatedDimensionRect.width, updatedDimensionRect.height,
blockArea);
// need antialiasing to remove color fill artifacts outside the bevel
buffImgG2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
// ADD BLOCK COLOR
Color blockColor = this.getBLockColor();
buffImgG2.setColor(blockColor);
buffImgG2.fill(blockArea);
// draw the bevel on the shape -- comment this line to not apply
// beveling
buffImgG2.drawImage(bevelImage, 0, 0, null);
// DRAW BLOCK IMAGES
repositionBlockImages(blockArea.getBounds().width,
blockArea.getBounds().height);
}
示例4: updateImage
import edu.mit.blocks.codeblockutil.GraphicsManager; //导入方法依赖的package包/类
public void updateImage() {
if (GraphicsEnvironment.isHeadless()) {
return;
}
// cache the focus so it'll know when it needs to redraw later.
hasFocus = rb.getBlock().hasFocus();
Color color = null;
if (hColor != null) {
color = hColor;
} else if (rb.getBlock().hasFocus()) {
color = new Color(200, 200, 255); //Color.BLUE);
} else if (isSearchResult) {
color = new Color(255, 255, 120); //Color.YELLOW);
} else if (rb.getBlock().isBad()) {
color = new Color(255, 100, 100); //Color.RED);
} else {
GraphicsManager.recycleGCCompatibleImage(hImage);
hImage = null;
return; // if we're not highlighting, destroy the image and just return
}
if (!rb.isVisible()) {
GraphicsManager.recycleGCCompatibleImage(hImage);
hImage = null;
return; // if we're not highlighting, destroy the image and just return
}
hImage = GraphicsManager.getGCCompatibleImage(rb.getBlockWidth() + HIGHLIGHT_STROKE_WIDTH, rb.getBlockHeight() + HIGHLIGHT_STROKE_WIDTH);
Graphics2D hg = (Graphics2D) hImage.getGraphics();
hg.addRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON));
hg.setColor(color);
hg.translate(HIGHLIGHT_STROKE_WIDTH / 2, HIGHLIGHT_STROKE_WIDTH / 2);
hg.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, .2f));
for (int i = 0; i < HIGHLIGHT_STROKE_WIDTH; i++) {
hg.setStroke(new BasicStroke(i));
hg.draw(rb.getBlockArea());
}
hg.setColor(new Color(0, 0, 0, 0));
hg.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC, 1));
hg.fill(rb.getBlockArea());
}
示例5: componentHidden
import edu.mit.blocks.codeblockutil.GraphicsManager; //导入方法依赖的package包/类
@Override
public void componentHidden(ComponentEvent arg0) {
GraphicsManager.recycleGCCompatibleImage(hImage);
hImage = null;
}