LEADTOOLS WebForms and AJAX (Leadtools.Web assembly)
LEAD Technologies, Inc

ApplyCommand Method

Example 





The Leadtools.ImageProcessing.RasterCommand to be applied to the image.
Applies a Leadtools.ImageProcessing.RasterCommand to the current image in order to process it.
Syntax
public void ApplyCommand( 
   RasterCommand cmd
)
'Declaration
 
Public Sub ApplyCommand( _
   ByVal cmd As RasterCommand _
) 
'Usage
 
Dim instance As WebImageViewer
Dim cmd As RasterCommand
 
instance.ApplyCommand(cmd)
public void ApplyCommand( 
   RasterCommand cmd
)
 function Leadtools.Web.Controls.WebImageViewer.ApplyCommand( 
   cmd 
)
public:
void ApplyCommand( 
   RasterCommand^ cmd
) 

Parameters

cmd
The Leadtools.ImageProcessing.RasterCommand to be applied to the image.
Example
 
Public Function WebImageViewer_FlipCommand(ByVal mainWebImageViewer As WebImageViewer) As RasterImage
   Dim cmd As FlipCommand = New FlipCommand()
   AddHandler mainWebImageViewer.ImageDataChanged, AddressOf mainWebImageViewer_ImageDataChanged
   mainWebImageViewer.ApplyCommand(cmd)
   RemoveHandler mainWebImageViewer.ImageDataChanged, AddressOf mainWebImageViewer_ImageDataChanged

   Dim imageUrl As String = mainWebImageViewer.ImageInfo.Url

   If (Not mainWebImageViewer.ImageInfo.CacheFileName = String.Empty) Then
      imageUrl = mainWebImageViewer.ImageInfo.CacheFileName
   End If
   Dim codecs As RasterCodecs = New RasterCodecs()

   Dim filePath As String = mainWebImageViewer.Page.MapPath(imageUrl)
   Dim pageNumber As Integer = mainWebImageViewer.ImageInfo.PageIndex + 1

   Dim image As RasterImage = codecs.Load(filePath, 0, CodecsLoadByteOrder.BgrOrGray, pageNumber, pageNumber)

   Return image
End Function

Sub mainWebImageViewer_ImageDataChanged(ByVal sender As Object, ByVal e As EventArgs)

   '' "Image Data changed"...
End Sub
public RasterImage WebImageViewer_FlipCommand(WebImageViewer mainWebImageViewer)
{
   FlipCommand cmd = new FlipCommand();
   mainWebImageViewer.ImageDataChanged += new EventHandler(mainWebImageViewer_ImageDataChanged);
   mainWebImageViewer.ApplyCommand(cmd);
   mainWebImageViewer.ImageDataChanged -= new EventHandler(mainWebImageViewer_ImageDataChanged);

   string imageUrl = mainWebImageViewer.ImageInfo.Url;

   if(mainWebImageViewer.ImageInfo.CacheFileName != string.Empty)
      imageUrl = mainWebImageViewer.ImageInfo.CacheFileName;

   RasterCodecs codecs = new RasterCodecs();

   string filePath = mainWebImageViewer.Page.MapPath(imageUrl);
   int pageNumber = mainWebImageViewer.ImageInfo.PageIndex + 1;

   RasterImage image = codecs.Load(filePath, 0, CodecsLoadByteOrder.BgrOrGray, pageNumber, pageNumber);

   return image;
}

void mainWebImageViewer_ImageDataChanged(object sender, EventArgs e)
{
   // "Image Data changed"...
}
function WebImageViewer_FlipCommand()
{
   var cmd = new FlipCommand();
   WebImageViewer1.ImageDataChanged = WebImageViewer1_ImageDataChanged;
   WebImageViewer1.ApplyCommand(cmd);
}
function WebImageViewer1_ImageDataChanged()
{
   var imageUrl = WebImageViewer1.getImageInfo().url;

   if(WebImageViewer1.getImageInfo().cacheFileName != "")
      imageUrl = WebImageViewer1.getImageInfo().cacheFileName;

   alert("Image Data changed, and the new image is located in " + imageUrl);
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

WebImageViewer Class
WebImageViewer Members
WebImageViewer Client Class
ImageProcessing Client Side Commands

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.