Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to rotate a graphic/image in .net cf?

23 views
Skip to first unread message

juvi

unread,
Apr 23, 2008, 4:49:00 AM4/23/08
to
Hello,

Is it possible to rotate a graphic/image in .net cf?

I want to rotate an image around a center point like a pointer of a clock.
Have no ideas where to start and if its possible or not!?

thanks for any help.
juvi

Paul G. Tobey [eMVP]

unread,
Apr 23, 2008, 11:28:35 AM4/23/08
to
Anything is possible, but this is something that the .NET CF doesn't do very
well with. Search the archives using the link below and see what others
have come up with previously:

http://groups.google.com/group/microsoft.public.dotnet.framework.compactframework/topics

Paul T.

"juvi" <ju...@discussions.microsoft.com> wrote in message
news:760B3E19-2B6C-437D...@microsoft.com...

Arun

unread,
Apr 24, 2008, 6:33:06 PM4/24/08
to
Take a look at this blog entry

http://blogs.msdn.com/windowsmobile/archive/2008/04/15/faster-c.aspx

Blogger Roshan khan explained very nicely, how to rotate a bitmap
image faster, so you might need to repeatedly call DoFilter() to
rotate the bitmap, which you can easily do when you read this article.

Hope this helps,
Cheers,
Arun


On Apr 23, 8:28 am, "Paul G. Tobey [eMVP]" <p space tobey no spam AT


no instrument no spam DOT com> wrote:
> Anything is possible, but this is something that the .NET CF doesn't do very
> well with.  Search the archives using the link below and see what others
> have come up with previously:
>

> http://groups.google.com/group/microsoft.public.dotnet.framework.comp...
>
> Paul T.
>
> "juvi" <j...@discussions.microsoft.com> wrote in message


>
> news:760B3E19-2B6C-437D...@microsoft.com...
>
>
>
> > Hello,
>
> > Is it possible to rotate a graphic/image in .net cf?
>
> > I want to rotate an image around a center point like a pointer of a clock.
> > Have no ideas where to start and if its possible or not!?
>
> > thanks for any help.

> > juvi- Hide quoted text -
>
> - Show quoted text -

juvi

unread,
Apr 25, 2008, 2:43:00 AM4/25/08
to
this is a good class...but this algorithm does invert the image and not
rotate it?? Which algorihm would do the following:

rotate the image by 6° everytime it is called around a point.

thx

Paul G. Tobey [eMVP]

unread,
Apr 25, 2008, 12:34:07 PM4/25/08
to
The point is that, in order to do this relatively quickly, you're going to
need to have access to the raw bits. Calling GetPixel() and SetPixel() will
never work fast enough. You know the graphics answer to your question (or I
hope you do), new_pixel_x = cos( angle ) * ( old_pixel_x - center_x ) +
center_x, and something similar for the Y direction, etc. No doubt you'll
need to pre-calculate a table of cosine and sine values to make this fast,
too.

If the question is, how do I rotate a bitmap through a random angle in real
time on my little 400MHz RISC processor device, the answer is *very* likely
to be, "You don't".

Paul T.

"juvi" <ju...@discussions.microsoft.com> wrote in message

news:8EE696C9-560A-4B23...@microsoft.com...

juvi

unread,
Apr 25, 2008, 12:55:00 PM4/25/08
to
thx for your reply.

Would you recommend to use 60 images for the clock hands that are drawn
every second? And if, how could I draw these images with transparent (alpha
info) image?? How could it be done to void memory leaks and what about GC?

thx
juvi

-----

Paul G. Tobey [eMVP]

unread,
Apr 25, 2008, 1:30:07 PM4/25/08
to
I would not use bitmaps for clock hands. It will be *MUCH* faster to simply
draw those using lines. I suppose that you might preallocate an array to
indicate the end points of the lines, to make this even faster. If you, for
some fairly inexplicable reason, need to have highly detailed hands, I'd
preallocate an array of bitmaps with the hands at each angle, and bitblt the
right one to the display at the correct position at the right time.

Paul T.

"juvi" <ju...@discussions.microsoft.com> wrote in message

news:A29A4DAB-1164-4C56...@microsoft.com...

0 new messages