ClearImage COM Server
CreateZone Method
See Also  Example  Send Feedback
left
top
right
bottom
CiImage Object : CreateZone Method

Description

Create new Zone within image

Syntax

Visual Basic
Public Function CreateZone( _
   Optional ByVal left As Long = 0, _
   Optional ByVal top As Long = 0, _
   Optional ByVal right As Long = 0, _
   Optional ByVal bottom As Long = 0 _
) As CiImage

Parameters

left
top
right
bottom

Remarks

The zone's rectangle object should have valid coordinates (right greater than left and bottom greater than top); otherwise the zone is considered empty (object.Zone.IsEmpty returns True.)  Invocation of ClearImage methods with an empty zone will generate an error. 

Coordinates are inclusive, meaning pixels belonging to left and top row, top and bottom columns belong to a zone.
Minimum width and height of zone are 2 pixels. 

Example

VB Example (Visual Basic)Copy Code
Public Sub T_Zone(ByRef Img As CiImage)
    ' Create zone on image
  Dim ImgZone As CiImage, ImgZone1 As CiImage
    ' Create zone
  Set ImgZone = Img.CreateZone(Img.Width / 3, Img.Height / 3, _
                               Img.Width * 2 / 3, Img.Height * 2 / 3)
    ' Inverts zo1ne
  ImgZone.Invert
    ' Use CreateZoneRect to create another zone
  Set ImgZone1 = Img.CreateZoneRect(ImgZone.Zone)
    ' Use Zone property to expand zone
  ImgZone1.Zone.left = ImgZone1.Zone.left - 100
  ImgZone1.Zone.right = ImgZone1.Zone.right + 100
  ImgZone1.Zone.top = ImgZone1.Zone.top - 50
  ImgZone1.Zone.bottom = ImgZone1.Zone.bottom + 50
    ' Inverts expanded zone
  ImgZone1.Invert
    ' Use IsZone property
  Debug.Print "Img is '" & IIf(Img.IsZone, "zone", "image") & "' object"
  Debug.Print "ImgZone1 is '" & IIf(ImgZone1.IsZone, "zone", "image") & "' object"
    ' Use Parent property
  If (Not ImgZone1.Parent.IsZone) Then
    ImgZone1.Parent.Invert
  End If
End Sub

See Also

© 1992-2011. Inlite Research, Inc. All Rights Reserved.