Jump to content

GreQueryColorData: Difference between revisions

From EDM2
Created page with "GreQueryColorData stores an array of information about the currently available logical color table and device colors at the location addressed by pArray. This function must ..."
 
Ak120 (talk | contribs)
mNo edit summary
 
Line 1: Line 1:
GreQueryColorData stores an array of information about the currently available logical color table and device colors at the location addressed by pArray.  
GreQueryColorData stores an array of information about the currently available logical color table and device colors at the location addressed by pArray.


This function must be supported by the presentation driver. GreQueryColorData is called by GpiQueryColorData in response to an application's request for the currently selected color table data for the device context. This function can be handled by bit-map simulation.  
This function must be supported by the presentation driver. GreQueryColorData is called by GpiQueryColorData in response to an application's request for the currently selected color table data for the device context. This function can be handled by bit-map simulation.


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


== Syntax ==  
== Syntax ==  
  GreQueryColorData(hdc, cArray, pArray, pInstance, lFunction);
  GreQueryColorData(hdc, cArray, pArray, pInstance, lFunction)


== Parameters ==
== Parameters ==
; hdc (HDC) - input : Device context handle.  
;hdc (HDC) - input: Device context handle.
 
;cArray (LONG) - input: Number of elements supplied in Array.
; cArray (LONG) - input : Number of elements supplied in Array.  
;pArray (PLONG) - input: Pointer to Array.
 
:On return, this array contains:
; pArray (PLONG) - input : Pointer to Array.  
:;lArray[QCD_LCT_FORMAT]: Format of loaded color table (if any):
 
::;LCOLF_DEFAULT: Default color table is in force.
On return, this array contains:  
::;LCOLF_INDRGB: Color table loaded, which provides translation from index to RGB.
:;lArray[QCD_LCT_FORMAT]: Format of loaded color table (if any):  
::;LCOLF_RGB: Color index = RGB.
::;LCOLF_DEFAULT: Default color table is in force.  
::;LCOLF_PALETTE: DC has a palette selected.
::;LCOLF_INDRGB: Color table loaded, which provides translation from index to RGB.  
:;lArray[QCD_LCT_LOINDEX]: Smallest color index loaded (always 0).
::;LCOLF_RGB: Color index = RGB.  
:;lArray[QCD_LCT_HIINDEX]: Largest color index loaded (never less than 15).
::;LCOLF_PALETTE: DC has a palette selected.  
:Information is only returned for the number of elements supplied. Any extra elements supplied must be zeroed by the handling routine.
:;lArray[QCD_LCT_LOINDEX]: Smallest color index loaded (always 0).  
;pInstance (PVOID) - input: Pointer to instance data.
:;lArray[QCD_LCT_HIINDEX]: Largest color index loaded (never less than 15).  
;lFunction (ULONG) - input: High-order WORD=flags; low-order WORD=NGreQueryColorData.
 
Information is only returned for the number of elements supplied. Any extra elements supplied must be zeroed by the handling routine.  
 
; pInstance (PVOID) - input : Pointer to instance data.  
 
; lFunction (ULONG) - input : High-order WORD=flags; low-order WORD=NGreQueryColorData.  


== Returns ==
== Returns ==
; rc (BOOL) - returns : Return Code.  
;rc (BOOL) - returns: Return Code.
 
: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_DEV_FUNC_NOT_INSTALLED
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_INV_HDC
 
*PMERR_INV_LENGTH_OR_COUNT
*PMERR_DEV_FUNC_NOT_INSTALLED  
Refer to the "Error Explanations" section in the ''Presentation Manager Programming Reference'' for further explanation.
*PMERR_INV_HDC  
*PMERR_INV_LENGTH_OR_COUNT  


Refer to the "Error Explanations" section in the Presentation Manager Programming Reference for further explanation.
== Sample ==
== Sample ==
<pre>
<pre>
Line 56: Line 47:
BOOL    rc;        /*  Return Code. */
BOOL    rc;        /*  Return Code. */


rc = GreQueryColorData(hdc, cArray, pArray,
rc = GreQueryColorData(hdc, cArray, pArray, pInstance, lFunction);
      pInstance, lFunction);
</pre>
</pre>


== Remarks ==
== Remarks ==
When the current table is the default logical color table, presentation drivers that support less than 16 colors return the device colors to which the 16 colors from 0 (CLR_BACKGROUND) through 15 (CLR_PALEGRAY) have been mapped.  
When the current table is the default logical color table, presentation drivers that support less than 16 colors return the device colors to which the 16 colors from 0 (CLR_BACKGROUND) through 15 (CLR_PALEGRAY) have been mapped.


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

Latest revision as of 23:20, 24 March 2020

GreQueryColorData stores an array of information about the currently available logical color table and device colors at the location addressed by pArray.

This function must be supported by the presentation driver. GreQueryColorData is called by GpiQueryColorData in response to an application's request for the currently selected color table data for the device context. This function can be handled by bit-map simulation.

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

Syntax

GreQueryColorData(hdc, cArray, pArray, pInstance, lFunction)

Parameters

hdc (HDC) - input
Device context handle.
cArray (LONG) - input
Number of elements supplied in Array.
pArray (PLONG) - input
Pointer to Array.
On return, this array contains:
lArray[QCD_LCT_FORMAT]
Format of loaded color table (if any):
LCOLF_DEFAULT
Default color table is in force.
LCOLF_INDRGB
Color table loaded, which provides translation from index to RGB.
LCOLF_RGB
Color index = RGB.
LCOLF_PALETTE
DC has a palette selected.
lArray[QCD_LCT_LOINDEX]
Smallest color index loaded (always 0).
lArray[QCD_LCT_HIINDEX]
Largest color index loaded (never less than 15).
Information is only returned for the number of elements supplied. Any extra elements supplied must be zeroed by the handling routine.
pInstance (PVOID) - input
Pointer to instance data.
lFunction (ULONG) - input
High-order WORD=flags; low-order WORD=NGreQueryColorData.

Returns

rc (BOOL) - returns
Return Code.
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_DEV_FUNC_NOT_INSTALLED
  • PMERR_INV_HDC
  • PMERR_INV_LENGTH_OR_COUNT

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

Sample

#define INCL_GRE_COLORTABLE
#include <os2.h>

HDC      hdc;        /*  Device context handle. */
LONG     cArray;     /*  Number of elements supplied in Array. */
PLONG    pArray;     /*  Pointer to Array. */
PVOID    pInstance;  /*  Pointer to instance data. */
ULONG    lFunction;  /*  High-order WORD=flags; low-order WORD=NGreQueryColorData. */
BOOL     rc;         /*  Return Code. */

rc = GreQueryColorData(hdc, cArray, pArray, pInstance, lFunction);

Remarks

When the current table is the default logical color table, presentation drivers that support less than 16 colors return the device colors to which the 16 colors from 0 (CLR_BACKGROUND) through 15 (CLR_PALEGRAY) have been mapped.