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

Re: How to rotate a graphic/image in .net cf? by Paul

Paul
Wed Apr 23 10:28:35 CDT 2008

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" <juvi@discussions.microsoft.com> wrote in message
news:760B3E19-2B6C-437D-98D9-7CF515DA2DBD@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



Re: How to rotate a graphic/image in .net cf? by Arun

Arun
Thu Apr 24 17:33:06 CDT 2008

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=A0am, "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 ve=
ry
> well with. =A0Search 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-98D9-7CF515DA2DBD@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 cloc=
k.
> > Have no ideas where to start and if its possible or not!?
>
> > thanks for any help.
> > juvi- Hide quoted text -
>
> - Show quoted text -


Re: How to rotate a graphic/image in .net cf? by juvi

juvi
Fri Apr 25 01:43:00 CDT 2008

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

"Arun" wrote:

> 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-98D9-7CF515DA2DBD@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 -
>
>

Re: How to rotate a graphic/image in .net cf? by Paul

Paul
Fri Apr 25 11:34:07 CDT 2008

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" <juvi@discussions.microsoft.com> wrote in message
news:8EE696C9-560A-4B23-9B4D-28645D1B4198@microsoft.com...
> 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
>
> "Arun" wrote:
>
>> 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-98D9-7CF515DA2DBD@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 -
>>
>>



Re: How to rotate a graphic/image in .net cf? by juvi

juvi
Fri Apr 25 11:55:00 CDT 2008

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]" wrote:

> 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" <juvi@discussions.microsoft.com> wrote in message
> news:8EE696C9-560A-4B23-9B4D-28645D1B4198@microsoft.com...
> > 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
> >
> > "Arun" wrote:
> >
> >> 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-98D9-7CF515DA2DBD@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 -
> >>
> >>
>
>
>

Re: How to rotate a graphic/image in .net cf? by Paul

Paul
Fri Apr 25 12:30:07 CDT 2008

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" <juvi@discussions.microsoft.com> wrote in message
news:A29A4DAB-1164-4C56-82A9-EE641456465A@microsoft.com...
> 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]" wrote:
>
>> 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" <juvi@discussions.microsoft.com> wrote in message
>> news:8EE696C9-560A-4B23-9B4D-28645D1B4198@microsoft.com...
>> > 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
>> >
>> > "Arun" wrote:
>> >
>> >> 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-98D9-7CF515DA2DBD@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 -
>> >>
>> >>
>>
>>
>>