feat: linear gradient default image
This commit is contained in:
parent
090076a26f
commit
f32263df62
1 changed files with 10 additions and 2 deletions
12
src/main.rs
12
src/main.rs
|
|
@ -5,7 +5,7 @@ use iced::{
|
||||||
keyboard::{self, Key, key},
|
keyboard::{self, Key, key},
|
||||||
theme, widget, window,
|
theme, widget, window,
|
||||||
};
|
};
|
||||||
use image::{EncodableLayout, ImageReader, RgbaImage, imageops};
|
use image::{EncodableLayout, ImageReader, Pixel, Rgba, RgbaImage, imageops};
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
enum Message {
|
enum Message {
|
||||||
|
|
@ -28,7 +28,15 @@ impl State {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.into_rgba8()
|
.into_rgba8()
|
||||||
} else {
|
} else {
|
||||||
RgbaImage::new(100, 100)
|
let mut image = RgbaImage::new(100, 100);
|
||||||
|
|
||||||
|
imageops::horizontal_gradient(
|
||||||
|
&mut image,
|
||||||
|
Rgba::from_slice(&[0, 0, 0, 0]),
|
||||||
|
Rgba::from_slice(&[255, 255, 255, 255]),
|
||||||
|
);
|
||||||
|
|
||||||
|
image
|
||||||
};
|
};
|
||||||
|
|
||||||
let state = State {
|
let state = State {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue