sub_arctic.style
Class hv_fill_image_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_image_blank
- public class hv_fill_image_blank
- extends hv_fill_blank
This class implements an image-based interactor blank. It's appearance is
controlled by 9 images:
0 1 2
3 4 5
6 7 8
where images 0, 2, 6, and 8 (the corners) are fixed size, images 1 and 7
will be tiled horizontally to fill the required space, images 3 and 5 will
be tiled vertially to fill the required space, and image 4 will be tiled
both horizontally and vertially to fill the space (image 4 will be used to
fill the area from the bottom-right corner of image 0 to the top-left corner
of image 8).
Important note: Images need to be of consistent sizes. That is
images 0, 3 and 6, plus 2, 5 and 8 need to be the same width, while
0, 1, and 2, plus 6, 7, and 8 need to be the same height. This is not
explicitly tested, but you will probably get unexpected results if its
not true.
To constructors are provided: one based on a requested exterior size, and
one based on a requested interior size (the resulting interior drawing area).
Note that the interior drawing area does not necessarily coincide with
image 4 -- this can be determined instead by an explict set of border values.
Constructor Summary |
hv_fill_image_blank(int w_kind,
int req_w,
int h_kind,
int req_h,
loaded_image[] images,
int[] borders)
Construct a blank based on 9 images, a set of border sizes, and either
an exterior or an interior size request for both the width and height
(as indicated by w/h_kind being either EXTERIOR_SIZED, or INTERIOR_SIZED
respectively). |
hv_fill_image_blank(int size_kind,
int req_w,
int req_h,
loaded_image[] images,
int[] borders)
Construct a blank based on 9 images, a set of border sizes, and either
an exterior or an interior size request (as indicated by size_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 java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
_image
protected loaded_image[] _image
- The images used to create this blank. This array will have exactly
9 images in it and should be treated as read-only (the blank will only
compute its size only at construction).
hv_fill_image_blank
public hv_fill_image_blank(int w_kind,
int req_w,
int h_kind,
int req_h,
loaded_image[] images,
int[] borders)
- Construct a blank based on 9 images, a set of border sizes, and either
an exterior or an interior size request for both the width and height
(as indicated by w/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
3 4 5
6 7 8
where the corners will be treated as fixed size and the other images will
be tiled horizontally and/or vertically to fill the desired area.
Important note: Images need to be of consistent sizes. That is
images 0, 3 and 6, plus 2, 5 and 8 need to be the same width, while
0, 1, and 2, plus 6, 7, and 8 need to be the same height. This is not
explicitly tested, but you will probably get unexpected results if its
not true.
- 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.loaded_image[]
- images the images to build the blank from. Note:
this array must contain at least 9 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.
hv_fill_image_blank
public hv_fill_image_blank(int size_kind,
int req_w,
int req_h,
loaded_image[] images,
int[] borders)
- Construct a blank based on 9 images, a set of border sizes, and either
an exterior or an interior size request (as indicated by size_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
3 4 5
6 7 8
where the corners will be treated as fixed size and the other images will
be tiled horizontally and/or vertically to fill the desired area.
Important note: Images need to be of consistent sizes. That is
images 0, 3 and 6, plus 2, 5 and 8 need to be the same width, while
0, 1, and 2, plus 6, 7, and 8 need to be the same height. This is not
explicitly tested, but you will probably get unexpected results if its
not true.
- 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.int
- req_w requested width.int
- req_h requested height.loaded_image[]
- images the images to build the blank from. Note:
this array must contain at least 9 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.
image
public loaded_image image(int indx)
- Retrieve one of the images used to create this blank. Indexes 0 through
8 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. 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)
- 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