Difference between revisions of "GpiSetBitmapBits"

From EDM2
Jump to: navigation, search
m (Related Functions)
m
 
Line 2: Line 2:
  
 
==Syntax==
 
==Syntax==
<PRE>
+
lScansSet = GpiSetBitmapBits(hps, lScanStart, lScans, pbBuffer, pbmiInfoTable);
lScansSet = GpiSetBitmapBits(hps, lScanStart, lScans, pbBuffer, pbmiInfoTable);
+
 
</PRE>
+
 
==Parameters==
 
==Parameters==
; hps (HPS) - input : Presentation-space handle.
+
;hps (HPS) - input : Presentation-space handle.
 
+
;lScanStart (LONG) - input : Line number.
; lScanStart (LONG) - input : Line number.
+
 
: Scan-line number at which the data transfer is to start, counting from 0 as the bottom line.
 
: Scan-line number at which the data transfer is to start, counting from 0 as the bottom line.
 
 
; lScans (LONG) - input : Number of scan lines to be transmitted.
 
; lScans (LONG) - input : Number of scan lines to be transmitted.
 
: It must be greater or equal to 0.
 
: It must be greater or equal to 0.
 
 
; pbBuffer (PBYTE) - input : Bit-map data buffer.
 
; pbBuffer (PBYTE) - input : Bit-map data buffer.
 
: Address in application storage from which the bit-map data is to be copied. This field must point to a doubleword aligned address to assure correct creation of the bit map by the device in device specific format.
 
: Address in application storage from which the bit-map data is to be copied. This field must point to a doubleword aligned address to assure correct creation of the bit map by the device in device specific format.
 
 
; pbmiInfoTable (PBITMAPINFO2) - input : Bit-map information table.
 
; pbmiInfoTable (PBITMAPINFO2) - input : Bit-map information table.
  
 +
==Return Code==
 
; lScansSet (LONG) - returns : Number of scan lines actually set.
 
; lScansSet (LONG) - returns : Number of scan lines actually set.
 
* >=0 : Number of scan lines actually set
 
* >=0 : Number of scan lines actually set
 
* GPI_ALTERROR : Error.
 
* GPI_ALTERROR : Error.
 
==Return Code==
 
  
 
==Errors==  
 
==Errors==  
 
Possible returns from WinGetLastError
 
Possible returns from WinGetLastError
 
+
:PMERR_INV_HPS (0x207F) : An invalid presentation-space handle was specified.
; 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_LENGTH_OR_COUNT (0x2092) : An invalid length or count parameter was specified.
; PMERR_PS_BUSY (0x20F4) : An attempt was made to access the presentation space from more than one thread simultaneously.
+
:PMERR_INV_INFO_TABLE (0x208F) : An invalid bit-map info table was specified with a bit-map operation.
; PMERR_INV_LENGTH_OR_COUNT (0x2092) : An invalid length or count parameter was specified.
+
:PMERR_NO_BITMAP_SELECTED (0x20E4) : An attempt has been made to operate on a memory device context that has no bit map selected.
; PMERR_INV_INFO_TABLE (0x208F) : An invalid bit-map info table was specified with a bit-map operation.
+
:PMERR_INV_SCAN_START (0x20C4) : An invalid scanstart parameter was specified with a bit-map function.
; PMERR_NO_BITMAP_SELECTED (0x20E4) : An attempt has been made to operate on a memory device context that has no bit map selected.
+
:PMERR_INCORRECT_DC_TYPE (0x203C) : An attempt was made to perform a bit-map operation on a presentation space associated with a device context of a type that is unable to support bit-map operations.
; PMERR_INV_SCAN_START (0x20C4)
+
An invalid scanstart parameter was specified with a bit-map function.
+
PMERR_INCORRECT_DC_TYPE (0x203C)
+
An attempt was made to perform a bit-map operation on a presentation space associated with a device context of a type that is
+
unable to support bit-map operations.
+
  
 
==Remarks==
 
==Remarks==
 
The presentation space must be currently associated with a memory device context that has a bit map currently selected.
 
The presentation space must be currently associated with a memory device context that has a bit map currently selected.
  
'''Note:''' This function does not set bits directly to any other kind of device.
+
;Note: This function does not set bits directly to any other kind of device.
  
 
If the format of the supplied bit map does not match that of the device, it is converted, using the supplied bit-map information table. The standard bit-map formats are supported, plus any known to be supported by the device; see GpiQueryDeviceBitmapFormats.
 
If the format of the supplied bit map does not match that of the device, it is converted, using the supplied bit-map information table. The standard bit-map formats are supported, plus any known to be supported by the device; see GpiQueryDeviceBitmapFormats.
Line 103: Line 92:
 
                 pbBuffer,
 
                 pbBuffer,
 
                 pbmi);
 
                 pbmi);
 
 
</PRE>
 
</PRE>
  

Latest revision as of 22:52, 31 July 2020

This function transfers bit-map data from application storage to a bit map.

Syntax

lScansSet = GpiSetBitmapBits(hps, lScanStart, lScans, pbBuffer, pbmiInfoTable);

Parameters

hps (HPS) - input 
Presentation-space handle.
lScanStart (LONG) - input 
Line number.
Scan-line number at which the data transfer is to start, counting from 0 as the bottom line.
lScans (LONG) - input 
Number of scan lines to be transmitted.
It must be greater or equal to 0.
pbBuffer (PBYTE) - input 
Bit-map data buffer.
Address in application storage from which the bit-map data is to be copied. This field must point to a doubleword aligned address to assure correct creation of the bit map by the device in device specific format.
pbmiInfoTable (PBITMAPINFO2) - input 
Bit-map information table.

Return Code

lScansSet (LONG) - returns 
Number of scan lines actually set.
  • >=0 : Number of scan lines actually set
  • GPI_ALTERROR : Error.

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_LENGTH_OR_COUNT (0x2092) : An invalid length or count parameter was specified.
PMERR_INV_INFO_TABLE (0x208F) : An invalid bit-map info table was specified with a bit-map operation.
PMERR_NO_BITMAP_SELECTED (0x20E4) : An attempt has been made to operate on a memory device context that has no bit map selected.
PMERR_INV_SCAN_START (0x20C4) : An invalid scanstart parameter was specified with a bit-map function.
PMERR_INCORRECT_DC_TYPE (0x203C) : An attempt was made to perform a bit-map operation on a presentation space associated with a device context of a type that is unable to support bit-map operations.

Remarks

The presentation space must be currently associated with a memory device context that has a bit map currently selected.

Note
This function does not set bits directly to any other kind of device.

If the format of the supplied bit map does not match that of the device, it is converted, using the supplied bit-map information table. The standard bit-map formats are supported, plus any known to be supported by the device; see GpiQueryDeviceBitmapFormats.

Example Code

This example uses the GpiSetBitmapBits function to copy image data to a bit map in a presentation space associated with a memory device context.

#define INCL_GPIPRIMITIVES
#define INCL_GPIBITMAPS
#define INCL_DOSMEMMGR
#define INCL_WINDIALOGS
#include <OS2.H>

 HPS hps; /* Presentation space handle */
 BITMAPINFOHEADER2 bmp = { 12, 32, 16, 1, 1 };
 SEL sel;
 PBITMAPINFOHEADER2 pbmi;
 BYTE pbBuffer[16]; /* buffer for image data */
 ULONG cbBitmapInfo;
 HBITMAP hbm, hbmOld;
 BOOL f;
 /* Allocate space for the bit-map information table. */

 cbBitmapInfo = sizeof(BITMAPINFO) + sizeof(RGB2);
 f = (BOOL)DosAllocMem((PPVOID)pbmi,
                       (ULONG)cbBitmapInfo,
                        PAG_READ |
                        PAG_WRITE |
                        PAG_COMMIT));
 if (f) {
         WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
                       "Sorry, Not enough memory",
                       NULL,
                       0,
                       MB_OK);
         return;
         }

/* Initialize the bit-map information table. */

pbmi->cbFix = 12;
pbmi->cx = 32;
pbmi ->cy = 16;
pbmi->cPlanes = 1;
pbmi ->cBitCount = 1;

/* Create the bit map, set to the device, and copy the image data. */

hbm = GpiCreateBitmap(hps,
                      pbmi,
                      0L,
                      NULL,
                      NULL);
hbmOld = GpiSetBitmap(hps, hbm); /* Save the old bitmap */

GpiSetBitmapBits(hps,
                 0L,
                 (LONG)bmp.cy,
                 pbBuffer,
                 pbmi);

Related Functions