sub_arctic.style
Class hv_fill_prog_blank

java.lang.Object
  |
  +--sub_arctic.style.composition_part_base
        |
        +--sub_arctic.style.blank_base
              |
              +--sub_arctic.style.hv_fill_blank
                    |
                    +--sub_arctic.style.hv_fill_prog_blank

public class hv_fill_prog_blank
extends hv_fill_blank

This class is intended to allow you create blanks with code, rather than images (see hv_fill_image_blank.java for that). The idea here is that you are looking for a programmatic bevel which can be expressed as an array of colors. So you pass an array of colors to use for the strips of color along the top, another array for the strips of color along the bottom, etc.


Field Summary
protected  java.awt.Color _base_col
          This holds the base color for this blank (the color of the background).
protected  java.awt.Color[] _bot_col
          This holds the array of colors for the bevelling at the bottom.
protected  java.awt.Color[] _left_col
          This holds the array of colors for the bevelling on the left.
protected  java.awt.Color[] _right_col
          This holds the array of colors for the bevelling on the right.
protected  java.awt.Color[] _top_col
          This holds the array of colors for the bevelling at the top.
 
Fields inherited from class sub_arctic.style.blank_base
_draw_area_h, _draw_area_w, _draw_area_x_off, _draw_area_y_off, _h, _w
 
Fields inherited from class sub_arctic.style.composition_part_base
_feature_points, _x, _y
 
Constructor Summary
hv_fill_prog_blank(int w_kind, int req_w, int h_kind, int req_h, java.awt.Color[] left, java.awt.Color[] right, java.awt.Color[] top, java.awt.Color[] bot, java.awt.Color base)
          Construct a blank from an interior or exterior size.
 
Method Summary
 java.awt.Color base_col()
          Return the color being used for this blank's background.
 java.awt.Color[] bot_col()
          Return the array of colors being used for this blank's bottom.
 blank build(int w_kind, int req_w, int h_kind, int req_h)
          This routine clones this blank to create another one using the same color strips for bevelling.
 void draw_self(drawable on_surface, int at_x, int at_y)
          This is the real brains of this outfit.
 java.awt.Color[] left_col()
          Return the array of colors being used for this blank's left.
 java.awt.Color[] right_col()
          Return the array of colors being used for this blank's right.
 java.awt.Color[] top_col()
          Return the array of colors being used for this blank's top.
 
Methods inherited from class sub_arctic.style.blank_base
build, can_set_h, can_set_w, draw_area_h, draw_area_w, draw_area_x_off, draw_area_y_off, h, set_draw_area_h, set_draw_area_w, set_h, set_w, w
 
Methods inherited from class sub_arctic.style.composition_part_base
feature_point, num_feature_points, set_feature_points, set_x, set_y, toString, x, y
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_top_col

protected java.awt.Color[] _top_col
This holds the array of colors for the bevelling at the top.

_bot_col

protected java.awt.Color[] _bot_col
This holds the array of colors for the bevelling at the bottom.

_left_col

protected java.awt.Color[] _left_col
This holds the array of colors for the bevelling on the left.

_right_col

protected java.awt.Color[] _right_col
This holds the array of colors for the bevelling on the right.

_base_col

protected java.awt.Color _base_col
This holds the base color for this blank (the color of the background).
Constructor Detail

hv_fill_prog_blank

public hv_fill_prog_blank(int w_kind,
                          int req_w,
                          int h_kind,
                          int req_h,
                          java.awt.Color[] left,
                          java.awt.Color[] right,
                          java.awt.Color[] top,
                          java.awt.Color[] bot,
                          java.awt.Color base)
Construct a blank from an interior or exterior size. You need to supply four arrays of colors, one for each side in the order left, right, top and then bottom. If your array has 1 element, you get a 1 pixel bevel, and so on. You also need to provide a color for the "base" or the "background" (which might be 'raised' so "background" is a little deceptive). This color is laid down before we lay down the beveling strips. If any of the parameters to this function are null you don't get drawing for that part of the object, thus allowing transparency. This includes the possibility of making arrays which have elements which are null; if you do this, you get a transparent strip. This allows you create an array like this {null,null} to mean you want two pixels of transparent border.

The other parameters are just like they are in our superclass, the exterior/interior sizing and the requested size in width and height.

Warning: We don't do sanity checks to make sure you provide a reasonable number of colors in the arrays. Most likely you could never want these arrays to have more than 4 elements, and probably just 1 or 2. Further, you probably want certain kinds of symmetry (such as all the sides have the same amount of bevelling) but we can't determine what you want so you have to just be careful.

Parameters:
int - w_kind either EXTERIOR_SIZED, or INTERIOR_SIZED to indicate whether the given width request is for the exterior size of the image or the interior drawing area within the blank.
int - req_w requested width.
int - w_kind either EXTERIOR_SIZED, or INTERIOR_SIZED to indicate whether the given height request is for the exterior size of the image or the interior drawing area within the blank.
int - req_h requested height.
Color[] - left array of bevelling colors for the left
Color[] - right array of bevelling colors for the right
Color[] - top array of bevelling colors for the top
Color[] - bot array of bevelling colors for the bottom
Color - base the base color for drawing
Method Detail

top_col

public java.awt.Color[] top_col()
Return the array of colors being used for this blank's top. It might be null if there is no top border. Elements might be null if particular strips want to be transparent.

bot_col

public java.awt.Color[] bot_col()
Return the array of colors being used for this blank's bottom. It might be null if there is no bottom border. Elements might be null if particular strips want to be transparent.

left_col

public java.awt.Color[] left_col()
Return the array of colors being used for this blank's left. It might be null if there is no left border. Elements might be null if particular strips want to be transparent.

right_col

public java.awt.Color[] right_col()
Return the array of colors being used for this blank's right. It might be null if there is no right border. Elements might be null if particular strips want to be transparent.

base_col

public java.awt.Color base_col()
Return the color being used for this blank's background. It might be null if there is no background color, and thus this object is transparent.

build

public blank build(int w_kind,
                   int req_w,
                   int h_kind,
                   int req_h)
This routine clones this blank to create another one using the same color strips for bevelling. Sizes can be specified as interior size (indicating allowable internal drawing area) or exterior size (indicating the bound of the resulting blank) by coding INTERIOR_SIZED or EXTERIOR_SIZED respectively.
Parameters:
int - w_kind either EXTERIOR_SIZED or INTERIOR_SIZED to indicate whether the width request is for the whole image or the interior drawing area within the blank. EXTERIOR_SIZED requests below a minimum size may result in creation of a blank at the (larger) minimum size instead of the requested size.
int - req_w requested width.
int - h_kind either EXTERIOR_SIZED or INTERIOR_SIZED to indicate whether the height request is for the whole image or the interior drawing area within the blank. EXTERIOR_SIZED requests below a minimum size may result in creation of a blank at the (larger) minimum size instead of the requested size.
int - req_h requested height.
Returns:
blank a new blank constructed based on this one as a prototype.
Overrides:
build in class blank_base

draw_self

public void draw_self(drawable on_surface,
                      int at_x,
                      int at_y)
This is the real brains of this outfit. Basically, this routine walks through the supplied color strips (arrays of color) and draws the blank on the supplied image. The top left corner of its bounding box is at the given location.
Parameters:
drawable - on_surface the drawing surface to draw on.
int - at_x the x location to place the image at.
int - at_y the y location to place the image at.
Overrides:
draw_self in class blank_base