att.grappa
Interface CustomRenderer


public interface CustomRenderer

An interface for describing the drawing of custom shapes that cannot be captured via a single GeneralPath. This interface would generally be used when the Attribute SHAPE_ATTR=custom and CUSTOM_ATTR is set to the name of a user provided class which would be an extension of GrappaShape and implements this interface. Note that if the custom shape desired by the user can be expressed as a single general path, then there is no need to use this interface or provide the methods it requires.

Version:
1.2, 21 Aug 2005; Copyright 1996 - 2005 by AT&T Corp.
Author:
John Mocenigo, Research @ AT&T Labs

Method Summary
 void draw(java.awt.Graphics2D g2d)
          The method called when the element needs to be drawn.
 void drawImage(java.awt.Graphics2D g2d)
          The method called when the element needs to draw its background image.
 void fill(java.awt.Graphics2D g2d)
          The method called when the element needs to be filled.
 

Method Detail

draw

void draw(java.awt.Graphics2D g2d)
The method called when the element needs to be drawn. When used with an extention of GrappaShape, the default behavior is obtained by:
 public void draw(java.awt.Graphics2D g2d) {
   g2d.draw(this);
 }
 

Parameters:
g2d - the Graphics2D context to be used for drawing

fill

void fill(java.awt.Graphics2D g2d)
The method called when the element needs to be filled. When used with an extention of GrappaShape, the default behavior is obtained by:
 public void fill(java.awt.Graphics2D g2d) {
   g2d.fill(this);
 }
 

Parameters:
g2d - the Graphics2D context to be used for drawing

drawImage

void drawImage(java.awt.Graphics2D g2d)
The method called when the element needs to draw its background image. When used with an extention of GrappaShape that provides the underlying element as a global variable, the default behavior is obtained by:
 public void drawImage(java.awt.Graphics2D g2d) {
   Rectangle sbox = this.getBounds();
   Shape clip = g2d.getClip();
   g2d.clip(this);
   g2d.drawImage(element.getGrappaNexus().getImage(), sbox.x, sbox.y, sbox.width, sbox.height, null);
   g2d.setClip(clip);
 }
 

Parameters:
g2d - the Graphics2D context to be used for drawing