1#![allow(deprecated)]slint::slint!{#[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/examples"#]
2// Copyright © SixtyFPS GmbH <info@slint.dev>
3// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial
4
5RectPath := Path {
6 MoveTo {
7 x: 0;
8 y: 0;
9 }
10
11 LineTo {
12 x: 100;
13 y: 0;
14 }
15
16 LineTo {
17 x: 100;
18 y: 100;
19 }
20
21 LineTo {
22 x: 0;
23 y: 100;
24 }
25
26 Close {}
27}
28
29PathViewBox := Window {
30 preferred-width: 600px;
31 preferred-height: 600px;
32
33 // This is the reference path rectangle
34 RectPath {
35 x: 100px;
36 y: 100px;
37 width: 100px;
38 height: 100px;
39
40 stroke-width: 1px;
41 stroke: black;
42 }
43
44 // This path rectangle uses an unclipped viewbox and therefore
45 // draws outside the boundaries of the underlying green rectangle.
46 Rectangle {
47 background: #26e115da;
48 x: 300px;
49 y: 100px;
50 width: 100px;
51 height: 100px;
52
53 RectPath {
54 width: 100px;
55 height: 100px;
56
57 stroke-width: 1px;
58 stroke: black;
59
60 viewbox-x: 50;
61 viewbox-y: 0;
62 viewbox-width: 100;
63 viewbox-height: 100;
64 }
65 }
66
67 // This path rectangle uses an clipped viewbox and therefore
68 // draws only inside the boundaries of the underlying green rectangle.
69 Rectangle {
70 background: #26e115da;
71 x: 100px;
72 y: 300px;
73 width: 100px;
74 height: 100px;
75
76 RectPath {
77 width: 100px;
78 height: 100px;
79
80 stroke-width: 1px;
81 stroke: black;
82
83 clip: true;
84
85 viewbox-x: 50;
86 viewbox-y: 0;
87 viewbox-width: 100;
88 viewbox-height: 100;
89 }
90 }
91}
92}
93