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


Java Graphics.setTextAntialias方法代码示例

本文整理汇总了Java中org.eclipse.draw2d.Graphics.setTextAntialias方法的典型用法代码示例。如果您正苦于以下问题:Java Graphics.setTextAntialias方法的具体用法?Java Graphics.setTextAntialias怎么用?Java Graphics.setTextAntialias使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.draw2d.Graphics的用法示例。


在下文中一共展示了Graphics.setTextAntialias方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fillShape

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
protected void fillShape(Graphics graphics) {
  LOGGER.trace("SVG fillShape - entry - for {}", getIconURI());
  try {
    svgShapeBounds = svgShapeBounds != null ? svgShapeBounds : determineExtremeBounds(getIconURI());
    int minX = svgShapeBounds.x;
    int minY = svgShapeBounds.y;

    int width = svgShapeBounds.width;
    int height = svgShapeBounds.height;
    setInitialSize(ga, width, height);

    // Simple instance caching to reduce redrawing overhead doesn't work here as it seems
    // we need to reconstruct the figure after all, when its shape is being moved.
    // TODO figure out a way in graphiti to differentiate plain redrawing due to selection/changes
    // somewhere else in the diagram, vs when this figure's shape effectively needs redrawing...
    // if (figure == null) {
    figure = new SVGFigure();
    // move SVG figure from its defined top-left to origin (0,0) top-left
    figure.setTranslateX(-minX);
    figure.setTranslateY(-minY);
    figure.setURI(getIconURI());
    figure.setBounds(this.getBounds());
    // }
    graphics.setAntialias(SWT.ON);
    graphics.setTextAntialias(SWT.ON);

    figure.paint(graphics);
  } catch (IOException e) {
    LOGGER.error("Error drawing SVG shape " + getIconURI(), e);
  }
  LOGGER.trace("SVG fillShape - exit - for {}", getIconURI());
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:34,代码来源:SvgModelElementShape.java

示例2: fillShape

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
protected void fillShape(Graphics graphics) {
  LOGGER.trace("Ptolemy fillShape - entry - for {}", getIconURI());
  try {
    iconDef = iconDef != null ? iconDef : (EditorIcon) WorkflowUtils.readFrom(URI.create(getIconURI()));
    // As Ptolemy II icon definitions often use negative coordinates,
    // while draw2d graphics assumes a top-left corner at (0,0),
    // the overall icon shape drawing must first determine the most extreme
    // boundaries as defined in the icon MOML and translate the draw2d coordinates space
    // accordingly before starting the effective drawing.
    ptShapeBounds = ptShapeBounds != null ? ptShapeBounds : determineExtremeBounds(iconDef, graphics);
    LOGGER.debug("Extreme bounds for {} : {}", getIconURI(), ptShapeBounds);

    int width = ptShapeBounds.width;
    int height = ptShapeBounds.height;

    Rectangle bnds = getBounds();
    graphics.setAntialias(SWT.ON);
    graphics.setTextAntialias(SWT.ON);
    graphics.drawRectangle(bnds.x, bnds.y, width, height);
    graphics.translate(getLocation());
    graphics.translate(ptShapeBounds.getTopLeft().getNegated().getTranslated(1, 1));
    for (VisibleAttribute a : iconDef.attributeList(VisibleAttribute.class)) {
      DrawingStrategy drawingStrategy = drawingStrategies.get(a.getClass());
      if (drawingStrategy != null) {
        drawingStrategy.draw(a, graphics, resourceManager);
      }
    }
    setInitialSize(ga, width + 2, height + 2);
  } catch (Exception e) {
    LOGGER.error("Error drawing ptolemy shape " + getIconURI(), e);
  }
  LOGGER.trace("Ptolemy fillShape - exit - for {}", getIconURI());
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:35,代码来源:PtolemyModelElementShape.java


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