Make gcore a std library and remove std, alloc, and more unused features (#2724)

* gcore: remove features `std`, `alloc`, `gpu` and `reflections`, now always available

* gcore: remove non-working features `kurbo` and `log`
This commit is contained in:
Firestar99 2025-06-20 00:12:30 +02:00 committed by Keavon Chambers
parent 6b69a75391
commit 34dced38ba
25 changed files with 40 additions and 233 deletions

View file

@ -7,28 +7,13 @@ authors = ["Graphite Authors <contact@graphite.rs>"]
license = "MIT OR Apache-2.0"
[features]
default = ["serde", "kurbo", "log", "std", "rand_chacha", "wasm"]
log = ["dep:log"]
gpu = ["spirv-std", "glam/bytemuck", "dyn-any", "glam/libm"]
default = ["serde", "wasm"]
nightly = []
alloc = ["dyn-any", "bezier-rs"]
type_id_logging = []
wasm = ["web-sys"]
wgpu = ["dep:wgpu"]
vello = ["dep:vello", "bezier-rs/kurbo", "wgpu"]
dealloc_nodes = ["reflections"]
std = [
"dyn-any",
"dyn-any/std",
"alloc",
"glam/std",
"specta",
"num-traits/std",
"rustybuzz",
"image",
"reflections",
]
reflections = ["alloc", "ctor"]
dealloc_nodes = []
serde = [
"dep:serde",
"glam/serde",
@ -55,31 +40,30 @@ petgraph = { workspace = true, default-features = false, features = [
] }
rustc-hash = { workspace = true }
math-parser = { path = "../../libraries/math-parser" }
dyn-any = { workspace = true }
ctor = { workspace = true }
rand_chacha = { workspace = true }
bezier-rs = { workspace = true }
specta = { workspace = true }
rustybuzz = { workspace = true }
image = { workspace = true, default-features = false, features = [
"png",
] }
# Required dependencies
half = { version = "2.4.1", default-features = false, features = ["bytemuck"] }
tinyvec = { version = "1" }
kurbo = { workspace = true }
log = { workspace = true }
# Optional workspace dependencies
dyn-any = { workspace = true, optional = true }
spirv-std = { workspace = true, optional = true }
serde = { workspace = true, optional = true, features = ["derive"] }
ctor = { workspace = true, optional = true }
log = { workspace = true, optional = true }
rand_chacha = { workspace = true, optional = true }
bezier-rs = { workspace = true, optional = true }
kurbo = { workspace = true, optional = true }
base64 = { workspace = true, optional = true }
vello = { workspace = true, optional = true }
wgpu = { workspace = true, optional = true }
specta = { workspace = true, optional = true }
rustybuzz = { workspace = true, optional = true }
web-sys = { workspace = true, optional = true, features = [
"HtmlCanvasElement",
] }
image = { workspace = true, optional = true, default-features = false, features = [
"png",
] }
[dev-dependencies]
# Workspace dependencies

View file

@ -36,7 +36,6 @@ impl Hash for SurfaceFrame {
}
}
#[cfg(feature = "dyn-any")]
unsafe impl StaticType for SurfaceFrame {
type Static = SurfaceFrame;
}
@ -52,8 +51,6 @@ impl Size for web_sys::HtmlCanvasElement {
}
}
// pub type TextureDataTable = Instances<ImageTexture>;
#[derive(Debug, Clone)]
pub struct ImageTexture {
#[cfg(feature = "wgpu")]
@ -84,7 +81,6 @@ impl PartialEq for ImageTexture {
}
}
#[cfg(feature = "dyn-any")]
unsafe impl StaticType for ImageTexture {
type Static = ImageTexture;
}
@ -123,7 +119,6 @@ impl<S: Size> Size for SurfaceHandle<S> {
}
}
#[cfg(feature = "dyn-any")]
unsafe impl<T: 'static> StaticType for SurfaceHandle<T> {
type Static = SurfaceHandle<T>;
}
@ -134,7 +129,6 @@ pub struct SurfaceHandleFrame<Surface> {
pub transform: DAffine2,
}
#[cfg(feature = "dyn-any")]
unsafe impl<T: 'static> StaticType for SurfaceHandleFrame<T> {
type Static = SurfaceHandleFrame<T>;
}
@ -309,7 +303,6 @@ impl<T> Debug for EditorApi<T> {
}
}
#[cfg(feature = "dyn-any")]
unsafe impl<T: StaticTypeSized> StaticType for EditorApi<T> {
type Static = EditorApi<T::Static>;
}

View file

@ -1,20 +0,0 @@
use crate::Color;
use crate::raster::Sample;
use bytemuck::{Pod, Zeroable};
use spirv_std::image::{Image2d, SampledImage};
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Pod, Zeroable)]
pub struct PushConstants {
pub n: u32,
pub node: u32,
}
impl Sample for SampledImage<Image2d> {
type Pixel = Color;
fn sample(&self, pos: glam::DVec2, _area: glam::DVec2) -> Option<Self::Pixel> {
let color = self.sample(pos);
Color::from_rgbaf32(color.x, color.y, color.z, color.w)
}
}

View file

@ -243,38 +243,6 @@ impl GraphicElement {
}
}
// // TODO: Rename to Raster
// #[derive(Clone, Debug, Hash, PartialEq, DynAny)]
// pub enum RasterDataType {
// /// A CPU-based bitmap image with a finite position and extent, equivalent to the SVG <image> tag: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/image
// // TODO: Rename to ImageTable
// RasterData(RasterDataTable<CPU>),
// /// A GPU texture with a finite position and extent
// // TODO: Rename to ImageTextureTable
// TextureData(TextureDataTable),
// }
// impl<'de> serde::Deserialize<'de> for RasterDataType {
// fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
// where
// D: serde::Deserializer<'de>,
// {
// Ok(RasterDataType::RasterData(RasterDataTable::new(Image::deserialize(deserializer)?)))
// }
// }
// impl serde::Serialize for RasterDataType {
// fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
// where
// S: serde::Serializer,
// {
// match self {
// RasterDataType::RasterData(_) => self.serialize(serializer),
// RasterDataType::TextureData(_) => todo!(),
// }
// }
// }
impl<'de> serde::Deserialize<'de> for Raster<CPU> {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where

View file

@ -142,7 +142,6 @@ impl<T: PartialEq> PartialEq for Instances<T> {
}
}
#[cfg(feature = "dyn-any")]
unsafe impl<T: StaticType + 'static> StaticType for Instances<T> {
type Static = Instances<T>;
}

View file

@ -1,17 +1,10 @@
#![cfg_attr(not(feature = "std"), no_std)]
#[cfg(feature = "alloc")]
extern crate alloc;
#[cfg(feature = "alloc")]
use core::future::Future;
#[cfg_attr(feature = "log", macro_use)]
#[cfg(feature = "log")]
#[macro_use]
extern crate log;
pub use crate as graphene_core;
pub use num_traits;
#[cfg(feature = "reflections")]
pub use ctor;
pub mod animation;
@ -24,37 +17,26 @@ pub mod misc;
pub mod ops;
pub mod raster_types;
pub mod structural;
#[cfg(feature = "std")]
pub mod text;
#[cfg(feature = "std")]
pub mod uuid;
pub mod value;
#[cfg(feature = "gpu")]
pub mod gpu;
#[cfg(feature = "alloc")]
pub mod memo;
pub mod raster;
#[cfg(feature = "alloc")]
pub mod transform;
#[cfg(feature = "alloc")]
mod graphic_element;
#[cfg(feature = "alloc")]
pub use graphic_element::*;
#[cfg(feature = "alloc")]
pub mod vector;
#[cfg(feature = "alloc")]
pub mod application_io;
#[cfg(feature = "reflections")]
pub mod registry;
pub use context::*;
use core::any::TypeId;
use core::future::Future;
use core::pin::Pin;
pub use dyn_any::{StaticTypeSized, WasmNotSend, WasmNotSync};
pub use memo::MemoHash;
@ -75,16 +57,13 @@ pub trait Node<'i, Input> {
core::any::type_name::<Self>()
}
/// Serialize the node which is used for the `introspect` function which can retrieve values from monitor nodes.
#[cfg(feature = "std")]
fn serialize(&self) -> Option<std::sync::Arc<dyn core::any::Any + Send + Sync>> {
log::warn!("Node::serialize not implemented for {}", core::any::type_name::<Self>());
None
}
}
#[cfg(feature = "alloc")]
mod types;
#[cfg(feature = "alloc")]
pub use types::*;
pub trait NodeIO<'i, Input>: Node<'i, Input>
@ -104,7 +83,6 @@ where
fn output_type_name(&self) -> &'static str {
core::any::type_name::<Self::Output>()
}
#[cfg(feature = "alloc")]
fn to_node_io(&self, inputs: Vec<Type>) -> NodeIOTypes {
NodeIOTypes {
call_argument: concrete!(<Input as StaticTypeSized>::Static),
@ -112,7 +90,6 @@ where
inputs,
}
}
#[cfg(feature = "alloc")]
fn to_async_node_io(&self, inputs: Vec<Type>) -> NodeIOTypes
where
<Self::Output as Future>::Output: StaticTypeSized,
@ -139,14 +116,12 @@ impl<'i, I: 'i, N: Node<'i, I> + ?Sized> Node<'i, I> for &'i N {
(*self).eval(input)
}
}
#[cfg(feature = "alloc")]
impl<'i, I: 'i, O: 'i, N: Node<'i, I, Output = O> + ?Sized> Node<'i, I> for Box<N> {
type Output = O;
fn eval(&'i self, input: I) -> O {
(**self).eval(input)
}
}
#[cfg(feature = "alloc")]
impl<'i, I: 'i, O: 'i, N: Node<'i, I, Output = O> + ?Sized> Node<'i, I> for alloc::sync::Arc<N> {
type Output = O;
fn eval(&'i self, input: I) -> O {
@ -154,7 +129,6 @@ impl<'i, I: 'i, O: 'i, N: Node<'i, I, Output = O> + ?Sized> Node<'i, I> for allo
}
}
#[cfg(feature = "alloc")]
impl<'i, I, O: 'i> Node<'i, I> for Pin<Box<dyn Node<'i, I, Output = O> + 'i>> {
type Output = O;
fn eval(&'i self, input: I) -> O {
@ -168,7 +142,6 @@ impl<'i, I, O: 'i> Node<'i, I> for Pin<&'i (dyn NodeIO<'i, I, Output = O> + 'i)>
}
}
#[cfg(feature = "alloc")]
pub use crate::application_io::{SurfaceFrame, SurfaceId};
#[cfg(feature = "wasm")]
pub type WasmSurfaceHandle = application_io::SurfaceHandle<web_sys::HtmlCanvasElement>;

View file

@ -1,5 +1,4 @@
use crate::{Node, WasmNotSend};
#[cfg(feature = "alloc")]
use alloc::sync::Arc;
use core::future::Future;
use core::ops::Deref;
@ -106,7 +105,6 @@ pub struct IORecord<I, O> {
pub output: O,
}
#[cfg(feature = "alloc")]
/// Caches the output of the last graph evaluation for introspection
#[derive(Default)]
pub struct MonitorNode<I, T, N> {
@ -115,7 +113,6 @@ pub struct MonitorNode<I, T, N> {
node: N,
}
#[cfg(feature = "alloc")]
impl<'i, T, I, N> Node<'i, I> for MonitorNode<I, T, N>
where
I: Clone + 'static + Send + Sync,
@ -139,7 +136,6 @@ where
}
}
#[cfg(feature = "alloc")]
impl<I, T, N> MonitorNode<I, T, N> {
pub fn new(node: N) -> MonitorNode<I, T, N> {
MonitorNode { io: Arc::new(Mutex::new(None)), node }
@ -173,7 +169,6 @@ impl<T: Hash + serde::Serialize> serde::Serialize for MemoHash<T> {
}
}
#[cfg(feature = "std")]
impl<T: Hash> MemoHash<T> {
pub fn new(value: T) -> Self {
let hash = Self::calc_hash(&value);

View file

@ -495,7 +495,6 @@ fn string_value(_: impl Ctx, _primary: (), string: String) -> String {
}
/// Meant for debugging purposes, not general use. Returns the size of the input type in bytes.
#[cfg(feature = "std")]
#[node_macro::node(category("Debug"))]
fn size_of(_: impl Ctx, ty: crate::Type) -> Option<usize> {
ty.size()
@ -535,8 +534,7 @@ fn extract_xy<T: Into<DVec2>>(_: impl Ctx, #[implementations(DVec2, IVec2, UVec2
/// The X or Y component of a coordinate.
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "std", derive(specta::Type))]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType)]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType, specta::Type)]
#[widget(Dropdown)]
pub enum XY {
#[default]
@ -587,7 +585,6 @@ impl<'i, N: for<'a> Node<'a, I> + Copy, I: 'i> Copy for TypeNode<N, I, <N as Nod
// Into
pub struct IntoNode<O>(PhantomData<O>);
impl<O> IntoNode<O> {
#[cfg(feature = "alloc")]
pub const fn new() -> Self {
Self(core::marker::PhantomData)
}

View file

@ -287,9 +287,7 @@ impl<T: BitmapMut + Bitmap> BitmapMut for &mut T {
}
}
#[cfg(feature = "alloc")]
pub use self::image::Image;
#[cfg(feature = "alloc")]
pub mod image;
trait SetBlendMode {

View file

@ -1,9 +1,7 @@
#![allow(clippy::too_many_arguments)]
use crate::raster::curve::{CubicSplines, CurveManipulatorGroup};
#[cfg(feature = "alloc")]
use crate::raster::curve::{Curve, ValueMapperNode};
#[cfg(feature = "alloc")]
use crate::raster::image::Image;
use crate::raster::{Channel, Color, Pixel};
use crate::raster_types::{CPU, Raster, RasterDataTable};
@ -35,8 +33,7 @@ use spirv_std::num_traits::float::Float;
// https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#:~:text=Color%20Lookup%20(Photoshop%20CS6
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "std", derive(specta::Type))]
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, DynAny, Hash, node_macro::ChoiceType)]
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, DynAny, Hash, node_macro::ChoiceType, specta::Type)]
#[widget(Dropdown)]
pub enum LuminanceCalculation {
#[default]
@ -49,8 +46,7 @@ pub enum LuminanceCalculation {
}
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "std", derive(specta::Type))]
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, DynAny, Hash)]
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, DynAny, Hash, specta::Type)]
#[repr(i32)] // TODO: Enable Int8 capability for SPIR-V so that we don't need this?
pub enum BlendMode {
// Basic group
@ -924,8 +920,7 @@ async fn vibrance<T: Adjust<Color>>(
/// Color Channel
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "std", derive(specta::Type))]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType)]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType, specta::Type)]
#[widget(Radio)]
pub enum RedGreenBlue {
#[default]
@ -936,8 +931,7 @@ pub enum RedGreenBlue {
/// Color Channel
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "std", derive(specta::Type))]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType)]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType, specta::Type)]
#[widget(Radio)]
pub enum RedGreenBlueAlpha {
#[default]
@ -949,8 +943,7 @@ pub enum RedGreenBlueAlpha {
/// Style of noise pattern
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "std", derive(specta::Type))]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType)]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType, specta::Type)]
#[widget(Dropdown)]
pub enum NoiseType {
#[default]
@ -966,8 +959,7 @@ pub enum NoiseType {
}
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "std", derive(specta::Type))]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType)]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType, specta::Type)]
/// Style of layered levels of the noise pattern
pub enum FractalType {
#[default]
@ -984,8 +976,7 @@ pub enum FractalType {
/// Distance function used by the cellular noise
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "std", derive(specta::Type))]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType)]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType, specta::Type)]
pub enum CellularDistanceFunction {
#[default]
Euclidean,
@ -996,8 +987,7 @@ pub enum CellularDistanceFunction {
}
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "std", derive(specta::Type))]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType)]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType, specta::Type)]
pub enum CellularReturnType {
CellValue,
#[default]
@ -1017,8 +1007,7 @@ pub enum CellularReturnType {
/// Type of domain warp
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "std", derive(specta::Type))]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType)]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType, specta::Type)]
#[widget(Dropdown)]
pub enum DomainWarpType {
#[default]
@ -1128,8 +1117,7 @@ async fn channel_mixer<T: Adjust<Color>>(
}
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "std", derive(specta::Type))]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType)]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType, specta::Type)]
#[widget(Radio)]
pub enum RelativeAbsolute {
#[default]
@ -1139,8 +1127,7 @@ pub enum RelativeAbsolute {
#[repr(C)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "std", derive(specta::Type))]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType)]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType, specta::Type)]
pub enum SelectiveColorChoice {
#[default]
Reds,
@ -1422,7 +1409,6 @@ async fn exposure<T: Adjust<Color>>(
const WINDOW_SIZE: usize = 1024;
#[cfg(feature = "alloc")]
#[node_macro::node(category(""))]
fn generate_curves<C: Channel + crate::raster::Linear>(_: impl Ctx, curve: Curve, #[implementations(f32, f64)] _target_format: C) -> ValueMapperNode<C> {
use bezier_rs::{Bezier, TValue};
@ -1463,7 +1449,6 @@ fn generate_curves<C: Channel + crate::raster::Linear>(_: impl Ctx, curve: Curve
ValueMapperNode::new(lut)
}
#[cfg(feature = "alloc")]
#[node_macro::node(category("Raster: Adjustment"))]
fn color_overlay<T: Adjust<Color>>(
_: impl Ctx,
@ -1491,10 +1476,8 @@ fn color_overlay<T: Adjust<Color>>(
image
}
// #[cfg(feature = "alloc")]
// pub use index_node::IndexNode;
// #[cfg(feature = "alloc")]
// mod index_node {
// use crate::raster::{Color, Image};
// use crate::Ctx;

View file

@ -85,8 +85,7 @@ impl Pixel for RGBA16F {}
#[repr(C)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "std", derive(specta::Type))]
#[derive(Debug, Default, Clone, Copy, PartialEq, DynAny, Pod, Zeroable)]
#[derive(Debug, Default, Clone, Copy, PartialEq, DynAny, Pod, Zeroable, specta::Type)]
pub struct SRGBA8 {
red: u8,
green: u8,
@ -167,8 +166,7 @@ impl Pixel for SRGBA8 {}
#[repr(C)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "std", derive(specta::Type))]
#[derive(Debug, Default, Clone, Copy, PartialEq, DynAny, Pod, Zeroable)]
#[derive(Debug, Default, Clone, Copy, PartialEq, DynAny, Pod, Zeroable, specta::Type)]
pub struct Luma(pub f32);
impl Luminance for Luma {
@ -209,8 +207,7 @@ impl Pixel for Luma {}
/// the values encode the brightness of each channel proportional to the light intensity in cd/m² (nits) in HDR, and `0.0` (black) to `1.0` (white) in SDR color.
#[repr(C)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "std", derive(specta::Type))]
#[derive(Debug, Default, Clone, Copy, PartialEq, DynAny, Pod, Zeroable)]
#[derive(Debug, Default, Clone, Copy, PartialEq, DynAny, Pod, Zeroable, specta::Type)]
pub struct Color {
red: f32,
green: f32,
@ -798,7 +795,6 @@ impl Color {
/// let color = Color::from_rgba8_srgb(0x52, 0x67, 0xFA, 0x61); // Premultiplied alpha
/// assert_eq!("3240a261", color.to_rgba_hex_srgb()); // Equivalent hex incorporating premultiplied alpha
/// ```
#[cfg(feature = "std")]
pub fn to_rgba_hex_srgb(&self) -> String {
let gamma = self.to_gamma_srgb();
format!(
@ -816,7 +812,6 @@ impl Color {
/// let color = Color::from_rgba8_srgb(0x52, 0x67, 0xFA, 0x61); // Premultiplied alpha
/// assert_eq!("3240a2", color.to_rgb_hex_srgb()); // Equivalent hex incorporating premultiplied alpha
/// ```
#[cfg(feature = "std")]
pub fn to_rgb_hex_srgb(&self) -> String {
self.to_gamma_srgb().to_rgb_hex_srgb_from_gamma()
}
@ -827,7 +822,6 @@ impl Color {
/// let color = Color::from_rgba8_srgb(0x52, 0x67, 0xFA, 0x61); // Premultiplied alpha
/// assert_eq!("3240a2", color.to_rgb_hex_srgb()); // Equivalent hex incorporating premultiplied alpha
/// ```
#[cfg(feature = "std")]
pub fn to_rgb_hex_srgb_from_gamma(&self) -> String {
format!("{:02x?}{:02x?}{:02x?}", (self.r() * 255.) as u8, (self.g() * 255.) as u8, (self.b() * 255.) as u8)
}

View file

@ -174,7 +174,6 @@ pub struct ValueMapperNode<C> {
lut: Vec<C>,
}
#[cfg(feature = "dyn-any")]
unsafe impl<C: StaticTypeSized> StaticType for ValueMapperNode<C> {
type Static = ValueMapperNode<C::Static>;
}

View file

@ -66,7 +66,6 @@ impl<P: Pixel + Debug> Debug for Image<P> {
}
}
#[cfg(feature = "dyn-any")]
unsafe impl<P> StaticType for Image<P>
where
P: dyn_any::StaticTypeSized + Pixel,
@ -265,7 +264,6 @@ pub fn migrate_image_frame<'de, D: serde::Deserializer<'de>>(deserializer: D) ->
}
}
#[cfg(feature = "dyn-any")]
unsafe impl<P> StaticType for ImageFrame<P>
where
P: dyn_any::StaticTypeSized + Pixel,
@ -362,7 +360,6 @@ pub fn migrate_image_frame_instance<'de, D: serde::Deserializer<'de>>(deserializ
}
}
#[cfg(feature = "dyn-any")]
unsafe impl<P> StaticType for ImageFrame<P>
where
P: dyn_any::StaticTypeSized + Pixel,

View file

@ -55,7 +55,6 @@ pub struct AsyncComposeNode<First, Second, I> {
phantom: PhantomData<I>,
}
#[cfg(feature = "alloc")]
impl<'i, Input: 'static, First, Second> Node<'i, Input> for AsyncComposeNode<First, Second, Input>
where
First: Node<'i, Input>,
@ -71,7 +70,6 @@ where
}
}
#[cfg(feature = "alloc")]
impl<'i, First, Second, Input: 'i> AsyncComposeNode<First, Second, Input>
where
First: Node<'i, Input>,
@ -95,7 +93,6 @@ pub trait Then<'i, Input: 'i>: Sized {
impl<'i, First: Node<'i, Input>, Input: 'i> Then<'i, Input> for First {}
#[cfg(feature = "alloc")]
pub trait AndThen<'i, Input: 'i>: Sized {
fn and_then<Second>(self, second: Second) -> AsyncComposeNode<Self, Second, Input>
where
@ -107,7 +104,6 @@ pub trait AndThen<'i, Input: 'i>: Sized {
}
}
#[cfg(feature = "alloc")]
impl<'i, First: Node<'i, Input>, Input: 'i> AndThen<'i, Input> for First {}
pub struct ConsNode<I: From<()>, Root>(pub Root, PhantomData<I>);

View file

@ -23,7 +23,7 @@ impl Builder {
impl OutlineBuilder for Builder {
fn move_to(&mut self, x: f32, y: f32) {
if !self.current_subpath.is_empty() {
self.other_subpaths.push(core::mem::replace(&mut self.current_subpath, Subpath::new(Vec::new(), false)));
self.other_subpaths.push(std::mem::replace(&mut self.current_subpath, Subpath::new(Vec::new(), false)));
}
self.current_subpath.push_manipulator_group(ManipulatorGroup::new_anchor_with_id(self.point(x, y), self.id.next_id()));
}
@ -47,7 +47,7 @@ impl OutlineBuilder for Builder {
fn close(&mut self) {
self.current_subpath.set_closed(true);
self.other_subpaths.push(core::mem::replace(&mut self.current_subpath, Subpath::new(Vec::new(), false)));
self.other_subpaths.push(std::mem::replace(&mut self.current_subpath, Subpath::new(Vec::new(), false)));
}
}
@ -139,7 +139,7 @@ pub fn to_path(str: &str, buzz_face: Option<rustybuzz::Face>, typesetting: Types
builder.offset = DVec2::new(glyph_position.x_offset as f64, glyph_position.y_offset as f64) * builder.scale;
buzz_face.outline_glyph(glyph_id, &mut builder);
if !builder.current_subpath.is_empty() {
builder.other_subpaths.push(core::mem::replace(&mut builder.current_subpath, Subpath::new(Vec::new(), false)));
builder.other_subpaths.push(std::mem::replace(&mut builder.current_subpath, Subpath::new(Vec::new(), false)));
}
builder.text_cursor += DVec2::new(glyph_position.x_advance as f64 * typesetting.character_spacing, glyph_position.y_advance as f64) * builder.scale;

View file

@ -1,8 +1,5 @@
use core::any::TypeId;
#[cfg(not(feature = "std"))]
pub use alloc::borrow::Cow;
#[cfg(feature = "std")]
pub use std::borrow::Cow;
#[macro_export]
@ -215,7 +212,6 @@ impl Default for Type {
}
}
#[cfg(feature = "dyn-any")]
unsafe impl dyn_any::StaticType for Type {
type Static = Self;
}

View file

@ -22,7 +22,7 @@ dyn-any = { path = "../../libraries/dyn-any", features = [
] }
# Workspace dependencies
graphene-core = { workspace = true, features = ["std"] }
graphene-core = { workspace = true }
log = { workspace = true }
glam = { workspace = true }
bezier-rs = { workspace = true }

View file

@ -15,7 +15,6 @@ passthrough = ["wgpu-executor/passthrough"]
gpu = [
"interpreted-executor/gpu",
"graphene-std/gpu",
"graphene-core/gpu",
"wgpu-executor",
]

View file

@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
[features]
default = ["wasm", "imaginate"]
gpu = [ "graphene-core/gpu" ]
gpu = []
wgpu = ["gpu", "graph-craft/wgpu"]
wasm = ["wasm-bindgen", "web-sys"]
imaginate = ["image/png", "base64", "web-sys", "wasm-bindgen-futures"]
@ -22,11 +22,7 @@ wayland = ["graph-craft/wayland"]
dyn-any = { path = "../../libraries/dyn-any", features = ["derive", "reqwest"] }
graph-craft = { path = "../graph-craft", features = ["serde"] }
wgpu-executor = { path = "../wgpu-executor" }
graphene-core = { path = "../gcore", default-features = false, features = [
"std",
"serde",
"alloc",
] }
graphene-core = { path = "../gcore", default-features = false, features = ["serde"] }
# Workspace dependencies
fastnoise-lite = { workspace = true }

View file

@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0"
[features]
default = []
serde = ["dep:serde", "graphene-std/serde", "glam/serde"]
gpu = ["graphene-std/gpu", "graphene-core/gpu", "graphene-std/wgpu"]
gpu = ["graphene-std/gpu", "graphene-std/wgpu"]
[dependencies]
# Local dependencies
@ -16,7 +16,7 @@ graph-craft = { path = "../graph-craft" }
wgpu-executor = { path = "../wgpu-executor" }
# Workspace dependencies
graphene-core = { workspace = true, features = ["std"] }
graphene-core = { workspace = true }
dyn-any = { workspace = true, features = ["log-bad-types", "glam"] }
log = { workspace = true }
glam = { workspace = true }

View file

@ -11,7 +11,7 @@ passthrough = []
[dependencies]
# Workspace dependencies
graphene-core = { workspace = true, features = ["std", "alloc", "gpu", "wgpu"] }
graphene-core = { workspace = true, features = ["wgpu"] }
dyn-any = { workspace = true, features = ["log-bad-types", "rc", "glam"] }
node-macro = { workspace = true }
glam = { workspace = true }