# Common Data Structures#

## Geometric Types#

Defined under the namespace Scandit.Datacapture.Core

`MeasureUnit`#

Specifies in what units the value has been specified (fraction, device-independent pixels, pixels).

`DIP`#

Value is measured in device-independent pixels.

`Pixel`#

Value is measured in pixels.

`Fraction`#

Value is measured as a fraction. Valid values range from 0 to 1. This can be used to specify values in relative coordinates with respect to a reference, e.g. the view width or height.

`SizingMode`#

An enumeration of possible ways to define a rectangular size.

`WidthAndHeight`#

This value will use a SizeWithUnit to determine width and the height.

`WidthAndAspectRatio`#

This value will use a NumberWithUnit to determine the width and a float multiplier to determine the height.

`HeightAndAspectRatio`#

This value will use a NumberWithUnit to determine the height and a float multiplier to determine the width.

`Point`#
``class Point``

`constructor(x, y)`#
````constructor`(x: number,
y: number)```

Construct a new point at position x and y.

`x`#
```get x(): number
```

X coordinate of the point.

`y`#
```get y(): number
```

Y coordinate of the point.

`PointWithUnit`#
``class PointWithUnit``

`x`#
```get x(): NumberWithUnit
```

X coordinate of the point.

`y`#
```get y(): NumberWithUnit
```

Y coordinate of the point.

`Rect`#
``class Rect``

`constructor(origin, size)`#
````constructor`(origin: Point,
size: Size)```

Construct a new rectangle.

`origin`#
```get origin(): Point
```

The origin (top-left corner) of the rectangle.

`size`#
```get size(): Size
```

The size of the rectangle.

`RectWithUnit`#
``class RectWithUnit``

`origin`#
```get origin(): PointWithUnit
```

The origin (top-left corner) of the rectangle.

`size`#
```get size(): SizeWithUnit
```

The size of the rectangle.

`SizeWithUnit`#
``class SizeWithUnit``

`width`#
```get width(): NumberWithUnit
```

The width.

`height`#
```get height(): NumberWithUnit
```

The height.

`SizeWithAspect`#
``class SizeWithAspect``

Holds values to define a rectangular size using a dimension and an aspect ratio multiplier.

`size`#
```get size(): NumberWithUnit
```

The size of one dimension.

`aspect`#
```get aspect(): number
```

The aspect ratio for the other dimension.

`NumberWithUnit`#
``class NumberWithUnit``

Holds a floating-point value plus a measure unit.

`value`#
```get value(): number
```

`unit`#
```get unit(): MeasureUnit
```

`MarginsWithUnit`#
``class MarginsWithUnit``

Holds margin values (left, top, right, bottom) that can each be expressed with a different measure unit.

`left`#
```get left(): NumberWithUnit
```

Left margin.

`right`#
```get right(): NumberWithUnit
```

Right margin.

`top`#
```get top(): NumberWithUnit
```

Top margin.

`bottom`#
```get bottom(): NumberWithUnit
```

Bottom margin.

`Quadrilateral`#
``class Quadrilateral``

Polygon represented by 4 corners.

`topLeft`#
```get topLeft(): Point
```

`topRight`#
```get topRight(): Point
```

`bottomRight`#
```get bottomRight(): Point
```

`bottomLeft`#
```get bottomLeft(): Point
```

`Size`#
``class Size``

`constructor(width, height)`#
````constructor`(width: number,
height: number)```

`width`#
```get width(): number
```

The width.

`height`#
```get height(): number
```

The height.

`SizeWithUnitAndAspect`#
``class SizeWithUnitAndAspect``

Holds a SizingMode - and corresponding required values - to define a rectangular size.

`widthAndHeight`#
```get widthAndHeight(): SizeWithUnit | null
```

The values for width and height.

Note

This value will always be null unless sizingMode is SizingMode.WidthAndHeight.

`widthAndAspectRatio`#
```get widthAndAspectRatio(): SizeWithAspect | null
```

The value for width and the aspect ratio for height.

Note

This value will always be null unless sizingMode is SizingMode.WidthAndAspectRatio.

`heightAndAspectRatio`#
```get heightAndAspectRatio(): SizeWithAspect | null
```

The value for height and the aspect ratio for width.

Note

This value will always be null unless sizingMode is SizingMode.HeightAndAspectRatio.

`sizingMode`#
```get sizingMode(): SizingMode
```

The sizing mode.

## Misc Types#

Defined under the namespace Scandit.Datacapture.Core

Defined under the namespace Scandit.Datacapture.Core

`EncodingRange`#
``class EncodingRange``

Defines the encoding of a range of bytes.

`ianaName`#
```get ianaName(): string
```

Charset encoding name as defined by IANA.

`startIndex`#
```get startIndex(): number
```

Start index of this encoding range.

`endIndex`#
```get endIndex(): number
```

End index (first index after the last) of this encoding range.

`Orientation`#

`Unknown`#

`Portrait`#

`PortraitUpsideDown`#

`LandscapeRight`#

`LandscapeLeft`#

`Color`#
``class Color``

`fromHex(hex)`#
`static `fromHex`(hex: string): Color`

Create a color from a hexadecimal string. Colors can be represented by hexadecimal strings in the following formats (R = red, G = green, B = blue, A = alpha) with an optional # prefix. The characters can be upper or lower case:

• RRGGBB

• RRGGBBAA

• #RRGGBB

• #RRGGBBAA

• RGB

• RGBA

• #RGB

• #RGBA

`fromRGBA(red, green, blue, alpha)`#
```static `fromRGBA`(red: number,
green: number,
blue: number,
alpha: number): Color```

Create a color from numerical color components.

`withAlpha(alpha)`#
``withAlpha`(alpha: number): Color`

Create a color that only differs in it’s alpha component.

`redComponent`#
```get redComponent(): string
```

Red component of the color as a hexadecimal string.

`greenComponent`#
```get greenComponent(): string
```

Green component of the color as a hexadecimal string.

`blueComponent`#
```get blueComponent(): string
```

Blue component of the color as a hexadecimal string.

`alphaComponent`#
```get alphaComponent(): string
```

Alpha component of the color as a hexadecimal string.

`red`#
```get red(): number
```

Red component of the color as a decimal value.

`green`#
```get green(): number
```

Green component of the color as a decimal value.

`blue`#
```get blue(): number
```

`alpha`#
```get alpha(): number