nanogui: Workaround for CreateBitmap() in uWin?


Previous by date: 12 Jan 2002 03:02:17 -0000 Re: null keyboard prototype error, Greg Haerr
Next by date: 12 Jan 2002 03:02:17 -0000 Re: CreateWindow fails..., Greg Haerr
Previous in thread: 12 Jan 2002 03:02:17 -0000 Workaround for CreateBitmap() in uWin?, Hihn Jason
Next in thread:

Subject: Re: [nanogui] Workaround for CreateBitmap() in uWin?
From: "Greg Haerr" ####@####.####
Date: 12 Jan 2002 03:02:17 -0000
Message-Id: <026d01c19b12$ec62d060$3aba46a6@xmission.com>

: Part of the problem is our current code is:
: 
: hBitmap = CreateBitmap( ..., bmComputedAtRunTime);
: 
: How can I take the bitmap image data and link it to a
: CreateCompatibleBitmapped () hBitmap return value?

I think what you're asking is how can I draw to a bitmap
that's selected into a device context using bits that
we've created at runtime, not using SetPixel or BitBlt
to draw them.  We need to implement a function like
SetDIBits or SetDIBitsToDevice.  It takes a bit of
explaining, but basically, this will end up using the 
engine function GdArea() to draw bits from user space
into a PSD, which will either be the screen or a bitmap.

Take a look at BitBlt, and then see if you can write the
SetDIBits function using the same idea but using GdArea
instead, and then wrap the whole thing with your above
CreateBitmap function, which uses something like the
following:
<code>
hdcMem=CreateCompatibleDC(...);
hBitmap=CreateCompatibleBitmap(...);
 
/* How do I get image data into the bitmap? */
GdArea(...)

DrawDIB(hdcMem, 0, 0, hBitmap);
BitBlit(hdc, ... hdcMem,...);
</code>


: 
: Also, how can I get LoadBMP data into a hBitmap as well?

Well, this is similar to the above, but you'll need a BMP decoder,
(get this from src/mwin/bmp/convbmp.c) and then you'll
need to draw the bits into a created HBMP.


: 
: I'm trying to keep as much of the code the same so it will still compile
: under real Windows as well.

Yes, good idea, I just never created these wrapper functions, nor
the core SetDIBits function...

Regards,

Greg



: 
: I'll keep digging, but thanks in advance. 
: 
: -J
: 
: ---------------------------------------------------------------------
: To unsubscribe, e-mail: ####@####.####
: For additional commands, e-mail: ####@####.####
: 


Previous by date: 12 Jan 2002 03:02:17 -0000 Re: null keyboard prototype error, Greg Haerr
Next by date: 12 Jan 2002 03:02:17 -0000 Re: CreateWindow fails..., Greg Haerr
Previous in thread: 12 Jan 2002 03:02:17 -0000 Workaround for CreateBitmap() in uWin?, Hihn Jason
Next in thread:


Powered by ezmlm-browse 0.20.