本文整理汇总了Java中org.eclipse.draw2d.Graphics.drawImage方法的典型用法代码示例。如果您正苦于以下问题:Java Graphics.drawImage方法的具体用法?Java Graphics.drawImage怎么用?Java Graphics.drawImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.draw2d.Graphics
的用法示例。
在下文中一共展示了Graphics.drawImage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paintFigure
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
* @see Figure#paintFigure(Graphics)
*/
protected void paintFigure(Graphics graphics) {
if (isOpaque())
super.paintFigure(graphics);
Rectangle bounds = getBounds();
graphics.translate(bounds.x, bounds.y);
if (icon != null)
graphics.drawImage(icon, getIconLocation());
if (!isEnabled()) {
graphics.translate(1, 1);
graphics.setForegroundColor(ColorConstants.buttonLightest);
graphics.drawText(getSubStringText(), getTextLocation());
graphics.translate(-1, -1);
graphics.setForegroundColor(ColorConstants.buttonDarker);
}
graphics.drawText(getSubStringText(), getTextLocation());
graphics.translate(-bounds.x, -bounds.y);
}
示例2: trackExecution
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
private void trackExecution(Graphics graphics) {
Rectangle rectangle = getBounds().getCopy();
if(componentStatus!=null){
if (componentStatus.equals(ComponentExecutionStatus.BLANK)){
compStatusImage = null;
}else if (componentStatus.equals(ComponentExecutionStatus.PENDING)){
compStatusImage =ImagePathConstant.COMPONENT_PENDING_ICON.getImageFromRegistry();
}else if (componentStatus.equals(ComponentExecutionStatus.RUNNING)){
compStatusImage =ImagePathConstant.COMPONENT_RUNNING_ICON.getImageFromRegistry();
}else if (componentStatus.equals(ComponentExecutionStatus.SUCCESSFUL)){
compStatusImage =ImagePathConstant.COMPONENT_SUCCESS_ICON.getImageFromRegistry();
}else if (componentStatus.equals(ComponentExecutionStatus.FAILED)){
compStatusImage = ImagePathConstant.COMPONENT_FAILED_ICON.getImageFromRegistry();
}
}
if (compStatusImage != null) {
graphics.drawImage(compStatusImage, new Point (8, rectangle.height - 22));
}
}
示例3: drawPropertyStatus
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
* Draws the status image to right corner of the component
*
* @param graphics
*/
private void drawPropertyStatus(Graphics graphics) {
Rectangle rectangle = getBounds().getCopy();
if (StringUtils.isNotBlank(getPropertyStatus()) && getPropertyStatus().equals(ValidityStatus.WARN.name())) {
statusImage = ImagePathConstant.COMPONENT_WARN_ICON.getImageFromRegistry();
} else if (StringUtils.isNotBlank(getPropertyStatus()) && getPropertyStatus().equals(ValidityStatus.ERROR.name())) {
statusImage = ImagePathConstant.COMPONENT_ERROR_ICON.getImageFromRegistry();
} else if (StringUtils.isNotBlank(getPropertyStatus()) && getPropertyStatus().equals(Constants.UPDATE_AVAILABLE)) {
statusImage = ImagePathConstant.COMPONENT_UPDATE_ICON.getImageFromRegistry();
} else if (StringUtils.isNotBlank(getPropertyStatus()) && getPropertyStatus().equals(ValidityStatus.VALID.name())){
statusImage=null;
}
logger.trace("Component has {} property status.", getPropertyStatus());
if (statusImage != null && !statusImage.isDisposed()) {
graphics.drawImage(statusImage, new Point(rectangle.width - 25, 8 + componentLabelMargin));
}
}
示例4: paingImage
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
* @param graphics
*/
private void paingImage(Graphics graphics) {
if (image != null){
PrecisionRectangle tempRect = new PrecisionRectangle(getBounds().crop(insets));
float r = getBorder().getActualBorderRadius(tempRect);
// must use paths to process not integer values
// the difference is visible with zoom
graphics.setBackgroundColor(getBackgroundColor());
float borderWidth = Math.min(Math.min(tempRect.height, tempRect.width)/2, getBorder().getBorderWidth());
float internalRadius = Math.max(0, r - borderWidth);
tempRect.shrink(borderWidth, borderWidth);
Image roundedImage = getBorder().getRoundedImage(new Image(null, image.getImageData().scaledTo(tempRect.width, tempRect.height)),
internalRadius);
graphics.drawImage(roundedImage, tempRect.x, tempRect.y);
roundedImage.dispose();
}
}
示例5: paintHasImage
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
protected void paintHasImage(Graphics graphics) {
if (hasImage != null){
Rectangle clientArea = getClientArea();
clientArea.setLocation(getLocation());
graphics.clipRect(clientArea);
int dy = (clientArea.height - hasImageDimension.height) /2;
Rectangle dest = new Rectangle(
new Point(clientArea.right() - hasImageDimension.width - 10,
clientArea.y + dy),
hasImageDimension
);
Rectangle src = new Rectangle(0, 0,
hasImage.getImageData().width, hasImage.getImageData().height);
graphics.drawImage(hasImage, src, dest);
}
}
示例6: paintFigure
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
protected void paintFigure(Graphics graphics)
{
if (vertical)
{
String subStringText = getSubStringText();
if (!subStringText.isEmpty())
{
Image image =
ImageUtilities.createRotatedImageOfString(subStringText, getFont(),
getForegroundColor(), getBackgroundColor());
graphics.drawImage(image, new Point(getTextLocation())
.translate(getLocation()));
image.dispose();
}
}
else
{
super.paintFigure(graphics);
}
}
示例7: paintFigure
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
public void paintFigure(Graphics g) {
Rectangle bounds = getBounds().getCopy();
// Avoid drawing images that are 0 in dimension
if (bounds.width < 5 || bounds.height < 5)
return;
// Don't paint the selector figure if the entire source is visible.
Dimension thumbnailSize = new Dimension(getThumbnailImage());
// expand to compensate for rounding errors in calculating bounds
Dimension size = getSize().getExpanded(1, 1);
if (size.contains(thumbnailSize))
return;
bounds.height--;
bounds.width--;
Image image = new Image(Display.getCurrent(), iData);
g.drawImage(image, iBounds, bounds);
image.dispose();
g.setForegroundColor(ColorConstants.menuBackgroundSelected);
g.drawRectangle(bounds);
}
示例8: paintRightImage
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
protected void paintRightImage(Graphics graphics) {
if (rightImage != null){
Rectangle clientArea = getClientArea();
clientArea.setLocation(getLocation());
graphics.clipRect(clientArea);
int dy = (clientArea.height - rightImageDimension.height) /2;
Rectangle dest = new Rectangle(
new Point(clientArea.right() - rightImageDimension.width - 10,
clientArea.y + dy),
rightImageDimension
);
Rectangle src = new Rectangle(0, 0,
rightImage.getImageData().width, rightImage.getImageData().height);
graphics.drawImage(rightImage, src, dest);
}
}
示例9: paintFigure
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
protected void paintFigure(Graphics graphics) {
if (image == null){//draw border to make the component visible
if (getBorder().getBorderWidth() <= 1){
getBorder().setBorderWidth(1f);
}
}
super.paintFigure(graphics);
if(image != null){
PrecisionRectangle tempRect = new PrecisionRectangle(getBounds().crop(insets));
float r = getBorder().getActualBorderRadius(tempRect);
// must use paths to process not integer values
// the difference is visible with zoom
graphics.setBackgroundColor(getBackgroundColor());
float borderWidth = Math.min(Math.min(tempRect.height, tempRect.width)/2, getBorder().getBorderWidth());
float internalRadius = Math.max(0, r - borderWidth);
tempRect.shrink(borderWidth, borderWidth);
Image roundedImage = getBorder().getRoundedImage(new Image(null, image.getImageData().scaledTo(tempRect.width, tempRect.height)),
internalRadius);
graphics.drawImage(roundedImage, tempRect.x, tempRect.y);
roundedImage.dispose();
}
}
示例10: paintTitaniumFigure
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
protected void paintTitaniumFigure(Graphics graphics) {
if (isON()){
graphics.setForegroundColor(ColorConstants.white);
}
super.paintTitaniumFigure(graphics);
Rectangle rect = getBounds().getCopy();
//rect.shrink((int)getBorder().getBorderWidth(), (int)getBorder().getBorderWidth());
if (isON()){
rect.x = rect.right() - rect.height;
}
rect.width = rect.height;
Image image = Drawer.getGradientRectangle(new PrecisionRectangle(rect.getCopy()),
RECT_B_RGB, RECT_T_RGB, rect.height / 2, rect.height, rect.height);
graphics.drawImage(image, rect.getLocation());
image.dispose();
}
示例11: paintFigure
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
protected void paintFigure(Graphics graphics) {
super.paintFigure(graphics);
Document document = getDocument();
if (document == null) {
return;
}
Image image = null;
try {
Rectangle r = getClientArea();
updateRenderingHints(graphics);
BufferedImage awtImage = transcoder.getBufferedImage();
if (awtImage != null) {
image = ShapeUtils.toSWT(Display.getCurrent(), awtImage);
graphics.drawImage(image, r.x, r.y);
}
} finally {
if (image != null) {
image.dispose();
}
}
}
示例12: drawSchemaPropogationInfoImageIfSchemaPropogationBreaks
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
* @param Draw the schema Propogation status image to left top corner of the component.
*/
private void drawSchemaPropogationInfoImageIfSchemaPropogationBreaks(Graphics graphics)
{
Rectangle rectangle=getBounds().getCopy();
graphics.drawImage(ImagePathConstant.SCHEMA_PROPOGATION_STOP_ICON.getImageFromRegistry(), new Point(rectangle.width - 90, 8 + componentLabelMargin));
}
示例13: paintFigure
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
protected void paintFigure(Graphics g) {
Rectangle r = getBounds();
if(valid) {
ImageData data = getImageData();
Image img = new Image(Display.getDefault(), data);
g.drawImage(img, 0, 0, width, height, r.x+1, r.y+1, width, height);
img.dispose();
}
else {
g.drawText("Invalid matrix", r.getLocation().translate(5, 15));
}
}
示例14: paintFigure
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
protected void paintFigure(Graphics graphics) {
super.paintFigure(graphics);
graphics.setAlpha(alpha);
Rectangle area = getClientArea();
if (this.fixAspectRatio) {
Rectangle destination = new Rectangle();
double dw = (double) this.imageSize.width / (double) area.width;
double dh = (double) this.imageSize.height / (double) area.height;
if (dw > dh) {
// we must limit the size by the width
destination.width = area.width;
destination.height = (int) (this.imageSize.height / dw);
} else {
// we must limit the size by the height
destination.width = (int) (this.imageSize.width / dh);
destination.height = area.height;
}
destination.x = (area.width - destination.width) / 2 + area.x;
destination.y = (area.height - destination.height) / 2 + area.y;
graphics.drawImage(this.image,
new Rectangle(this.image.getBounds()), destination);
} else {
graphics.drawImage(this.image,
new Rectangle(this.image.getBounds()), area);
}
}
示例15: paintFigure
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
* @see org.eclipse.draw2d.Figure#paintFigure(org.eclipse.draw2d.Graphics)
*/
protected void paintFigure(Graphics graphics) {
if (opacity != FRAMES) {
if (image != null) {
image.dispose();
count--;
image = null;
}
if (opacity != FRAMES - 1) {
Display display = Display.getCurrent();
PaletteData pData = new PaletteData(0xFF, 0xFF00, 0xFF0000);
Color localBackgroundColor = createMixedColor();
int fillColor = pData.getPixel(localBackgroundColor
.getRGB());
localBackgroundColor.dispose();
ImageData iData = new ImageData(1, 1, 24, pData);
iData.setPixel(0, 0, fillColor);
iData.setAlpha(0, 0, 255 * opacity / FRAMES);
image = new Image(display, iData);
count++;
}
Display.getCurrent().timerExec(100, new Runnable() {
public void run() {
opacity = Math.min(FRAMES, opacity + 1);
repaint();
}
});
}
Rectangle r = getBounds();
if (image != null)
graphics.drawImage(image, 0, 0, 1, 1, r.x, r.y, r.width,
r.height);
else
super.paintFigure(graphics);
}