1 | // Copyright © SixtyFPS GmbH <info@slint.dev> |
2 | // SPDX-License-Identifier: MIT |
3 | |
4 | import { Slider, GroupBox, HorizontalBox, VerticalBox, GridBox } from "std-widgets.slint" ; |
5 | |
6 | export component App inherits Window { |
7 | in property <image> texture <=> image.source; |
8 | out property <int> requested-texture-width: image.width/1phx; |
9 | out property <int> requested-texture-height: image.height/1phx; |
10 | out property <float> selected-red <=> red.value; |
11 | out property <float> selected-green <=> green.value; |
12 | out property <float> selected-blue <=> blue.value; |
13 | |
14 | preferred-width: 500px; |
15 | preferred-height: 600px; |
16 | title: "Slint OpenGL Texture Example" ; |
17 | icon: @image-url("../../logo/slint-logo-small-light.png" ); |
18 | |
19 | VerticalBox { |
20 | Text { |
21 | text: "This text is rendered using Slint. The rotating cube below is rendered into an OpenGL texture." ; |
22 | wrap: word-wrap; |
23 | } |
24 | |
25 | image := Image { |
26 | preferred-width: 640px; |
27 | preferred-height: 640px; |
28 | min-width: 64px; |
29 | min-height: 64px; |
30 | width: 100%; |
31 | //height: 100%; |
32 | } |
33 | |
34 | GroupBox { |
35 | title: "Cube Color Controls" ; |
36 | |
37 | GridBox { |
38 | Row { |
39 | Text { |
40 | text: "Red:" ; |
41 | vertical-alignment: center; |
42 | } |
43 | |
44 | red := Slider { |
45 | minimum: 0.1; |
46 | maximum: 1.0; |
47 | value: 0.2; |
48 | } |
49 | } |
50 | |
51 | Row { |
52 | Text { |
53 | text: "Green:" ; |
54 | vertical-alignment: center; |
55 | } |
56 | |
57 | green := Slider { |
58 | minimum: 0.1; |
59 | maximum: 1.0; |
60 | value: 0.5; |
61 | } |
62 | } |
63 | |
64 | Row { |
65 | Text { |
66 | text: "Blue:" ; |
67 | vertical-alignment: center; |
68 | } |
69 | |
70 | blue := Slider { |
71 | minimum: 0.1; |
72 | maximum: 1.0; |
73 | value: 0.9; |
74 | } |
75 | } |
76 | } |
77 | } |
78 | } |
79 | } |
80 | |