ClearImage .NET API
AndImage Method (CiTools)
Example 





Inlite.ClearImage Namespace > CiTools Class : AndImage Method
Source image
Target position on object.Image.   The default value is 0
Target position on object.Image.   The default value is 0
Logical AND the image with another image
Syntax
'Declaration
 
Public Function AndImage( _
   ByVal ImgSrc As CiImage, _
   ByVal left As System.Integer, _
   ByVal top As System.Integer _
) As System.Integer
'Usage
 
Dim instance As CiTools
Dim ImgSrc As CiImage
Dim left As System.Integer
Dim top As System.Integer
Dim value As System.Integer
 
value = instance.AndImage(ImgSrc, left, top)
public System.int AndImage( 
   CiImage ImgSrc,
   System.int left,
   System.int top
)
public function AndImage( 
    ImgSrc: CiImage;
    left: System.Integer;
    top: System.Integer
): System.Integer; 
public function AndImage( 
   ImgSrc : CiImage,
   left : System.int,
   top : System.int
) : System.int;
public:
System.int AndImage( 
   CiImage^ ImgSrc,
   System.int left,
   System.int top
) 

Parameters

ImgSrc
Source image
left
Target position on object.Image.   The default value is 0
top
Target position on object.Image.   The default value is 0
Remarks

This method sets object.Image pixels to a result of the logical operation between themselves and corresponding pixels of ImgSrc located at left and top offsets.

BitsPerPixel property of object.Image and ImgSrc should be the same.

This method generates an error if object.Image.IsZone is true.

Example
void LogicalMethods(string imageFile1, string imageFile2, string imageFileOut)
{
    // Create objects and open input images
    CiServer ci = Inlite.ClearImageNet.Server.GetThreadServer();
    CiTools Tools = ci.CreateTools();
    Tools.Image.Open(imageFile1, 1);
    CiImage Image = ci.CreateImage();
    Image.Open(imageFile2, 1);
    // Do processing
    int x = 20, y = 20;
    Tools.AndImage(Image, x, y);
    x = x + Tools.Image.Width / 5 + 20;
    y = y + Tools.Image.Height / 5 + 20;
    Tools.OrImage(Image, x, y);

    x = x + Tools.Image.Width / 5 + 20;
    y = y + Tools.Image.Height / 5 + 20;
    Tools.XorImage(Image, x, y);

    x = x + Tools.Image.Width / 5 + 20;
    y = y + Tools.Image.Height / 5 + 20;
    Tools.PasteImage(Image, x, y);
    // Save results
    Tools.Image.SaveAs(imageFileOut, EFileFormat.ciEXT);
}
Sub LogicalMethods(imageFile1 As String, imageFile2 As String, imageFileOut As String)
    ' Create objects and open input images
    Dim ci As CiServer = Inlite.ClearImageNet.Server.GetThreadServer()
    Dim Tools As CiTools = ci.CreateTools()
    Tools.Image.Open(imageFile1, 1)
    Dim Image As CiImage = ci.CreateImage()
    Image.Open(imageFile2, 1)
    ' Do processing
    Dim x As Integer = 20, y As Integer = 20
    Tools.AndImage(Image, x, y)
    x = x + Tools.Image.Width / 5 + 20
    y = y + Tools.Image.Height / 5 + 20
    Tools.OrImage(Image, x, y)

    x = x + Tools.Image.Width / 5 + 20
    y = y + Tools.Image.Height / 5 + 20
    Tools.XorImage(Image, x, y)

    x = x + Tools.Image.Width / 5 + 20
    y = y + Tools.Image.Height / 5 + 20
    Tools.PasteImage(Image, x, y)
    ' Save results
    Tools.Image.SaveAs(imageFileOut, EFileFormat.ciEXT)
End Sub
See Also

Reference

CiTools Class
CiTools Members
OrImage Method
XorImage Method
PasteImage Method