Re: WM5 - Bitmap Rotation
- From: rubo_diada <ruben_yc@xxxxxxxxxxx>
- Date: Wed, 19 Dec 2007 05:17:55 -0800 (PST)
On Dec 19, 3:34 pm, "Uncle Marvo"
<pau...@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
"rubo_diada" <ruben...@xxxxxxxxxxx> wrote in message
news:6ca0c7fb-1c8d-412c-a3d2-091632a7b023@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Dec 18, 7:04 pm, "Uncle Marvo"
<pau...@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
"rubo_diada" <ruben...@xxxxxxxxxxx> wrote in message
news:f69250fe-e15c-45b6-b9c9-9b80f409a01c@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Dec 17, 8:53 pm, "@sid" <asid...@xxxxxxxxx> wrote:
On Dec 17, 2:03 pm, rubo_diada <ruben...@xxxxxxxxxxx> wrote:
Hi All,
How is it possible to rotate bitmaps in C++ forWM5? Do I have to use
standard GDI functions and rotate thebitmapmanually (by reading
bitmapbytes), or maybe it is possible to use DirectX for that
purpose. Can anyone please provide some sample or point to some
documentation or article?
Thanks,
Ruben
WM5SDK has Imaging API. Look for IImagingFactory & IBasicBitmapOps in
MSDN. The last one has a very useful method for you Rotate().
BR,
Denis
Unfortunately these APIs only allow to rotate images by 90,180,270 and
360 degrees, though I need to get rotated by any angle.
Does it have to be fast? How big is the bitmap compared to the display
size?
There are a few "game" packages which have this sort of feature but as
far
as I know they're not free. If you do it in code it will be pretty slow
whichever way you do it.
Alternatively, you could just turn the device round a bit :-)
The bitmap size is 500x1000 pixels and it should be as fast as it is
currently possible to do. I don't realize faster way then copying the
bitmap bits (I'm not using GetPixel/SetPixel). Any suggestions?
Obviously you'd set up another DC and then move the pixels from the
original memory to the new one, then BitBlt it back to the Screen DC,
possibly using a bit of asm to get it fast as it can be. 500*1000 sounds
enormous for a WM5 device, I've never seen one that size. Also it will be
badly skewed unless it's at a sensible rotation angle.
Do you have an example of BM that you're going to rotate?
it doesn't matter what BMP it is, it can simply be a 500x1000
completely red bitmap. Currently I am doing that way you told:
creating a new DC and writing rotated bitmap info into it, and then
drawing it back to the screen DC. The most interesting thing is that
after rotation the bitmap becomes somehow different (with green and
blue sprites). Seems like it is color palette problem, but it should
not be, because what I do is:
1) load the 24bit BMP
2) create a new bitmap with the same header info as the original one
with the following changes: width, height and size
3) allocate space for new bitmap and fill it with black and original
bitmap pixels
4) put last 2 steps together: call CreateDIBSection, and then select
the new bitmap into the DC
5) BitBlt the new DC to the screen DC
I really don't get the problem why it not works :(
.
- References:
- WM5 - Bitmap Rotation
- From: rubo_diada
- Re: WM5 - Bitmap Rotation
- From: @sid
- Re: WM5 - Bitmap Rotation
- From: rubo_diada
- Re: WM5 - Bitmap Rotation
- From: Uncle Marvo
- Re: WM5 - Bitmap Rotation
- From: rubo_diada
- Re: WM5 - Bitmap Rotation
- From: Uncle Marvo
- WM5 - Bitmap Rotation
- Prev by Date: CreateFile Bluetooth
- Next by Date: WM5 PPC: profiler for native applications
- Previous by thread: Re: WM5 - Bitmap Rotation
- Next by thread: Re: WIFI Help Needed
- Index(es):
Relevant Pages
|