Translates a rectangle from this
RasterImage view perspective to the specified view perspective.
Syntax
Parameters
- viewPerspective
- Destination view perspective to which the rectangle should be translated.
- rc
- The rectangle to translate.
Return Value
The translated rectangle.
Example
This example finds out where the selected rectangle of the image would be in a TopLeft ViewPerspective.
Visual Basic | Copy Code |
---|
Public Sub RectangleFromImageExample()
RasterCodecs.Startup()
Dim codecs As RasterCodecs = New RasterCodecs()
Dim image As RasterImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "ULAY1.BMP")
Dim ImageRectangle As Rectangle = New Rectangle(0, 0, image.Width - 1, image.Height - 1)
ImageRectangle = image.RectangleFromImage(RasterViewPerspective.TopLeft, ImageRectangle)
Console.WriteLine(String.Format("{0},{1},{2},{3}", ImageRectangle.Left, ImageRectangle.Top, ImageRectangle.Right, ImageRectangle.Bottom))
ImageRectangle = New Rectangle(0, 0, image.Width - 1, image.Height - 1)
ImageRectangle = image.RectangleToImage(RasterViewPerspective.TopLeft, ImageRectangle)
Console.WriteLine(String.Format("{0},{1},{2},{3}", ImageRectangle.Left, ImageRectangle.Top, ImageRectangle.Right, ImageRectangle.Bottom))
image.Dispose()
codecs.Dispose()
RasterCodecs.Shutdown()
End Sub |
C# | Copy Code |
---|
public void RectangleFromImageExample() { RasterCodecs.Startup(); RasterCodecs codecs = new RasterCodecs(); // Load an image that has BottomLeft ViewPerspective RasterImage image = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "ULAY1.BMP"); Rectangle ImageRectangle = new Rectangle(0, 0, image.Width - 1, image.Height - 1); ImageRectangle = image.RectangleFromImage(Leadtools.RasterViewPerspective.TopLeft, ImageRectangle); Console.WriteLine(string.Format("{0},{1},{2},{3}", ImageRectangle.Left, ImageRectangle.Top, ImageRectangle.Right, ImageRectangle.Bottom)); ImageRectangle = new Rectangle(0, 0, image.Width - 1, image.Height - 1); ImageRectangle = image.RectangleToImage(Leadtools.RasterViewPerspective.TopLeft, ImageRectangle); Console.WriteLine(string.Format("{0},{1},{2},{3}", ImageRectangle.Left, ImageRectangle.Top, ImageRectangle.Right, ImageRectangle.Bottom)); image.Dispose(); codecs.Dispose(); RasterCodecs.Shutdown(); } |
Remarks
Requirements
Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family
See Also