Anyline View Configuration

This section explains the Anyline view configuration in detail.

Configuring your Anyline plugin with JSON

The most common way to set up your Anyline scanning solution, regardless of the platform you are running, would be through a configuration string in the JSON format.

ScanViewPlugins and ScanViews are initialized using JSON strings.

JSON configs for scanning use cases are typically defined on .json text files and loaded into application memory during runtime.

Check out the platform-specific documentation on how to accomplish this for your respective platform.

The Structure of a JSON configuration

A typical Anyline configuration in JSON has the following structure:

  • viewPluginConfig: contains a group of related configurations as follows below:

    • pluginConfig: the plugin to use, and options pertaining to it

    • cutoutConfig: how the scan view cutout would look

    • scanFeedbackConfig: how feedback during scanning would appear and behave

  • cameraConfig: camera properties for the platform

  • flashConfig: platform-specific properties for the flash (or torch) module

From this structure, only viewPluginConfig and its child pluginConfig are required nodes. When an optional node is omitted in the config, the SDKs would determine the best possible default values for your platform.

The following JSON configuration (defining a TIN tire scanning use case) shows a typical example:

{
    "viewPluginConfig": {
        "pluginConfig": {
            "id": "tin-dot",
            "tinConfig": {
                "scanMode": "UNIVERSAL"
            },
            "cancelOnResult": true
        },
        "cutoutConfig": {
            "width": 750,
            "alignment": "top_half",
            "ratioFromSize": { "width": 4, "height": 1 },
            "cornerRadius": 1,
            "strokeColor": "0099ff",
            "strokeWidth": 2,
            "feedbackStrokeColor": "8be9fd"
        },
        "scanFeedbackConfig": {
            "style": "contour_rect",
            "strokeWidth": 2,
            "cornerRadius": 4
        }
    },
    "cameraConfig": {
        "pictureResolution": "1080p"
    },
    "flashConfig": {
        "mode": "manual",
        "alignment": "top_left"
    }
}

We will go over each configuration property in detail in the subsequent sections.

Note that there is a special JSON structure used for composite scanning use-cases. For more details, please head over to the corresponding documentation for your specific platform.

viewPluginConfig

The viewPluginConfig is an aggregate structure containing a pluginConfig, a cutoutConfig, and a scanFeedbackConfig (the latter two of which are optional).

pluginConfig

A pluginConfig defines what scanning models are used (e.g. License Plate, ID, Meter, and so on), as well as scanning options related to the plugin used.

Please see the respective platform’s documentation for complete details on plugin configuration with use cases supported by Anyline.

cutoutConfig

A cutoutConfig includes configuration details on how the scan view’s cutout, which indicate the location within the camera frame the scanning process should concentrate on, should appear.

Property Name Note Default Value

alignment

A preset location in the scan view where the cutout will be placed. Values: top, top_half, center, bottom_half, bottom.

center

width

The cutout’s suggested width in pixels, based on device resolution width. Will be used, unless maxWidthPercent is specified and evaluates to a smaller width.

If zero, will be computed based on values from maxWidthPercent, maxHeightPercent, and ratioFromSize.

0

maxWidthPercent

Numeric value representing the maximum width in percent (0-100) of the scan view the cutout will occupy, subject to constraints set by device resolution, width, and ratioFromSize.

100

maxHeightPercent

Numeric value representing the maximum height in percent (0-100) of the scan view the cutout will occupy, subject to constraints set by device resolution, width, and ratioFromSize.

100

ratioFromSize

A size value constraining the cutout width-height ratio. e.g. { "width": 3, "height": 2 }.

If the size is zero, evaluates to a full frame cutout (please note that this only works well for barcode use cases).

{"width": 0, "height": 0}

strokeWidth

Stroke width of the cutout

0

strokeColor

Stroke color of the cutout as a hex string (e.g. "00CCFF")

0099FF

feedbackStrokeColor

Color of the cutout when the scanner is reporting feedback as a hex string (e.g. "00CCFF")

0099FF

cornerRadius

Amount of corner rounding applied to the cutout

0

outerColor

Background color as a hex string. Use a hex string format (either "XXXXXX", or "XXXXXXXX" wherein the first two digits are to be considered as the alpha component)

4D000000

offset

Position offset of the cutout, used in conjunction with alignment

{ "x": 0, "y": 0 }

image

(Not currently supported) A custom image used for the cutout

null

animation

Animation type for the cutout when initially displayed. Values: none, fade, zoom

none

cropPadding

Amount of padding to be applied to the cutout (NOTE: use positive amounts only). A crop padding truncates the visual area represented by the cutout used in optimizing scan performance for some plugins. Define as a width-height structure.

{"width": 0, "height": 0}

cropOffset

Used in conjunction with cropPadding. This offset further adjusts the crop position after the padding is applied. Define as an x-y point structure

{ "x": 0, "y": 0 }

While generally all plugins (Technical Capabilities) require a cutout region for best performance and results, Barcode also allows usage completely without a cutoutConfig, resulting in Full Frame Scanning.

To make use of Full Frame Scanning for Barcode simply remove the cutoutConfig completely from your View Configuration .json.

Please be aware that this is only supported on Barcode Scanning.

scanFeedbackConfig

A scanFeedbackConfig determines how the scan view behaves when objects of interest are detected during scanning.

Property Name Note Default Value

feedbackStyle

The scan feedback style displayed when an object is detected. Values: none, rect, contour_rect, contour_underline, contour_point, animated_rect

rect

strokeColor

Stroke color of the visual feedback. Use a hex string in the XXXXXX format

0099FF

fillColor

Fill color of the visual feedback. Use an "XXXXXXXX" hex string with the first two characters representing the alpha component of the fill

00000000

strokeWidth

Stroke width of the visual feedback, in pixels

2

cornerRadius

The corner rounding level of visual feedback shapes drawn

1

redrawTimeout

The amount of time a visual feedback object remains on screen until it is removed

0

animationDuration

How long the animation lasts, in ms

75

animationStyle

The animation style used with the visual feedback drawn on the scan view. Values: none, traverse_single, traverse_multi, kitt, blink, resize, pulse, and pulse_random

none

blinkAnimationOnResult

A boolean indicating whether a brief "flicker" of the scan view is shown when an object is successfully scanned

false

beepOnResult

A boolean indicating whether a device beep sound is played when an object is successfully scanned

false

vibrateOnResult

A boolean indicating whether the device should vibrate briefly when an object is succesfully scanned

false

cameraConfig

A cameraConfig configures the camera module to be used during scanning.

Property Name Note Default Value

defaultCamera

Whether to use the back camera (BACK), or the front camera (FRONT)

BACK

captureResolution

The device resolution to use. Currently (for iOS) only 1080p is supported.

1080p

pictureResolution

The device resolution to use. Currently (for iOS) only 1080p is supported.

1080p

zoomGesture

(iOS only) A boolean indicating whether pinch-to-zoom is enabled for the scan view

false

focalLength

The zoom factor (magnification) used by the camera

1

maxFocalLength

If zoomGesture is enabled, defines the maximum magnification factor possible

0

flashConfig

A flashConfig configures the flash (or torch) module which can be used to brighten up the sample for more accurate scanning.

Property Name Note Default Value

flashMode

Determines whether the flash toggle is hidden (none), visible with torch starting disabled (manual_off), starting enabled (manual_on), or on automatic mode (auto), which turns torch on or off based on ambient lighting

manual_off

flashAlignment

Position of the flash toggle within the scan view, if visible. Possible values: top, top_left, top_right, bottom, bottom_left, bottom_right

top_left

flashOffset

Position offset of the flash toggle within the scan view, after flashAlignment is evaluated

{ "x": 0, "y": 0 }

flashImage

String indicating the image name of the flash toggle. If null, will use the default flash toggle image.

null

Get help

If there is anything you are missing, you require support or want to provide us with feedback, reach out to us via Helpdesk or Support.