Create iced_widget subcrate and re-organize the whole codebase

This commit is contained in:
Héctor Ramón Jiménez 2023-03-04 05:37:11 +01:00
parent c54409d171
commit 3a0d34c024
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
209 changed files with 1959 additions and 2183 deletions

View file

@ -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"

View file

@ -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),

View file

@ -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;

View file

@ -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),

View file

@ -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;

View file

@ -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>;

View file

@ -1,4 +1,5 @@
use crate::{Antialiasing, Font};
use crate::core::Font;
use crate::graphics::Antialiasing;
/// The settings of a [`Backend`].
///

View file

@ -1,3 +0,0 @@
mod compositor;
pub use compositor::Compositor;