sub_arctic.style
Class v_fill_image_blank

java.lang.Object
  |
  +--sub_arctic.style.composition_part_base
        |
        +--sub_arctic.style.blank_base
              |
              +--sub_arctic.style.v_fill_blank
                    |
                    +--sub_arctic.style.v_fill_image_blank

public class v_fill_image_blank
extends v_fill_blank

This class implements an image-based interactor blank that expands only vertically. It's appearance is controlled by 3 images:

    0
    1
    2
 
where images 0, and 2 are fixed size end caps and image 1 will be tiled vertically to fill the required space.

Important note: Images need to be of consistent sizes (i.e., the same width). This is not explicitly tested, but you will probably get unexpected results if its not true.

Two constructors are provided: one based on a requested exterior size, and one based on a requested interior size.


Field Summary
protected  loaded_image[] _image
          The images used to create this blank.
 
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
v_fill_image_blank(int h_kind, int req_h, loaded_image[] images, int[] borders)
          Construct a blank based on 3 images, a set of border sizes, and either an exterior or an interior size request for both the height (as indicated by h_kind being either EXTERIOR_SIZED, or INTERIOR_SIZED respectively).
 
Method Summary
 blank build(int w_kind, int req_w, int h_kind, int req_h)
          Create a new blank of a given size using this one as a prototype.
 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.
 loaded_image image(int indx)
          Retrieve one of the images used to create this blank.
 
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

_image

protected loaded_image[] _image
The images used to create this blank. This array will have exactly 3 images in it and should be treated as read-only (the blank will only compute its size only at construction).
Constructor Detail

v_fill_image_blank

public v_fill_image_blank(int h_kind,
                          int req_h,
                          loaded_image[] images,
                          int[] borders)
Construct a blank based on 3 images, a set of border sizes, and either an exterior or an interior size request for both the height (as indicated by h_kind being either EXTERIOR_SIZED, or INTERIOR_SIZED respectively). Note: requests for exterior sizes smaller than the border sizes (i.e. leaving no drawing area) will fail and a minimum size image will be produced instead.

Images will be laid out as:

   0  
   1
   2
 
where images 0 and 2 will be treated as fixed size end caps and image 1 will be tiled vertically to fill the desired area.

Parameters:
int - h_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.
loaded_image[] - images the images to build the blank from. Note: this array must contain 3 images or an error will be thrown.
int[] - borders the offsets from the left, top, right, and bottom exterior edges of the image (in that order) to the corresponding edges of the interior drawing area. Note: this array must contain at least 4 values or an error will be thrown.
Method Detail

image

public loaded_image image(int indx)
Retrieve one of the images used to create this blank. Indexes 0 through 2 are the only valid ones and the images must be treated as read-only (the blank will only compute its size only at construction).
Parameters:
int - indx index of requested image.
Returns:
loaded_image the image.

build

public blank build(int w_kind,
                   int req_w,
                   int h_kind,
                   int req_h)
Create a new blank of a given size using this one as a prototype. Size 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)
Draw the image of the blank on the given drawing surface with the top left corner of its bounding box 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