×

GDI+点的旋转

Kalet Kalet 发表于2009-03-20 12:00:14 浏览330 评论0

抢沙发发表评论


   这可是用GDI+碰撞检测的基础哦。转来转去,不要转得不知道什么位置了。GDI+是可以找到转了以后的点的位置的~~很好,很强大!


    是用Graphic的TransformPoints,转下MSDN的代码吧。

GDI+点的旋转

  Graphics graphics(hdc);
   Pen pen(Color(255, 0, 0, 255));

   // Create an array of two Point objects.
   Point points[2] = {Point(0, 0), Point(100, 50)};

   // Draw a line that connects the two points.
   // No transformation has been performed yet.
   graphics.DrawLine(&pen, points[0], points[1]);

   // Set the world transformation of the Graphics object.
   graphics.TranslateTransform(40.0f, 30.0f);

   // Transform the points in the array from world to page coordinates.
   graphics.TransformPoints(GDI+点的旋转
      CoordinateSpacePage,
      CoordinateSpaceWorld,
      points,
      2);

   // It is the world transformation that takes points from world
   // space to page space. Because the world transformation is a
   // translation 40 to the right and 30 down, the
   // points in the array are now (40, 30) and (140, 80).

   // Draw a line that connects the transformed points.
   graphics.ResetTransform();
   graphics.DrawLine(&pen, points[0], points[1]);


    效果~ 当然如果检测效果的话 需要在另一个graphics里画点哦
    模仿痛苦进行当中。太多不会的东西了>_<东一块西一块的打补丁。还再期末,还再应付老板,疯了。GDI+点的旋转



群贤毕至

访客