repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/node-graph/libraries/vector-types/src/vector/algorithms/bezpath_algorithms.rs | node-graph/libraries/vector-types/src/vector/algorithms/bezpath_algorithms.rs | use super::intersection::bezpath_intersections;
use super::poisson_disk::poisson_disk_sample;
use super::util::pathseg_tangent;
use crate::vector::algorithms::offset_subpath::MAX_ABSOLUTE_DIFFERENCE;
use crate::vector::misc::{PointSpacingType, dvec2_to_point, point_to_dvec2};
use core_types::math::polynomial::pathseg_t... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/node-graph/libraries/vector-types/src/vector/algorithms/merge_by_distance.rs | node-graph/libraries/vector-types/src/vector/algorithms/merge_by_distance.rs | use crate::vector::{PointDomain, PointId, SegmentDomain, SegmentId, Vector};
use glam::{DAffine2, DVec2};
use petgraph::graph::{EdgeIndex, NodeIndex, UnGraph};
use petgraph::prelude::UnGraphMap;
use rustc_hash::FxHashMap;
use rustc_hash::FxHashSet;
pub trait MergeByDistanceExt {
/// Collapse all points with edges sho... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/node-graph/libraries/raster-types/src/lib.rs | node-graph/libraries/raster-types/src/lib.rs | pub mod image;
pub mod raster_types;
// Re-exports for convenience
pub use image::Image;
pub use raster_types::*;
// Re-export color types from no-std-types
pub use core_types::color::*;
/// as to not yet rename all references
pub mod color {
pub use super::*;
}
use std::fmt::Debug;
pub trait Bitmap {
type Pixel... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/node-graph/libraries/raster-types/src/image.rs | node-graph/libraries/raster-types/src/image.rs | use crate::raster_types::{CPU, Raster};
use crate::{Bitmap, BitmapMut};
use core_types::AlphaBlending;
use core_types::Color;
use core_types::color::float_to_srgb_u8;
use core_types::table::{Table, TableRow};
// use crate::vector::Vector; // TODO: Check if Vector is actually used, if so handle differently
use core::has... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/node-graph/libraries/raster-types/src/raster_types.rs | node-graph/libraries/raster-types/src/raster_types.rs | use crate::image::Image;
use core::ops::Deref;
use core_types::Color;
use core_types::bounds::{BoundingBox, RenderBoundingBox};
use core_types::math::quad::Quad;
use dyn_any::DynAny;
use glam::{DAffine2, DVec2};
use std::fmt::Debug;
use std::ops::DerefMut;
mod __private {
pub trait Sealed {}
}
pub trait Storage: __p... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/node-graph/libraries/core-types/src/consts.rs | node-graph/libraries/core-types/src/consts.rs | use crate::Color;
// RENDERING
pub const LAYER_OUTLINE_STROKE_COLOR: Color = Color::BLACK;
pub const LAYER_OUTLINE_STROKE_WEIGHT: f64 = 0.5;
// Fonts
pub const DEFAULT_FONT_FAMILY: &str = "Lato";
pub const DEFAULT_FONT_STYLE: &str = "Regular (400)";
| rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/node-graph/libraries/core-types/src/misc.rs | node-graph/libraries/core-types/src/misc.rs | // TODO(TrueDoctor): Replace this with the more idiomatic approach instead of using `trait Clampable`.
/// A trait for types that can be clamped within a min/max range defined by f64.
pub trait Clampable: Sized {
/// Clamps the value to be no less than `min`.
fn clamp_hard_min(self, min: f64) -> Self;
/// Clamps th... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/node-graph/libraries/core-types/src/lib.rs | node-graph/libraries/core-types/src/lib.rs | extern crate log;
pub mod bounds;
pub mod consts;
pub mod context;
pub mod generic;
pub mod math;
pub mod memo;
pub mod misc;
pub mod ops;
pub mod registry;
pub mod render_complexity;
pub mod table;
pub mod transform;
pub mod uuid;
pub mod value;
pub use crate as core_types;
pub use blending::*;
pub use color::Color;... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/node-graph/libraries/core-types/src/value.rs | node-graph/libraries/core-types/src/value.rs | use crate::Node;
use std::cell::{Cell, RefCell, RefMut};
use std::marker::PhantomData;
#[derive(Default, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
pub struct IntNode<const N: u32>;
impl<'i, const N: u32, I> Node<'i, I> for IntNode<N> {
type Output = u32;
#[inline(always)]
fn eval(&'i self, _input:... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/node-graph/libraries/core-types/src/transform.rs | node-graph/libraries/core-types/src/transform.rs | use crate::math::bbox::AxisAlignedBbox;
use core::f64;
use glam::{DAffine2, DMat2, DVec2, UVec2};
pub trait Transform {
fn transform(&self) -> DAffine2;
fn local_pivot(&self, pivot: DVec2) -> DVec2 {
pivot
}
fn decompose_scale(&self) -> DVec2 {
DVec2::new(self.transform().transform_vector2(DVec2::X).length()... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/node-graph/libraries/core-types/src/table.rs | node-graph/libraries/core-types/src/table.rs | use crate::bounds::{BoundingBox, RenderBoundingBox};
use crate::transform::ApplyTransform;
use crate::uuid::NodeId;
use crate::{AlphaBlending, math::quad::Quad};
use dyn_any::{StaticType, StaticTypeSized};
use glam::DAffine2;
use std::hash::Hash;
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/node-graph/libraries/core-types/src/bounds.rs | node-graph/libraries/core-types/src/bounds.rs | use crate::Color;
use glam::{DAffine2, DVec2};
#[derive(Clone, Copy, Default, Debug, PartialEq)]
pub enum RenderBoundingBox {
#[default]
None,
Infinite,
Rectangle([DVec2; 2]),
}
pub trait BoundingBox {
fn bounding_box(&self, transform: DAffine2, include_stroke: bool) -> RenderBoundingBox;
}
macro_rules! none_im... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/node-graph/libraries/core-types/src/text.rs | node-graph/libraries/core-types/src/text.rs | mod font_cache;
mod path_builder;
mod text_context;
mod to_path;
use dyn_any::DynAny;
pub use font_cache::*;
pub use text_context::TextContext;
pub use to_path::*;
/// Alignment of lines of type within a text block.
#[repr(C)]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize, ... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/node-graph/libraries/core-types/src/types.rs | node-graph/libraries/core-types/src/types.rs | use std::any::TypeId;
pub use std::borrow::Cow;
use std::fmt::{Display, Formatter};
use std::ops::Deref;
#[macro_export]
macro_rules! concrete {
($type:ty) => {
$crate::Type::Concrete($crate::TypeDescriptor {
id: Some(std::any::TypeId::of::<$type>()),
name: $crate::Cow::Borrowed(std::any::type_name::<$type>(... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/node-graph/libraries/core-types/src/registry.rs | node-graph/libraries/core-types/src/registry.rs | use crate::{ContextFeature, Node, NodeIO, NodeIOTypes, ProtoNodeIdentifier, Type, WasmNotSend};
use dyn_any::{DynAny, StaticType};
use std::collections::HashMap;
use std::marker::PhantomData;
use std::ops::Deref;
use std::pin::Pin;
use std::sync::{LazyLock, Mutex};
pub use no_std_types::registry::types;
// Translatio... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/node-graph/libraries/core-types/src/render_complexity.rs | node-graph/libraries/core-types/src/render_complexity.rs | // Raster types moved to raster-types crate
use crate::Color;
use crate::table::Table;
pub trait RenderComplexity {
fn render_complexity(&self) -> usize {
0
}
}
impl<T: RenderComplexity> RenderComplexity for Table<T> {
fn render_complexity(&self) -> usize {
self.iter().map(|row| row.element.render_complexity()... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/node-graph/libraries/core-types/src/memo.rs | node-graph/libraries/core-types/src/memo.rs | use std::hash::DefaultHasher;
use std::hash::{Hash, Hasher};
use std::ops::Deref;
use std::sync::Arc;
/// Stores both what a node was called with and what it returned.
#[derive(Clone, Debug)]
pub struct IORecord<I, O> {
pub input: I,
pub output: O,
}
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug)]
pub struc... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/node-graph/libraries/core-types/src/context.rs | node-graph/libraries/core-types/src/context.rs | use crate::transform::Footprint;
use glam::DVec2;
pub use no_std_types::context::{ArcCtx, Ctx};
use std::any::Any;
use std::borrow::Borrow;
use std::hash::{Hash, Hasher};
use std::panic::Location;
use std::sync::Arc;
pub trait ExtractFootprint {
#[track_caller]
fn try_footprint(&self) -> Option<&Footprint>;
#[track... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/node-graph/libraries/core-types/src/generic.rs | node-graph/libraries/core-types/src/generic.rs | use crate::Node;
use std::marker::PhantomData;
#[derive(Clone)]
pub struct FnNode<T: Fn(I) -> O, I, O>(T, PhantomData<(I, O)>);
impl<'i, T: Fn(I) -> O + 'i, O: 'i, I: 'i> Node<'i, I> for FnNode<T, I, O> {
type Output = O;
fn eval(&'i self, input: I) -> Self::Output {
self.0(input)
}
}
impl<T: Fn(I) -> O, I, O> F... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/node-graph/libraries/core-types/src/ops.rs | node-graph/libraries/core-types/src/ops.rs | use crate::Node;
use crate::table::{Table, TableRow};
use crate::transform::Footprint;
use glam::DVec2;
use std::future::Future;
use std::marker::PhantomData;
// Type
// TODO: Document this
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct TypeNode<N: for<'a> Node<'a, I>, I, O>(pub N, pub Phan... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/node-graph/libraries/core-types/src/uuid.rs | node-graph/libraries/core-types/src/uuid.rs | use dyn_any::DynAny;
pub use uuid_generation::*;
#[derive(Clone, Copy, serde::Serialize, serde::Deserialize, specta::Type)]
pub struct Uuid(
#[serde(with = "u64_string")]
#[specta(type = String)]
u64,
);
mod u64_string {
use serde::{self, Deserialize, Deserializer, Serializer};
use std::str::FromStr;
// The si... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/node-graph/libraries/core-types/src/math/polynomial.rs | node-graph/libraries/core-types/src/math/polynomial.rs | use kurbo::PathSeg;
use std::fmt::{self, Display, Formatter};
use std::ops::{Add, AddAssign, Mul, MulAssign, Neg, Sub, SubAssign};
/// A struct that represents a polynomial with a maximum degree of `N-1`.
///
/// It provides basic mathematical operations for polynomials like addition, multiplication, differentiation, ... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/node-graph/libraries/core-types/src/math/rect.rs | node-graph/libraries/core-types/src/math/rect.rs | use crate::math::quad::Quad;
use glam::{DAffine2, DVec2};
#[derive(Debug, Clone, Default, Copy, PartialEq)]
/// An axis aligned rect defined by two vertices.
pub struct Rect(pub [DVec2; 2]);
impl Rect {
/// Create a zero sized quad at the point
#[must_use]
pub fn from_point(point: DVec2) -> Self {
Self([point; 2... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/node-graph/libraries/core-types/src/math/bbox.rs | node-graph/libraries/core-types/src/math/bbox.rs | use dyn_any::DynAny;
use glam::{DAffine2, DVec2};
#[derive(Clone, Debug, DynAny)]
pub struct AxisAlignedBbox {
pub start: DVec2,
pub end: DVec2,
}
impl AxisAlignedBbox {
pub const ZERO: Self = Self { start: DVec2::ZERO, end: DVec2::ZERO };
pub const ONE: Self = Self { start: DVec2::ZERO, end: DVec2::ONE };
pub ... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/node-graph/libraries/core-types/src/math/mod.rs | node-graph/libraries/core-types/src/math/mod.rs | pub mod bbox;
pub mod polynomial;
pub mod quad;
pub mod rect;
| rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/node-graph/libraries/core-types/src/math/quad.rs | node-graph/libraries/core-types/src/math/quad.rs | use glam::{DAffine2, DVec2};
#[derive(Debug, Clone, Default, Copy)]
/// A quad defined by four vertices. Clockwise from the top left:
///
/// `top_left`, `top_right`, `bottom_right`, `bottom_left`.
pub struct Quad(pub [DVec2; 4]);
impl Quad {
/// Get the top left corner of the quad.
pub fn top_left(&self) -> DVec2 ... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/proc-macros/src/helper_structs.rs | proc-macros/src/helper_structs.rs | use proc_macro2::{Ident, TokenStream};
use std::collections::HashMap;
use syn::parse::{Parse, ParseStream};
use syn::punctuated::Punctuated;
use syn::token::Paren;
use syn::{LitStr, Token, parenthesized};
pub struct IdentList {
pub parts: Punctuated<Ident, Token![,]>,
}
impl Parse for IdentList {
fn parse(input: Pa... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/proc-macros/src/lib.rs | proc-macros/src/lib.rs | #![allow(unused)]
mod as_message;
mod combined_message_attrs;
mod discriminant;
mod extract_fields;
mod helper_structs;
mod helpers;
mod hierarchical_tree;
mod hint;
mod message_handler_data_attr;
mod transitive_child;
mod widget_builder;
use crate::as_message::derive_as_message_impl;
use crate::combined_message_attr... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/proc-macros/src/combined_message_attrs.rs | proc-macros/src/combined_message_attrs.rs | use crate::helpers::call_site_ident;
use proc_macro2::Ident;
use proc_macro2::TokenStream;
use quote::ToTokens;
use syn::Token;
use syn::parse::{Parse, ParseStream};
use syn::{ItemEnum, TypePath};
struct MessageArgs {
pub _top_parent: TypePath,
pub _comma1: Token![,],
pub parent: TypePath,
pub _comma2: Token![,],
... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/proc-macros/src/extract_fields.rs | proc-macros/src/extract_fields.rs | use crate::helpers::clean_rust_type_syntax;
use proc_macro2::{Span, TokenStream};
use quote::{ToTokens, format_ident, quote};
use syn::{Data, DeriveInput, Fields, Type, parse2};
pub fn derive_extract_field_impl(input: TokenStream) -> syn::Result<TokenStream> {
let input = parse2::<DeriveInput>(input)?;
let struct_na... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/proc-macros/src/helpers.rs | proc-macros/src/helpers.rs | use proc_macro2::{Ident, Span};
use syn::punctuated::Punctuated;
use syn::{Path, PathArguments, PathSegment, Token};
/// Returns `Ok(Vec<T>)` if all items are `Ok(T)`, else returns a combination of every error encountered (not just the first one)
// Allowing this lint because this is a false positive in this case. The... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/proc-macros/src/hierarchical_tree.rs | proc-macros/src/hierarchical_tree.rs | use crate::helpers::clean_rust_type_syntax;
use proc_macro2::{Span, TokenStream};
use quote::{ToTokens, quote};
use syn::{Data, DeriveInput, Fields, Type, parse2};
pub fn generate_hierarchical_tree(input: TokenStream) -> syn::Result<TokenStream> {
let input = parse2::<DeriveInput>(input)?;
let input_type = &input.id... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/proc-macros/src/transitive_child.rs | proc-macros/src/transitive_child.rs | use crate::helper_structs::Pair;
use proc_macro2::{Span, TokenStream};
use syn::{DeriveInput, Expr, Type};
pub fn derive_transitive_child_impl(input_item: TokenStream) -> syn::Result<TokenStream> {
let input = syn::parse2::<DeriveInput>(input_item).unwrap();
let attribute = input
.attrs
.iter()
.find(|a| a.pa... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/proc-macros/src/hint.rs | proc-macros/src/hint.rs | use crate::helper_structs::AttrInnerKeyStringMap;
use crate::helpers::{fold_error_iter, two_segment_path};
use proc_macro2::{Span, TokenStream as TokenStream2};
use syn::{Attribute, Data, DeriveInput, LitStr, Variant};
fn parse_hint_helper_attrs(attrs: &[Attribute]) -> syn::Result<(Vec<LitStr>, Vec<LitStr>)> {
fold_e... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/proc-macros/src/message_handler_data_attr.rs | proc-macros/src/message_handler_data_attr.rs | use crate::helpers::{call_site_ident, clean_rust_type_syntax};
use proc_macro2::{Span, TokenStream};
use quote::{ToTokens, quote};
use syn::{ItemImpl, Type, parse2, spanned::Spanned};
pub fn message_handler_data_attr_impl(attr: TokenStream, input_item: TokenStream) -> syn::Result<TokenStream> {
// Parse the input as ... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/proc-macros/src/discriminant.rs | proc-macros/src/discriminant.rs | use crate::helpers::call_site_ident;
use proc_macro2::{Ident, Span, TokenStream};
use syn::spanned::Spanned;
use syn::{Attribute, Data, DeriveInput, Field, Fields, ItemEnum, MetaList};
pub fn derive_discriminant_impl(input_item: TokenStream) -> syn::Result<TokenStream> {
let input = syn::parse2::<DeriveInput>(input_i... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/proc-macros/src/widget_builder.rs | proc-macros/src/widget_builder.rs | use proc_macro2::{Ident, Literal, TokenStream as TokenStream2};
use quote::ToTokens;
use syn::spanned::Spanned;
use syn::{Attribute, Data, DeriveInput, Field, PathArguments, Type};
/// Check if a specified `#[widget_builder target]` attribute can be found in the list
fn has_attribute(attrs: &[Attribute], target: &str)... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/proc-macros/src/as_message.rs | proc-macros/src/as_message.rs | use proc_macro2::{Span, TokenStream};
use syn::{Data, DeriveInput};
pub fn derive_as_message_impl(input_item: TokenStream) -> syn::Result<TokenStream> {
let input = syn::parse2::<DeriveInput>(input_item).unwrap();
let data = match input.data {
Data::Enum(data) => data,
_ => return Err(syn::Error::new(Span::call... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/frontend/wasm/src/lib.rs | frontend/wasm/src/lib.rs | #![doc = include_str!("../README.md")]
// `macro_use` puts the log macros (`error!`, `warn!`, `debug!`, `info!` and `trace!`) in scope for the crate
#[macro_use]
extern crate log;
pub mod editor_api;
pub mod helpers;
pub mod native_communcation;
use editor::messages::prelude::*;
use std::panic;
use std::sync::Mutex;... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/frontend/wasm/src/helpers.rs | frontend/wasm/src/helpers.rs | use editor::messages::input_mapper::utility_types::input_keyboard::Key;
/// Translate a keyboard key from its JS name to its Rust `Key` enum
pub fn translate_key(name: &str) -> Key {
use Key::*;
trace!("Key event received: {name}");
match name {
// Writing system keys
"Digit0" | "Numpad0" => Digit0,
"Digit1... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/frontend/wasm/src/native_communcation.rs | frontend/wasm/src/native_communcation.rs | use editor::messages::prelude::FrontendMessage;
use js_sys::{ArrayBuffer, Uint8Array};
use wasm_bindgen::prelude::*;
use crate::editor_api::{self, EditorHandle};
#[wasm_bindgen(js_name = "receiveNativeMessage")]
pub fn receive_native_message(buffer: ArrayBuffer) {
let buffer = Uint8Array::new(buffer.as_ref()).to_vec... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/frontend/wasm/src/editor_api.rs | frontend/wasm/src/editor_api.rs | #![allow(clippy::too_many_arguments)]
//
// This file is where functions are defined to be called directly from JS.
// It serves as a thin wrapper over the editor backend API that relies
// on the dispatcher messaging system and more complex Rust data types.
//
use crate::helpers::translate_key;
use crate::{EDITOR_HAND... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | true |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/rawkit/src/lib.rs | libraries/rawkit/src/lib.rs | pub mod decoder;
pub mod demosaicing;
pub mod metadata;
pub mod postprocessing;
pub mod preprocessing;
pub mod processing;
pub mod tiff;
use crate::metadata::identify::CameraModel;
use processing::{Pixel, PixelTransform, RawPixel, RawPixelTransform};
use rawkit_proc_macros::Tag;
use std::io::{Read, Seek};
use thiserro... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/rawkit/src/processing.rs | libraries/rawkit/src/processing.rs | use crate::CHANNELS_IN_RGB;
#[derive(Clone, Copy)]
pub struct RawPixel {
pub value: u16,
pub row: usize,
pub column: usize,
}
#[derive(Clone, Copy)]
pub struct Pixel {
pub values: [u16; CHANNELS_IN_RGB],
pub row: usize,
pub column: usize,
}
pub trait RawPixelTransform {
fn apply(&mut self, pixel: RawPixel) ->... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/rawkit/src/demosaicing/linear_demosaicing.rs | libraries/rawkit/src/demosaicing/linear_demosaicing.rs | use crate::{Pixel, RawImage};
fn average(data: &[u16], indexes: impl Iterator<Item = i64>) -> u16 {
let mut sum = 0;
let mut count = 0;
for index in indexes {
if index >= 0 && (index as usize) < data.len() {
sum += data[index as usize] as u32;
count += 1;
}
}
(sum / count) as u16
}
impl RawImage {
pu... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/rawkit/src/demosaicing/mod.rs | libraries/rawkit/src/demosaicing/mod.rs | pub mod linear_demosaicing;
| rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/rawkit/src/metadata/identify.rs | libraries/rawkit/src/metadata/identify.rs | use crate::tiff::file::TiffRead;
use crate::tiff::tags::{Make, Model, Tag};
use crate::tiff::{Ifd, TiffError};
use rawkit_proc_macros::Tag;
use std::io::{Read, Seek};
const COMPANY_NAMES: [&str; 22] = [
"AgfaPhoto",
"Canon",
"Casio",
"Epson",
"Fujifilm",
"Mamiya",
"Minolta",
"Motorola",
"Kodak",
"Konica",
"... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/rawkit/src/metadata/camera_data.rs | libraries/rawkit/src/metadata/camera_data.rs | use crate::RawImage;
use rawkit_proc_macros::build_camera_data;
pub struct CameraData {
pub black: u16,
pub maximum: u16,
pub xyz_to_camera: [i16; 9],
}
impl CameraData {
const DEFAULT: CameraData = CameraData {
black: 0,
maximum: 0,
xyz_to_camera: [0; 9],
};
}
const CAMERA_DATA: [(&str, CameraData); 40] ... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/rawkit/src/metadata/mod.rs | libraries/rawkit/src/metadata/mod.rs | pub mod camera_data;
pub mod identify;
| rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/rawkit/src/preprocessing/scale_to_16bit.rs | libraries/rawkit/src/preprocessing/scale_to_16bit.rs | use crate::{RawImage, RawPixel, SubtractBlack};
impl RawImage {
pub fn scale_to_16bit_fn(&self) -> impl Fn(RawPixel) -> u16 + use<> {
let black_level = match self.black {
SubtractBlack::CfaGrid(x) => x,
_ => unreachable!(),
};
let maximum = self.maximum - black_level.iter().max().unwrap();
let scale_to... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/rawkit/src/preprocessing/mod.rs | libraries/rawkit/src/preprocessing/mod.rs | pub mod scale_to_16bit;
pub mod scale_white_balance;
pub mod subtract_black;
| rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/rawkit/src/preprocessing/scale_white_balance.rs | libraries/rawkit/src/preprocessing/scale_white_balance.rs | use crate::{RawImage, RawPixel};
impl RawImage {
pub fn scale_white_balance_fn(&self) -> impl Fn(RawPixel) -> u16 + use<> {
let Some(mut white_balance) = self.white_balance else { todo!() };
if white_balance[1] == 0. {
white_balance[1] = 1.;
}
// TODO: Move this at its correct location when highlights ar... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/rawkit/src/preprocessing/subtract_black.rs | libraries/rawkit/src/preprocessing/subtract_black.rs | use crate::RawPixel;
use crate::{RawImage, SubtractBlack};
impl RawImage {
pub fn subtract_black_fn(&self) -> impl Fn(RawPixel) -> u16 + use<> {
match self.black {
SubtractBlack::CfaGrid(black_levels) => move |pixel: RawPixel| pixel.value.saturating_sub(black_levels[2 * (pixel.row % 2) + (pixel.column % 2)]),
... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/rawkit/src/decoder/arw2.rs | libraries/rawkit/src/decoder/arw2.rs | use crate::tiff::file::{Endian, TiffRead};
use crate::tiff::tags::{BitsPerSample, CfaPattern, CfaPatternDim, Compression, ImageLength, ImageWidth, SonyToneCurve, StripByteCounts, StripOffsets, Tag, WhiteBalanceRggbLevels};
use crate::tiff::values::{CompressionValue, CurveLookupTable};
use crate::tiff::{Ifd, TiffError};... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/rawkit/src/decoder/uncompressed.rs | libraries/rawkit/src/decoder/uncompressed.rs | use crate::tiff::file::TiffRead;
use crate::tiff::tags::{BitsPerSample, BlackLevel, CfaPattern, CfaPatternDim, Compression, ImageLength, ImageWidth, RowsPerStrip, StripByteCounts, StripOffsets, Tag, WhiteBalanceRggbLevels};
use crate::tiff::values::CompressionValue;
use crate::tiff::{Ifd, TiffError};
use crate::{Orient... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/rawkit/src/decoder/mod.rs | libraries/rawkit/src/decoder/mod.rs | pub mod arw1;
pub mod arw2;
pub mod uncompressed;
| rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/rawkit/src/decoder/arw1.rs | libraries/rawkit/src/decoder/arw1.rs | use crate::tiff::Ifd;
use crate::tiff::file::TiffRead;
use crate::tiff::tags::SonyDataOffset;
use crate::{OrientationValue, RawImage, SubtractBlack};
use bitstream_io::{BE, BitRead, BitReader, Endianness};
use std::io::{Read, Seek};
pub fn decode_a100<R: Read + Seek>(ifd: Ifd, file: &mut TiffRead<R>) -> RawImage {
le... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/rawkit/src/tiff/values.rs | libraries/rawkit/src/tiff/values.rs | use num_enum::{IntoPrimitive, TryFromPrimitive};
pub trait ToFloat {
fn to_float(&self) -> f64;
}
impl ToFloat for u32 {
fn to_float(&self) -> f64 {
*self as f64
}
}
impl ToFloat for i32 {
fn to_float(&self) -> f64 {
*self as f64
}
}
pub struct Rational<T: ToFloat> {
pub numerator: T,
pub denominator: T,... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/rawkit/src/tiff/file.rs | libraries/rawkit/src/tiff/file.rs | use std::io::{Error, ErrorKind, Read, Result, Seek, SeekFrom};
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub enum Endian {
Little,
Big,
}
pub struct TiffRead<R: Read + Seek> {
reader: R,
endian: Endian,
}
impl<R: Read + Seek> TiffRead<R> {
pub fn new(mut reader: R) -> Result<Self> {
let error = Error::new(... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/rawkit/src/tiff/types.rs | libraries/rawkit/src/tiff/types.rs | use super::file::TiffRead;
use super::values::{CompressionValue, CurveLookupTable, OrientationValue, Rational};
use super::{Ifd, IfdTagType, TiffError};
use std::io::{Read, Seek};
pub struct TypeAscii;
pub struct TypeByte;
pub struct TypeShort;
pub struct TypeLong;
pub struct TypeRational;
pub struct TypeSByte;
pub st... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/rawkit/src/tiff/mod.rs | libraries/rawkit/src/tiff/mod.rs | pub mod file;
pub mod tags;
mod types;
pub mod values;
use file::TiffRead;
use num_enum::{FromPrimitive, IntoPrimitive};
use std::fmt::Display;
use std::io::{Read, Seek};
use tags::Tag;
use thiserror::Error;
#[derive(Copy, Clone, Debug, PartialEq, Eq, FromPrimitive, IntoPrimitive)]
#[repr(u16)]
pub enum TagId {
Imag... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/rawkit/src/tiff/tags.rs | libraries/rawkit/src/tiff/tags.rs | use super::types::{Array, ConstArray, TagType, TypeByte, TypeCompression, TypeIfd, TypeLong, TypeNumber, TypeOrientation, TypeSRational, TypeSShort, TypeShort, TypeSonyToneCurve, TypeString};
use super::{Ifd, TagId, TiffError, TiffRead};
use std::io::{Read, Seek};
pub trait SimpleTag {
type Type: TagType;
const ID:... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/rawkit/src/postprocessing/transform.rs | libraries/rawkit/src/postprocessing/transform.rs | use crate::{Image, OrientationValue, Pixel};
impl Image<u16> {
pub fn orientation_iter(&self) -> (usize, usize, impl Iterator<Item = Pixel> + use<'_>) {
let (final_width, final_height) = if self.orientation.will_swap_coordinates() {
(self.height, self.width)
} else {
(self.width, self.height)
};
let in... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/rawkit/src/postprocessing/gamma_correction.rs | libraries/rawkit/src/postprocessing/gamma_correction.rs | use crate::{CHANNELS_IN_RGB, Histogram, Image, Pixel};
use std::f64::consts::E;
impl Image<u16> {
pub fn gamma_correction_fn(&self, histogram: &Histogram) -> impl Fn(Pixel) -> [u16; CHANNELS_IN_RGB] + use<> {
let percentage = self.width * self.height;
let mut white = 0;
for channel_histogram in histogram {
... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/rawkit/src/postprocessing/mod.rs | libraries/rawkit/src/postprocessing/mod.rs | pub mod convert_to_rgb;
pub mod gamma_correction;
pub mod record_histogram;
pub mod transform;
| rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/rawkit/src/postprocessing/convert_to_rgb.rs | libraries/rawkit/src/postprocessing/convert_to_rgb.rs | use crate::{CHANNELS_IN_RGB, Pixel, RawImage};
impl RawImage {
pub fn convert_to_rgb_fn(&self) -> impl Fn(Pixel) -> [u16; CHANNELS_IN_RGB] + use<> {
let Some(camera_to_rgb) = self.camera_to_rgb else { todo!() };
move |pixel: Pixel| {
std::array::from_fn(|i| i)
.map(|i| camera_to_rgb[i].iter().zip(pixel.va... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/rawkit/src/postprocessing/record_histogram.rs | libraries/rawkit/src/postprocessing/record_histogram.rs | use crate::{CHANNELS_IN_RGB, Histogram, Pixel, PixelTransform, RawImage};
impl RawImage {
pub fn record_histogram_fn(&self) -> RecordHistogram {
RecordHistogram::new()
}
}
pub struct RecordHistogram {
pub histogram: Histogram,
}
impl RecordHistogram {
fn new() -> RecordHistogram {
RecordHistogram {
histog... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/rawkit/tests/tests.rs | libraries/rawkit/tests/tests.rs | // Only compile this file if the feature "rawkit-tests" is enabled
#![cfg(feature = "rawkit-tests")]
use image::codecs::png::{CompressionType, FilterType, PngEncoder};
use image::{ColorType, ImageEncoder};
use libraw::Processor;
use rawkit::RawImage;
use rayon::prelude::*;
use std::collections::HashMap;
use std::fmt::... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/rawkit/rawkit-proc-macros/src/lib.rs | libraries/rawkit/rawkit-proc-macros/src/lib.rs | extern crate proc_macro;
mod build_camera_data;
mod tag_derive;
use proc_macro::TokenStream;
#[proc_macro_derive(Tag)]
pub fn tag_derive(input: TokenStream) -> TokenStream {
tag_derive::tag_derive(input)
}
#[proc_macro]
pub fn build_camera_data(_: TokenStream) -> TokenStream {
build_camera_data::build_camera_data... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/rawkit/rawkit-proc-macros/src/build_camera_data.rs | libraries/rawkit/rawkit-proc-macros/src/build_camera_data.rs | use proc_macro::TokenStream;
use quote::{ToTokens, quote};
use std::fs;
use std::path::Path;
use toml::{Table, Value};
enum CustomValue {
String(String),
Integer(i64),
Float(f64),
Boolean(bool),
Array(Vec<CustomValue>),
}
impl ToTokens for CustomValue {
fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream)... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/rawkit/rawkit-proc-macros/src/tag_derive.rs | libraries/rawkit/rawkit-proc-macros/src/tag_derive.rs | use proc_macro::TokenStream;
use quote::{format_ident, quote};
use syn::{Data, DeriveInput, Fields};
pub fn tag_derive(input: TokenStream) -> TokenStream {
let ast: DeriveInput = syn::parse(input).unwrap();
let name = &ast.ident;
let data_struct = if let Data::Struct(data_struct) = ast.data {
data_struct
} els... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/math-parser/src/ast.rs | libraries/math-parser/src/ast.rs | use crate::value::Complex;
#[derive(Debug, PartialEq, Eq)]
pub struct Unit {
// Exponent of length unit (meters)
pub length: i32,
// Exponent of mass unit (kilograms)
pub mass: i32,
// Exponent of time unit (seconds)
pub time: i32,
}
impl Default for Unit {
fn default() -> Self {
Self::BASE_UNIT
}
}
impl U... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/math-parser/src/lib.rs | libraries/math-parser/src/lib.rs | #![allow(unused)]
pub mod ast;
mod constants;
pub mod context;
pub mod executer;
pub mod parser;
pub mod value;
use ast::Unit;
use context::{EvalContext, ValueMap};
use executer::EvalError;
use parser::ParseError;
use value::Value;
pub fn evaluate(expression: &str) -> Result<(Result<Value, EvalError>, Unit), ParseEr... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/math-parser/src/parser.rs | libraries/math-parser/src/parser.rs | use crate::ast::{BinaryOp, Literal, Node, UnaryOp, Unit};
use crate::context::EvalContext;
use crate::value::{Complex, Number, Value};
use lazy_static::lazy_static;
use num_complex::ComplexFloat;
use pest::Parser;
use pest::iterators::{Pair, Pairs};
use pest::pratt_parser::{Assoc, Op, PrattParser};
use pest_derive::Par... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/math-parser/src/value.rs | libraries/math-parser/src/value.rs | use crate::ast::{BinaryOp, UnaryOp};
use num_complex::ComplexFloat;
use std::f64::consts::PI;
pub type Complex = num_complex::Complex<f64>;
#[derive(Debug, PartialEq, Clone, Copy)]
pub enum Value {
Number(Number),
}
impl Value {
pub fn from_f64(x: f64) -> Self {
Self::Number(Number::Real(x))
}
pub fn as_real(... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/math-parser/src/executer.rs | libraries/math-parser/src/executer.rs | use crate::ast::{Literal, Node};
use crate::constants::DEFAULT_FUNCTIONS;
use crate::context::{EvalContext, FunctionProvider, ValueProvider};
use crate::value::{Number, Value};
use thiserror::Error;
#[derive(Debug, Error)]
pub enum EvalError {
#[error("Missing value: {0}")]
MissingValue(String),
#[error("Missing f... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/math-parser/src/constants.rs | libraries/math-parser/src/constants.rs | use crate::value::{Number, Value};
use lazy_static::lazy_static;
use num_complex::{Complex, ComplexFloat};
use std::collections::HashMap;
use std::f64::consts::PI;
type FunctionImplementation = Box<dyn Fn(&[Value]) -> Option<Value> + Send + Sync>;
lazy_static! {
pub static ref DEFAULT_FUNCTIONS: HashMap<&'static str,... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/math-parser/src/context.rs | libraries/math-parser/src/context.rs | use crate::value::Value;
use std::collections::HashMap;
use std::ops::{Deref, DerefMut};
//TODO: editor integration, implement these traits for whatever is needed, maybe merge them if needed
pub trait ValueProvider {
fn get_value(&self, name: &str) -> Option<Value>;
}
pub trait FunctionProvider {
fn run_function(&s... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/math-parser/benches/bench.rs | libraries/math-parser/benches/bench.rs | use criterion::{Criterion, black_box, criterion_group, criterion_main};
use math_parser::ast;
use math_parser::context::EvalContext;
macro_rules! generate_benchmarks {
($( $input:expr_2021 ),* $(,)?) => {
fn parsing_bench(c: &mut Criterion) {
$(
c.bench_function(concat!("parse ", $input), |b| {
b.iter(|... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/dyn-any/src/lib.rs | libraries/dyn-any/src/lib.rs | #![doc(html_root_url = "http://docs.rs/const-default/1.0.0")]
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(clippy::missing_safety_doc)]
#[cfg(feature = "alloc")]
extern crate alloc;
#[cfg(feature = "derive")]
pub use dyn_any_derive::DynAny;
/// Implement this trait for your `dyn Trait` types for all `T: Trait`... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/dyn-any/derive/src/lib.rs | libraries/dyn-any/derive/src/lib.rs | #![doc(html_root_url = "http://docs.rs/dyn-any-derive/0.1.0")]
extern crate proc_macro;
use proc_macro::TokenStream;
use proc_macro2::Span;
use quote::quote;
use syn::{DeriveInput, GenericParam, Lifetime, LifetimeParam, TypeParamBound, parse_macro_input};
/// Derives an implementation for the [`DynAny`] trait.
///
/... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/path-bool/src/path_boolean.rs | libraries/path-bool/src/path_boolean.rs | //! Implements boolean operations on paths using graph-based algorithms.
//!
//! This module uses concepts from graph theory to efficiently perform boolean
//! operations on complex paths. The main algorithms involve creating a graph
//! representation of the paths, simplifying this graph, and then working with
//! its... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | true |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/path-bool/src/path.rs | libraries/path-bool/src/path.rs | pub(crate) mod intersection_path_segment;
pub(crate) mod line_segment;
pub(crate) mod line_segment_aabb;
pub(crate) mod path_cubic_segment_self_intersection;
pub(crate) mod path_segment;
use glam::DVec2;
#[cfg(feature = "parsing")]
use crate::path_command::{AbsolutePathCommand, PathCommand, to_absolute_commands};
use... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/path-bool/src/lib.rs | libraries/path-bool/src/lib.rs | #![expect(clippy::needless_doctest_main)]
#![doc = include_str!("../README.md")]
mod path_boolean;
// #[cfg(feature = "parsing")]
mod parsing {
pub(crate) mod path_command;
pub(crate) mod path_data;
}
mod util {
pub(crate) mod aabb;
pub(crate) mod epsilons;
pub(crate) mod grid;
pub(crate) mod math;
}
mod path;
#[... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/path-bool/src/visual_tests.rs | libraries/path-bool/src/visual_tests.rs | use crate::path_boolean::{self, FillRule, PathBooleanOperation};
use crate::path_data::{path_from_path_data, path_to_path_data};
use core::panic;
use glob::glob;
use image::{DynamicImage, GenericImageView, RgbaImage};
use resvg::render;
use resvg::tiny_skia::Transform;
use resvg::usvg::{Options, Tree};
use std::fs;
use... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/path-bool/src/util/epsilons.rs | libraries/path-bool/src/util/epsilons.rs | #[derive(Clone, Copy, Debug)]
pub struct Epsilons {
pub point: f64,
pub linear: f64,
pub param: f64,
}
| rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/path-bool/src/util/aabb.rs | libraries/path-bool/src/util/aabb.rs | use glam::{BVec2, DVec2};
#[derive(Clone, Copy, Debug, PartialEq)]
pub(crate) struct Aabb {
min: DVec2,
max: DVec2,
}
impl Default for Aabb {
fn default() -> Self {
Self {
min: DVec2::INFINITY,
max: DVec2::NEG_INFINITY,
}
}
}
impl Aabb {
#[inline]
pub(crate) fn min(&self) -> DVec2 {
self.min
}
#[... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/path-bool/src/util/math.rs | libraries/path-bool/src/util/math.rs | use glam::{DVec2, FloatExt};
pub use std::f64::consts::PI;
pub fn lin_map(value: f64, in_min: f64, in_max: f64, out_min: f64, out_max: f64) -> f64 {
((value - in_min) / (in_max - in_min)) * (out_max - out_min) + out_min
}
pub fn lerp(a: f64, b: f64, t: f64) -> f64 {
a.lerp(b, t)
}
pub fn vector_angle(u: DVec2, v: ... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/path-bool/src/util/grid.rs | libraries/path-bool/src/util/grid.rs | use crate::aabb::Aabb;
use glam::{DVec2, IVec2};
use rustc_hash::FxHashMap;
use smallvec::SmallVec;
pub(crate) struct Grid {
cell_factor: f64,
cells: FxHashMap<IVec2, SmallVec<[usize; 6]>>,
}
impl Grid {
pub(crate) fn new(cell_size: f64, edges: usize) -> Self {
Grid {
cell_factor: cell_size.recip(),
cells:... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/path-bool/src/parsing/path_command.rs | libraries/path-bool/src/parsing/path_command.rs | use glam::DVec2;
#[derive(Clone, Debug)]
pub enum AbsolutePathCommand {
H(f64),
V(f64),
M(DVec2),
L(DVec2),
C(DVec2, DVec2, DVec2),
S(DVec2, DVec2),
Q(DVec2, DVec2),
T(DVec2),
A(f64, f64, f64, bool, bool, DVec2),
Z,
}
#[derive(Clone, Debug)]
pub enum RelativePathCommand {
H(f64),
V(f64),
M(f64, f64),
L(... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/path-bool/src/parsing/path_data.rs | libraries/path-bool/src/parsing/path_data.rs | use crate::BooleanError;
use crate::path::{Path, path_from_commands, path_to_commands};
use crate::path_command::{AbsolutePathCommand, PathCommand, RelativePathCommand};
use glam::DVec2;
use regex::Regex;
pub fn commands_from_path_data(d: &str) -> Result<Vec<PathCommand>, BooleanError> {
let re_float = Regex::new(r"^... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/path-bool/src/path/line_segment_aabb.rs | libraries/path-bool/src/path/line_segment_aabb.rs | use crate::aabb::Aabb;
use crate::line_segment::LineSegment;
const INSIDE: u8 = 0;
const LEFT: u8 = 1;
const RIGHT: u8 = 1 << 1;
const BOTTOM: u8 = 1 << 2;
const TOP: u8 = 1 << 3;
fn out_code(x: f64, y: f64, bounding_box: &Aabb) -> u8 {
let mut code = INSIDE;
if x < bounding_box.left() {
code |= LEFT;
} else if... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/path-bool/src/path/path_segment.rs | libraries/path-bool/src/path/path_segment.rs | //! Defines the `PathSegment` enum and related functionality for representing and
//! manipulating path segments in 2D space.
//!
//! This module provides implementations for various types of path segments including
//! lines, cubic and quadratic Bézier curves, and elliptical arcs. It also includes
//! utility function... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/path-bool/src/path/path_cubic_segment_self_intersection.rs | libraries/path-bool/src/path/path_cubic_segment_self_intersection.rs | use crate::path_segment::PathSegment;
const EPS: f64 = 1e-12;
pub fn path_cubic_segment_self_intersection(seg: &PathSegment) -> Option<[f64; 2]> {
// https://math.stackexchange.com/questions/3931865/self-intersection-of-a-cubic-bezier-interpretation-of-the-solution
if let PathSegment::Cubic(p1, p2, p3, p4) = seg {... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/path-bool/src/path/intersection_path_segment.rs | libraries/path-bool/src/path/intersection_path_segment.rs | use crate::aabb::{Aabb, bounding_box_max_extent, bounding_boxes_overlap};
use crate::epsilons::Epsilons;
use crate::line_segment::{line_segment_intersection, line_segments_intersect};
use crate::line_segment_aabb::line_segment_aabb_intersect;
use crate::math::lerp;
use crate::path_segment::PathSegment;
use glam::DVec2;... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/path-bool/src/path/line_segment.rs | libraries/path-bool/src/path/line_segment.rs | use glam::DVec2;
pub type LineSegment = [DVec2; 2];
const COLLINEAR_EPS: f64 = f64::EPSILON * 64.;
#[inline(never)]
pub fn line_segment_intersection([p1, p2]: LineSegment, [p3, p4]: LineSegment, eps: f64) -> Option<(f64, f64)> {
// https://en.wikipedia.org/wiki/Intersection_(geometry)#Two_line_segments
let a = p2... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/path-bool/benches/path_segment_intersection.rs | libraries/path-bool/benches/path_segment_intersection.rs | use criterion::{Criterion, black_box, criterion_group, criterion_main};
use glam::DVec2;
use path_bool::*;
pub fn criterion_benchmark(crit: &mut Criterion) {
crit.bench_function("intersect 1", |bench| bench.iter(|| path_segment_intersection(black_box(&a()), black_box(&b()), true, &EPS)));
crit.bench_function("inters... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
GraphiteEditor/Graphite | https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/libraries/path-bool/benches/painted_dreams.rs | libraries/path-bool/benches/painted_dreams.rs | use criterion::{Criterion, black_box, criterion_group, criterion_main};
use path_bool::*;
pub fn criterion_benchmark(c: &mut Criterion) {
let path_a =
path_from_path_data("M0,340C161.737914,383.575765 107.564182,490.730587 273,476 C419,463 481.741198,514.692273 481.333333,768 C481.333333,768 -0,768 -0,768 C-0,768 0... | rust | Apache-2.0 | 42440c0d0bcf5735b05d8a9e5bd27187f74b1589 | 2026-01-04T15:38:29.103662Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/tests/egui_tests/tests/regression_tests.rs | tests/egui_tests/tests/regression_tests.rs | use egui::accesskit::Role;
use egui::{Align, Color32, Image, Label, Layout, RichText, Sense, TextWrapMode, include_image};
use egui_kittest::Harness;
use egui_kittest::kittest::Queryable as _;
#[test]
fn image_button_should_have_alt_text() {
let harness = Harness::new_ui(|ui| {
_ = ui.button(
I... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/tests/egui_tests/tests/test_atoms.rs | tests/egui_tests/tests/test_atoms.rs | use egui::{Align, AtomExt as _, Button, Layout, TextWrapMode, Ui, Vec2};
use egui_kittest::{HarnessBuilder, SnapshotResult, SnapshotResults};
#[test]
fn test_atoms() {
let mut results = SnapshotResults::new();
results.add(single_test("max_width", |ui| {
ui.add(Button::new((
"max width not ... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.