GpiQueryAttrs: Difference between revisions
Appearance
Created page with "This function returns current attributes for the specified primitive type. ==Syntax== GpiQueryAttrs(hps, lPrimType, flAttrMask, ppbunAttrs) ==Parameters== ;hps (HPS) - input : Presentation-space handle. ;lPrimType (LONG) - input : Primitive type. :This is the type of primitive for which attributes are to be queried, as follows: :;PRIM_LINE ::Line and arc primitives :;PRIM_CHAR ::Character primitives :;PRIM_MARKER ::Marker primitives :;PRIM_AREA ::Area pr..." |
mNo edit summary |
||
Line 1: | Line 1: | ||
This function returns current attributes for the specified primitive type. | This function returns current attributes for the specified primitive type. | ||
==Syntax== | ==Syntax== | ||
Line 5: | Line 5: | ||
==Parameters== | ==Parameters== | ||
;hps ([[HPS]]) - input : Presentation-space handle. | ;hps ([[HPS]]) - input : Presentation-space handle. | ||
;lPrimType ([[LONG]]) - input : Primitive type. | ;lPrimType ([[LONG]]) - input : Primitive type. | ||
:This is the type of primitive for which attributes are to be queried, as follows: | :This is the type of primitive for which attributes are to be queried, as follows: | ||
: | ::PRIM_LINE - Line and arc primitives | ||
::PRIM_CHAR - Character primitives | |||
: | ::PRIM_MARKER - Marker primitives | ||
::PRIM_AREA - Area primitives | |||
: | ::PRIM_IMAGE - Image primitives. | ||
: | |||
: | |||
;flAttrMask (ULONG) - input : Attributes mask. | ;flAttrMask (ULONG) - input : Attributes mask. | ||
:Each flag that is set indicates that the corresponding flag in lDefMask is to be updated, and that if the corresponding attribute is not currently set to default, its value is to be returned in the ppbunAttrs buffer. | :Each flag that is set indicates that the corresponding flag in lDefMask is to be updated, and that if the corresponding attribute is not currently set to default, its value is to be returned in the ppbunAttrs buffer. | ||
: If all flags in flAttrMask are zero, the ppbunAttrs buffer address is not used. | :If all flags in flAttrMask are zero, the ppbunAttrs buffer address is not used. | ||
;ppbunAttrs (PBUNDLE) - output : Attributes. | |||
; ppbunAttrs (PBUNDLE) - output : Attributes. | |||
:ppbunAttrs is a buffer in which is returned the value of each non-default attribute for which the flAttrMask flag is set, in the order specified in GpiSetAttrs for the particular primitive type. | :ppbunAttrs is a buffer in which is returned the value of each non-default attribute for which the flAttrMask flag is set, in the order specified in GpiSetAttrs for the particular primitive type. | ||
:Only data for attributes for which the appropriate flag in flAttrMask is set is updated, so ppbunAttrs need only be large enough for the highest offset attribute to be returned (see [[GpiSetAttrs]]). | :Only data for attributes for which the appropriate flag in flAttrMask is set is updated, so ppbunAttrs need only be large enough for the highest offset attribute to be returned (see [[GpiSetAttrs]]). | ||
:The data returned in ppbunAttrs for any attribute for which the flAttrMask flag is set, but which is currently set to default, is undefined. | |||
==Returns== | ==Returns== | ||
; lDefMask (LONG) - returns : Defaults mask. | ;lDefMask (LONG) - returns : Defaults mask. | ||
:As flDefMask in GpiSetAttrs: | :As flDefMask in GpiSetAttrs: | ||
: | ::GPI_ALTERROR - Error occurred | ||
::Positive - Defaults mask, numeric value can be greater than or equal to 0. | |||
: | |||
==Errors== | ==Errors== | ||
Possible returns from WinGetLastError | Possible returns from WinGetLastError | ||
: | :PMERR_INV_HPS (0x207F) - An invalid presentation-space handle was specified. | ||
:PMERR_PS_BUSY (0x20F4) - An attempt was made to access the presentation space from more than one thread simultaneously. | |||
: | :PMERR_INV_PRIMITIVE_TYPE (0x20B9) - An invalid primitive type parameter was specified with GpiSetAttrs or GpiQueryAttrs. | ||
:PMERR_UNSUPPORTED_ATTR (0x2109) - An unsupported attribute was specified in the attrmask with GpiSetAttrs or GpiQueryAttrs. | |||
: | :PMERR_INV_IN_RETAIN_MODE (0x208C) - An attempt was made to issue a function (for example, query) that is invalid when the actual drawing mode is not draw or draw-and-retain. | ||
:PMERR_INV_DC_TYPE (0x2060) - An invalid type parameter was specified with DevOpenDC, or a function was issued that is invalid for a OD_METAFILE_NOQUERY device context. | |||
: | |||
: | |||
==Remarks== | ==Remarks== | ||
This function is invalid when the drawing mode (see [[GpiSetDrawingMode]]) is set to retain. This function returns a mask, similar in meaning to flDefMask in GpiSetAttrs. Each flag in the returned mask is updated if the corresponding flag in flAttrMask is set. It is set if the attribute is set to the default, otherwise it is reset. Other flags are undefined. | This function is invalid when the drawing mode (see [[GpiSetDrawingMode]]) is set to retain. This function returns a mask, similar in meaning to flDefMask in GpiSetAttrs. Each flag in the returned mask is updated if the corresponding flag in flAttrMask is set. It is set if the attribute is set to the default, otherwise it is reset. Other flags are undefined. | ||
The parameters returned by this function may be used to reinstate exactly the same attributes as are queried, using [[GpiSetAttrs]]. | The parameters returned by this function may be used to reinstate exactly the same attributes as are queried, using [[GpiSetAttrs]]. | ||
==Example Code== | ==Example Code== | ||
This example uses the GpiQueryAttrs function to retrieve the current attributes for the line primitive. | |||
<pre> | <pre> | ||
#define INCL_GPIPRIMITIVES /* GPI primitive functions */ | |||
#define INCL_GPIPRIMITIVES /* GPI primitive functions | |||
#include <os2.h> | #include <os2.h> | ||
HPS hps; /* presentation space handle | HPS hps; /* presentation space handle */ | ||
LINEBUNDLE lbnd; | LINEBUNDLE lbnd; | ||
LONG flDefMask; | LONG flDefMask; | ||
Line 100: | Line 66: | ||
/* The line color has the default value. */ | /* The line color has the default value. */ | ||
} | } | ||
</pre> | </pre> | ||
==Related Functions== | ==Related Functions== | ||
* [[GpiSetAttrs]] | * [[GpiSetAttrs]] | ||
[[Category:Gpi]] | [[Category:Gpi]] |
Latest revision as of 18:02, 6 April 2025
This function returns current attributes for the specified primitive type.
Syntax
GpiQueryAttrs(hps, lPrimType, flAttrMask, ppbunAttrs)
Parameters
- hps (HPS) - input
- Presentation-space handle.
- lPrimType (LONG) - input
- Primitive type.
- This is the type of primitive for which attributes are to be queried, as follows:
- PRIM_LINE - Line and arc primitives
- PRIM_CHAR - Character primitives
- PRIM_MARKER - Marker primitives
- PRIM_AREA - Area primitives
- PRIM_IMAGE - Image primitives.
- flAttrMask (ULONG) - input
- Attributes mask.
- Each flag that is set indicates that the corresponding flag in lDefMask is to be updated, and that if the corresponding attribute is not currently set to default, its value is to be returned in the ppbunAttrs buffer.
- If all flags in flAttrMask are zero, the ppbunAttrs buffer address is not used.
- ppbunAttrs (PBUNDLE) - output
- Attributes.
- ppbunAttrs is a buffer in which is returned the value of each non-default attribute for which the flAttrMask flag is set, in the order specified in GpiSetAttrs for the particular primitive type.
- Only data for attributes for which the appropriate flag in flAttrMask is set is updated, so ppbunAttrs need only be large enough for the highest offset attribute to be returned (see GpiSetAttrs).
- The data returned in ppbunAttrs for any attribute for which the flAttrMask flag is set, but which is currently set to default, is undefined.
Returns
- lDefMask (LONG) - returns
- Defaults mask.
- As flDefMask in GpiSetAttrs:
- GPI_ALTERROR - Error occurred
- Positive - Defaults mask, numeric value can be greater than or equal to 0.
Errors
Possible returns from WinGetLastError
- PMERR_INV_HPS (0x207F) - An invalid presentation-space handle was specified.
- PMERR_PS_BUSY (0x20F4) - An attempt was made to access the presentation space from more than one thread simultaneously.
- PMERR_INV_PRIMITIVE_TYPE (0x20B9) - An invalid primitive type parameter was specified with GpiSetAttrs or GpiQueryAttrs.
- PMERR_UNSUPPORTED_ATTR (0x2109) - An unsupported attribute was specified in the attrmask with GpiSetAttrs or GpiQueryAttrs.
- PMERR_INV_IN_RETAIN_MODE (0x208C) - An attempt was made to issue a function (for example, query) that is invalid when the actual drawing mode is not draw or draw-and-retain.
- PMERR_INV_DC_TYPE (0x2060) - An invalid type parameter was specified with DevOpenDC, or a function was issued that is invalid for a OD_METAFILE_NOQUERY device context.
Remarks
This function is invalid when the drawing mode (see GpiSetDrawingMode) is set to retain. This function returns a mask, similar in meaning to flDefMask in GpiSetAttrs. Each flag in the returned mask is updated if the corresponding flag in flAttrMask is set. It is set if the attribute is set to the default, otherwise it is reset. Other flags are undefined.
The parameters returned by this function may be used to reinstate exactly the same attributes as are queried, using GpiSetAttrs.
Example Code
This example uses the GpiQueryAttrs function to retrieve the current attributes for the line primitive.
#define INCL_GPIPRIMITIVES /* GPI primitive functions */ #include <os2.h> HPS hps; /* presentation space handle */ LINEBUNDLE lbnd; LONG flDefMask; flDefMask = GpiQueryAttrs(hps, /* presentation-space handle */ PRIM_LINE, /* line primitive */ LBB_COLOR | /* line color */ LBB_MIX_MODE | /* color-mix mode */ LBB_WIDTH | /* line width */ LBB_GEOM_WIDTH | /* geometric-line width */ LBB_TYPE | /* line style */ LBB_END | /* line-end style */ LBB_JOIN, /* line-join style */ &lbnd); /* buffer for attributes */ if (flDefMask & LBB_COLOR) { /* The line color has the default value. */ }