Translates a point (x,y) from this
RasterImage view perspective to the specified view perspective.
Supported in Silverlight, Windows Phone 7
Syntax
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()
Dim codecs As RasterCodecs = New RasterCodecs()
' Load an image that has BottomLeft ViewPerspective
Dim image As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "ULAY1.BMP"))
Dim ImagePoint As LeadPoint = New LeadPoint(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()
End Sub
Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class |
C# | Copy Code |
---|
public void PointFromImageExample()
{
RasterCodecs codecs = new RasterCodecs();
// Load an image that has BottomLeft ViewPerspective
RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "ULAY1.BMP"));
LeadPoint ImagePoint = new LeadPoint(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();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
} |
SilverlightCSharp | Copy Code |
---|
public void PointFromImageExample(RasterImage image)
{
// image should be an image that has BottomLeft ViewPerspective (ulay1.bmp)
LeadPoint ImagePoint = new LeadPoint(0, 0);
ImagePoint = image.PointFromImage(RasterViewPerspective.TopLeft, ImagePoint);
Debug.WriteLine(string.Format("{0},{1}", ImagePoint.X, ImagePoint.Y));
ImagePoint.X = 0;
ImagePoint.Y = 0;
ImagePoint = image.PointToImage(RasterViewPerspective.TopLeft, ImagePoint);
Debug.WriteLine(string.Format("{0},{1}", ImagePoint.X, ImagePoint.Y));
image.Dispose();
} |
SilverlightVB | Copy Code |
---|
Public Sub PointFromImageExample(ByVal image As RasterImage)
' image should be an image that has BottomLeft ViewPerspective (ulay1.bmp)
Dim ImagePoint As LeadPoint = New LeadPoint(0, 0)
ImagePoint = image.PointFromImage(RasterViewPerspective.TopLeft, ImagePoint)
Debug.WriteLine(String.Format("{0},{1}", ImagePoint.X, ImagePoint.Y))
ImagePoint.X = 0
ImagePoint.Y = 0
ImagePoint = image.PointToImage(RasterViewPerspective.TopLeft, ImagePoint)
Debug.WriteLine(String.Format("{0},{1}", ImagePoint.X, ImagePoint.Y))
image.Dispose()
End Sub |
Remarks
Requirements
Target Platforms: Silverlight, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7, MAC OS/X (Intel Only), Windows Phone 7
See Also