Xbasic

UI_SHAPE_RECT Function

Syntax

V UI_SHAPE_RECT(C shape,N x,N y,N width,N height[,C shape_operation])

Arguments

shape

The name of a new or existing shape.

x

The horizontal coordinate of the upper left corner of the rectangle. Larger values move right.

y

The vertical coordinate of the upper left corner of the rectangle. Larger values move down.

width

The width of the rectangle.

height

The height of the rectangle.

shape_operation

Optional. Default = erase previous shape. An indication of how to combine the shape with other shapes.

"and" = show only the intersection of the rectangle and any other shapes.
"or" = show both the union of the rectangle and any other shapes.
"xor" = show both the rectangle and any other shapes, but do not show their intersection.

Description

The UI_SHAPE_RECT() function draws a rectangle into the shape buffer. You can then use the shape buffer:

to define a new object to write to the bitmap, or
with the CLIP_SHAPE()to limit the portion of the bitmap that can be written on.
images/GR_ui_shape_rect.gif

Example

This example uses a rectangular shape to limit the drawing region.

ui_bitmap_load("stone", file.to_blob("C:\WINDOWS\Greenstone.bmp"))
ui_bitmap_create("test", 4, 2)
ui_shape_rect("rect", 0, 0, 2, 1)
ui_bitmap_draw("test", <<%code%
inner_rect(0, 0, 4, 2)
clip_shape("rect", 1, .5)
bitmap("stone", 0, 0, 4, 2)
%code%)
ui_dlg_box("", "{image=test}")

This example creates a rectangular shape and draws it onto the bitmap. The border color is set by the current pen. There is no fill.

ui_bitmap_load("stone", file.to_blob("C:\WINDOWS\Greenstone.bmp"))
ui_bitmap_create("test", 4, 2)
ui_shape_rect("rect", 0, 0, 2, 1)
ui_bitmap_draw("test", <<%code%
inner_rect(0, 0, 4, 2)
clip_shape("rect", 1, .5)
bitmap("stone", 0, 0, 4, 2)
%code%)
ui_dlg_box("", "{image=test}")

This example creates a rectangular shape and draws it onto the bitmap. The border color is set by the current pen. There is no fill.

images/GR_rect.gif
ui_bitmap_create("test", 4, 2)
ui_shape_rect("rect", 0, 0, 2, 1)
ui_bitmap_draw("test", <<%code%
inner_rect(0, 0, 4, 2)
set_pen("black")
set_brush("green")
shape("rect", 1, .5)
%code%)
ui_dlg_box("", "{image=test}")

Limitations

This function is only used in the Code sections of UI_BITMAP_DRAW(), UI_SCREEN_DRAW(), and UI_PRINTER_DRAW().

See Also