overview.hlp (Table of Contents; Topic list)
About Drawing in Windows (1.2)
Using Section  Function Group                     Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
                          About Drawing in Windows
 
This topic describes the functions that are specifically designed to help
you draw in windows. You should also be familiar with the following topics:
 
    Frame windows
    Presentation spaces and device contexts
    Graphics programming interface
 
The functions described in this topic overlap the functionality of similar
drawing functions provided by the GPI sections of MS OS/2. The difference
between the Gpi drawing functions and these window-drawing functions is that
the functions described in this topic are designed specifically for drawing
in windows. Because these window-drawing functions are less general than the
Gpi functions, they are somewhat easier to use, but they also offer fewer
capabilities than the complete set of Gpi functions. The functions described
in this topic offer a quick and easy way to create simple graphics.
Programmers seeking more functionality should use the Gpi functions of MS
OS/2.
 
Points and Rectangles
 
All drawing in a window takes place in the context of the window's
coordinate system. Locations in the window are described by POINTL
structures that contain an x- and a y-coordinate for the location. The
lower-left corner of a window always has the coordinates (0,0).
 
The RECTL structure defines a rectangular area in a window. This structure
is made up of two points that define the lower-left and upper-right corners
of the rectangle.
 
An empty rectangle is a rectangle that has no area: the right coordinate is
less than or equal to the left coordinate or the top coordinate is less than
or equal to the bottom coordinate.
 
There are two types of rectangles in MS OS/2: inclusive-exclusive and
inclusive-inclusive. In inclusive-exclusive rectangles the lower-left
coordinate of the rectangle is included in the rectangle area while the
upper-right coordinate is excluded from the rectangle area. In an
inclusive-inclusive rectangle, both the lower-left and the upper-right
coordinates are included in the rectangle.
 
The dimensions of an inclusive-exclusive rectangle can be calculated as
follows:
 
cx = rcl.xRight - rcl.xLeft;
cy = rcl.yTop - rcl.yBottom;
 
The dimensions of an inclusive-inclusive rectangle can be calculated as
follows:
 
cx = (rcl.xRight - rcl.xLeft) + 1;
cy = (rcl.yTop - rcl.yBottom) + 1;
 
In general, graphics operations involving device coordinates (such as
regions, bitmaps and bit blits, and window management) use
inclusive-exclusive rectangles. All other graphics operations, such as Gpi
functions that define paths, use inclusive-inclusive rectangles.
 
 
                                      ♦