Create iced_widget subcrate and re-organize the whole codebase
This commit is contained in:
parent
c54409d171
commit
3a0d34c024
209 changed files with 1959 additions and 2183 deletions
|
|
@ -13,10 +13,6 @@ tracing = ["iced_wgpu/tracing"]
|
|||
raw-window-handle = "0.5"
|
||||
thiserror = "1"
|
||||
|
||||
[dependencies.iced_native]
|
||||
version = "0.9"
|
||||
path = "../native"
|
||||
|
||||
[dependencies.iced_graphics]
|
||||
version = "0.7"
|
||||
path = "../graphics"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
use crate::{Font, Point, Size};
|
||||
|
||||
use iced_graphics::backend;
|
||||
use iced_graphics::text;
|
||||
use crate::core::text;
|
||||
use crate::core::{Font, Point, Size};
|
||||
use crate::graphics::backend;
|
||||
|
||||
use std::borrow::Cow;
|
||||
|
||||
|
|
@ -99,7 +98,7 @@ impl backend::Text for Backend {
|
|||
|
||||
#[cfg(feature = "image")]
|
||||
impl backend::Image for Backend {
|
||||
fn dimensions(&self, handle: &iced_native::image::Handle) -> Size<u32> {
|
||||
fn dimensions(&self, handle: &crate::core::image::Handle) -> Size<u32> {
|
||||
match self {
|
||||
Self::Wgpu(backend) => backend.dimensions(handle),
|
||||
Self::TinySkia(backend) => backend.dimensions(handle),
|
||||
|
|
@ -111,7 +110,7 @@ impl backend::Image for Backend {
|
|||
impl backend::Svg for Backend {
|
||||
fn viewport_dimensions(
|
||||
&self,
|
||||
handle: &iced_native::svg::Handle,
|
||||
handle: &crate::core::svg::Handle,
|
||||
) -> Size<u32> {
|
||||
match self {
|
||||
Self::Wgpu(backend) => backend.viewport_dimensions(handle),
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
use crate::{Backend, Color, Error, Renderer, Settings, Viewport};
|
||||
use crate::core::Color;
|
||||
use crate::graphics::compositor::{Information, SurfaceError};
|
||||
use crate::graphics::{Error, Viewport};
|
||||
use crate::{Backend, Renderer, Settings};
|
||||
|
||||
use raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle};
|
||||
|
||||
pub use iced_graphics::window::compositor::{Information, SurfaceError};
|
||||
|
||||
pub enum Compositor<Theme> {
|
||||
Wgpu(iced_wgpu::window::Compositor<Theme>),
|
||||
TinySkia(iced_tiny_skia::window::Compositor<Theme>),
|
||||
|
|
@ -14,7 +15,7 @@ pub enum Surface {
|
|||
TinySkia(iced_tiny_skia::window::Surface),
|
||||
}
|
||||
|
||||
impl<Theme> iced_graphics::window::Compositor for Compositor<Theme> {
|
||||
impl<Theme> crate::graphics::Compositor for Compositor<Theme> {
|
||||
type Settings = Settings;
|
||||
type Renderer = Renderer<Theme>;
|
||||
type Surface = Surface;
|
||||
|
|
@ -2,9 +2,9 @@ mod cache;
|
|||
|
||||
pub use cache::Cache;
|
||||
|
||||
pub use iced_graphics::geometry::*;
|
||||
|
||||
use crate::{Backend, Point, Rectangle, Size, Vector};
|
||||
use crate::core::{Point, Rectangle, Size, Vector};
|
||||
use crate::graphics::geometry::{Fill, Geometry, Path, Stroke, Text};
|
||||
use crate::Backend;
|
||||
|
||||
pub enum Frame {
|
||||
Wgpu(iced_wgpu::geometry::Frame),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
use crate::core::Size;
|
||||
use crate::geometry::{Frame, Geometry};
|
||||
use crate::{Primitive, Renderer, Size};
|
||||
use crate::graphics::Primitive;
|
||||
use crate::Renderer;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::sync::Arc;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
pub mod window;
|
||||
pub mod compositor;
|
||||
|
||||
#[cfg(feature = "geometry")]
|
||||
pub mod geometry;
|
||||
|
|
@ -6,18 +6,14 @@ pub mod geometry;
|
|||
mod backend;
|
||||
mod settings;
|
||||
|
||||
pub use iced_graphics::primitive;
|
||||
pub use iced_graphics as graphics;
|
||||
pub use iced_graphics::core;
|
||||
|
||||
pub use backend::Backend;
|
||||
pub use primitive::Primitive;
|
||||
pub use compositor::Compositor;
|
||||
pub use settings::Settings;
|
||||
|
||||
pub use iced_graphics::{
|
||||
Antialiasing, Color, Error, Font, Point, Rectangle, Size, Vector, Viewport,
|
||||
};
|
||||
|
||||
/// The default graphics renderer for [`iced`].
|
||||
///
|
||||
/// [`iced`]: https://github.com/iced-rs/iced
|
||||
pub type Renderer<Theme = iced_native::Theme> =
|
||||
iced_graphics::Renderer<Backend, Theme>;
|
||||
pub type Renderer<Theme> = iced_graphics::Renderer<Backend, Theme>;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
use crate::{Antialiasing, Font};
|
||||
use crate::core::Font;
|
||||
use crate::graphics::Antialiasing;
|
||||
|
||||
/// The settings of a [`Backend`].
|
||||
///
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
mod compositor;
|
||||
|
||||
pub use compositor::Compositor;
|
||||
Loading…
Add table
Add a link
Reference in a new issue