mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-09-04 20:20:32 +00:00
Improve the categorization across many nodes
This commit is contained in:
parent
2ec0ff38f3
commit
fdb09e334b
11 changed files with 41 additions and 54 deletions
|
@ -12,15 +12,9 @@ use graphene_core::raster_types::{CPU, Raster, RasterDataTable};
|
|||
use graphene_core::renderer::GraphicElementRendered;
|
||||
use graphene_core::transform::Transform;
|
||||
use graphene_core::value::ClonedNode;
|
||||
use graphene_core::vector::VectorDataTable;
|
||||
use graphene_core::vector::brush_stroke::{BrushStroke, BrushStyle};
|
||||
use graphene_core::{Ctx, GraphicElement, Node};
|
||||
|
||||
#[node_macro::node(category("Debug"))]
|
||||
fn vector_points(_: impl Ctx, vector_data: VectorDataTable) -> Vec<DVec2> {
|
||||
vector_data.instance_iter().flat_map(|element| element.instance.point_domain.positions().to_vec()).collect()
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub struct BrushStampGenerator<P: Pixel + Alpha> {
|
||||
color: P,
|
||||
|
|
|
@ -6,7 +6,7 @@ use image::{DynamicImage, GenericImage, GenericImageView, GrayImage, ImageBuffer
|
|||
use ndarray::{Array2, ArrayBase, Dim, OwnedRepr};
|
||||
use std::cmp::{max, min};
|
||||
|
||||
#[node_macro::node(category("Raster"))]
|
||||
#[node_macro::node(category("Raster: Filter"))]
|
||||
async fn dehaze(_: impl Ctx, image_frame: RasterDataTable<CPU>, strength: Percentage) -> RasterDataTable<CPU> {
|
||||
let mut result_table = RasterDataTable::default();
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use graphene_core::Ctx;
|
||||
|
||||
#[node_macro::node(category("Network"))]
|
||||
#[node_macro::node(category("Web Request"))]
|
||||
async fn get_request(_: impl Ctx, url: String) -> reqwest::Response {
|
||||
reqwest::get(url).await.unwrap()
|
||||
}
|
||||
|
||||
#[node_macro::node(category("Network"))]
|
||||
#[node_macro::node(category("Web Request"))]
|
||||
async fn post_request(_: impl Ctx, url: String, body: String) -> reqwest::Response {
|
||||
reqwest::Client::new().post(url).body(body).send().await.unwrap()
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use graphene_core::raster_types::{CPU, RasterDataTable};
|
||||
use graphene_core::{Color, Ctx};
|
||||
|
||||
#[node_macro::node(category("Raster"))]
|
||||
#[node_macro::node(category("Color"))]
|
||||
async fn image_color_palette(
|
||||
_: impl Ctx,
|
||||
image: RasterDataTable<CPU>,
|
||||
|
|
|
@ -91,7 +91,7 @@ fn sample_image(ctx: impl ExtractFootprint + Clone + Send, image_frame: RasterDa
|
|||
result_table
|
||||
}
|
||||
|
||||
#[node_macro::node(category("Raster"))]
|
||||
#[node_macro::node(category("Raster: Channels"))]
|
||||
fn combine_channels(
|
||||
_: impl Ctx,
|
||||
_primary: (),
|
||||
|
@ -402,7 +402,7 @@ fn image_value(_: impl Ctx, _primary: (), image: RasterDataTable<CPU>) -> Raster
|
|||
// tiling: Tiling: bool,
|
||||
// }
|
||||
|
||||
#[node_macro::node(category("Raster"))]
|
||||
#[node_macro::node(category("Raster: Pattern"))]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn noise_pattern(
|
||||
ctx: impl ExtractFootprint + Ctx,
|
||||
|
@ -559,7 +559,7 @@ fn noise_pattern(
|
|||
result
|
||||
}
|
||||
|
||||
#[node_macro::node(category("Raster"))]
|
||||
#[node_macro::node(category("Raster: Pattern"))]
|
||||
fn mandelbrot(ctx: impl ExtractFootprint + Send) -> RasterDataTable<CPU> {
|
||||
let footprint = ctx.footprint();
|
||||
let viewport_bounds = footprint.viewport_bounds_in_local_space();
|
||||
|
|
|
@ -60,7 +60,7 @@ async fn create_surface<'a: 'n>(_: impl Ctx, editor: &'a WasmEditorApi) -> Arc<W
|
|||
// }
|
||||
// }
|
||||
|
||||
#[node_macro::node(category("Network"))]
|
||||
#[node_macro::node(category("Web Request"))]
|
||||
async fn load_resource<'a: 'n>(_: impl Ctx, _primary: (), #[scope("editor-api")] editor: &'a WasmEditorApi, #[name("URL")] url: String) -> Arc<[u8]> {
|
||||
let Some(api) = editor.application_io.as_ref() else {
|
||||
return Arc::from(include_bytes!("../../graph-craft/src/null.png").to_vec());
|
||||
|
@ -75,7 +75,7 @@ async fn load_resource<'a: 'n>(_: impl Ctx, _primary: (), #[scope("editor-api")]
|
|||
data
|
||||
}
|
||||
|
||||
#[node_macro::node(category("Network"))]
|
||||
#[node_macro::node(category("Web Request"))]
|
||||
fn decode_image(_: impl Ctx, data: Arc<[u8]>) -> RasterDataTable<CPU> {
|
||||
let Some(image) = image::load_from_memory(data.as_ref()).ok() else {
|
||||
return RasterDataTable::default();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue