Device Structure
About 729 words
- Type: Map
- Position: the
devicesregistry in the Header Extension
A Device describes where a display area is and how large it is: it can be a monitor (Display), or a window inside a monitor or a "board within a board" (Window). Device is not a top-level block; it appears only in the registry.
Levels
- Core: only needs to know which Devices exist, and shows the Canvases of the first Device per FILE-9.
- Full: positions of multiple Devices, Window nesting and
zIndexcompositing.
Units
- DEV-1 Device position and size use pixels: a Display uses pixel coordinates of the system virtual desktop, and a Window uses the pixel coordinates of its parent Device. Canvas coordinates and stroke widths use the pixels of the Device they belong to (INK-6).
- DEV-2 The file does not record DPI scaling. When the same file is opened on screens with different DPI, the physical size of strokes relative to the screen may differ; apps that need to keep the visual size may adjust the Canvas
viewport.scale. - DEV-3 A Device describes only the display area itself, not which part of the Canvas it is looking at; that is the job of the Canvas
viewport. The Devicex/ymust not be used as aviewport.
Common fields
| Field | Type | Requirement | Description |
|---|---|---|---|
guid | string(36) | Required | Permanent UUID of the Device |
deviceType | int32 | Required | 0 Display, 1 Window; 2–127 reserved, 128+ private |
name | string | Optional | Display name |
hardware | Map | Optional | Matching information for the physical monitor; Display only |
extra | Map | Optional | App-private fields |
Display
| Field | Type | Requirement | Description |
|---|---|---|---|
x | int32 | Required | X origin in the system virtual desktop; may be negative |
y | int32 | Required | Y origin in the system virtual desktop; may be negative |
width | uint32 | Required | Width, greater than 0 |
height | uint32 | Required | Height, greater than 0 |
Hardware Map
All fields are optional and are used only to match the Device to an actual monitor:
| Field | Type | Description |
|---|---|---|
name | string | Name reported by the hardware |
id | string | Hardware identifier provided by the platform |
identifiers | Map<string, string> | Other identifiers; keys and values are both strings |
physicalWidth | uint32 | Native resolution width, greater than 0 |
physicalHeight | uint32 | Native resolution height, greater than 0 |
scaleFactor | float32 | System display scaling at save time, for reference only; a finite positive number |
- DEV-4 Information in
hardwaredoes not take part in coordinate calculations. When the hardware cannot be matched, readers still continue loading with the saved geometry or the current display area.
Window
| Field | Type | Requirement | Description |
|---|---|---|---|
parentDeviceGuid | string(36) | Required | Parent Display or Window |
x | float32 | Required | X relative to the parent Device |
y | float32 | Required | Y relative to the parent Device |
width | float32 | Required | Width, greater than 0 |
height | float32 | Required | Height, greater than 0 |
zIndex | uint32 | Required | Stacking order under the same parent Device; larger is closer to the front |
- Monitor 1Display ·
deviceType 0x- 0
y- 0
width- 3840
height- 2160
- Monitor 2Display ·
deviceType 0x- 3840
y- 0
width- 1920
height- 1080
- Board within a boardWindow ·
deviceType 1parentDeviceGuid- → Monitor 1
x- 120.0
y- 80.0
width- 1280.0
height- 720.0
zIndex- 10
x / y relative to the parent Device (Monitor 1)
- DEV-5 A Window may nest Windows and may extend partly beyond its parent area; the host clips the part outside.
- DEV-6 When
zIndexis equal, the Window registered later is on top (FILE-13). - DEV-7 The Device tree must not contain cycles. When
parentDeviceGuidcannot be found or forms a cycle, readers break the reference, treat the Window as a temporary root display area, and report a warning (FILE-22). - DEV-8 Unknown
deviceType: treated as a root display area used temporarily for the current load (FILE-21).
Example
[
{
"guid": "11111111-1111-4111-8111-111111111111",
"deviceType": 0,
"name": "Main display",
"x": 0, "y": 0, "width": 3840, "height": 2160,
"hardware": { "id": "DISPLAY\\ACR1234", "scaleFactor": 1.5 }
},
{
"guid": "22222222-2222-4222-8222-222222222222",
"deviceType": 1,
"name": "Board within a board",
"parentDeviceGuid": "11111111-1111-4111-8111-111111111111",
"x": 120.0, "y": 80.0, "width": 1280.0, "height": 720.0,
"zIndex": 10
}
]Fallback
| Capability the reader lacks | How it is shown |
|---|---|
| Multiple Devices (below Full) | Show only the Canvases of the first registered Device, or let the user choose |
| Window compositing (below Full) | Canvases on a Window are shown as independent pages, not overlaid on the parent Device |