Gets the total number of pixels in the image region. 
Syntax
| Visual Basic (Declaration) | 
  | 
Public Function CalculateRegionArea() As Long  | 
 
| Visual Basic (Usage) | 
 Copy Code | 
Dim instance As RasterImage
Dim value As Long
 
value = instance.CalculateRegionArea()
  | 
 
| C# | 
  | 
public long CalculateRegionArea()  | 
 
| C++/CLI | 
  | 
public:
long CalculateRegionArea();   | 
 
Return Value
The pixel count.
 
Example
| Visual Basic | 
 Copy Code | 
Public Sub CalculateRegionAreaExample()    RasterCodecs.Startup()    Dim codecs As RasterCodecs = New RasterCodecs()
     Dim srcFileName As String = LeadtoolsExamples.Common.ImagesPath.Path + "Image1.cmp"
         Dim image As RasterImage = codecs.Load(srcFileName)
         Dim rc As Rectangle = New Rectangle(image.Width \ 3, image.Height \ 3, image.Width \ 3, image.Height \ 3)    image.AddEllipseToRegion(Nothing, rc, RasterRegionCombineMode.Set)
         Dim area As Integer = CInt(image.CalculateRegionArea())    Console.WriteLine("Number of pixels in region after a region is added: {0}", area)
     image.Dispose()    codecs.Dispose()    RasterCodecs.Shutdown() End Sub | 
 
| C# | 
 Copy Code | 
public void CalculateRegionAreaExample()  {     RasterCodecs.Startup();     RasterCodecs codecs = new RasterCodecs();       string srcFileName = LeadtoolsExamples.Common.ImagesPath.Path + "Image1.cmp";       // Load the image     RasterImage image = codecs.Load(srcFileName);       // Add a region to the image     Rectangle rc = new Rectangle(image.Width / 3, image.Height / 3, image.Width / 3, image.Height / 3);     image.AddEllipseToRegion(null, rc, RasterRegionCombineMode.Set);       // Get the number of pixels in the region     long area = image.CalculateRegionArea();     Console.WriteLine("Number of pixels in region after a region is added: {0}", area);       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