Avoid iced_image import in screenshot example
This commit is contained in:
parent
c1021c7175
commit
7adfaa88a6
1 changed files with 4 additions and 5 deletions
|
|
@ -1,18 +1,17 @@
|
||||||
|
use ::image as img;
|
||||||
|
use ::image::ColorType;
|
||||||
use iced::alignment::{Horizontal, Vertical};
|
use iced::alignment::{Horizontal, Vertical};
|
||||||
use iced::keyboard::KeyCode;
|
use iced::keyboard::KeyCode;
|
||||||
use iced::theme::{Button, Container};
|
use iced::theme::{Button, Container};
|
||||||
use iced::widget::runtime::{CropError, Screenshot};
|
use iced::widget::runtime::{CropError, Screenshot};
|
||||||
use iced::widget::{
|
use iced::widget::{
|
||||||
button, column as col, container, image as iced_image, row, text,
|
button, column as col, container, image, row, text, text_input,
|
||||||
text_input,
|
|
||||||
};
|
};
|
||||||
use iced::{
|
use iced::{
|
||||||
event, executor, keyboard, subscription, Alignment, Application, Command,
|
event, executor, keyboard, subscription, Alignment, Application, Command,
|
||||||
ContentFit, Element, Event, Length, Rectangle, Renderer, Subscription,
|
ContentFit, Element, Event, Length, Rectangle, Renderer, Subscription,
|
||||||
Theme,
|
Theme,
|
||||||
};
|
};
|
||||||
use image as img;
|
|
||||||
use image::ColorType;
|
|
||||||
|
|
||||||
fn main() -> iced::Result {
|
fn main() -> iced::Result {
|
||||||
env_logger::builder().format_timestamp(None).init();
|
env_logger::builder().format_timestamp(None).init();
|
||||||
|
|
@ -131,7 +130,7 @@ impl Application for Example {
|
||||||
fn view(&self) -> Element<'_, Self::Message, Renderer<Self::Theme>> {
|
fn view(&self) -> Element<'_, Self::Message, Renderer<Self::Theme>> {
|
||||||
let image: Element<Message> = if let Some(screenshot) = &self.screenshot
|
let image: Element<Message> = if let Some(screenshot) = &self.screenshot
|
||||||
{
|
{
|
||||||
iced_image(iced_image::Handle::from_pixels(
|
image(image::Handle::from_pixels(
|
||||||
screenshot.size.width,
|
screenshot.size.width,
|
||||||
screenshot.size.height,
|
screenshot.size.height,
|
||||||
screenshot.bytes.clone(),
|
screenshot.bytes.clone(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue