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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Rotation

Rotation

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
7 Posts 4 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
    satyavasu
    wrote on last edited by
    #1

    How to Rotate the Enhanced MetaFile Without using SetWorldTransform?

    C B 2 Replies Last reply
    0
    • S satyavasu

      How to Rotate the Enhanced MetaFile Without using SetWorldTransform?

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      are you really going to ask this question every day? -c


      Be very, very careful what you put into that head, because you will never, ever get it out. --Thomas Cardinal Wolsey

      Fractals

      S 1 Reply Last reply
      0
      • C Chris Losinger

        are you really going to ask this question every day? -c


        Be very, very careful what you put into that head, because you will never, ever get it out. --Thomas Cardinal Wolsey

        Fractals

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

        TRy to understand myprob I want the use in my app.Because I was posted several times Don't angry on me Sorry for the distrubence

        1 Reply Last reply
        0
        • S satyavasu

          How to Rotate the Enhanced MetaFile Without using SetWorldTransform?

          B Offline
          B Offline
          Blade DMS
          wrote on last edited by
          #4

          First off, You need to use GDI+... rect is a RectF containing the position of where to draw the metafile. RotationXY is the rotation around the center of that rectange (in hundeths of a degree I think).

          PointF destinationPoints[3];
          PointF Origin;
          
          destinationPoints[0].X = (float)rect->GetLeft();
          destinationPoints[0].Y = (float)rect->GetTop();
          
          destinationPoints[1].X = (float)rect->GetRight();
          destinationPoints[1].Y = (float)rect->GetTop();
          
          destinationPoints[2].X = (float)rect->GetLeft();
          destinationPoints[2].Y = (float)rect->GetBottom();
          
          destinationPoints[3].X = (float)rect->GetRight();
          destinationPoints[3].Y = (float)rect->GetBottom();
          
          Origin.X = (rect->GetLeft()) + ((rect->Width)/2.0f);
          Origin.Y = (rect->GetTop()) + ((rect->Height)/2.0f);
          
          RotatePoints( destinationPoints, Origin, RotationXY, 3 );
          
          graphics.DrawImage(&metafile, destinationPoints, 3); 
          

          and here is the RotatePoints function...

          RotatePoints(PointF *point, PointF origin, T_DWORD RotationXY, int count)
          {
          	double x, y, rad, crad, srad;
          	#define	PI (3.1415926535)
          			
          	//x' = (x * cos A) - (y * sin A) 
          	//y' = (x * sin A) + (y * cos A) 
          			
          	rad = RotationXY;	// in 0.01 degrees.
          	rad = (rad * 2.0 * 3.1415926535)/36000.0; // change to radians.
          
          	crad = cos( rad );
          	srad = sin( rad );
          
          	while( count > 0)
          	{
          		x = point->X - origin.X;
          		y = point->Y - origin.Y;
          
          		point->X = (float)(origin.X + ((x * crad) - (y * srad)));
          		point->Y = (float)(origin.Y + ((x  * srad) + (y * crad)));
          
          		count--;
          		point++;
          	}
          }
          

          Blade[DMS]

          S 1 Reply Last reply
          0
          • B Blade DMS

            First off, You need to use GDI+... rect is a RectF containing the position of where to draw the metafile. RotationXY is the rotation around the center of that rectange (in hundeths of a degree I think).

            PointF destinationPoints[3];
            PointF Origin;
            
            destinationPoints[0].X = (float)rect->GetLeft();
            destinationPoints[0].Y = (float)rect->GetTop();
            
            destinationPoints[1].X = (float)rect->GetRight();
            destinationPoints[1].Y = (float)rect->GetTop();
            
            destinationPoints[2].X = (float)rect->GetLeft();
            destinationPoints[2].Y = (float)rect->GetBottom();
            
            destinationPoints[3].X = (float)rect->GetRight();
            destinationPoints[3].Y = (float)rect->GetBottom();
            
            Origin.X = (rect->GetLeft()) + ((rect->Width)/2.0f);
            Origin.Y = (rect->GetTop()) + ((rect->Height)/2.0f);
            
            RotatePoints( destinationPoints, Origin, RotationXY, 3 );
            
            graphics.DrawImage(&metafile, destinationPoints, 3); 
            

            and here is the RotatePoints function...

            RotatePoints(PointF *point, PointF origin, T_DWORD RotationXY, int count)
            {
            	double x, y, rad, crad, srad;
            	#define	PI (3.1415926535)
            			
            	//x' = (x * cos A) - (y * sin A) 
            	//y' = (x * sin A) + (y * cos A) 
            			
            	rad = RotationXY;	// in 0.01 degrees.
            	rad = (rad * 2.0 * 3.1415926535)/36000.0; // change to radians.
            
            	crad = cos( rad );
            	srad = sin( rad );
            
            	while( count > 0)
            	{
            		x = point->X - origin.X;
            		y = point->Y - origin.Y;
            
            		point->X = (float)(origin.X + ((x * crad) - (y * srad)));
            		point->Y = (float)(origin.Y + ((x  * srad) + (y * crad)));
            
            		count--;
            		point++;
            	}
            }
            

            Blade[DMS]

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

            Thanks for the reply, I was unable use the GDI+.Pl give if another solution to this.

            B 1 Reply Last reply
            0
            • S satyavasu

              Thanks for the reply, I was unable use the GDI+.Pl give if another solution to this.

              B Offline
              B Offline
              Blade DMS
              wrote on last edited by
              #6

              I'm afraid that is the only solution I have found which does not involve stepping through the metafile and modifying each record manually. Blade[DMS]

              A 1 Reply Last reply
              0
              • B Blade DMS

                I'm afraid that is the only solution I have found which does not involve stepping through the metafile and modifying each record manually. Blade[DMS]

                A Offline
                A Offline
                Anonymous
                wrote on last edited by
                #7

                Thank u for reply I am trying modify of each record manually.If u r found pl help Once again thanks for the reply

                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