- Main Page
- Classes
- Files
- Directories
- Related Pages

- Class List
- Class Hierarchy
- Class Members

# KrBox Class Reference

A Box is sse to create filled or unfilled rectangles, horizontal lines, verticle lines, and crosshairs. More...

`#include <box.h>`

Inheritance diagram for KrBox:

List of all members.

## Public Member Functions
| KrBox (KrBoxResource *resource)
| Construct from a resource.
virtual KrBox * | ToBox ()
| Return a pointer if this is a box.
int | Width ()
| Width.
int | Height ()
| Height.
void | SetSize (int w, int h)
| Set the width and height of this box.
void | SetBoxColor (KrRGBA color)
| Set the color of this box.
void | SetType (int boxtype)
| Set box type (OUTLINE, FILL, or CROSSHAIR).
virtual KrImNode * | Clone ()
| Return a copy if this object, not in a Tree().
virtual bool | HitTest (int x, int y, int flags, std::vector< KrImage * > *results, int win)
| Hit test this object. Returns true if there was a hit, and 'this' will be added to results.
virtual void | QueryBoundingBox (grinliz::Rectangle2I *boundingBox, int window=0)
| Get the bounding box of the image, in its current state.

## Detailed Description

A Box is sse to create filled or unfilled rectangles, horizontal lines, verticle lines, and crosshairs.

(A line is a box with a 1 pixel width or height.)

It can be constructed from a BoxResource, or even without one, depending on which constructor is used. The BoxResource can have multiple colors, but the box is ofter easier to manage without a resource.

The size, color, and type can be changed after construction. (If a multi-color box resource is in use, all but the first color is lost if the size, color, or type is set after construction.)

## Member Function Documentation

virtual KrImNode* KrBox::Clone | ( |  | ) | `[virtual]`

Return a copy if this object, not in a Tree().

It is return untransformed. In the case of a sprite, the action and frame will be set to the current value.

Reimplemented from KrImNode.

virtual void KrBox::QueryBoundingBox | ( | grinliz::Rectangle2I * | boundingBox,
|  | int | window = `0` |
| ) |  |  | `[virtual]`

Get the bounding box of the image, in its current state.

If this is a sprite, it will be the bounding box of the current frame and action. The bounds are relative to the hotspot, so xmin and ymin will often be not zero.

The current transformation matrix will be applied, so the result may be transformed bounds.

Implements KrImage.

The documentation for this class was generated from the following file:

- box.h