java.awt.Graphics2D.clipRect()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(211)

本文整理了Java中java.awt.Graphics2D.clipRect()方法的一些代码示例,展示了Graphics2D.clipRect()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graphics2D.clipRect()方法的具体详情如下:
包路径:java.awt.Graphics2D
类名称:Graphics2D
方法名:clipRect

Graphics2D.clipRect介绍

暂无

代码示例

代码示例来源:origin: org.apache.poi/poi

BufferedImage argbImg = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
Graphics2D g = argbImg.createGraphics();
g.clipRect(0, 0, width, y);
g.drawImage(img, 0, 0, null);
g.dispose();

代码示例来源:origin: apache/pdfbox

@Override
public void clipRect(int x, int y, int width, int height)
{
  groupG2D.clipRect(x, y, width, height);
  alphaG2D.clipRect(x, y, width, height);
}

代码示例来源:origin: geotools/geotools

public void clipRect(int x, int y, int width, int height) {
  delegate.clipRect(x, y, width, height);
}

代码示例来源:origin: org.apache.pivot/pivot-wtk

@Override
public Graphics2D prepare(Component component, Graphics2D graphics) {
  graphics.clipRect(x, y, width, height);
  return graphics;
}

代码示例来源:origin: com.barchart.pivot/pivot-wtk

@Override
public Graphics2D prepare(Component component, Graphics2D graphics) {
  graphics.clipRect(x, y, width, height);
  return graphics;
}

代码示例来源:origin: org.apache.pdfbox/pdfbox

@Override
public void clipRect(int x, int y, int width, int height)
{
  groupG2D.clipRect(x, y, width, height);
  alphaG2D.clipRect(x, y, width, height);
}

代码示例来源:origin: com.samskivert/samskivert

@Override
public void clipRect (int x, int y, int w, int h)
{
  _copy.clipRect(x, y, w, h);
  _primary.clipRect(x, y, w, h);
}

代码示例来源:origin: robo-code/robocode

private void processClipRect(Graphics2D g) {
  // clipRect(int, int, int, int)
  g.clipRect(calls.getInt(), calls.getInt(), calls.getInt(), calls.getInt());
}

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

public void clipRect(int x, int y, int width, int height)
{
  System.out.println( "clipRect(int, int, int, int):" );
  System.out.println( "x = " + x );
  System.out.println( "y = " + y );
  System.out.println( "width = " + width );
  System.out.println( "height = " + height );
  g2D.clipRect( x, y, width, height );
}

代码示例来源:origin: com.haulmont.thirdparty/poi

public void clipRect(int x, int y, int width, int height)
{
  System.out.println( "clipRect(int, int, int, int):" );
  System.out.println( "x = " + x );
  System.out.println( "y = " + y );
  System.out.println( "width = " + width );
  System.out.println( "height = " + height );
  g2D.clipRect( x, y, width, height );
}

代码示例来源:origin: stackoverflow.com

Graphics2D g2d = (Graphics2D) g;

g2d.clipRect(150, 10, 100, 100);
g2d.draw(new RoundRectangle2D.Double(100, 10, 80, 30, 15, 15));

g2d.setClip(null);
g2d.clipRect(100, 10, 50, 100);
g2d.draw(new Rectangle2D.Double(100, 10, 80, 30));

代码示例来源:origin: org.openmicroscopy/ome-poi

public void clipRect(int x, int y, int width, int height)
{
  System.out.println( "clipRect(int, int, int, int):" );
  System.out.println( "x = " + x );
  System.out.println( "y = " + y );
  System.out.println( "width = " + width );
  System.out.println( "height = " + height );
  g2D.clipRect( x, y, width, height );
}

代码示例来源:origin: org.apache.pivot/pivot-wtk

@Override
  public void paint(Graphics2D graphics) {
    graphics.translate(-bounds.x, -bounds.y);
    graphics.clipRect(bounds.x, bounds.y, bounds.width, bounds.height);
    tableView.paint(graphics);
  }
}

代码示例来源:origin: com.barchart.pivot/pivot-wtk

@Override
  public void paint(Graphics2D graphics) {
    graphics.translate(-bounds.x, -bounds.y);
    graphics.clipRect(bounds.x, bounds.y, bounds.width, bounds.height);
    tableView.paint(graphics);
  }
}

代码示例来源:origin: com.synaptix/SynaptixSwing

private void paintVoyageDraw(Graphics g, LotDraw lotDraw, VoyageDraw voyageDraw, Rectangle rect) {
  Graphics2D g2 = (Graphics2D) g.create();
  boolean selected = false;
  if (currentSelectedPath != null && currentSelectedPath.getVoyageDraw() != null && currentSelectedPath.getVoyageDraw().equals(voyageDraw)) {
    selected = true;
    selectedVoyageDraw = true;
    selectedVoyageDrawRect = rect;
  }
  g2.clipRect(rect.x, rect.y, rect.width, rect.height);
  voyageDraw.getRenderer().paintVoyageDraw(g2, rect, JTriage.this, side, lotDraw, voyageDraw, selected);
  g2.dispose();
}

代码示例来源:origin: org.apache.pivot/pivot-wtk

@Override
public Graphics2D prepare(Component component, Graphics2D graphics) {
  if (clip) {
    Bounds decoratedBounds = component.getDecoratedBounds();
    graphics.clipRect(decoratedBounds.x - component.getX(),
      decoratedBounds.y - component.getY(),
      decoratedBounds.width, decoratedBounds.height);
  }
  graphics.translate(x, y);
  return graphics;
}

代码示例来源:origin: com.barchart.pivot/pivot-wtk

@Override
public Graphics2D prepare(Component component, Graphics2D graphics) {
  if (clip) {
    Bounds decoratedBounds = component.getDecoratedBounds();
    graphics.clipRect(decoratedBounds.x - component.getX(),
      decoratedBounds.y - component.getY(),
      decoratedBounds.width, decoratedBounds.height);
  }
  graphics.translate(x, y);
  return graphics;
}

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

protected void drawConstrainer(Graphics2D g) {
  Shape clip = g.getClip();
  Rectangle r = getCanvasViewBounds();
  g.clipRect(r.x, r.y, r.width, r.height);
  getConstrainer().draw(g, this);
  g.setClip(clip);
}

代码示例来源:origin: com.github.haifengl/smile-plot

/**
 * Restrict the draw area to the valid base coordinate space.
 */
public void clip() {
  int x = (int) (projection.canvas.getWidth() * projection.canvas.margin);
  int y = (int) (projection.canvas.getHeight() * projection.canvas.margin);
  int w = (int) (projection.canvas.getWidth() * (1 - 2 * projection.canvas.margin));
  int h = (int) (projection.canvas.getHeight() * (1 - 2 * projection.canvas.margin));
  originalClip = g2d.getClip();
  g2d.clipRect(x, y, w, h);
}

代码示例来源:origin: org.geomajas.plugin/geomajas-plugin-printing

public Graphics2D getGraphics2D(Rectangle clipRect) {
  Graphics2D graphics = template.createGraphics(template.getWidth(), template.getHeight());
  graphics.translate(origX, template.getHeight() - origY - clipRect.getHeight());
  graphics.clipRect(0, 0, (int) clipRect.getWidth(), (int) clipRect.getHeight());
  return graphics;
}

相关文章

Graphics2D类方法