feat: linear gradient default image

This commit is contained in:
electria 2026-06-28 18:12:18 -07:00
commit f32263df62
Signed by: electria
SSH key fingerprint: SHA256:8LlB3ucPbBHqozqkhsNbaV5oG3SlzzqUj8FZDL6IPQs

View file

@ -5,7 +5,7 @@ use iced::{
keyboard::{self, Key, key},
theme, widget, window,
};
use image::{EncodableLayout, ImageReader, RgbaImage, imageops};
use image::{EncodableLayout, ImageReader, Pixel, Rgba, RgbaImage, imageops};
#[derive(Clone, Debug)]
enum Message {
@ -28,7 +28,15 @@ impl State {
.unwrap()
.into_rgba8()
} 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 {