sub_arctic.output
Class transparent_drawable

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

public class transparent_drawable
extends drawable

A drawable object that draws everything with increased transparency. Well, almost everything -- AWT does not support transparent text so text is always drawn at full opacity.

See Also:
RGBImageFilter

Field Summary
protected  int _alpha_value
          Max transparency that we paint everything with.
protected  int alpha_mask
          Copy of _alpha_value pre-shifted to apply directly as alpha value in RGB-alpha encoding.
protected  java.awt.image.ImageFilter trans_filter
          Filter to increase transparency of images
 
Fields inherited from class sub_arctic.output.drawable
_ignore, g
 
Constructor Summary
transparent_drawable(drawable wrappee)
          Constructor from drawable that defaults to alpha value of 50%
transparent_drawable(drawable wrappee, int alph)
          Full constructor from a drawable.
transparent_drawable(java.awt.Graphics wrappee)
          Constructor that defaults to alpha value of 50%
transparent_drawable(java.awt.Graphics wrappee, int alph)
          Full constructor.
 
Method Summary
 int alpha_factor()
          Max transparency that we paint everything with.
protected  java.awt.Color apply_alpha(java.awt.Color c)
          Apply transparency value to a 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, modifying transparency.
 boolean drawImage(java.awt.Image img, int x, int y, java.awt.image.ImageObserver observer)
          Override to filter images, modifying transparency.
 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, modifying transparency.
 boolean drawImage(java.awt.Image img, int x, int y, int w, int h, java.awt.image.ImageObserver obs)
          Override to filter images, modifying transparency.
protected  java.awt.Image make_trans(java.awt.Image from_img)
          Filter the given image to add our transparency to it.
 void set_alpha_value(int a)
          Set max transparency that we paint everything with.
 void setColor(java.awt.Color c)
          Override to set all colors to one with modified transparency.
 boolean tileImage(loaded_image pattern, int x, int y, int w, int h)
          Override tiled image drawing, modifying transparency.
 
Methods inherited from class sub_arctic.output.drawable
arrowhead_bound, arrowhead_bound, clear_rect, clearRect, clip_rect, clipRect, copy_area, copy, copy, copyArea, 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

_alpha_value

protected int _alpha_value
Max transparency that we paint everything with. 225 is opaque, 0 is fully transparent.

alpha_mask

protected int alpha_mask
Copy of _alpha_value pre-shifted to apply directly as alpha value in RGB-alpha encoding.

trans_filter

protected java.awt.image.ImageFilter trans_filter
Filter to increase transparency of images
Constructor Detail

transparent_drawable

public transparent_drawable(java.awt.Graphics wrappee,
                            int alph)
Full constructor.
Parameters:
Graphics - wrappee the Graphics object we wrap.
int - alph the minimum alpha value (0 = fully transparent, 255 = fully opaque) that this drawable draws in.

transparent_drawable

public transparent_drawable(java.awt.Graphics wrappee)
Constructor that defaults to alpha value of 50%
Parameters:
Graphics - wrappee the Graphics object we wrap.

transparent_drawable

public transparent_drawable(drawable wrappee,
                            int alph)
Full constructor from a drawable.
Parameters:
drawable - wrappee the drawable object we wrap.
int - alph the minimum alpha value (0 = fully transparent, 255 = fully opaque) that this drawable draws in.

transparent_drawable

public transparent_drawable(drawable wrappee)
Constructor from drawable that defaults to alpha value of 50%
Parameters:
drawable - wrappee the drawable object we wrap.
Method Detail

alpha_factor

public int alpha_factor()
Max transparency that we paint everything with. 225 is opaque, 0 is fully transparent.

set_alpha_value

public void set_alpha_value(int a)
Set max transparency that we paint everything with. 225 is opaque, 0 is fully transparent.

apply_alpha

protected java.awt.Color apply_alpha(java.awt.Color c)
Apply transparency value to a color. The result has the min of the alpha already in the color and ours.
Parameters:
Color - c the color to be transformed.
Returns:
Color the resulting color.

create

public java.awt.Graphics create()
Override create() to create a new wrapper also
Returns:
Graphics the new transparent_drawable copied from the old.
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 transparent_drawable object based on the old.
Overrides:
create in class drawable

setColor

public void setColor(java.awt.Color c)
Override to set all colors to one with modified transparency.
Parameters:
Color - c base color we are setting current color to.
Overrides:
setColor in class drawable

make_trans

protected java.awt.Image make_trans(java.awt.Image from_img)
Filter the given image to add our transparency to it.
Parameters:
Image - from_img the original image.

drawImage

public boolean drawImage(java.awt.Image img,
                         int x,
                         int y,
                         java.awt.image.ImageObserver observer)
Override to filter images, modifying transparency.
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 drawImage return value.
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, modifying transparency.
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 drawImage return value.
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, modifying transparency.
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 drawImage return value.
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, modifying transparency.
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 drawImage return value.
Overrides:
drawImage in class drawable

tileImage

public boolean tileImage(loaded_image pattern,
                         int x,
                         int y,
                         int w,
                         int h)
Override tiled image drawing, modifying transparency.
Parameters:
loaded_image - pattern the pattern we tile with.
int - x x position to place the tiling at.
int - y y position to place the tiling at.
int - w width of tiled area.
int - h height of tiled area.
Returns:
boolean undocumented AWT drawImage return value from the last draw.
Overrides:
tileImage in class drawable