Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Rotation of a image

Rotation of a image

Scheduled Pinned Locked Moved C#
csharphelp
8 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    s4_sabahatf
    wrote on last edited by
    #1

    hi i want to ask that if there exit any function through which we can rotate image in c#. i used the functions rotateTransform( , ,) and RotateAt(, ,) but the problem with these functions is that it create multiple data of the that image i want to rotate the text from the image thanx in advance

    C 1 Reply Last reply
    0
    • S s4_sabahatf

      hi i want to ask that if there exit any function through which we can rotate image in c#. i used the functions rotateTransform( , ,) and RotateAt(, ,) but the problem with these functions is that it create multiple data of the that image i want to rotate the text from the image thanx in advance

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      s4_sabahatf wrote:

      ut the problem with these functions is that it create multiple data of the that image

      It creates a copy, yes.  You can also set a rotate transform on your Graphics object, and so render the bitmap rotated, without ever rotating it.

      s4_sabahatf wrote:

      i want to rotate the text from the image

      You want to render text that is rotated on an image ? Well, you just need to set the rotation and translation on the graphics object, and you can draw your text that way.

      Christian Graus - C++ MVP

      S 1 Reply Last reply
      0
      • C Christian Graus

        s4_sabahatf wrote:

        ut the problem with these functions is that it create multiple data of the that image

        It creates a copy, yes.  You can also set a rotate transform on your Graphics object, and so render the bitmap rotated, without ever rotating it.

        s4_sabahatf wrote:

        i want to rotate the text from the image

        You want to render text that is rotated on an image ? Well, you just need to set the rotation and translation on the graphics object, and you can draw your text that way.

        Christian Graus - C++ MVP

        S Offline
        S Offline
        s4_sabahatf
        wrote on last edited by
        #3

        ya i m using the graphics object by overridng the paint method but still it creates mulipte copies then what shud i do??

        C 1 Reply Last reply
        0
        • S s4_sabahatf

          ya i m using the graphics object by overridng the paint method but still it creates mulipte copies then what shud i do??

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          I'm not sure what you mean by 'multiple copies' ? Do you have a memory leak ? You can't rotate an image in place, you can't rotate it without making a copy.  Doing it in your paint method makes a copy direct to the DC, and so costs nothing.

          Christian Graus - C++ MVP

          S 1 Reply Last reply
          0
          • C Christian Graus

            I'm not sure what you mean by 'multiple copies' ? Do you have a memory leak ? You can't rotate an image in place, you can't rotate it without making a copy.  Doing it in your paint method makes a copy direct to the DC, and so costs nothing.

            Christian Graus - C++ MVP

            S Offline
            S Offline
            s4_sabahatf
            wrote on last edited by
            #5

            no no !!i dnt mean that for memory let me expalin u suppose i hav a image having text "SIg" when i apply roation to that image it writes multiple times "Sig" "sig" on same image.it make partitions of that image .which creates problem

            C 1 Reply Last reply
            0
            • S s4_sabahatf

              no no !!i dnt mean that for memory let me expalin u suppose i hav a image having text "SIg" when i apply roation to that image it writes multiple times "Sig" "sig" on same image.it make partitions of that image .which creates problem

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              OK, that's because your code is wrong, obviously.  Post your code.

              Christian Graus - C++ MVP

              S 1 Reply Last reply
              0
              • C Christian Graus

                OK, that's because your code is wrong, obviously.  Post your code.

                Christian Graus - C++ MVP

                S Offline
                S Offline
                s4_sabahatf
                wrote on last edited by
                #7

                now i solved my poblem by using DrawImage method,but now i m suffering from another problem that how will i change g.DrawImage(, ,) into bitmap?

                C 1 Reply Last reply
                0
                • S s4_sabahatf

                  now i solved my poblem by using DrawImage method,but now i m suffering from another problem that how will i change g.DrawImage(, ,) into bitmap?

                  C Offline
                  C Offline
                  Christian Graus
                  wrote on last edited by
                  #8

                  Build the graphics object from a bitmap ( Graphics.FromImage ), then call that method to draw onto it.

                  Christian Graus - C++ MVP

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups