当前位置: 首页>>代码示例>>Java>>正文


Java Graphics.drawImage方法代码示例

本文整理汇总了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);
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:21,代码来源:CollapsedLabel.java

示例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));
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:20,代码来源:ComponentFigure.java

示例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));
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:22,代码来源:ComponentFigure.java

示例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();
	}
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:20,代码来源:ButtonFigure.java

示例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);
	}
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:19,代码来源:TableViewRowFigure.java

示例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);
  }
}
 
开发者ID:debrief,项目名称:limpet,代码行数:23,代码来源:DirectionalLabel.java

示例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);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:25,代码来源:ScrollableThumbnail.java

示例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);
	}
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:19,代码来源:PickerRowFigure.java

示例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();
	}
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:24,代码来源:ImageViewFigure.java

示例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();
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:18,代码来源:SwitchFigure.java

示例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();
    }
  }
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:23,代码来源:SVGFigure.java

示例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));
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:10,代码来源:ComponentFigure.java

示例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));
	}
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:14,代码来源:ImageFigure.java

示例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);

	}

}
 
开发者ID:kozake,项目名称:ermaster-k,代码行数:40,代码来源:InsertedImageFigure.java

示例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);
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:38,代码来源:SnapFeedbackPolicy.java


注:本文中的org.eclipse.draw2d.Graphics.drawImage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。