Jump to content

GreDeviceSetAttributes: Difference between revisions

From EDM2
Created page with "GreDeviceSetAttributes sets attributes in the attribute bundle. This function must be supported by the presentation driver. ; Simulation support: None. This function is ma..."
 
Ak120 (talk | contribs)
mNo edit summary
 
Line 1: Line 1:
GreDeviceSetAttributes sets attributes in the attribute bundle.  
GreDeviceSetAttributes sets attributes in the attribute bundle.


This function must be supported by the presentation driver.  
This function must be supported by the presentation driver.


; Simulation support: None. This function is mandatory for all drivers.  
; Simulation support: None. This function is mandatory for all drivers.


== Syntax ==  
== Syntax ==  
  GreDeviceSetAttributes(hdc, lBType, flDefsMask, flAttrsMask, pAttrs, pInstance, lFunction);
  GreDeviceSetAttributes(hdc, lBType, flDefsMask, flAttrsMask, pAttrs, pInstance, lFunction)


== Parameters ==
== Parameters ==
; hdc (HDC) - input : Device context handle.  
;hdc (HDC) - input: Device context handle.
 
;lBType (LONG) - input: Bundle type.
; lBType (LONG) - input : Bundle type.  
:Device attribute bundle. The following device bundles are defined:
 
:*PRIM_AREA Area (Pattern) attribute bundle see Area (Pattern) Attributes.
: Device attribute bundle. The following device bundles are defined:  
:*PRIM_CHAR Character attribute bundle see Character Attributes.
 
:*PRIM_IMAGE Image attribute bundle see Image Attributes.
:*PRIM_AREA Area (Pattern) attribute bundle see Area (Pattern) Attributes.  
:*PRIM_LINE Line attribute bundle (see Line Attributes.
:*PRIM_CHAR Character attribute bundle see Character Attributes.  
:*PRIM_MARKER Marker attribute bundle see Marker Attributes.
:*PRIM_IMAGE Image attribute bundle see Image Attributes.  
:All device bundles share a similar format. They consist of two bundles, a bundle of logical attributes and a bundle of device information.
:*PRIM_LINE Line attribute bundle (see Line Attributes.  
;flDefsMask (ULONG) - input: Mask indicating the attributes to be set to their standard default values.
:*PRIM_MARKER Marker attribute bundle see Marker Attributes.  
;flAttrsMask (ULONG) - input: Mask indicating the attributes to be modified.
 
;pAttrs (PBUNDLE) - input: Pointer to a bundle structure.
: All device bundles share a similar format. They consist of two bundles, a bundle of logical attributes and a bundle of device information.  
:Pointer to the DLINEBUNDLE, DCHARBUNDLE, DMARKERBUNDLE, DAREABUNDLE, or DIMAGEBUNDLE structure containing the new attributes.
 
;pInstance (PVOID) - input : Pointer to instance data.
; flDefsMask (ULONG) - input : Mask indicating the attributes to be set to their standard default values.  
;lFunction (ULONG) - input : High-order WORD=flags; low-order WORD=NGreDeviceSetAttributes.
 
; flAttrsMask (ULONG) - input : Mask indicating the attributes to be modified.  
 
; pAttrs (PBUNDLE) - input: Pointer to a bundle structure.  
 
: Pointer to the DLINEBUNDLE, DCHARBUNDLE, DMARKERBUNDLE, DAREABUNDLE, or DIMAGEBUNDLE structure containing the new attributes.  
 
; pInstance (PVOID) - input : Pointer to instance data.  
 
; lFunction (ULONG) - input : High-order WORD=flags; low-order WORD=NGreDeviceSetAttributes.  


== Returns ==
== Returns ==
; rc (BOOL) - returns : Return Codes.  
;rc (BOOL) - returns : Return Codes.
 
:On completion, the handling routine must return a BOOLEAN value to indicate success or an error.
On completion, the handling routine must return a BOOLEAN value to indicate success or an error.  
* TRUE Successful
* TRUE Successful  
* FALSE Error
* FALSE Error  
Possible Errors Detected: When an error is detected, the handling routine must call WinSetErrorInfo to post the condition. Error codes for conditions that the handling routine is expected to check include:
 
* PMERR_COORDINATE_OVERFLOW
Possible Errors Detected: When an error is detected, the handling routine must call WinSetErrorInfo to post the condition. Error codes for conditions that the handling routine is expected to check include:  
* PMERR_DEV_FUNC_NOT_INSTALLED
* PMERR_COORDINATE_OVERFLOW  
* PMERR_EXCEEDS_MAX_SEG_LENGTH
* PMERR_DEV_FUNC_NOT_INSTALLED  
* PMERR_HDC_BUSY
* PMERR_EXCEEDS_MAX_SEG_LENGTH  
* PMERR_HUGE_FONTS_NOT_SUPPORTED
* PMERR_HDC_BUSY  
* PMERR_INSUFFICIENT_MEMORY
* PMERR_HUGE_FONTS_NOT_SUPPORTED  
* PMERR_INV_BACKGROUND_COL_ATTR
* PMERR_INSUFFICIENT_MEMORY  
* PMERR_INV_BACKGROUND_MIX_ATTR
* PMERR_INV_BACKGROUND_COL_ATTR  
* PMERR_INV_CHAR_DIRECTION_ATTR
* PMERR_INV_BACKGROUND_MIX_ATTR  
* PMERR_INV_CHAR_MODE_ATTR
* PMERR_INV_CHAR_DIRECTION_ATTR  
* PMERR_INV_CODEPAGE
* PMERR_INV_CHAR_MODE_ATTR  
* PMERR_INV_COLOR_ATTR
* PMERR_INV_CODEPAGE  
* PMERR_INV_COORD_SPACE
* PMERR_INV_COLOR_ATTR  
* PMERR_INV_HDC
* PMERR_INV_COORD_SPACE  
* PMERR_INV_LENGTH_OR_COUNT
* PMERR_INV_HDC  
* PMERR_INV_LINE_TYPE_ATTR
* PMERR_INV_LENGTH_OR_COUNT  
* PMERR_INV_MIX_ATTR
* PMERR_INV_LINE_TYPE_ATTR  
* PMERR_INV_PATTERN_REF_PT_ATTR
* PMERR_INV_MIX_ATTR  
* PMERR_INV_PATTERN_SET_ATTR
* PMERR_INV_PATTERN_REF_PT_ATTR  
* PMERR_INV_PATTERN_SET_FONT
* PMERR_INV_PATTERN_SET_ATTR  
Refer to the "Error Explanations" section of the ''Presentation Manager Programming Reference'' for further explanation.
* PMERR_INV_PATTERN_SET_FONT  
 
Refer to the "Error Explanations" section of the Presentation Manager Programming Reference for further explanation.  


== Sample ==
== Sample ==
Line 85: Line 72:


== Remarks ==
== Remarks ==
This function sets attributes in the attribute bundle specified by lBType. Pointers to the current attribute bundles are maintained by presentation drivers in the instance data structure. The handling routine for GreDeviceSetAttributes modifies the specified bundle as directed by flAttrsMask and flDefsMask (see "Bundle Masks").  
This function sets attributes in the attribute bundle specified by lBType. Pointers to the current attribute bundles are maintained by presentation drivers in the instance data structure. The handling routine for GreDeviceSetAttributes modifies the specified bundle as directed by flAttrsMask and flDefsMask (see "Bundle Masks").


The handling routine must allow any attribute to be set to any value in the defined range for that attribute even when the value cannot be implemented on the device. For example, the presentation driver for a vector hardcopy device must accept BM_XOR background mix. When the hardcopy driver is called to write to the device, it should map values that cannot be implemented to the default value. If this call would set any of the attributes to a value that is not in the defined range of values for that attribute, the handling routine must restore all attributes to the value they had on entry to this routine.  
The handling routine must allow any attribute to be set to any value in the defined range for that attribute even when the value cannot be implemented on the device. For example, the presentation driver for a vector hardcopy device must accept BM_XOR background mix. When the hardcopy driver is called to write to the device, it should map values that cannot be implemented to the default value. If this call would set any of the attributes to a value that is not in the defined range of values for that attribute, the handling routine must restore all attributes to the value they had on entry to this routine.


When this function is called for the first time to set the character attributes, the handling routine should set the default font in the usSet parameter of the character attribute bundle (see Character Attributes). If the default font is an engine font, the presentation driver must save the address and flags of the font. This ensures that the default font is restored if the device context is reset (see ResetDCState).  
When this function is called for the first time to set the character attributes, the handling routine should set the default font in the usSet parameter of the character attribute bundle (see Character Attributes). If the default font is an engine font, the presentation driver must save the address and flags of the font. This ensures that the default font is restored if the device context is reset (see ResetDCState).


; Bundle Masks  
; Bundle Masks  


The parameters flDefsMask and flAttrsMask are instances of the mask for the specified attribute bundle. Valid flags are listed under the following bundle definitions:  
The parameters flDefsMask and flAttrsMask are instances of the mask for the specified attribute bundle. Valid flags are listed under the following bundle definitions:
 
*Line Attributes
*Line Attributes  
*Area (Pattern) Attributes
*Area (Pattern) Attributes  
*Character Attributes
*Character Attributes  
*Image Attributes
*Image Attributes  
*Marker Attributes
*Marker Attributes  
Flags set in flAttrsMask identify which fields in the attribute bundle are to be changed. For each flag that is set in flAttrsMask, the state of that flag in flDefsMask determines the source for the new value of the field. If the flag is set in both masks, the corresponding field should be set to its default value. If the flag is set in flAttrsMask and not set in flDefsMask, the corresponding field will be set from the relevant field in the bundle addressed by pAttrs.
 
Flags set in flAttrsMask identify which fields in the attribute bundle are to be changed. For each flag that is set in flAttrsMask, the state of that flag in flDefsMask determines the source for the new value of the field. If the flag is set in both masks, the corresponding field should be set to its default value. If the flag is set in flAttrsMask and not set in flDefsMask, the corresponding field will be set from the relevant field in the bundle addressed by pAttrs.  


In the attribute bundle addressed by pAttrs, the only fields that contain valid values are those that will be used to modify the device context's attribute bundle.  
In the attribute bundle addressed by pAttrs, the only fields that contain valid values are those that will be used to modify the device context's attribute bundle.


When setting pattern and area attributes, the pattern origin from world coordinates must be converted (in the attributes bundle) to device coordinates (in the DC instance data).  
When setting pattern and area attributes, the pattern origin from world coordinates must be converted (in the attributes bundle) to device coordinates (in the DC instance data).


[[Category:Gre]]
[[Category:Gre]]

Latest revision as of 00:05, 24 March 2020

GreDeviceSetAttributes sets attributes in the attribute bundle.

This function must be supported by the presentation driver.

Simulation support
None. This function is mandatory for all drivers.

Syntax

GreDeviceSetAttributes(hdc, lBType, flDefsMask, flAttrsMask, pAttrs, pInstance, lFunction)

Parameters

hdc (HDC) - input
Device context handle.
lBType (LONG) - input
Bundle type.
Device attribute bundle. The following device bundles are defined:
  • PRIM_AREA Area (Pattern) attribute bundle see Area (Pattern) Attributes.
  • PRIM_CHAR Character attribute bundle see Character Attributes.
  • PRIM_IMAGE Image attribute bundle see Image Attributes.
  • PRIM_LINE Line attribute bundle (see Line Attributes.
  • PRIM_MARKER Marker attribute bundle see Marker Attributes.
All device bundles share a similar format. They consist of two bundles, a bundle of logical attributes and a bundle of device information.
flDefsMask (ULONG) - input
Mask indicating the attributes to be set to their standard default values.
flAttrsMask (ULONG) - input
Mask indicating the attributes to be modified.
pAttrs (PBUNDLE) - input
Pointer to a bundle structure.
Pointer to the DLINEBUNDLE, DCHARBUNDLE, DMARKERBUNDLE, DAREABUNDLE, or DIMAGEBUNDLE structure containing the new attributes.
pInstance (PVOID) - input
Pointer to instance data.
lFunction (ULONG) - input
High-order WORD=flags; low-order WORD=NGreDeviceSetAttributes.

Returns

rc (BOOL) - returns
Return Codes.
On completion, the handling routine must return a BOOLEAN value to indicate success or an error.
  • TRUE Successful
  • FALSE Error

Possible Errors Detected: When an error is detected, the handling routine must call WinSetErrorInfo to post the condition. Error codes for conditions that the handling routine is expected to check include:

  • PMERR_COORDINATE_OVERFLOW
  • PMERR_DEV_FUNC_NOT_INSTALLED
  • PMERR_EXCEEDS_MAX_SEG_LENGTH
  • PMERR_HDC_BUSY
  • PMERR_HUGE_FONTS_NOT_SUPPORTED
  • PMERR_INSUFFICIENT_MEMORY
  • PMERR_INV_BACKGROUND_COL_ATTR
  • PMERR_INV_BACKGROUND_MIX_ATTR
  • PMERR_INV_CHAR_DIRECTION_ATTR
  • PMERR_INV_CHAR_MODE_ATTR
  • PMERR_INV_CODEPAGE
  • PMERR_INV_COLOR_ATTR
  • PMERR_INV_COORD_SPACE
  • PMERR_INV_HDC
  • PMERR_INV_LENGTH_OR_COUNT
  • PMERR_INV_LINE_TYPE_ATTR
  • PMERR_INV_MIX_ATTR
  • PMERR_INV_PATTERN_REF_PT_ATTR
  • PMERR_INV_PATTERN_SET_ATTR
  • PMERR_INV_PATTERN_SET_FONT

Refer to the "Error Explanations" section of the Presentation Manager Programming Reference for further explanation.

Sample

#define INCL_GRE_DEVMISC1
#include <os2.h>

HDC        hdc;          /*  Device context handle. */
LONG       lBType;       /*  Bundle type. */
ULONG      flDefsMask;
ULONG      flAttrsMask;  /*  Mask indicating the attributes to be modified. */
PBUNDLE    pAttrs;       /*  Pointer to a bundle structure. */
PVOID      pInstance;    /*  Pointer to instance data. */
ULONG      lFunction;
BOOL       rc;           /*  Return Codes. */

rc = GreDeviceSetAttributes(hdc, lBType, flDefsMask,
       flAttrsMask, pAttrs, pInstance, lFunction);

Remarks

This function sets attributes in the attribute bundle specified by lBType. Pointers to the current attribute bundles are maintained by presentation drivers in the instance data structure. The handling routine for GreDeviceSetAttributes modifies the specified bundle as directed by flAttrsMask and flDefsMask (see "Bundle Masks").

The handling routine must allow any attribute to be set to any value in the defined range for that attribute even when the value cannot be implemented on the device. For example, the presentation driver for a vector hardcopy device must accept BM_XOR background mix. When the hardcopy driver is called to write to the device, it should map values that cannot be implemented to the default value. If this call would set any of the attributes to a value that is not in the defined range of values for that attribute, the handling routine must restore all attributes to the value they had on entry to this routine.

When this function is called for the first time to set the character attributes, the handling routine should set the default font in the usSet parameter of the character attribute bundle (see Character Attributes). If the default font is an engine font, the presentation driver must save the address and flags of the font. This ensures that the default font is restored if the device context is reset (see ResetDCState).

Bundle Masks

The parameters flDefsMask and flAttrsMask are instances of the mask for the specified attribute bundle. Valid flags are listed under the following bundle definitions:

  • Line Attributes
  • Area (Pattern) Attributes
  • Character Attributes
  • Image Attributes
  • Marker Attributes

Flags set in flAttrsMask identify which fields in the attribute bundle are to be changed. For each flag that is set in flAttrsMask, the state of that flag in flDefsMask determines the source for the new value of the field. If the flag is set in both masks, the corresponding field should be set to its default value. If the flag is set in flAttrsMask and not set in flDefsMask, the corresponding field will be set from the relevant field in the bundle addressed by pAttrs.

In the attribute bundle addressed by pAttrs, the only fields that contain valid values are those that will be used to modify the device context's attribute bundle.

When setting pattern and area attributes, the pattern origin from world coordinates must be converted (in the attributes bundle) to device coordinates (in the DC instance data).