Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4defcfc

Browse files
committed
Merge branch 'master' into 0.6
2 parents665c85f +4c61f12 commit4defcfc

File tree

109 files changed

+3286
-1417
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+3286
-1417
lines changed

‎CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,39 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
##[Unreleased]
88

9+
##[0.6.0] - 2022-12-07
10+
###Added
11+
- Support for non-uniform border radius for`Primitive::Quad`.[#1506](https://github.com/iced-rs/iced/pull/1506)
12+
- Operation to query the current focused widget.[#1526](https://github.com/iced-rs/iced/pull/1526)
13+
- Additional operations for`TextInput`.[#1529](https://github.com/iced-rs/iced/pull/1529)
14+
- Styling support for`Svg`.[#1578](https://github.com/iced-rs/iced/pull/1578)
15+
16+
###Changed
17+
- Triangle geometry using a solid color is now drawn in a single draw call.[#1538](https://github.com/iced-rs/iced/pull/1538)
18+
19+
###Fixed
20+
- Gradients for WebAssembly target.[#1524](https://github.com/iced-rs/iced/pull/1524)
21+
-`Overlay` layout cache not being invalidated.[#1528](https://github.com/iced-rs/iced/pull/1528)
22+
- Operations not working for`PaneGrid`.[#1533](https://github.com/iced-rs/iced/pull/1533)
23+
- Mapped`widget::Operation` always returning`Outcome::None`.[#1536](https://github.com/iced-rs/iced/pull/1536)
24+
- Padding of`TextInput` with`Length::Units` width.[#1539](https://github.com/iced-rs/iced/pull/1539)
25+
- Clipping of`Image` and`Svg` widgets in`iced_glow`.[#1557](https://github.com/iced-rs/iced/pull/1557)
26+
- Invalid links in documentation.[#1560](https://github.com/iced-rs/iced/pull/1560)
27+
-`Custom` style of`PickList` widget.[#1570](https://github.com/iced-rs/iced/pull/1570)
28+
- Scroller in`Scrollable` always being drawn.[#1574](https://github.com/iced-rs/iced/pull/1574)
29+
30+
Many thanks to...
31+
32+
-@bungoboingo
33+
-@l1Dan
34+
-@mmstick
35+
-@mtkennerly
36+
-@PolyMeilex
37+
-@rksm
38+
-@rs017991
39+
-@tarkah
40+
-@wash2
41+
942
##[0.5.0] - 2022-11-10
1043
###Added
1144
-__[Stabilization of stateless widgets][stateless]__ (#1393)

‎Cargo.toml

Lines changed: 9 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name ="iced"
3-
version ="0.5.2"
3+
version ="0.6.0"
44
authors = ["Héctor Ramón Jiménez <hector0193@gmail.com>"]
55
edition ="2021"
66
description ="A cross-platform GUI library inspired by Elm"
@@ -55,48 +55,17 @@ members = [
5555
"style",
5656
"wgpu",
5757
"winit",
58-
"examples/arc",
59-
"examples/bezier_tool",
60-
"examples/clock",
61-
"examples/color_palette",
62-
"examples/component",
63-
"examples/counter",
64-
"examples/custom_widget",
65-
"examples/download_progress",
66-
"examples/events",
67-
"examples/exit",
68-
"examples/game_of_life",
69-
"examples/integration_opengl",
70-
"examples/integration_wgpu",
71-
"examples/lazy",
72-
"examples/modern_art",
73-
"examples/multitouch",
74-
"examples/pane_grid",
75-
"examples/pick_list",
76-
"examples/pokedex",
77-
"examples/progress_bar",
78-
"examples/qr_code",
79-
"examples/scrollable",
80-
"examples/sierpinski_triangle",
81-
"examples/solar_system",
82-
"examples/stopwatch",
83-
"examples/styling",
84-
"examples/svg",
85-
"examples/system_information",
86-
"examples/todos",
87-
"examples/tooltip",
88-
"examples/tour",
89-
"examples/websocket",
58+
"examples/*",
9059
]
9160

9261
[dependencies]
9362
iced_core = {version ="0.6",path ="core" }
9463
iced_futures = {version ="0.5",path ="futures" }
95-
iced_native = {version ="0.6",path ="native" }
96-
iced_graphics = {version ="0.4",path ="graphics" }
97-
iced_winit = {version ="0.5",path ="winit",features = ["application"] }
98-
iced_glutin = {version ="0.4",path ="glutin",optional =true }
99-
iced_glow = {version ="0.4",path ="glow",optional =true }
64+
iced_native = {version ="0.7",path ="native" }
65+
iced_graphics = {version ="0.5",path ="graphics" }
66+
iced_winit = {version ="0.6",path ="winit",features = ["application"] }
67+
iced_glutin = {version ="0.5",path ="glutin",optional =true }
68+
iced_glow = {version ="0.5",path ="glow",optional =true }
10069
thiserror ="1.0"
10170

10271
[dependencies.image_rs]
@@ -105,10 +74,10 @@ package = "image"
10574
optional =true
10675

10776
[target.'cfg(not(target_arch="wasm32"))'.dependencies]
108-
iced_wgpu = {version ="0.6",path ="wgpu",optional =true }
77+
iced_wgpu = {version ="0.7",path ="wgpu",optional =true }
10978

11079
[target.'cfg(target_arch="wasm32")'.dependencies]
111-
iced_wgpu = {version ="0.6",path ="wgpu",features = ["webgl"],optional =true }
80+
iced_wgpu = {version ="0.7",path ="wgpu",features = ["webgl"],optional =true }
11281

11382
[package.metadata.docs.rs]
11483
rustdoc-args = ["--cfg","docsrs"]

‎README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ __Iced is currently experimental software.__ [Take a look at the roadmap],
6868
Add`iced` as a dependency in your`Cargo.toml`:
6969

7070
```toml
71-
iced ="0.5"
71+
iced ="0.6"
7272
```
7373

7474
If your project is using a Rust edition older than 2021, then you will need to
@@ -215,7 +215,7 @@ cargo run --features iced/glow --package game_of_life
215215
and then use it in your project with
216216

217217
```toml
218-
iced = {version ="0.5",default-features =false,features = ["glow"] }
218+
iced = {version ="0.6",default-features =false,features = ["glow"] }
219219
```
220220

221221
__NOTE:__ Chances are you have hardware that supports at least OpenGL 2.1 or OpenGL ES 2.0,

‎core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name ="iced_core"
3-
version ="0.6.1"
3+
version ="0.6.2"
44
authors = ["Héctor Ramón Jiménez <hector0193@gmail.com>"]
55
edition ="2021"
66
description ="The essential concepts of Iced"

‎core/src/color.rs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,17 @@ impl Color {
8989
}
9090
}
9191

92+
/// Converts the [`Color`] into its RGBA8 equivalent.
93+
#[must_use]
94+
pubfninto_rgba8(self) ->[u8;4]{
95+
[
96+
(self.r*255.0).round()asu8,
97+
(self.g*255.0).round()asu8,
98+
(self.b*255.0).round()asu8,
99+
(self.a*255.0).round()asu8,
100+
]
101+
}
102+
92103
/// Converts the [`Color`] into its linear values.
93104
pubfninto_linear(self) ->[f32;4]{
94105
// As described in:
@@ -148,24 +159,26 @@ impl From<[f32; 4]> for Color {
148159
#[macro_export]
149160
macro_rules! color{
150161
($r:expr, $g:expr, $b:expr) =>{
151-
Color::from_rgb8($r, $g, $b)
162+
$crate::Color::from_rgb8($r, $g, $b)
152163
};
153164
($r:expr, $g:expr, $b:expr, $a:expr) =>{
154-
Color::from_rgba8($r, $g, $b, $a)
165+
$crate::Color::from_rgba8($r, $g, $b, $a)
155166
};
156167
($hex:expr) =>{{
157168
let hex = $hexasu32;
158169
let r =(hex&0xff0000) >>16;
159170
let g =(hex&0xff00) >>8;
160171
let b =(hex&0xff);
161-
Color::from_rgb8(rasu8, gasu8, basu8)
172+
173+
$crate::Color::from_rgb8(rasu8, gasu8, basu8)
162174
}};
163175
($hex:expr, $a:expr) =>{{
164176
let hex = $hexasu32;
165177
let r =(hex&0xff0000) >>16;
166178
let g =(hex&0xff00) >>8;
167179
let b =(hex&0xff);
168-
Color::from_rgba8(rasu8, gasu8, basu8, $a)
180+
181+
$crate::Color::from_rgba8(rasu8, gasu8, basu8, $a)
169182
}};
170183
}
171184

‎core/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//! ![The foundations of the Iced ecosystem](https://github.com/iced-rs/iced/blob/0525d76ff94e828b7b21634fa94a747022001c83/docs/graphs/foundations.png?raw=true)
88
//!
99
//! [Iced]: https://github.com/iced-rs/iced
10-
//! [`iced_native`]: https://github.com/iced-rs/iced/tree/0.5/native
10+
//! [`iced_native`]: https://github.com/iced-rs/iced/tree/0.6/native
1111
//! [`iced_web`]: https://github.com/iced-rs/iced_web
1212
#![doc(
1313
html_logo_url ="https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg"

‎examples/custom_quad/Cargo.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[package]
2+
name ="custom_quad"
3+
version ="0.1.0"
4+
authors = ["Robert Krahn"]
5+
edition ="2021"
6+
publish =false
7+
8+
[dependencies]
9+
iced = {path ="../.." }
10+
iced_native = {path ="../../native" }

‎examples/custom_quad/src/main.rs

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
//! This example showcases a drawing a quad.
2+
mod quad{
3+
use iced_native::layout::{self,Layout};
4+
use iced_native::renderer;
5+
use iced_native::widget::{self,Widget};
6+
use iced_native::{Color,Element,Length,Point,Rectangle,Size};
7+
8+
pubstructCustomQuad{
9+
size:f32,
10+
radius:[f32;4],
11+
border_width:f32,
12+
}
13+
14+
implCustomQuad{
15+
pubfnnew(size:f32,radius:[f32;4],border_width:f32) ->Self{
16+
Self{
17+
size,
18+
radius,
19+
border_width,
20+
}
21+
}
22+
}
23+
24+
impl<Message,Renderer>Widget<Message,Renderer>forCustomQuad
25+
where
26+
Renderer: renderer::Renderer,
27+
{
28+
fnwidth(&self) ->Length{
29+
Length::Shrink
30+
}
31+
32+
fnheight(&self) ->Length{
33+
Length::Shrink
34+
}
35+
36+
fnlayout(
37+
&self,
38+
_renderer:&Renderer,
39+
_limits:&layout::Limits,
40+
) -> layout::Node{
41+
layout::Node::new(Size::new(self.size,self.size))
42+
}
43+
44+
fndraw(
45+
&self,
46+
_state:&widget::Tree,
47+
renderer:&mutRenderer,
48+
_theme:&Renderer::Theme,
49+
_style:&renderer::Style,
50+
layout:Layout<'_>,
51+
_cursor_position:Point,
52+
_viewport:&Rectangle,
53+
){
54+
renderer.fill_quad(
55+
renderer::Quad{
56+
bounds: layout.bounds(),
57+
border_radius:self.radius.into(),
58+
border_width:self.border_width,
59+
border_color:Color::from_rgb(1.0,0.0,0.0),
60+
},
61+
Color::BLACK,
62+
);
63+
}
64+
}
65+
66+
impl<'a,Message,Renderer>From<CustomQuad>forElement<'a,Message,Renderer>
67+
where
68+
Renderer: renderer::Renderer,
69+
{
70+
fnfrom(circle:CustomQuad) ->Self{
71+
Self::new(circle)
72+
}
73+
}
74+
}
75+
76+
use iced::widget::{column, container, slider, text};
77+
use iced::{Alignment,Element,Length,Sandbox,Settings};
78+
79+
pubfnmain() -> iced::Result{
80+
Example::run(Settings::default())
81+
}
82+
83+
structExample{
84+
radius:[f32;4],
85+
border_width:f32,
86+
}
87+
88+
#[derive(Debug,Clone,Copy)]
89+
#[allow(clippy::enum_variant_names)]
90+
enumMessage{
91+
RadiusTopLeftChanged(f32),
92+
RadiusTopRightChanged(f32),
93+
RadiusBottomRightChanged(f32),
94+
RadiusBottomLeftChanged(f32),
95+
BorderWidthChanged(f32),
96+
}
97+
98+
implSandboxforExample{
99+
typeMessage =Message;
100+
101+
fnnew() ->Self{
102+
Self{
103+
radius:[50.0;4],
104+
border_width:0.0,
105+
}
106+
}
107+
108+
fntitle(&self) ->String{
109+
String::from("Custom widget - Iced")
110+
}
111+
112+
fnupdate(&mutself,message:Message){
113+
let[tl, tr, br, bl] =self.radius;
114+
match message{
115+
Message::RadiusTopLeftChanged(radius) =>{
116+
self.radius =[radius, tr, br, bl];
117+
}
118+
Message::RadiusTopRightChanged(radius) =>{
119+
self.radius =[tl, radius, br, bl];
120+
}
121+
Message::RadiusBottomRightChanged(radius) =>{
122+
self.radius =[tl, tr, radius, bl];
123+
}
124+
Message::RadiusBottomLeftChanged(radius) =>{
125+
self.radius =[tl, tr, br, radius];
126+
}
127+
Message::BorderWidthChanged(width) =>{
128+
self.border_width = width;
129+
}
130+
}
131+
}
132+
133+
fnview(&self) ->Element<Message>{
134+
let[tl, tr, br, bl] =self.radius;
135+
136+
let content =column![
137+
quad::CustomQuad::new(200.0,self.radius,self.border_width),
138+
text(format!("Radius: {tl:.2}/{tr:.2}/{br:.2}/{bl:.2}")),
139+
slider(1.0..=100.0, tl,Message::RadiusTopLeftChanged).step(0.01),
140+
slider(1.0..=100.0, tr,Message::RadiusTopRightChanged).step(0.01),
141+
slider(1.0..=100.0, br,Message::RadiusBottomRightChanged)
142+
.step(0.01),
143+
slider(1.0..=100.0, bl,Message::RadiusBottomLeftChanged)
144+
.step(0.01),
145+
slider(1.0..=10.0,self.border_width,Message::BorderWidthChanged)
146+
.step(0.01),
147+
]
148+
.padding(20)
149+
.spacing(20)
150+
.max_width(500)
151+
.align_items(Alignment::Center);
152+
153+
container(content)
154+
.width(Length::Fill)
155+
.height(Length::Fill)
156+
.center_x()
157+
.center_y()
158+
.into()
159+
}
160+
}

‎examples/custom_widget/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ mod circle {
6161
renderer.fill_quad(
6262
renderer::Quad{
6363
bounds: layout.bounds(),
64-
border_radius:self.radius,
64+
border_radius:self.radius.into(),
6565
border_width:0.0,
6666
border_color:Color::TRANSPARENT,
6767
},

‎examples/geometry/Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[package]
2+
name ="geometry"
3+
version ="0.1.0"
4+
authors = ["Héctor Ramón Jiménez <hector0193@gmail.com>"]
5+
edition ="2021"
6+
publish =false
7+
8+
[dependencies]
9+
iced = {path ="../.." }
10+
iced_native = {path ="../../native" }
11+
iced_graphics = {path ="../../graphics" }

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp