JdBP> So I'm looking for an efficient way of drawing characters to a
JdBP> presentation space during a WM_PAINT event myself.
If you have a lot of painting you should do it in a separate thread.
That thread should be an PM thread. There you can create a memory presentation
space and paint what ever you have to paint - hidden and asyncronous.
If your real presentation space is object to repaint you can simply do a
GpiBitBlt() and copy the whole region or simple one or more rectangle(s) from
your memory hps into that of your window.
A simple trick to tune up high frequently changes on your screen is to paint
into more memory presentation spaces parallel and copy the one you need to
show into the screen PS.
In case you would use that in WM_PAINT you have to change the lines
hdcScreen = ...
hpsScreen = ...
to
hpsScreen = WinBeginPaint(.....
A sample from GPI Guide and Reference:
----------------------------Abbeiáen-----------------------
This example uses GpiBitBlt to copy a bit map from one presentation space to
another. Two presentation spaces are
created: one associated with a memory context, and the other associated with
a screen context. The function copies the
memory context bit map that is 100 pels wide and 100 pels high into a
50-by-50-pel rectangle at the location (300,400) on
the screen, thereby causing the bit map to be visible in the window. Since
the raster operation is ROP_SRCCOPY, GpiBitBlt
replaces the image previously in the target rectangle. The function
compresses the bit map to fit the new rectangle by
discarding extra rows and columns as specified by the BBO_IGNORE option.
#define INCL_GPIBITMAPS /* Bit map functions */
#define INCL_DEV /* Device Function definitions */
#define INCL_GPICONTROL /* GPI control Functions */
#define INCL_WINWINDOWMGR /* Window Manager Functions */
#include
HAB hab; /* anchor-block handle */
HPS hpsMemory; /* presentation-space handle */
HPS hpsScreen; /* presentation-space handle */
HDC hdcScreen; /* Device-context handle */
HDC hdcMemory; /* Device-context handle */
SIZEL sizl={0, 0}; /* use same page size as device */
/* context data structure */
DEVOPENSTRUC dop = {0L, "DISPLAY", NULL, 0L, 0L, 0L, 0L, 0L, 0L};
POINTL aptl[4] = {
300, 400, /* lower-left corner of target */
350, 450, /* upper-right corner of target */
0, 0, /* lower-left corner of source */
100, 100 }; /* upper-right corner of source */
HWND hwnd;
/* create memory device context and presentation space, associating
DC with the PS */
hdcMemory = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop,
NULLHANDLE);
hpsMemory = GpiCreatePS(hab, hdcMemory, &sizl, GPIA_ASSOC
| PU_PELS);
/* create window device context and presentation space, associating
DC with the PS */
hdcScreen = WinOpenWindowDC(hwnd); /* Open window device context */
hpsScreen = GpiCreatePS(hab, hdcScreen, &sizl, PU_PELS | GPIF_LONG
| GPIA_ASSOC);
/*
.
. get bit map, associate bit map with memory device context,
. draw into bit map
.
*/
/* display the bit map on the screen by copying it from the memory
device context into the screen device context */
GpiBitBlt(hpsScreen, hpsMemory, 4L, aptl, ROP_SRCCOPY, BBO_IGNORE);
----------------------------Abbeiáen-----------------------
--- Sqed/32 1.14/development
* Origin: Schont die Umwelt: Vermeidet DOSen (2:2476/493)
|