mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 14:21:16 +00:00
Use the color property of the window as a background
This commit is contained in:
parent
61399e566a
commit
b42c16851a
3 changed files with 10 additions and 10 deletions
|
@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- title property to the Window element
|
- title property to the Window element
|
||||||
|
- color property to the Window element
|
||||||
|
|
||||||
|
|
||||||
## [0.0.4] - 2020-12-04
|
## [0.0.4] - 2020-12-04
|
||||||
|
|
|
@ -13,11 +13,7 @@ App := Window {
|
||||||
width: 500px;
|
width: 500px;
|
||||||
height: 550px;
|
height: 550px;
|
||||||
title: "SixtyFPS Gallery";
|
title: "SixtyFPS Gallery";
|
||||||
Rectangle {
|
color: #ecedeb;
|
||||||
color: #ecedeb;
|
|
||||||
width: parent.width;
|
|
||||||
height: parent.height;
|
|
||||||
}
|
|
||||||
|
|
||||||
VerticalLayout {
|
VerticalLayout {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
|
|
|
@ -722,11 +722,14 @@ impl<Backend: GraphicsBackend> crate::eventloop::GenericWindow for GraphicsWindo
|
||||||
let window = map_state.as_mapped();
|
let window = map_state.as_mapped();
|
||||||
let mut backend = window.backend.borrow_mut();
|
let mut backend = window.backend.borrow_mut();
|
||||||
let size = backend.window().inner_size();
|
let size = backend.window().inner_size();
|
||||||
let mut frame = backend.new_frame(
|
let root_item = component.as_ref().get_item_ref(0);
|
||||||
size.width,
|
let background_color = if let Some(window_item) = ItemRef::downcast_pin(root_item) {
|
||||||
size.height,
|
crate::items::Window::FIELD_OFFSETS.color.apply_pin(window_item).get()
|
||||||
&RgbaColor { red: 255 as u8, green: 255, blue: 255, alpha: 255 }.into(),
|
} else {
|
||||||
);
|
RgbaColor { red: 255 as u8, green: 255, blue: 255, alpha: 255 }.into()
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut frame = backend.new_frame(size.width, size.height, &background_color);
|
||||||
crate::item_rendering::render_component_items(
|
crate::item_rendering::render_component_items(
|
||||||
&component_rc,
|
&component_rc,
|
||||||
&mut frame,
|
&mut frame,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue