overview.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
About Regions (1.2)
Using Section  Function Group                     Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
                               About Regions
 
This topic describes a graphics object called a region. You should also be
familiar with the following topics:
 
    Presentation spaces and device contexts
    Coordinate spaces and transformations
    Color and mix modes
    Area primitives
 
A region is a rectangle, multiple disjoint rectangles, or a polygon formed
by multiple intersecting rectangles, in your application's device space. If
a region consists of intersecting rectangles, the intersecting sides are
always perpendicular. Since regions are always created and drawn in your
application's device space, region coordinates (the coordinates that define
the location and dimensions of a region) are always device coordinates.
 
Most of the region creation, detection, offsetting, and filling functions
use a special RECTL structure to define the device-space coordinates of
rectangles that correspond to regions.
 
When you create a rectangle in a device space and pass its coordinates to a
region function, MS OS/2 excludes the top and rightmost edges. This means
that you will need to add 1 to the values in the xRight and yTop fields in
order to obtain the desired dimensions. For example, if your application
requires a region that measures 100-by-100 device units with a lower-left
corner at (10,10), you would need to set xRight and yTop to 111 instead of
110.
 
You can use regions to clip output in your application's device space, to
draw a single filled rectangle, or to draw a special filled polygon
consisting of two intersecting rectangles. You can also use regions to
repaint the background in the client area of your application's window or to
repaint part of an object in a picture.
 
Clip Regions
 
A clip region is a special region that MS OS/2 uses to clip output in your
application's device space.
 
Combining Regions
 
You can use the GpiCombineRegion function to combine two rectangles in one
of five ways to form a region.
 
Painting Regions
 
You can use regions to draw a single filled rectangle or a filled polygon
(that consists of multiple intersecting rectangles) by calling the
GpiPaintRegion function after you create a region. This function uses the
current fill pattern to fill the interior of the region. The default fill
pattern is solid black. If this pattern is not appropriate for your
application, you can select one of fifteen other predefined patterns, or you
can create a custom pattern by using a bitmap.
 
MS OS/2 stores the fill pattern and the fill-pattern colors in the
AREABUNDLE structure. You can determine which predefined pattern is
currently selected by calling the GpiQueryPattern or GpiQueryAttrs function.
You can select a different predefined pattern by calling the GpiSetPattern
or GpiSetAttrs function. For more information about selecting a new pattern
or creating a custom pattern, see the topic Area primitives.
 
 
                                      ♦