Share via


CheckScanner.DefineCropArea Method

2/27/2008

Establishes one or more cropping areas that can be applied to a scanned image.

Namespace: Microsoft.PointOfService
Assembly: Microsoft.PointOfService (in microsoft.pointofservice.dll)

Syntax

'Declaration
Public MustOverride Sub DefineCropArea ( _
    cropAreaId As Integer, _
    x As Integer, _
    y As Integer, _
    width As Integer, _
    height As Integer _
)
public abstract void DefineCropArea (
    int cropAreaId,
    int x,
    int y,
    int width,
    int height
)
public:
virtual void DefineCropArea (
    int cropAreaId, 
    int x, 
    int y, 
    int width, 
    int height
) abstract
public abstract void DefineCropArea (
    int cropAreaId, 
    int x, 
    int y, 
    int width, 
    int height
)
public abstract function DefineCropArea (
    cropAreaId : int, 
    x : int, 
    y : int, 
    width : int, 
    height : int
)

Parameters

  • cropAreaId
    The numeric identifier for the defined crop area.
  • x
    The starting X-coordinate of the cropping area.
  • y
    The starting Y-coordinate of the cropping area.
  • width
    The value added to the X-coordinate to determine the x endpoint for the cropping area. If set to CropAreaRight, the x endpoint value is set to the value of the DocumentWidth property.
  • height
    The value added to the Y-coordinate to determine the y endpoint for the cropping area. If set to CropAreaBottom, the y endpoint value is set to the value of the DocumentHeight property.

Remarks

The values are specified in units designated by the MapMode property, and use the upper-left corner of the scanned document as the origin (0,0). All values are positive.

DefineCropArea specifies an area of interest that is contained within a crop box and given an index number for reference. Only the data that is defined by this index number is sent when the application calls the RetrieveImage method. The crop areas should be set before calling RetrieveImage, and they remain in effect until changed.

A crop box cannot contain an area larger than that defined by the current DocumentWidth and DocumentHeight properties. If the resultant value for the endpoint (x + width) is greater than the DocumentWidth value, then, the x endpoint value is set to DocumentWidth. If the resultant value for the endpoint (y + height) is greater than the DocumentHeight value, then the y endpoint value is set to DocumentHeight.

The following table shows the possible constant values for the cropAreaID parameter.

Value

Meaning

CropAreaResetAll

The crop area definitions (as specified by the value of the MaxCropAreas property) will have their x,y and width/height values reset to 0,0 and DocumentWidth and DocumentHeight, respectively.

CropAreaEntireImage

The crop area is equal to the scanned image. The method returns without storing the image.

DefineCropArea may cause a PosControlException to be thrown with the following ErrorCodes.

Value

Meaning

Illegal

One of the following problems was found:

  • The Check Scanner device does not support crop areas (that is, the CapDefineCropArea property is set to false).

  • The value that is stored in cropAreaID is invalid.

  • All available crop areas have already been defined for the device.

  • The values specified for x and y or y are invalid.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread-safe. Any instance members are not guaranteed to be thread-safe.

See Also

Reference

CheckScanner Class
CheckScanner Members
Microsoft.PointOfService Namespace
CapDefineCropArea
CropAreaCount
DocumentHeight
DocumentWidth
MapMode
MaxCropAreas