sub_arctic.output
Class conditional_drawable

java.lang.Object
  |
  +--java.awt.Graphics
        |
        +--sub_arctic.output.drawable
              |
              +--sub_arctic.output.drawable_wrapper
                    |
                    +--sub_arctic.output.conditional_drawable
Direct Known Subclasses:
isolation_drawable

public class conditional_drawable
extends drawable_wrapper

Subclass of drawable_wrapper that conditionally does or skips drawing operations based on a settable boolean flag. All state changes such as color and clipping changes are always performs. This allows the drawable to operate smoothly in an interactor redraw pass since trivial rejects depend on the proper clipping rect being set and operations lower in the tree that are drawn may depend on state set which drawing is off. This class wraps another drawing object rather than being a conventional drawable in and of itself. This allows it to be composed with other drawing effects.

See Also:
Graphics

Field Summary
protected  boolean _currently_drawing
          Do we currently have drawing on/or off?
 
Fields inherited from class sub_arctic.output.drawable_wrapper
_wrappee
 
Fields inherited from class sub_arctic.output.drawable
_ignore, g
 
Constructor Summary
conditional_drawable(drawable rappee)
          Constructor defaulting to drawing on
conditional_drawable(drawable rappee, boolean draw_status)
          Full constructor
conditional_drawable(java.awt.Graphics rappee)
          Constructor working from a Graphics.
 
Method Summary
 void clearRect(int x, int y, int w, int h)
           
 void copyArea(int x, int y, int w, int h, int dx, int dy)
           
 java.awt.Graphics create()
          Override create() to create the properly typed wrapper around a copy of the object we wrap.
 java.awt.Graphics create(int x, int y, int w, int h)
          Override create() to create the properly typed wrapper around a copy of the object we wrap.
 boolean currently_drawing()
          Do we currently have drawing on/or off?
 void draw_arrowhead(int x1, int y1, int x2, int y2, int arrow_head_len, int arrow_head_angle, double arrow_inset)
          Draw a hollow arrowhead (as lines) at the second end of the given line (this does not draw the line).
 void draw3DRect(int x, int y, int w, int h, boolean raised)
           
 void drawArc(int x, int y, int w, int h, int start_ang, int arc_ang)
           
 void drawBytes(byte[] data, int off, int len, int x, int y)
           
 void drawChars(char[] data, int off, int len, int x, int y)
           
 boolean drawImage(java.awt.Image img, int x, int y, java.awt.Color bgcolor, java.awt.image.ImageObserver obs)
           
 boolean drawImage(java.awt.Image img, int x, int y, java.awt.image.ImageObserver observer)
           
 boolean drawImage(java.awt.Image img, int x, int y, int w, int h, java.awt.Color bgcolor, java.awt.image.ImageObserver obs)
           
 boolean drawImage(java.awt.Image img, int x, int y, int w, int h, java.awt.image.ImageObserver obs)
           
 boolean drawImage(loaded_image img, int x, int y)
          Extended draw image that can deal with a loaded_image w/o an observer.
 boolean drawImage(loaded_image img, int x, int y, java.awt.Color bgcolor)
          Extended draw image that can deal with a loaded_image w/o an observer.
 boolean drawImage(loaded_image img, int x, int y, int w, int h)
          Extended draw image that can deal with a loaded_image w/o an observer.
 boolean drawImage(loaded_image img, int x, int y, int w, int h, java.awt.Color bgcolor)
          Extended draw image that can deal with a loaded_image w/o an observer.
 void drawLine(int x1, int y1, int x2, int y2)
           
 void drawOval(int x, int y, int w, int h)
           
 void drawPolygon(int[] xp, int[] yp, int np)
           
 void drawPolygon(java.awt.Polygon p)
           
 void drawRect(int x, int y, int w, int h)
           
 void drawRoundRect(int x, int y, int w, int h, int arcw, int arch)
           
 void drawString(java.lang.String str, int x, int y)
           
 void fill_arrowhead(int x1, int y1, int x2, int y2, int arrow_head_len, int arrow_head_angle, double arrow_inset)
          Draw a filled arrowhead polygon at the second end of the given line (this does not draw the line).
 void fill3DRect(int x, int y, int w, int h, boolean raised)
           
 void fillArc(int x, int y, int w, int h, int start_ang, int arc_ang)
           
 void fillOval(int x, int y, int w, int h)
           
 void fillPolygon(int[] xp, int[] yp, int np)
           
 void fillPolygon(java.awt.Polygon p)
           
 void fillRect(int x, int y, int w, int h)
           
 void fillRoundRect(int x, int y, int w, int h, int arcw, int arch)
           
 void set_currently_drawing(boolean draw_status)
          Set whether we currently have drawing on/or off.
 boolean tileImage(loaded_image pattern, int x, int y, int w, int h)
          Tiled drawing of a pattern image over an area.
 java.lang.String toString()
          Convert to a human readable string.
 
Methods inherited from class sub_arctic.output.drawable_wrapper
arrowhead_bound, clipRect, copy, copy, dispose, end_interactor_draw, finalize, getClipBounds, getColor, getFont, getFontMetrics, getFontMetrics, graphics, mark_interactor_draw, setClip, setColor, setFont, setPaintMode, setXORMode, start_interactor_draw, translate, wrappee
 
Methods inherited from class sub_arctic.output.drawable
arrowhead_bound, clear_rect, clip_rect, copy_area, draw_3D_rect, draw_arc, draw_arrowhead, draw_bytes, draw_chars, draw_image, draw_image, draw_image, draw_image, draw_image, draw_image, draw_image, draw_image, draw_image, draw_image, draw_image, draw_image, draw_line, draw_oval, draw_polygon, draw_polygon, draw_polyline, draw_rect, draw_round_rect, draw_string, drawImage, drawImage, drawImage, drawImage, drawPolyline, drawString, fill_3D_rect, fill_arc, fill_arrowhead, fill_oval, fill_polygon, fill_polygon, fill_rect, fill_round_rect, get_clip_bounds, get_clip, get_color, get_font_metrics, get_font_metrics, get_font, getClip, set_clip, set_clip, set_color, set_font, set_paint_mode, set_XOR_mode, setClip, tile_image
 
Methods inherited from class java.awt.Graphics
getClipBounds, getClipRect, hitClip
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_currently_drawing

protected boolean _currently_drawing
Do we currently have drawing on/or off?
Constructor Detail

conditional_drawable

public conditional_drawable(drawable rappee,
                            boolean draw_status)
Full constructor
Parameters:
drawable - rappee the drawable we create a wrapper around.
boolean - draw_status initial draw status (true == drawing on).

conditional_drawable

public conditional_drawable(drawable rappee)
Constructor defaulting to drawing on
Parameters:
boolean - draw_status initial draw status (true == drawing on).

conditional_drawable

public conditional_drawable(java.awt.Graphics rappee)
Constructor working from a Graphics. We will basically create a plain drawable wrapping the given Graphics object, then use that as the drawable we wrap. This to drawing on.
Parameters:
Graphics - rappee the object we are wrapper around.
Method Detail

currently_drawing

public boolean currently_drawing()
Do we currently have drawing on/or off?
Returns:
boolean indicating current draw status.

set_currently_drawing

public void set_currently_drawing(boolean draw_status)
Set whether we currently have drawing on/or off.
Parameters:
boolean - draw_status passed to true to turn drawing on.

create

public java.awt.Graphics create()
Override create() to create the properly typed wrapper around a copy of the object we wrap. Note: subclasses will typically need to do this also.
Returns:
Graphics a new conditional_drawable object copied from this one.
Overrides:
create in class drawable_wrapper

create

public java.awt.Graphics create(int x,
                                int y,
                                int w,
                                int h)
Override create() to create the properly typed wrapper around a copy of the object we wrap. Note: subclasses will typically need to do this also.
Parameters:
int - x x component of origin of new drawable
int - y y component of origin of new drawable
int - w width of new drawable
int - h height of new drawable
Returns:
Graphics a new conditional_drawable object derived from this one.
Overrides:
create in class drawable_wrapper

drawImage

public boolean drawImage(loaded_image img,
                         int x,
                         int y)
Extended draw image that can deal with a loaded_image w/o an observer. If the image has not actually been loaded yet, this will block until it has.
Parameters:
loaded_image - img the image to be drawn.
int - x x position to place the image at.
int - y y position to place the image at.
Returns:
boolean undocumented return value from AWT drawImage() routine.
Overrides:
drawImage in class drawable_wrapper

drawImage

public boolean drawImage(loaded_image img,
                         int x,
                         int y,
                         int w,
                         int h)
Extended draw image that can deal with a loaded_image w/o an observer. If the image has not actually been loaded yet, this will block until it has.
Parameters:
loaded_image - img the image to be drawn.
int - x x position to place the image at.
int - y y position to place the image at.
int - w width image will be scaled to.
int - h height image will be scaled to.
Returns:
boolean undocumented return value from AWT drawImage() routine.
Overrides:
drawImage in class drawable_wrapper

drawImage

public boolean drawImage(loaded_image img,
                         int x,
                         int y,
                         java.awt.Color bgcolor)
Extended draw image that can deal with a loaded_image w/o an observer. If the image has not actually been loaded yet, this will block until it has.
Parameters:
loaded_image - img the image to be drawn.
int - x x position to place the image at.
int - y y position to place the image at.
Color - bgcolor background color.
Returns:
boolean undocumented return value from AWT drawImage() routine.
Overrides:
drawImage in class drawable_wrapper

drawImage

public boolean drawImage(loaded_image img,
                         int x,
                         int y,
                         int w,
                         int h,
                         java.awt.Color bgcolor)
Extended draw image that can deal with a loaded_image w/o an observer. If the image has not actually been loaded yet, this will block until it has.
Parameters:
loaded_image - img the image to be drawn.
int - x x position to place the image at.
int - y y position to place the image at.
int - w width image will be scaled to.
int - h height image will be scaled to.
Color - bgcolor background color.
Returns:
boolean undocumented return value from AWT drawImage() routine.
Overrides:
drawImage in class drawable_wrapper

tileImage

public boolean tileImage(loaded_image pattern,
                         int x,
                         int y,
                         int w,
                         int h)
Tiled drawing of a pattern image over an area. The given image is drawn repeatedly to fill the given area.
Parameters:
loaded_image - pattern the pattern to be tiled with the given space.
int - x x position to place the image at.
int - y y position to place the image at.
int - w width of area to tile.
int - h height of area to tile.
Returns:
boolean undocumented return value from AWT drawImage() routine.
Overrides:
tileImage in class drawable_wrapper

fill_arrowhead

public void fill_arrowhead(int x1,
                           int y1,
                           int x2,
                           int y2,
                           int arrow_head_len,
                           int arrow_head_angle,
                           double arrow_inset)
Draw a filled arrowhead polygon at the second end of the given line (this does not draw the line).

Parameters:
int - x1 first x coordinate of the line
int - y1 first y coordinate of the line
int - x2 second x coordinate of the line (arrow head point goes here)
int - y2 second y coordinate of the line (arrow head point goes here)
int - arrow_head_len length of the sides of the arrow head
int - arrow_head_angle angle between each side and the line in degrees
double - arrow_inset percent inset for base of arrow [0..1] (values around 0.60 seem to work well).
Overrides:
fill_arrowhead in class drawable_wrapper

draw_arrowhead

public void draw_arrowhead(int x1,
                           int y1,
                           int x2,
                           int y2,
                           int arrow_head_len,
                           int arrow_head_angle,
                           double arrow_inset)
Draw a hollow arrowhead (as lines) at the second end of the given line (this does not draw the line).

Parameters:
int - x1 first x coordinate of the line.
int - y1 first y coordinate of the line.
int - x2 second x coordinate of the line (arrow head point goes here).
int - y2 second y coordinate of the line (arrow head point goes here).
int - arrow_head_len length of the sides of the arrow head.
int - arrow_head_angle angle between each side and the line in degrees.
double - arrow_inset percent inset for base of arrow [0..1] (values around 0.60 seem to work well).
Overrides:
draw_arrowhead in class drawable_wrapper

copyArea

public void copyArea(int x,
                     int y,
                     int w,
                     int h,
                     int dx,
                     int dy)
Overrides:
copyArea in class drawable_wrapper

drawLine

public void drawLine(int x1,
                     int y1,
                     int x2,
                     int y2)
Overrides:
drawLine in class drawable_wrapper

fillRect

public void fillRect(int x,
                     int y,
                     int w,
                     int h)
Overrides:
fillRect in class drawable_wrapper

drawRect

public void drawRect(int x,
                     int y,
                     int w,
                     int h)
Overrides:
drawRect in class drawable_wrapper

clearRect

public void clearRect(int x,
                      int y,
                      int w,
                      int h)
Overrides:
clearRect in class drawable_wrapper

drawRoundRect

public void drawRoundRect(int x,
                          int y,
                          int w,
                          int h,
                          int arcw,
                          int arch)
Overrides:
drawRoundRect in class drawable_wrapper

fillRoundRect

public void fillRoundRect(int x,
                          int y,
                          int w,
                          int h,
                          int arcw,
                          int arch)
Overrides:
fillRoundRect in class drawable_wrapper

draw3DRect

public void draw3DRect(int x,
                       int y,
                       int w,
                       int h,
                       boolean raised)
Overrides:
draw3DRect in class drawable_wrapper

fill3DRect

public void fill3DRect(int x,
                       int y,
                       int w,
                       int h,
                       boolean raised)
Overrides:
fill3DRect in class drawable_wrapper

drawOval

public void drawOval(int x,
                     int y,
                     int w,
                     int h)
Overrides:
drawOval in class drawable_wrapper

fillOval

public void fillOval(int x,
                     int y,
                     int w,
                     int h)
Overrides:
fillOval in class drawable_wrapper

drawArc

public void drawArc(int x,
                    int y,
                    int w,
                    int h,
                    int start_ang,
                    int arc_ang)
Overrides:
drawArc in class drawable_wrapper

fillArc

public void fillArc(int x,
                    int y,
                    int w,
                    int h,
                    int start_ang,
                    int arc_ang)
Overrides:
fillArc in class drawable_wrapper

drawPolygon

public void drawPolygon(int[] xp,
                        int[] yp,
                        int np)
Overrides:
drawPolygon in class drawable_wrapper

drawPolygon

public void drawPolygon(java.awt.Polygon p)
Overrides:
drawPolygon in class drawable_wrapper

fillPolygon

public void fillPolygon(int[] xp,
                        int[] yp,
                        int np)
Overrides:
fillPolygon in class drawable_wrapper

fillPolygon

public void fillPolygon(java.awt.Polygon p)
Overrides:
fillPolygon in class drawable_wrapper

drawString

public void drawString(java.lang.String str,
                       int x,
                       int y)
Overrides:
drawString in class drawable_wrapper

drawChars

public void drawChars(char[] data,
                      int off,
                      int len,
                      int x,
                      int y)
Overrides:
drawChars in class drawable_wrapper

drawBytes

public void drawBytes(byte[] data,
                      int off,
                      int len,
                      int x,
                      int y)
Overrides:
drawBytes in class drawable_wrapper

drawImage

public boolean drawImage(java.awt.Image img,
                         int x,
                         int y,
                         java.awt.image.ImageObserver observer)
Overrides:
drawImage in class drawable_wrapper

drawImage

public boolean drawImage(java.awt.Image img,
                         int x,
                         int y,
                         int w,
                         int h,
                         java.awt.image.ImageObserver obs)
Overrides:
drawImage in class drawable_wrapper

drawImage

public boolean drawImage(java.awt.Image img,
                         int x,
                         int y,
                         java.awt.Color bgcolor,
                         java.awt.image.ImageObserver obs)
Overrides:
drawImage in class drawable_wrapper

drawImage

public boolean drawImage(java.awt.Image img,
                         int x,
                         int y,
                         int w,
                         int h,
                         java.awt.Color bgcolor,
                         java.awt.image.ImageObserver obs)
Overrides:
drawImage in class drawable_wrapper

toString

public java.lang.String toString()
Convert to a human readable string.
Overrides:
toString in class drawable_wrapper