sub_arctic.output
Class shadow_drawable

java.lang.Object
  |
  +--java.awt.Graphics
        |
        +--sub_arctic.output.drawable
              |
              +--sub_arctic.output.shadow_drawable

public class shadow_drawable
extends drawable

A drawable object that draws everything in a uniform color (typically a light gray) offset by a small amount. This is used to cast shadows by drawing objects once offset slightly in gray, then again over the top in normal colors. This drawable operates in two modes: expensive (but slow) or cheap (but fast). In cheap mode, images are drawn as unicolor rectangles. In expensive mode, we process images to properly account for transparency.


Field Summary
protected  boolean _expensive_draw
          Do we do expensive but realistic drawing of images, or do we just do their bounding rectangle? Default is to be cheap about it.
static java.awt.Color default_color
          Default color for drawing (Color.gray).
static int default_off_x
          Default for x drawing offset (10).
static int default_off_y
          Default for y drawing offset (10).
protected  java.awt.Color the_color
          Color we paint everything in
protected  java.awt.image.ImageFilter uni_filter
          Filter to turn images into our one color
 
Fields inherited from class sub_arctic.output.drawable
_ignore, g
 
Constructor Summary
shadow_drawable(drawable wrappee, int off_x, int off_y, java.awt.Color c)
          Constructor from drawable that defaults to fast drawing
shadow_drawable(drawable wrappee, int off_x, int off_y, java.awt.Color c, boolean do_expensive_draw)
          Full constructor from a drawable
shadow_drawable(java.awt.Graphics wrappee)
          Constructor with default shadow offset and color
shadow_drawable(java.awt.Graphics wrappee, int off_x, int off_y)
          Constructor with default color.
shadow_drawable(java.awt.Graphics wrappee, int off_x, int off_y, java.awt.Color c)
          Constructor that defaults to fast drawing
shadow_drawable(java.awt.Graphics wrappee, int off_x, int off_y, java.awt.Color c, boolean do_expensive_draw)
          Full constructor.
 
Method Summary
 void clearRect(int x, int y, int w, int h)
          Override to turn clear into fill with our color (since clear is an opaque operation).
 void copyArea(int x, int y, int w, int h, int dx, int dy)
          Override to turn into a fill with our color.
 java.awt.Graphics create()
          Override create() to create a new wrapper also.
 java.awt.Graphics create(int x, int y, int w, int h)
          Override create() to create a new wrapper also.
 boolean drawImage(java.awt.Image img, int x, int y, java.awt.Color bgcolor, java.awt.image.ImageObserver obs)
          Override to filter images, turning all non-transparent colors to ours.
 boolean drawImage(java.awt.Image img, int x, int y, java.awt.image.ImageObserver observer)
          Override to filter images, turning all non-transparent colors to ours.
 boolean drawImage(java.awt.Image img, int x, int y, int w, int h, java.awt.Color bgcolor, java.awt.image.ImageObserver obs)
          Override to filter images, turning all non-transparent colors to ours.
 boolean drawImage(java.awt.Image img, int x, int y, int w, int h, java.awt.image.ImageObserver obs)
          Override to filter images, turning all non-transparent colors to ours.
 boolean expensive_draw()
          Are currently doing expensive but realistic drawing of images, or do are we just drawing their bounding rectangle?
protected  java.awt.Image make_shadow(java.awt.Image from_img)
          Process an image to make a shadow version.
 void set_expensive_draw(boolean v)
          Set whether we draw images realistically, but expensively (slow), or just draw their bounding rectangles (fast).
 void setColor(java.awt.Color c)
          Override to set all colors to our color.
 boolean tileImage(loaded_image pattern, int x, int y, int w, int h)
          Override tiled image drawing, turning all non-transparent colors to ours.
 
Methods inherited from class sub_arctic.output.drawable
arrowhead_bound, arrowhead_bound, clear_rect, clip_rect, clipRect, copy_area, copy, copy, dispose, draw_3D_rect, draw_arc, draw_arrowhead, 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, draw3DRect, drawArc, drawBytes, drawChars, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawLine, drawOval, drawPolygon, drawPolygon, drawPolyline, drawRect, drawRoundRect, drawString, drawString, end_interactor_draw, fill_3D_rect, fill_arc, fill_arrowhead, fill_arrowhead, fill_oval, fill_polygon, fill_polygon, fill_rect, fill_round_rect, fill3DRect, fillArc, fillOval, fillPolygon, fillPolygon, fillRect, fillRoundRect, get_clip_bounds, get_clip, get_color, get_font_metrics, get_font_metrics, get_font, getClip, getClipBounds, getColor, getFont, getFontMetrics, getFontMetrics, graphics, mark_interactor_draw, set_clip, set_clip, set_color, set_font, set_paint_mode, set_XOR_mode, setClip, setClip, setFont, setPaintMode, setXORMode, start_interactor_draw, tile_image, toString, translate
 
Methods inherited from class java.awt.Graphics
finalize, getClipBounds, getClipRect, hitClip
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

the_color

protected java.awt.Color the_color
Color we paint everything in

uni_filter

protected java.awt.image.ImageFilter uni_filter
Filter to turn images into our one color

_expensive_draw

protected boolean _expensive_draw
Do we do expensive but realistic drawing of images, or do we just do their bounding rectangle? Default is to be cheap about it.

default_off_x

public static final int default_off_x
Default for x drawing offset (10).

default_off_y

public static final int default_off_y
Default for y drawing offset (10).

default_color

public static final java.awt.Color default_color
Default color for drawing (Color.gray).
Constructor Detail

shadow_drawable

public shadow_drawable(java.awt.Graphics wrappee,
                       int off_x,
                       int off_y,
                       java.awt.Color c,
                       boolean do_expensive_draw)
Full constructor.
Parameters:
Graphics - wrappee Graphics object we are a wrapper around.
int - off_x x offset we draw everything at.
int - off_y y offset we draw everything at.
Color - c color we draw everything in.
boolean - do_expensive_draw do we use expensive mode?

shadow_drawable

public shadow_drawable(java.awt.Graphics wrappee,
                       int off_x,
                       int off_y,
                       java.awt.Color c)
Constructor that defaults to fast drawing
Parameters:
Graphics - wrappee Graphics object we are a wrapper around.
int - off_x x offset we draw everything at.
int - off_y y offset we draw everything at.
Color - c color we draw everything in.

shadow_drawable

public shadow_drawable(drawable wrappee,
                       int off_x,
                       int off_y,
                       java.awt.Color c,
                       boolean do_expensive_draw)
Full constructor from a drawable
Parameters:
drawable - wrappee drawable object we are a wrapper around.
int - off_x x offset we draw everything at.
int - off_y y offset we draw everything at.
Color - c color we draw everything in.
boolean - do_expensive_draw do we use expensive mode?

shadow_drawable

public shadow_drawable(drawable wrappee,
                       int off_x,
                       int off_y,
                       java.awt.Color c)
Constructor from drawable that defaults to fast drawing
Parameters:
drawable - wrappee drawable object we are a wrapper around.
int - off_x x offset we draw everything at.
int - off_y offset we draw everything at.
Color - c color we draw everything in.

shadow_drawable

public shadow_drawable(java.awt.Graphics wrappee,
                       int off_x,
                       int off_y)
Constructor with default color.
Parameters:
Graphics - wrappee Graphics object we are a wrapper around.
int - off_x x offset we draw everything at.
int - off_y y offset we draw everything at.

shadow_drawable

public shadow_drawable(java.awt.Graphics wrappee)
Constructor with default shadow offset and color
Parameters:
Graphics - wrappee Graphics object we are a wrapper around.
Method Detail

expensive_draw

public boolean expensive_draw()
Are currently doing expensive but realistic drawing of images, or do are we just drawing their bounding rectangle?

set_expensive_draw

public void set_expensive_draw(boolean v)
Set whether we draw images realistically, but expensively (slow), or just draw their bounding rectangles (fast).

create

public java.awt.Graphics create()
Override create() to create a new wrapper also.
Returns:
Graphics new shadow_drawable object.
Overrides:
create in class drawable

create

public java.awt.Graphics create(int x,
                                int y,
                                int w,
                                int h)
Override create() to create a new wrapper also.
Parameters:
int - x x origin for new drawable.
int - y y origin for new drawable.
int - w width of new drawable.
int - h height of new drawable.
Returns:
Graphics the new shadow_drawable object.
Overrides:
create in class drawable

setColor

public void setColor(java.awt.Color c)
Override to set all colors to our color.
Parameters:
Color - c color we were supposed to draw in but don't.
Overrides:
setColor in class drawable

copyArea

public void copyArea(int x,
                     int y,
                     int w,
                     int h,
                     int dx,
                     int dy)
Override to turn into a fill with our color.
Parameters:
int - x source x position.
int - y source y position.
int - w width of copied area.
int - h height of copied area.
int - dx destination x position.
int - dy destination y position.
Overrides:
copyArea in class drawable

clearRect

public void clearRect(int x,
                      int y,
                      int w,
                      int h)
Override to turn clear into fill with our color (since clear is an opaque operation).
Parameters:
int - x x position of area to clear.
int - y y position of area to clear.
int - w width of area to clear.
int - h height of area to clear.
Overrides:
clearRect in class drawable

make_shadow

protected java.awt.Image make_shadow(java.awt.Image from_img)
Process an image to make a shadow version. This is the expensive version of the operation. Basically we turn all colors to our color, but leave the transparency (alpha) value alone. This requires a pixel by pixel mapping, so it can be slow.
Parameters:
Image - from_img the image that we are filtering to produce a shadow version of.

drawImage

public boolean drawImage(java.awt.Image img,
                         int x,
                         int y,
                         java.awt.image.ImageObserver observer)
Override to filter images, turning all non-transparent colors to ours. This will do either the expensive version via make_shadow() or the cheap version that fills a rectangle depending on the setting of expensive_draw.
Parameters:
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.
ImageObserver - observer observer to notify us of progress drawing the Image
Returns:
boolean undocumented AWT return value (here we always return true).
Overrides:
drawImage in class drawable

drawImage

public boolean drawImage(java.awt.Image img,
                         int x,
                         int y,
                         int w,
                         int h,
                         java.awt.image.ImageObserver obs)
Override to filter images, turning all non-transparent colors to ours. This will do either the expensive version via make_shadow() or the cheap version that fills a rectangle depending on the setting of expensive_draw.
Parameters:
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 that image will be scaled to.
int - h height that image will be scaled to.
ImageObserver - observer observer to notify us of progress drawing the Image
Returns:
boolean undocumented AWT return value (here we always return true).
Overrides:
drawImage in class drawable

drawImage

public boolean drawImage(java.awt.Image img,
                         int x,
                         int y,
                         java.awt.Color bgcolor,
                         java.awt.image.ImageObserver obs)
Override to filter images, turning all non-transparent colors to ours. This will do either the expensive version via make_shadow() or the cheap version that fills a rectangle depending on the setting of expensive_draw.
Parameters:
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.
ImageObserver - observer observer to notify us of progress drawing the Image
Returns:
boolean undocumented AWT return value (here we always return true).
Overrides:
drawImage in class drawable

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)
Override to filter images, turning all non-transparent colors to ours. This will do either the expensive version via make_shadow() or the cheap version that fills a rectangle depending on the setting of expensive_draw.
Parameters:
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 that image will be scaled to.
int - h height that image will be scaled to.
Color - bgcolor background color.
ImageObserver - observer observer to notify us of progress drawing the Image
Returns:
boolean undocumented AWT return value (here we always return true).
Overrides:
drawImage in class drawable

tileImage

public boolean tileImage(loaded_image pattern,
                         int x,
                         int y,
                         int w,
                         int h)
Override tiled image drawing, turning all non-transparent colors to ours.
Parameters:
loaded_image - pattern the pattern we tile with
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 AWT return value (here we always return true).
Overrides:
tileImage in class drawable