Leadtools Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
PointFromImage Method
See Also  Example
Leadtools Namespace > RasterImage Class : PointFromImage Method



viewPerspective
Destination view perspective to which the point should be translated.
pt
The point to translate.
Translates a point (x,y) from this RasterImage view perspective to the specified view perspective.

Syntax

Visual Basic (Declaration)  
Public Function PointFromImage( _
   ByVal viewPerspective As RasterViewPerspective, _
   ByVal pt As Point _
) As Point
Visual Basic (Usage) Copy Code
Dim instance As RasterImage
Dim viewPerspective As RasterViewPerspective
Dim pt As Point
Dim value As Point
 
value = instance.PointFromImage(viewPerspective, pt)
C#  
public Point PointFromImage( 
   RasterViewPerspective viewPerspective,
   Point pt
)
C++/CLI  
public:
Point PointFromImage( 
   RasterViewPerspective viewPerspective,
   Point pt
) 

Parameters

viewPerspective
Destination view perspective to which the point should be translated.
pt
The point to translate.

Return Value

The translated point.

Example

This example finds out where the origin of the image would be. Then it converts a known point to bitmap coordinates.

Visual Basic Copy Code
Public Sub PointFromImageExample()
   RasterCodecs.Startup()
   Dim codecs As RasterCodecs = New RasterCodecs()
   ' Load an image that has BottomLeft ViewPerspective
   Dim image As RasterImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "ULAY1.BMP")

   Dim ImagePoint As Point = New Point(0, 0)
   ImagePoint = image.PointFromImage(RasterViewPerspective.TopLeft, ImagePoint)
   Console.WriteLine(String.Format("{0},{1}", ImagePoint.X, ImagePoint.Y))

   ImagePoint.X = 0
   ImagePoint.Y = 0
   ImagePoint = image.PointToImage(RasterViewPerspective.TopLeft, ImagePoint)
   Console.WriteLine(String.Format("{0},{1}", ImagePoint.X, ImagePoint.Y))

   image.Dispose()
   codecs.Dispose()
   RasterCodecs.Shutdown()
End Sub
C# Copy Code
public void PointFromImageExample() 

   RasterCodecs.Startup(); 
   RasterCodecs codecs = new RasterCodecs(); 
   // Load an image that has BottomLeft ViewPerspective 
   RasterImage image = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "ULAY1.BMP"); 
 
   Point ImagePoint = new Point(0, 0); 
   ImagePoint = image.PointFromImage(RasterViewPerspective.TopLeft, ImagePoint); 
   Console.WriteLine(string.Format("{0},{1}", ImagePoint.X, ImagePoint.Y)); 
 
   ImagePoint.X = 0; 
   ImagePoint.Y = 0; 
   ImagePoint = image.PointToImage(RasterViewPerspective.TopLeft, ImagePoint); 
   Console.WriteLine(string.Format("{0},{1}", ImagePoint.X, ImagePoint.Y)); 
 
   image.Dispose(); 
   codecs.Dispose(); 
   RasterCodecs.Shutdown(); 
}

Remarks

For more information, refer to Accounting for View Perspective.

For more information, refer to Changing Image Coordinates.

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family

See Also