Jump to content

WinFillRect: Difference between revisions

From EDM2
Created page with "This function ''draws a filled rectangular area''. ==Syntax== WinFillRect(hps, prcl, lColor) ==Parameters== ;hps (HPS) - Input : Presentation-space handle. : This can be either a micro-presentation space or a normal presentation space. ;prcl (PRECTL) - Input : Rectangle to be filled, in window coordinates. : Points on the left and bottom boundaries of the rectangle are included in the fill, but points on the right and top boundaries are not, except where they..."
 
No edit summary
 
Line 11: Line 11:
: Rectangle to be filled, in window coordinates.
: Rectangle to be filled, in window coordinates.
: Points on the left and bottom boundaries of the rectangle are included in the fill, but points on the right and top boundaries are not, except where they are also on the left and bottom boundaries; that is, the top-left and bottom-right corners.
: Points on the left and bottom boundaries of the rectangle are included in the fill, but points on the right and top boundaries are not, except where they are also on the left and bottom boundaries; that is, the top-left and bottom-right corners.
:;{{hp2|Note}}
:;Note
::The value of each field in this structure must be in the range -32 768 through 32 767. The data type [[WRECT]] can also be used, if supported by the language.
::The value of each field in this structure must be in the range -32 768 through 32 767. The data type [[WRECT]] can also be used, if supported by the language.
;lColor ([[LONG]]) - Input
;lColor ([[LONG]]) - Input
: Color with which to fill the rectangle.
: Color with which to fill the rectangle.
: This is either a color index, or an RGB color value, depending upon whether and how a logical color table has been loaded. (See &osq.GpiCreateLogColorTable&osq. in the {{hp1|Graphics Programming Interface Programming Reference}}.)
: This is either a color index, or an RGB color value, depending upon whether and how a logical color table has been loaded. (See &osq.GpiCreateLogColorTable&osq. in the Graphics Programming Interface Programming Reference.)


==Returns==
==Returns==

Latest revision as of 02:06, 9 April 2025

This function draws a filled rectangular area.

Syntax

WinFillRect(hps, prcl, lColor)

Parameters

hps (HPS) - Input
Presentation-space handle.
This can be either a micro-presentation space or a normal presentation space.
prcl (PRECTL) - Input
Rectangle to be filled, in window coordinates.
Points on the left and bottom boundaries of the rectangle are included in the fill, but points on the right and top boundaries are not, except where they are also on the left and bottom boundaries; that is, the top-left and bottom-right corners.
Note
The value of each field in this structure must be in the range -32 768 through 32 767. The data type WRECT can also be used, if supported by the language.
lColor (LONG) - Input
Color with which to fill the rectangle.
This is either a color index, or an RGB color value, depending upon whether and how a logical color table has been loaded. (See &osq.GpiCreateLogColorTable&osq. in the Graphics Programming Interface Programming Reference.)

Returns

rc (BOOL) - returns
Success indicator.
TRUE
Successful completion
FALSE
Error occurred.

Remarks

This function does not change any presentation space state. This function must only be used in draw mode (DM_DRAW) to a screen device context. If an empty rectangle is specified, this function draws nothing and completes successfully (that is, TRUE is returned).

Example Code

#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, Also in COMMON section */
#include <os2.h>

HPS       hps;     /*  Presentation-space handle. */
PRECTL    prcl;    /*  Rectangle to be filled, in window coordinates. */
LONG      lColor;  /*  Color with which to fill the rectangle. */
BOOL      rc;      /*  Success indicator. */

rc = WinFillRect(hps, prcl, lColor);

This example fills an update rectangle with a white background in response to the WM_PAINT message, after obtaining a presentation space handle via WinBeginPaint.

#define INCL_WINWINDOWMGR       /* Window Manager Functions     */
#include <os2.h>

BOOL  fSuccess;         /* success indicator                    */
HAB     hab;            /* anchor-block handle                  */
PRECTL prclRect1 = {0,0,100,100}; /* fill rectangle              */
LONG  lColor=CLR_WHITE; /* fill color                           */
HWND   hwnd;            /* client window handle                 */
HPS    hps;             /* presentation-space handle            */

case WM_PAINT:
     hps = WinBeginPaint(hwnd, NULLHANDLE, &prclRect1);
     fSuccess = WinFillRect(hps, &prclRect1, lColor);
     WinEndPaint(hps);

Related Functions