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
|
||||
- title property to the Window element
|
||||
- color property to the Window element
|
||||
|
||||
|
||||
## [0.0.4] - 2020-12-04
|
||||
|
|
|
@ -13,11 +13,7 @@ App := Window {
|
|||
width: 500px;
|
||||
height: 550px;
|
||||
title: "SixtyFPS Gallery";
|
||||
Rectangle {
|
||||
color: #ecedeb;
|
||||
width: parent.width;
|
||||
height: parent.height;
|
||||
}
|
||||
color: #ecedeb;
|
||||
|
||||
VerticalLayout {
|
||||
padding: 20px;
|
||||
|
|
|
@ -722,11 +722,14 @@ impl<Backend: GraphicsBackend> crate::eventloop::GenericWindow for GraphicsWindo
|
|||
let window = map_state.as_mapped();
|
||||
let mut backend = window.backend.borrow_mut();
|
||||
let size = backend.window().inner_size();
|
||||
let mut frame = backend.new_frame(
|
||||
size.width,
|
||||
size.height,
|
||||
&RgbaColor { red: 255 as u8, green: 255, blue: 255, alpha: 255 }.into(),
|
||||
);
|
||||
let root_item = component.as_ref().get_item_ref(0);
|
||||
let background_color = if let Some(window_item) = ItemRef::downcast_pin(root_item) {
|
||||
crate::items::Window::FIELD_OFFSETS.color.apply_pin(window_item).get()
|
||||
} 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(
|
||||
&component_rc,
|
||||
&mut frame,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue