sub_arctic.style
Interface blank

All Known Implementing Classes:
blank_base

public abstract interface blank
extends composition_part

This interface describes objects which serve as interactor image blanks. A blank is a background image designed to have parts filled in within or over it to complete the appearance of an interactor. Each blank provides either * an image, or code to produce one, along with a bounding box for its interior drawing area (also known as its interior size). For example, a button blank provides the appearance of a button without a textual label and provides an interior drawing area which is the bounding box that the label is to fit within.

Each blank also serves as a prototype for instantiating new blanks of the same time, but with a potentially different size. Sizes for new blanks can be given as exterior or interior size. Interior size indicates the resultant available drawing area for the blank. All not-negative values for interior size are acceptable. However, there may be a minimum exterior size for some blanks. If an exterior size smaller than the minimum is requested, a minimum sized blank will be returned instead.


Field Summary
static int EXTERIOR_SIZED
          Constant to indicate we want to build based on exterior size.
static int INTERIOR_SIZED
          Constant to indicate we want to build based on interior size.
 
Method Summary
 blank build(int size_kind, int req_w, int req_h)
          Build a new blank like this one, but with a different size.
 blank build(int w_size_kind, int req_w, int h_size_kind, int req_h)
          Build a new blank like this one, but with a different size.
 int draw_area_h()
          Height of interior drawing area.
 int draw_area_w()
          Width of interior drawing area.
 int draw_area_x_off()
          Offset from left edge of bounding box to the left edge of the interior drawing area.
 int draw_area_y_off()
          Offset from top edge of bounding box to the top edge of the interior drawing area.
 void draw_self(drawable on_surface, int at_x, int at_y)
          Draw the image of the blank on the given drawing surface with the top left corner of its bounding box at the given location.
 void set_draw_area_h(int val)
          Set the height of interior drawing area.
 void set_draw_area_w(int val)
          Set the width of interior drawing area.
 
Methods inherited from interface sub_arctic.style.composition_part
can_set_h, can_set_w, feature_point, h, num_feature_points, set_h, set_w, set_x, set_y, w, x, y
 

Field Detail

EXTERIOR_SIZED

public static final int EXTERIOR_SIZED
Constant to indicate we want to build based on exterior size.

INTERIOR_SIZED

public static final int INTERIOR_SIZED
Constant to indicate we want to build based on interior size.
Method Detail

draw_area_x_off

public int draw_area_x_off()
Offset from left edge of bounding box to the left edge of the interior drawing area.
Returns:
int the x position of the interior drawing area.

draw_area_y_off

public int draw_area_y_off()
Offset from top edge of bounding box to the top edge of the interior drawing area.
Returns:
int the y position of the interior drawing area.

draw_area_w

public int draw_area_w()
Width of interior drawing area.
Returns:
int the width of the interior drawing area.

set_draw_area_w

public void set_draw_area_w(int val)
Set the width of interior drawing area. Note: this should only be called if can_set_w() returns true. In other cases it may throw an exception.
Parameters:
int - val the new width of the interior drawing area.

draw_area_h

public int draw_area_h()
Height of interior drawing area.
Returns:
int the height of the interior drawing area.

set_draw_area_h

public void set_draw_area_h(int val)
Set the height of interior drawing area. Note: this should only be called if can_set_h() returns true. In other cases it may throw an exception.
Parameters:
int - val the new height of the interior drawing area.

draw_self

public void draw_self(drawable on_surface,
                      int at_x,
                      int at_y)
Draw the image of the blank on the given drawing surface with the top left corner of its bounding box at the given location.
Specified by:
draw_self in interface composition_part
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.

build

public blank build(int size_kind,
                   int req_w,
                   int req_h)
Build a new blank like this one, but with a different size. 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, for the first parameter.
Parameters:
int - size_kind either EXTERIOR_SIZED or INTERIOR_SIZED to indicate whether the given size 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 - req_h requested height.
Returns:
blank a new blank constructed based on this one as a prototype.

build

public blank build(int w_size_kind,
                   int req_w,
                   int h_size_kind,
                   int req_h)
Build a new blank like this one, but with a different size. In this case sizes in the two dimensions can be specified independently as either 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_size_kind either EXTERIOR_SIZED or INTERIOR_SIZED to indicate whether the given size request is for the external width of the whole blank or the interior drawing width 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_size_kind either EXTERIOR_SIZED or INTERIOR_SIZED to indicate whether the given size request is for the external width of the whole blank or the interior drawing width 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.