Java Code Examples for java.awt.geom.Arc2D#setAngles()

The following examples show how to use java.awt.geom.Arc2D#setAngles() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MfCmdArc.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Replays the command on the given WmfFile.
 *
 * @param file the meta file.
 */
public void replay( final WmfFile file ) {
  final Graphics2D graph = file.getGraphics2D();
  final Rectangle rec = getScaledBounds();
  final Point start = getScaledStartingIntersection();
  final Point end = getScaledEndingIntersection();

  final Arc2D arc = new Arc2D.Double();
  arc.setArcType( Arc2D.OPEN );
  arc.setFrame( rec.x, rec.y, rec.width, rec.height );
  arc.setAngles( start.x, start.y, end.x, end.y );

  final MfDcState state = file.getCurrentState();

  if ( state.getLogBrush().isVisible() ) {
    state.preparePaint();
    graph.fill( arc );
    state.postPaint();
  }
  if ( state.getLogPen().isVisible() ) {
    state.prepareDraw();
    graph.draw( arc );
    state.postDraw();
  }
}
 
Example 2
Source File: MfCmdChord.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Replays the command on the given WmfFile.
 *
 * @param file the meta file.
 */
public void replay( final WmfFile file ) {
  final Graphics2D graph = file.getGraphics2D();
  final Rectangle rec = getBounds();
  final Point start = getStartingIntersection();
  final Point end = getEndingIntersection();

  final Arc2D arc = new Arc2D.Double();
  arc.setArcType( Arc2D.CHORD );
  arc.setFrame( rec.x, rec.y, rec.width, rec.height );
  arc.setAngles( start.x, start.y, end.x, end.y );

  final MfDcState state = file.getCurrentState();

  if ( state.getLogBrush().isVisible() ) {
    state.preparePaint();
    graph.fill( arc );
    state.postPaint();
  }
  if ( state.getLogPen().isVisible() ) {
    state.prepareDraw();
    graph.draw( arc );
    state.postDraw();
  }

}
 
Example 3
Source File: MfCmdPie.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Replays the command on the given WmfFile.
 *
 * @param file the meta file.
 */
public void replay( final WmfFile file ) {
  final Graphics2D graph = file.getGraphics2D();
  final Rectangle rec = getScaledBounds();
  final Point start = getScaledStartingIntersection();
  final Point end = getScaledEndingIntersection();

  final Arc2D arc = new Arc2D.Double();
  arc.setArcType( Arc2D.PIE );
  arc.setFrame( rec.x, rec.y, rec.width, rec.height );
  arc.setAngles( start.x, start.y, end.x, end.y );

  final MfDcState state = file.getCurrentState();

  if ( state.getLogBrush().isVisible() ) {
    state.preparePaint();
    graph.fill( arc );
    state.postPaint();
  }
  if ( state.getLogPen().isVisible() ) {
    state.prepareDraw();
    graph.draw( arc );
    state.postDraw();
  }
}