# `VideoResolution`

A video's frame size in pixels, written `1920x1080`: by its pixels, not a name like "4K".

[Media and visual](types.md#media-and-visual); not ordered; since Jadpo 0.1.0.

## Make one

Build one from its fields, `VideoResolution { width: ...  height: ... }`.

`text.parse(raw, as: VideoResolution)` reads one from its text; text that isn't one at all fails `malformed`, such as `0x1080`, `1920x0` or `1920X1080`.

## Fields

| Field | Type |
|---|---|
| `width` | `Int` |
| `height` | `Int` |

## Text, JSON and storage

`text.from` writes its canonical text, the one form `text.parse` reads back. JSON sends an object of its parts.

| Text | JSON |
|---|---|
| `1280x720` | `{"width":1280,"height":720}` |
| `1920x1080` | `{"width":1920,"height":1080}` |
| `3840x2160` | `{"width":3840,"height":2160}` |
| `4096x2160` | `{"width":4096,"height":2160}` |

It is stored in 2 columns, each named for the field, `_` and its suffix. This is `3840x2160`:

| Column | Type | Holds |
|---|---|---|
| `<field>_width` | `integer` | `3840` |
| `<field>_height` | `integer` | `2160` |

## Shown to people

`text.format(value, locale:)` shows it to people in their locale.

With `locale: Locale.en_gb`:

| Value | Shown |
|---|---|
| `1280x720` | `1280x720` |
| `1920x1080` | `1920x1080` |
| `3840x2160` | `3840x2160` |
| `4096x2160` | `4096x2160` |

## Operations

It has the contract's own operations: `text.parse`, `text.from`, `text.format`, `json.read`, `json.write` and `==`. It isn't ordered, so `<` and sorting don't take it. [Every standard type meets one contract](../topics/every-standard-type-meets-one-contract.md) says how they work.
