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

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

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

Graphics2D.getPaint介绍

暂无

代码示例

代码示例来源:origin: jphp-group/jphp

@Getter
public Color getFill() {
  return gc.getPaint() instanceof Color ? (Color) gc.getPaint() : null;
}

代码示例来源:origin: chewiebug/GCViewer

protected void paintComponent(Graphics g) {
  super.paintComponent(g);
  Graphics2D g2d = (Graphics2D)g;
  Paint oldPaint = g2d.getPaint();
  Object oldAAHint = g2d.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
  if (modelChart.isAntiAlias()) g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  g2d.setPaint(getLinePaint());
  paintComponent(g2d);
  g2d.setPaint(oldPaint);
  g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, oldAAHint);
}

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

@Override
public Paint getPaint()
{
  return groupG2D.getPaint();
}

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

public Paint getPaint() {
  return delegate.getPaint();
}

代码示例来源:origin: magefree/mage

Paint paint = g2.getPaint();
g2.setPaint(new GradientPaint(0, 0, new Color(0x818a9b), 0, height, new Color(0x3a4252)));
g2.fill(casing);
g2.setColor(Color.BLACK);
Paint paint = g2.getPaint();
g2.setPaint(new GradientPaint(0, 0, new Color(0x818a9b), 0, height, new Color(0x3a4252)));
g2.fill(casing);

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

int height = getHeight();
Graphics2D g2 = (Graphics2D) g;
Paint oldPaint = g2.getPaint();
g2.setPaint(new GradientPaint(0, 0, background, width, 0, controlColor));
g2.fillRect(0, 0, width, height);

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

int height = getHeight();
Graphics2D g2 = (Graphics2D) g;
Paint oldPaint = g2.getPaint();
g2.setPaint(new GradientPaint(0, 0, background, width, 0, controlColor));
g2.fillRect(0, 0, width, height);

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

if (!(graphics.getPaint() instanceof Color))

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

@Override
public Paint getPaint()
{
  return groupG2D.getPaint();
}

代码示例来源:origin: pentaho/pentaho-reporting

/**
 * Returns the current <code>Paint</code> of the <code>Graphics2D</code> context.
 *
 * @return the current <code>Graphics2D</code> <code>Paint</code>, which defines a color or pattern.
 * @see #setPaint
 * @see Graphics#setColor
 */
public Paint getPaint() {
 return parent.getPaint();
}

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

/**
 * Get the current paint object.
 */
public Paint getPaint() {
  return g2d.getPaint();
}

代码示例来源:origin: org.gephi/utils

private static void drawHighlight(Graphics2D g, float x, float y, Color highlightColor) {
  Paint oldPaint = g.getPaint();
  g.setPaint(highlightColor);
  g.fill(new Ellipse2D.Double(x - HIGHLIGHT_RADIUS / 2f, y - HIGHLIGHT_RADIUS / 2f, HIGHLIGHT_RADIUS, HIGHLIGHT_RADIUS));
  g.setPaint(oldPaint);
}

代码示例来源:origin: com.bbossgroups.activiti/activiti-engine

public void drawSequenceflowWithoutArrow(int srcX, int srcY, int targetX, int targetY, boolean conditional, boolean highLighted) {
 Paint originalPaint = g.getPaint();
 if (highLighted)
  g.setPaint(HIGHLIGHT_COLOR);
 Line2D.Double line = new Line2D.Double(srcX, srcY, targetX, targetY);
 g.draw(line);
 if (conditional) {
  drawConditionalSequenceFlowIndicator(line);
 }
 if (highLighted)
  g.setPaint(originalPaint);
}

代码示例来源:origin: uk.org.mygrid.taverna.scufl/scufl-ui-api

protected void paintComponent(Graphics g) {
  final int width = getWidth();
  final int height = getHeight();
  Graphics2D g2d = (Graphics2D) g;
  Paint oldPaint = g2d.getPaint();
  g2d.setPaint(new GradientPaint(0, 0, this.colour, width, height,
      toColour));
  g2d.fillRect(0, 0, width, height);
  g2d.setPaint(oldPaint);
  super.paintComponent(g);
}

代码示例来源:origin: nroduit/Weasis

protected void paintBoundOutline(Graphics2D g2d, AffineTransform transform) {
  Rectangle2D boundingRect = getTransformedBounds(transform);
  Paint oldPaint = g2d.getPaint();
  g2d.setPaint(Color.BLACK);
  g2d.draw(boundingRect);
  GeomUtil.growRectangle(boundingRect, -1);
  g2d.setPaint(Color.WHITE);
  g2d.draw(boundingRect);
  g2d.setPaint(oldPaint);
}

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

public void save(Graphics g) {
  Graphics2D g2 = (Graphics2D) g;
  paint = g2.getPaint();
  font = g2.getFont();
  stroke = g2.getStroke();
  transform = g2.getTransform();
  composite = g2.getComposite();
  clip = g2.getClip();
  renderingHints = g2.getRenderingHints();
  color = g2.getColor();
  background = g2.getBackground();
}

代码示例来源:origin: uk.org.mygrid.taverna.processors/taverna-soaplab-processor

protected void paintComponent(Graphics g) {
  final int width = getWidth();
  final int height = getHeight();
  Graphics2D g2d = (Graphics2D) g;
  Paint oldPaint = g2d.getPaint();
  g2d.setPaint(new GradientPaint(0, 0, col, width, 0, col2));
  g2d.fillRect(0, 0, width, height);
  g2d.setPaint(oldPaint);
  super.paintComponent(g);
}
/**

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-kenai-ui

@Override
public void paintComponent( Graphics g ) {
  if( isRoot && isAqua && node.isExpandable() ) {
    Graphics2D g2d = (Graphics2D) g;
    Paint oldPaint = g2d.getPaint();
    g2d.setPaint( new GradientPaint(0,0, Color.white, 0, getHeight()/2, getBackground()) );
    g2d.fillRect(0, 0, getWidth(), getHeight());
    g2d.setPaint(oldPaint);
  } else {
    super.paintComponent(g);
  }
}

代码示例来源:origin: org.netbeans.api/org-netbeans-swing-plaf

public void paint (Graphics g, JComponent c) {
  Rectangle r = c.getBounds(scratch);
  AbstractButton b = (AbstractButton) c;
  r.x = 0;
  r.y = 0;
  Paint temp = ((Graphics2D) g).getPaint();
  paintBackground ((Graphics2D)g, b, r);
  paintIcon (g, b, r);
  ((Graphics2D) g).setPaint(temp);
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-bugtracking

@Override
public void paintComponent(Graphics g) {
  if (ColorManager.getDefault().isAqua()) {
    Graphics2D g2d = (Graphics2D) g;
    Paint oldPaint = g2d.getPaint();
    g2d.setPaint(new GradientPaint(0, 0, Color.white, 0, getHeight() / 2, getBackground()));
    g2d.fillRect(0, 0, getWidth(), getHeight());
    g2d.setPaint(oldPaint);
  } else {
    super.paintComponent(g);
  }
}

相关文章

Graphics2D类方法