Types of Coordinate Systems

of 6
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Related Documents
Types of Coordinate Systems
  Types of Coordinate Systems[13/01/2014 15:09:21] Export (0) PrintCollapse All Types of CoordinateSystems GDI+ uses three coordinate spaces: world, page, and device. Worldcoordinates are the coordinates used to model a particular graphic world andare the coordinates you pass to methods in the .NET Framework. Pagecoordinates refer to the coordinate system used by a drawing surface, such asa form or control. Device coordinates are the coordinates used by thephysical device being drawn on, such as a screen or sheet of paper. Whenyou make the call myGraphics.DrawLine(myPen, 0, 0, 160, 80) , thepoints that you pass to the DrawLine method— (0, 0)  and (160, 80) —arein the world coordinate space. Before GDI+ can draw the line on the screen,the coordinates pass through a sequence of transformations. Onetransformation, called the world transformation, converts world coordinates topage coordinates, and another transformation, called the page transformation,converts page coordinates to device coordinates.Suppose you want to work with a coordinate system that has its srcin inthe body of the client area rather than the upper-left corner. Say, forexample, that you want the srcin to be 100 pixels from the left edge of the client area and 50 pixels from the top of the client area. The followingillustration shows such a coordinate system. Transforms and Coordinate Systems Developer Network Home   Opportunity   Platform   Connect   Downloads   Library   SamplesMSDN subscriptions   Get tools   Sign inJoin us MSDN Library.NET Development.NET Framework 4.5Development GuideClient Applications   Windows FormsEnhancing Windows FormsApplicationsGraphics and Drawing in WindowsFormsAbout GDI+ Managed CodeCoordinate Systems andTransformations Types of Coordinate Systems Matrix Representation of TransformationsGlobal and LocalTransformations .NET Framework 4.5 Other Versions1 out of 2 rated this helpful - Rate this topic  Types of Coordinate Systems[13/01/2014 15:09:21] When you make the call myGraphics.DrawLine(myPen, 0, 0, 160,80) , you get the line shown in the following illustration.The coordinates of the endpoints of your line in the three coordinatespaces are as follows:World(0, 0) to (160, 80)Page(100, 50) to (260, 130)Device(100, 50) to (260, 130)Note that the page coordinate space has its srcin at the upper-left cornerof the client area; this will always be the case. Also note that because theunit of measure is the pixel, the device coordinates are the same as thepage coordinates. If you set the unit of measure to something other thanpixels (for example, inches), then the device coordinates will be differentfrom the page coordinates.  Types of Coordinate Systems[13/01/2014 15:09:21] The world transformation, which maps world coordinates to pagecoordinates, is held in the Transform property of the Graphics class. In the preceding example, the world transformation is a translation 100 units inthe x direction and 50 units in the y direction. The following example setsthe world transformation of a Graphics object and then uses that Graphics object to draw the line shown in the preceding figure:The page transformation maps page coordinates to device coordinates.The Graphics class provides the PageUnit and PageScale properties for manipulating the page transformation. The Graphics class also provides tworead-only properties, DpiX and DpiY, for examining the horizontal and vertical dots per inch of the display device.You can use the PageUnit property of the Graphics class to specify a unit of measure other than the pixel.  Note You cannot set the PageUnit property to World, as this is not a physical unit and will cause an exception.The following example draws a line from (0, 0) to (2, 1), where the point(2, 1) is 2 inches to the right and 1 inch down from the point (0, 0):  Note If you don't specify a pen width when you construct your pen, thepreceding example will draw a line that is one inch wide. You canspecify the pen width in the second argument to the Pen constructor: myGraphics.TranslateTransform(100, 50);myGraphics.DrawLine(myPen, 0, 0, 160, 80);myGraphics.PageUnit = GraphicsUnit.Inch;myGraphics.DrawLine(myPen, 0, 0, 2, 1); C#VBC#VB  Types of Coordinate Systems[13/01/2014 15:09:21] If we assume that the display device has 96 dots per inch in the horizontaldirection and 96 dots per inch in the vertical direction, the endpoints of theline in the preceding example have the following coordinates in the threecoordinate spaces:World(0, 0) to (2, 1)Page(0, 0) to (2, 1)Device(0, 0, to (192, 96)Note that because the srcin of the world coordinate space is at theupper-left corner of the client area, the page coordinates are the same asthe world coordinates.You can combine the world and page transformations to achieve a varietyof effects. For example, suppose you want to use inches as the unit of measure and you want the srcin of your coordinate system to be 2 inchesfrom the left edge of the client area and 1/2 inch from the top of the clientarea. The following example sets the world and page transformations of aGraphics object and then draws a line from (0, 0) to (2, 1):The following illustration shows the line and coordinate system. Pen myPen = new Pen(Color.Black, 1 / myGraphics.DpiX);myGraphics.TranslateTransform(2, 0.5f);myGraphics.PageUnit = GraphicsUnit.Inch;myGraphics.DrawLine(myPen, 0, 0, 2, 1); C#VBC#VB

Bagayas v. Bagayas

Jul 23, 2017


Jul 23, 2017
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks