Name
Box -- draw a rectangle
Synopsis
Box(x, y, width, height[[, color], table])
Function
This function draws a rectangle at the position specified by x and y in the dimensions specified by width and height using the specified color (RGB value). The rectangle will be drawn in the form style specified using SetFormStyle() and will be filled according to the configuration selected with SetFillStyle().

If layers are enabled, this command will add a new layer of the type #BOX to the layer stack.

New in Hollywood 2.0: Color can also be an ARGB value for alpha-blended drawing.

Starting with Hollywood 4.5 this function uses a new syntax with just a single table as an optional argument. The old syntax is still supported for compatibility reasons. The optional table argument can be used to configure the style of the box. The following options are possible:

RoundLevel:
You can specify this tag to create a rectangle with rounded corners. You need to pass a round level in percentage which specifies how round the corners will be (possible values are 0 to 100). Defaults to 0 which means no round corners. (V1.9)

CornerA, CornerB, CornerC, CornerD:
These four tags allow you to fine-tune the corner rounding of the rectangle. You can specify a rounding level (0 to 100) for every corner of the rectangle thus allowing you to create a rectangle where not all corners are rounded, or where the different corners use different rounding levels. These tags will override any setting specified in the RoundLevel tag. (V5.0)

Furthermore, the optional table argument can also contain one or more of the standard tags for all drawing commands. See Standard drawing tags for more information about the standard tags that nearly all Hollywood drawing commands support.

Note that when drawing to a palette-based target and the palette mode is set to #PALETTEMODE_PEN, this function will draw using the pen set via SetDrawPen() instead of the color passed to the function.

Inputs
x
destination x offset
y
destination y offset
width
desired width
height
desired height
color
optional: RGB or ARGB color (defaults to #BLACK) color is optional because it is not required when you render to a mask or alpha channel
table
optional: table containing further arguments; can be any from the ones listed above and from the standard tags (V4.5)
Example
Box(0, 0, 640, 480, #YELLOW)
The above code draws a yellow box as a border of the 640x480 display.


Box(0, 0, 300, 200, #RED, {RoundLevel = 25})
The code above draws a red box with corners rounded by 25%.

Show TOC