Jump to content

GpiSetBitmapId: Difference between revisions

From EDM2
No edit summary
 
Line 2: Line 2:


==Syntax==
==Syntax==
<PRE>
GpiSetBitmapId(hps, hbm, lLcid)
rc = GpiSetBitmapId(hps, hbm, lLcid);
 
</PRE>
==Parameters==
==Parameters==
; hps (HPS) - input : Presentation-space handle.
;hps ([[HPS]]) - input: Presentation-space handle.
 
;hbm ([[HBITMAP]]) - input: Bit-map handle.
; hbm (HBITMAP) - input : Bit-map handle.
:: The bit map must not be currently selected into a device context (see [[GpiSetBitmap]]).
: The bit map must not be currently selected into a device context (see GpiSetBitmap).
;lLcid ([[LONG]]) - input: Local identifier with which the bit map is to be tagged.
 
:: Valid values are in the range 1 through 254.
; lLcid (LONG) - input : Local identifier with which the bit map is to be tagged.
:: It is an error if the local identifier is already used to refer to a font or bit map.
: Valid values are in the range 1 through 254.
: It is an error if the local identifier is already used to refer to a font or bit map.
 
==Return Code==
; rc (BOOL) - returns : Success indicator.
* TRUE : Successful completion
* FALSE : Error occurred.


==Errors==  
==Returns==
Possible returns from WinGetLastError
;rc ([[BOOL]]) - returns: Success indicator.
:: TRUE - Successful completion.
:: FALSE - Error occurred.


; PMERR_INV_HPS (0x207F) : An invalid presentation-space handle was specified.
==Errors==
; PMERR_PS_BUSY (0x20F4) : An attempt was made to access the presentation space from more than one thread simultaneously.
Possible returns from WinGetLastError:
; PMERR_INV_HBITMAP (0x207B) : An invalid bit-map handle was specified.
;PMERR_INV_HPS (0x207F): An invalid presentation-space handle was specified.
; PMERR_INV_SETID (0x20CA) : An invalid setid parameter was specified.
;PMERR_PS_BUSY (0x20F4): An attempt was made to access the presentation space from more than one thread simultaneously.
; PMERR_SETID_IN_USE (0x2102) : An attempt was made to specify a setid that was already in use as the currently selected character, marker or pattern set.
;PMERR_INV_HBITMAP (0x207B): An invalid bit-map handle was specified.
; PMERR_BITMAP_IN_USE (0x2008) : An attempt was made either to set a bit map into a device context using GpiSetBitmap while it was already selected into an existing device context, or to tag a bit map with a local pattern set identifier (setid) using GpiSetBitmapId while it was already tagged with an existing setid.
;PMERR_INV_SETID (0x20CA): An invalid setid parameter was specified.
; PMERR_HBITMAP_BUSY (0x2032) : An internal bit map busy error was detected. The bit map was locked by one thread during an attempt to access it from another thread.
;PMERR_SETID_IN_USE (0x2102): An attempt was made to specify a setid that was already in use as the currently selected character, marker or pattern set.
;PMERR_BITMAP_IN_USE (0x2008): An attempt was made either to set a bit map into a device context using [[GpiSetBitmap]] while it was already selected into an existing device context, or to tag a bit map with a local pattern set identifier (setid) using GpiSetBitmapId while it was already tagged with an existing setid.
;PMERR_HBITMAP_BUSY (0x2032): An internal bit map busy error was detected. The bit map was locked by one thread during an attempt to access it from another thread.


==Remarks==
==Remarks==
To use the bit map for area shading (or as the pattern in a GpiBitBlt or GpiWCBitBlt operation), a GpiSetPatternSet must be issued with the specified local identifier.
To use the bit map for area shading (or as the pattern in a [[GpiBitBlt]] or [[GpiWCBitBlt]] operation), a [[GpiSetPatternSet]] must be issued with the specified local identifier.
Any bit map of a format supported by the device can be specified. However, it may be simplified before use (see [[GpiSetPatternSet]]).
[[GpiDeleteSetId]] can subsequently be used to release the tag.


Any bit map of a format supported by the device can be specified. However, it may be simplified before use (see GpiSetPatternSet).
==Example Code==
<pre>
#define INCL_GPIBITMAPS /* Or use INCL_GPI, INCL_PM, */
#include <os2.h>


GpiDeleteSetId can subsequently be used to release the tag.
HPS hps;  /* Presentation-space handle. */
HBITMAP hbm; /* Bit-map handle. */
LONG lLcid; /* Local identifier with which the bit map is to be tagged. */
BOOL rc;    /* Success indicator. */


==Example Code==
rc = GpiSetBitmapId(hps, hbm, lLcid);
</pre>
This function tags a bit map with a local identifier, so that it can be used as a pattern set, containing a single member.
This function tags a bit map with a local identifier, so that it can be used as a pattern set, containing a single member.
<PRE>
<pre>
#define INCL_GPIBITMAPS
#define INCL_GPIBITMAPS
#include <OS2.H>
#include <OS2.H>
 
HPS hps; /* Presentation space handle */
HPS hps; /* Presentation space handle */
HBITMAP hbm; /* bit-map handle. */
HBITMAP hbm; /* bit-map handle. */
LONG lid = 23; /* local identifier. */
LONG lid = 23; /* local identifier. */
 
GpiSetBitmapId(hps,
GpiSetBitmapId(hps,
              hbm,
            hbm,
              lid);
            lid);
--------------------------------------------
</pre>
</PRE>


==Related Functions==
==Related Functions==
Line 58: Line 60:
* [[GpiCreateBitmap]]
* [[GpiCreateBitmap]]
* [[GpiDeleteBitmap]]
* [[GpiDeleteBitmap]]
* GpiDeleteSetId
* [[GpiDeleteSetId]]
* [[GpiDrawBits]]
* [[GpiDrawBits]]
* [[GpiLoadBitmap]]
* [[GpiLoadBitmap]]

Latest revision as of 23:12, 7 April 2025

This function tags a bit map with a local identifier, so that it can be used as a pattern set, containing a single member.

Syntax

GpiSetBitmapId(hps, hbm, lLcid)

Parameters

hps (HPS) - input
Presentation-space handle.
hbm (HBITMAP) - input
Bit-map handle.
The bit map must not be currently selected into a device context (see GpiSetBitmap).
lLcid (LONG) - input
Local identifier with which the bit map is to be tagged.
Valid values are in the range 1 through 254.
It is an error if the local identifier is already used to refer to a font or bit map.

Returns

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

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_HBITMAP (0x207B)
An invalid bit-map handle was specified.
PMERR_INV_SETID (0x20CA)
An invalid setid parameter was specified.
PMERR_SETID_IN_USE (0x2102)
An attempt was made to specify a setid that was already in use as the currently selected character, marker or pattern set.
PMERR_BITMAP_IN_USE (0x2008)
An attempt was made either to set a bit map into a device context using GpiSetBitmap while it was already selected into an existing device context, or to tag a bit map with a local pattern set identifier (setid) using GpiSetBitmapId while it was already tagged with an existing setid.
PMERR_HBITMAP_BUSY (0x2032)
An internal bit map busy error was detected. The bit map was locked by one thread during an attempt to access it from another thread.

Remarks

To use the bit map for area shading (or as the pattern in a GpiBitBlt or GpiWCBitBlt operation), a GpiSetPatternSet must be issued with the specified local identifier. Any bit map of a format supported by the device can be specified. However, it may be simplified before use (see GpiSetPatternSet). GpiDeleteSetId can subsequently be used to release the tag.

Example Code

#define INCL_GPIBITMAPS /* Or use INCL_GPI, INCL_PM, */
#include <os2.h>

HPS hps;   /* Presentation-space handle. */
HBITMAP hbm; /* Bit-map handle. */
LONG lLcid; /* Local identifier with which the bit map is to be tagged. */
BOOL rc;    /* Success indicator. */

rc = GpiSetBitmapId(hps, hbm, lLcid);

This function tags a bit map with a local identifier, so that it can be used as a pattern set, containing a single member.

#define INCL_GPIBITMAPS
#include <OS2.H>
HPS hps; /* Presentation space handle */
HBITMAP hbm; /* bit-map handle. */
LONG lid = 23; /* local identifier. */
GpiSetBitmapId(hps,
             hbm,
             lid);

Related Functions