Re: WM5 - Bitmap Rotation

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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 :(
.



Relevant Pages

  • Re: WM5 - Bitmap Rotation
    ... and use DirectX 3D to rotate and scale it. ... you're going to rotate the bitmap by 90, 180 or 270 degrees, because ... pixels from the original bitmap point to the same pixel on the ...
    (microsoft.public.pocketpc.developer)
  • Re: STGAPIBuffer rotated to landscape? Possible? How?
    ... Take the bitmap that needs to be rotated and copy it to a DIBSection then use the pointer to the raw bytes create a WORD array and store all pixels as 16bit-565, rotating the picture -90 degrees as you go. ... What I'm trying to do is tweak STGapiBuffer to rotate the bitmap for me as STGAPI is converting it to "native" format. ... In other words what needs to be changed in CreateNativeBitmap and CreateNativeBitmapFromBGRBits in order to rotate my HBITMAP 90deg counterclockwise? ...
    (microsoft.public.pocketpc.developer)
  • Re: This is how I rotate an bitmap
    ... One of the cardinal rules is that you never rotate one way and then rotate back the other. ... Matrix transformations add compound errors to the values so that over time, ... Nothing of the original image is lost, it is getting smaller or the new bitmap is a little bigger then need be. ... When you've made your rotation there is no easy way to tell what is your original bitmap and what is white space. ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Replacing the system mouse cursor
    ... PlgBlt is a fast way to rotate a bitmap. ... mouse_eventto inject mouse movements and clicks into Windows. ...
    (microsoft.public.vc.mfc)
  • Re: Text in Gdiplus
    ... from the bitmap do some form of rotate on it and then drawString. ... to rotate the text to the correct orientation and position. ... have no idea what the transform and matrix parameters were doing but ...
    (comp.lang.smalltalk.dolphin)