Rotates and flips the image data as necessary to achieve the desired view perspective.
Supported in Silverlight, Windows Phone 7
Object Model
Syntax
Example
This example will load an image and then change its view perspective.
Visual Basic | Copy Code |
---|
Public Sub ChangeViewPerspectiveCommandExample()
Dim codecs As RasterCodecs = New RasterCodecs()
Dim srcFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp")
' Load the source image from disk
Dim image As RasterImage = codecs.Load(srcFileName)
' Check the view perspective
Console.WriteLine("Original view perspective = {0}", image.ViewPerspective)
' If the view perspective is TopLeft, change to BottomLeft and vise versa
Dim viewPerspective As RasterViewPerspective = image.ViewPerspective
If viewPerspective = RasterViewPerspective.TopLeft Then
viewPerspective = RasterViewPerspective.BottomLeft
Else
viewPerspective = RasterViewPerspective.TopLeft
End If
' Change the image view perspective
Dim command As ChangeViewPerspectiveCommand = New ChangeViewPerspectiveCommand()
command.ViewPerspective = viewPerspective
command.InPlace = True
command.Run(image)
' Re-check the view perspective
Console.WriteLine("New view perspective = {0}", image.ViewPerspective)
Debug.Assert(image.ViewPerspective = viewPerspective)
' Clean up
image.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 ChangeViewPerspectiveCommandExample()
{
RasterCodecs codecs = new RasterCodecs();
string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp");
// Load the source image from disk
RasterImage image = codecs.Load(srcFileName);
// Check the view perspective
Console.WriteLine("Original view perspective = {0}", image.ViewPerspective);
// If the view perspective is TopLeft, change to BottomLeft and vise versa
RasterViewPerspective viewPerspective = image.ViewPerspective;
if(viewPerspective == RasterViewPerspective.TopLeft)
viewPerspective = RasterViewPerspective.BottomLeft;
else
viewPerspective = RasterViewPerspective.TopLeft;
// Change the image view perspective
ChangeViewPerspectiveCommand command = new ChangeViewPerspectiveCommand();
command.ViewPerspective = viewPerspective;
command.InPlace = true;
command.Run(image);
// Re-check the view perspective
Console.WriteLine("New view perspective = {0}", image.ViewPerspective);
Debug.Assert(image.ViewPerspective == viewPerspective);
// Clean up
image.Dispose();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
} |
SilverlightCSharp | Copy Code |
---|
public void ChangeViewPerspectiveCommandExample(RasterImage image)
{
RasterCodecs codecs = new RasterCodecs();
// Check the view perspective
Debug.WriteLine("Original view perspective = {0}", image.ViewPerspective);
// If the view perspective is TopLeft, change to BottomLeft and vise versa
RasterViewPerspective viewPerspective = image.ViewPerspective;
if(viewPerspective == RasterViewPerspective.TopLeft)
viewPerspective = RasterViewPerspective.BottomLeft;
else
viewPerspective = RasterViewPerspective.TopLeft;
// Change the image view perspective
ChangeViewPerspectiveCommand command = new ChangeViewPerspectiveCommand();
command.ViewPerspective = viewPerspective;
command.InPlace = true;
command.Run(image);
// Re-check the view perspective
Debug.WriteLine("New view perspective = {0}", image.ViewPerspective);
Debug.Assert(image.ViewPerspective == viewPerspective);
// Clean up
image.Dispose();
} |
SilverlightVB | Copy Code |
---|
Public Sub ChangeViewPerspectiveCommandExample(ByVal image As RasterImage)
Dim codecs As RasterCodecs = New RasterCodecs()
' Check the view perspective
Debug.WriteLine("Original view perspective = {0}", image.ViewPerspective)
' If the view perspective is TopLeft, change to BottomLeft and vise versa
Dim viewPerspective As RasterViewPerspective = image.ViewPerspective
If viewPerspective = RasterViewPerspective.TopLeft Then
viewPerspective = RasterViewPerspective.BottomLeft
Else
viewPerspective = RasterViewPerspective.TopLeft
End If
' Change the image view perspective
Dim command As ChangeViewPerspectiveCommand = New ChangeViewPerspectiveCommand()
command.ViewPerspective = viewPerspective
command.InPlace = True
command.Run(image)
' Re-check the view perspective
Debug.WriteLine("New view perspective = {0}", image.ViewPerspective)
Debug.Assert(image.ViewPerspective = viewPerspective)
' Clean up
image.Dispose()
End Sub |
Remarks
Inheritance Hierarchy
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