[<<] [<] Page 1 of 1 [>] [>>] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Workaround for CreateBitmap() in uWin?
From: Hihn Jason ####@####.#### Date: 11 Jan 2002 20:36:43 -0000 Message-Id: <E1836A7F3557D311A14000805F9F36FC0141C471@usdfo011.usac.danfoss.net> Hello all, I'm attempting to port code that uses CreateBitmap and LoadBitmap. I notice that there is no such function in uWin, but I can come close: <code> hdcMem=CreateCompatibleDC(...); hBitmap=CreateCompatibleBitmap(...); /* How do I get image data into the bitmap? */ DrawDIB(hdcMem, 0, 0, hBitmap); BitBlit(hdc, ... hdcMem,...); </code> 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? Also, how can I get LoadBMP data into a hBitmap as well? I'm trying to keep as much of the code the same so it will still compile under real Windows as well. I'll keep digging, but thanks in advance. -J | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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: ####@####.#### : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[<<] [<] Page 1 of 1 [>] [>>] |