diff --git a/crates/engine/src/cmd/brushlib.rs b/crates/engine/src/cmd/brushlib.rs index 944534bb15..2d31c5af6e 100644 --- a/crates/engine/src/cmd/brushlib.rs +++ b/crates/engine/src/cmd/brushlib.rs @@ -16,7 +16,7 @@ use vectorcraft_brush::{ Variation, }; use vectorcraft_color::{Color, Paint}; -use vectorcraft_doc::{Appearance, AppearanceItem, Document, FillLayer, Node, NodeId, NodeKind, PatternDef, Symbol}; +use vectorcraft_doc::{Appearance, AppearanceItem, Document, FillLayer, ImageBlob, ImageObject, Node, NodeId, NodeKind, PatternDef, Symbol}; use vectorcraft_geom::{Affine, FillRule, PathData, Point, Rect, SubPath, shapes}; use super::brushsym::{apply_brush, brush_targets, roots, stroke_paint}; @@ -183,6 +183,7 @@ pub const BUILTIN: &[BuiltinBrushLibrary] = &[ BuiltinBrushLibrary { id: "dry-media", name: "Dry Media", make: dry_media }, BuiltinBrushLibrary { id: "tech-circuit", name: "Tech Circuit", make: tech_circuit }, BuiltinBrushLibrary { id: "arrows", name: "Arrows", make: arrows }, + BuiltinBrushLibrary { id: "image-brush", name: "Image Brush", make: image_brush }, ]; /// Built-in library `id`, made once. @@ -572,6 +573,80 @@ fn scatter(name: &str, art: Node, s: Scatter) -> Brush { Brush { name: name.into(), kind: BrushKind::Scatter(Scatter { art, ..s }) } } +/// Four original raster stamps. Scatter brushes preserve their image art while placing a copy +/// along the path; art brushes bend their art and cannot bend an image. Each 24 px stamp is placed +/// 6 pt wide, the size of the Scatter Shapes art, so a 1 pt stroke on a 10 pt line shows a stamp. +fn image_brush() -> BrushLibrary { + const SIDE: u32 = 24; + const PT_PER_PX: f64 = 0.25; + let mut doc = Document::new(100.0, 100.0); + let mut brushes = Vec::new(); + for (index, name) in ["Soft Bloom", "Halftone Field", "Solar Grain", "Color Flecks"].into_iter().enumerate() { + let mut pixels = Vec::with_capacity((SIDE * SIDE * 4) as usize); + for y in 0..SIDE { + for x in 0..SIDE { + let (dx, dy) = (x as f64 - 11.5, y as f64 - 11.5); + let r = dx.hypot(dy); + let angle = dy.atan2(dx); + let rgba = match index { + 0 => { + let edge = 7.0 + 3.0 * (5.0 * angle).cos(); + [199, 69, 139, (220.0 * ((edge - r) / 2.5).clamp(0.0, 1.0)) as u8] + } + 1 => { + let (gx, gy) = ((x % 6) as f64 - 2.5, (y % 6) as f64 - 2.5); + [39, 139, 175, if r < 11.0 && gx.hypot(gy) < 1.9 { 225 } else { 0 }] + } + 2 => { + let ray = (9.0 * angle).cos().abs(); + [234, 144, 40, if r < 3.5 || (r < 10.5 && ray > 0.72) { 235 } else { 0 }] + } + _ => { + let seed = (x * 37 + y * 71 + x * y * 13) % 19; + [if seed % 2 == 0 { 67 } else { 114 }, 79, 167, if r < 11.0 && seed < 5 { 210 } else { 0 }] + } + }; + pixels.extend_from_slice(&rgba); + } + } + let Ok(image) = + craft_image_codecs::Image::from_raw(SIDE, SIDE, craft_image_codecs::ChannelLayout::Rgba, craft_image_codecs::SampleType::U8, pixels) + else { + continue; + }; + let Ok(png) = craft_image_codecs::encode(&image, craft_image_codecs::Format::Png, &craft_image_codecs::EncodeOptions::default()) else { + continue; + }; + let key = format!("image-brush-{index}"); + doc.images.insert(key.clone(), ImageBlob::png(png)); + let art = Node::new( + NodeId(0), + NodeKind::Image(Box::new(ImageObject { + key, + width: SIDE, + height: SIDE, + xf: Affine::scale(PT_PER_PX) * Affine::translate((-12.0, -12.0)), + link: None, + placement: Default::default(), + pixels: None, + })), + ); + brushes.push(scatter( + name, + art, + Scatter { + size: (90.0, 110.0), + spacing: (125.0, 155.0), + scatter: (-20.0, 20.0), + rotation: (-15.0, 15.0), + colorization: Colorization::None, + ..Default::default() + }, + )); + } + built("Image Brush", doc, brushes) +} + /// Scatter Shapes: scatter brushes of shapes drawn here; Sparkles scatters the library's own /// symbol, Sparkle. fn scatter_shapes() -> BrushLibrary { diff --git a/crates/engine/src/tests/brushlib.rs b/crates/engine/src/tests/brushlib.rs index 168cc20db8..1010f6f3d3 100644 --- a/crates/engine/src/tests/brushlib.rs +++ b/crates/engine/src/tests/brushlib.rs @@ -119,7 +119,8 @@ fn the_builtin_libraries_are_original_brushes_generated_in_code() { "energy-beams", "dry-media", "tech-circuit", - "arrows" + "arrows", + "image-brush" ] ); assert!(libs.iter().all(|l| l["category"] == "builtIn")); @@ -175,6 +176,7 @@ fn the_builtin_libraries_are_original_brushes_generated_in_code() { ("energy-beams", "art"), ("dry-media", "art"), ("arrows", "art"), + ("image-brush", "scatter"), ] { let (_, lib) = cmd::brushlib::library(&s, id).unwrap(); assert!(lib.len() >= 4, "{id}"); @@ -205,6 +207,43 @@ fn the_builtin_libraries_are_original_brushes_generated_in_code() { assert!(s.execute("brush.library", &json!({"library": "nope"})).is_err()); } +#[test] +fn image_brush_stamps_draw_and_carry_their_pixels_when_added_and_saved() { + let mut s = session(); + let (_, lib) = cmd::brushlib::library(&s, "image-brush").unwrap(); + let names = ["Soft Bloom", "Halftone Field", "Solar Grain", "Color Flecks"]; + assert_eq!(lib.brushes.iter().map(|b| b.name.as_str()).collect::>(), names); + assert_eq!(lib.doc.images.len(), 4); + let path = run(&mut s, "shape.line", json!({"x1": 10, "y1": 40, "x2": 190, "y2": 40}))["id"].as_u64().unwrap(); + for b in &lib.brushes { + let BrushKind::Scatter(sc) = &b.kind else { panic!("{} is not a scatter brush", b.name) }; + let NodeKind::Image(image) = &sc.art.kind else { panic!("{} has no image stamp", b.name) }; + assert!(lib.doc.images.get(&image.key).is_some_and(|blob| blob.bytes.starts_with(b"\x89PNG\r\n\x1a\n"))); + let pieces = vectorcraft_brush::stroke_pieces(&lib.doc, b, &line_to(180.0), &black_stroke()); + assert!(pieces.len() >= 3 && pieces.iter().all(|p| matches!(p.kind, NodeKind::Image(_))), "{}", b.name); + // A short accent shows at least one stamp at a 1 pt stroke. + let short = vectorcraft_brush::stroke_pieces(&lib.doc, b, &line_to(10.0), &black_stroke()); + assert!(!short.is_empty() && short.iter().all(|p| matches!(p.kind, NodeKind::Image(_))), "{} on a 10 pt line", b.name); + let before = undo_len(&s); + let added = run(&mut s, "brush.addFromLibrary", json!({"library": "image-brush", "name": b.name, "apply": true, "ids": [path]})); + assert_eq!(strs(&added["added"]), [b.name.as_str()]); + assert_eq!(added["applied"], json!([path])); + assert_eq!(undo_len(&s), before + 1); + assert!(doc(&s).images.contains_key(&image.key), "{} pixels were not copied", b.name); + } + let saved = run(&mut s, "brush.saveLibrary", json!({"names": names})); + let bytes = vectorcraft_format::base64_decode(saved["dataBase64"].as_str().unwrap()).unwrap(); + let reopened = vectorcraft_format::load(&bytes).unwrap(); + let mut saved_brushes = vectorcraft_brush::library(&reopened); + for brush in &mut saved_brushes { + if let BrushKind::Scatter(sc) = &mut brush.kind { + sc.art.id = NodeId(0); // Loaded image art is given a fresh document node ID. + } + } + assert_eq!(saved_brushes, lib.brushes); + assert_eq!(reopened.images, lib.doc.images); +} + /// Every path of brush art `n`: (anchors, opacity). fn art_paths(n: &vectorcraft_doc::Node) -> Vec<(usize, f32)> { let mut out = vec![]; diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 3a3efbf75b..210b875754 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -7794,6 +7794,11 @@ breakText Glyphs Глифи @msg A joint does not close by {gap} pt. Една връзка не се затваря с {gap} pt. @msg Two panels pass through each other. Два панела минават един през друг. @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer трябва да е "singleLine", "everyLine", "standardSingleLine" или "standardEveryLine" + Image Brush Четки за изображения + Soft Bloom Мек цъфтеж + Halftone Field Полутоново поле + Solar Grain Слънчево зърно + Color Flecks Цветни пръски Fine Stipple Фина точкова текстура Dense Stipple Гъста точкова текстура Soft Stipple Мека точкова текстура diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index f10274e278..1e61de444a 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -7849,6 +7849,11 @@ shape Open Otvoren @msg A joint does not close by {gap} pt. Spoj se ne zatvara za {gap} pt. @msg Two panels pass through each other. Dva panela prolaze jedan kroz drugi. @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer mora biti "singleLine", "everyLine", "standardSingleLine" ili "standardEveryLine" + Image Brush Slikovni kistovi + Soft Bloom Meko cvjetanje + Halftone Field Polutonsko polje + Solar Grain Sunčano zrno + Color Flecks Šarene mrlje Fine Stipple Fino tačkasto sjenčenje Dense Stipple Gusto tačkasto sjenčenje Soft Stipple Meko tačkasto sjenčenje diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index ebd7a1f8e3..ff0e0035fe 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -8821,6 +8821,11 @@ breakText Glyphs Glifs @msg A joint does not close by {gap} pt. Una unió no es tanca per {gap} pt. @msg Two panels pass through each other. Dos panells es travessen l’un a l’altre. @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer ha de ser "singleLine", "everyLine", "standardSingleLine" o "standardEveryLine" + Image Brush Pinzells d'imatge + Soft Bloom Floració suau + Halftone Field Camp de semitons + Solar Grain Gra solar + Color Flecks Esquitxos de color Fine Stipple Puntejat fi Dense Stipple Puntejat dens Soft Stipple Puntejat suau diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index bc2c65132a..900517b947 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -10646,6 +10646,11 @@ breakText Glyphs Glyfy @msg A panel is not joined to the rest by a crease. Panel není se zbytkem spojen žádnou linií bigu. @msg A fold line is on a non-printing layer. Linie skladu je na netisknutelné vrstvě. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Panely: {panels}, panty: {hinges}, chyby: {errors}, upozornění: {warnings} + Image Brush Obrazové štětce + Soft Bloom Jemný květ + Halftone Field Polotónové pole + Solar Grain Sluneční zrno + Color Flecks Barevné skvrny Paper Cutouts Papírové výřezy Coral Layers Korálové vrstvy Mint Layers Mátové vrstvy diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 8296b0608d..c5bbf6e360 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -10708,6 +10708,11 @@ breakText Glyphs Glyffer @msg A joint does not close by {gap} pt. En samling lukker ikke med {gap} pt. @msg Two panels pass through each other. To paneler går gennem hinanden. @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer skal være "singleLine", "everyLine", "standardSingleLine" eller "standardEveryLine" + Image Brush Billedpensler + Soft Bloom Blød blomstring + Halftone Field Halvtonefelt + Solar Grain Solkorn + Color Flecks Farvestænk Fine Stipple Fint prikmønster Dense Stipple Tæt prikmønster Soft Stipple Blødt prikmønster diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 0fc9657417..6afbf145df 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -10259,6 +10259,11 @@ breakText Glyphs Glyphen @msg A panel is not joined to the rest by a crease. Ein Feld ist durch keine Rilllinie mit den übrigen verbunden. @msg A fold line is on a non-printing layer. Eine Faltlinie liegt auf einer nicht druckbaren Ebene. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Felder: {panels}, Scharniere: {hinges}, Fehler: {errors}, Warnungen: {warnings} + Image Brush Bildpinsel + Soft Bloom Sanfte Blüte + Halftone Field Rasterfeld + Solar Grain Sonnenkorn + Color Flecks Farbsprenkel Paper Cutouts Papierschnitte Coral Layers Korallschichten Mint Layers Minzschichten diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 2736f1600d..9408c554f0 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -8795,6 +8795,11 @@ breakText Glyphs Γλύφοι @msg A joint does not close by {gap} pt. Μια ένωση δεν κλείνει κατά {gap} pt. @msg Two panels pass through each other. Δύο πάνελ διαπερνούν το ένα το άλλο. @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" το composer πρέπει να είναι "singleLine", "everyLine", "standardSingleLine" ή "standardEveryLine" + Image Brush Πινέλα εικόνας + Soft Bloom Απαλό άνθος + Halftone Field Πεδίο ημιτόνων + Solar Grain Ηλιακός κόκκος + Color Flecks Χρωματικές πιτσιλιές Fine Stipple Λεπτή στιγμογραφία Dense Stipple Πυκνή στιγμογραφία Soft Stipple Απαλή στιγμογραφία diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 8d999a9cd8..3e2cf4f433 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -10538,6 +10538,11 @@ breakText Glyphs Glifos @msg A joint does not close by {gap} pt. Una unión no cierra por {gap} pt. @msg Two panels pass through each other. Dos paneles se atraviesan entre sí. @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer debe ser "singleLine", "everyLine", "standardSingleLine" o "standardEveryLine" + Image Brush Pinceles de imagen + Soft Bloom Flor suave + Halftone Field Campo de semitonos + Solar Grain Grano solar + Color Flecks Motas de color Fine Stipple Punteado fino Dense Stipple Punteado denso Soft Stipple Punteado suave diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 40167f6a0a..befb978570 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -8878,6 +8878,11 @@ breakText Glyphs Merkit @msg A joint does not close by {gap} pt. Liitos ei sulkeudu, rako {gap} pt. @msg Two panels pass through each other. Kaksi paneelia kulkee toistensa läpi. @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer on oltava "singleLine", "everyLine", "standardSingleLine" tai "standardEveryLine" + Image Brush Kuvasiveltimet + Soft Bloom Pehmeä kukinta + Halftone Field Rasterikenttä + Solar Grain Aurinkorakeet + Color Flecks Väripilkut Fine Stipple Hieno pistetys Dense Stipple Tiheä pistetys Soft Stipple Pehmeä pistetys diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 13577c0441..b101f75587 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -10609,6 +10609,11 @@ breakText Glyphs Glyphes @msg A joint does not close by {gap} pt. Un joint ne se ferme pas, avec un écart de {gap} pt. @msg Two panels pass through each other. Deux panneaux se traversent. @msg {_1} × {_2} pixels is too large for GIF (at most 65535 pixels a side): lower the resolution {_1} × {_2} pixels, c’est trop grand pour le GIF (65535 pixels par côté au plus) : réduisez la résolution + Image Brush Pinceaux d’image + Soft Bloom Floraison douce + Halftone Field Champ de demi-teintes + Solar Grain Grain solaire + Color Flecks Éclats colorés Paper Cutouts Découpes de papier Coral Layers Couches corail Mint Layers Couches menthe diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index edc1d8368e..e57626fee5 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -5512,6 +5512,11 @@ swatch [Registration] [રજિસ્ટ્રેશન] Standard Single-line Composer સ્ટાન્ડર્ડ સિંગલ-લાઇન કમ્પોઝર Standard Every-line Composer સ્ટાન્ડર્ડ એવરી-લાઇન કમ્પોઝર @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer આમાંથી એક હોવું જોઈએ: "singleLine", "everyLine", "standardSingleLine" અથવા "standardEveryLine" + Image Brush છબી બ્રશ + Soft Bloom નરમ ફૂલ + Halftone Field હાફટોન ક્ષેત્ર + Solar Grain સૂર્ય કણ + Color Flecks રંગીન છાંટા Fine Stipple સૂક્ષ્મ બિંદુ છાંયાંકન Dense Stipple ઘન બિંદુ છાંયાંકન Soft Stipple નરમ બિંદુ છાંયાંકન diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index 55970ae123..5ed8d4b250 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -10252,6 +10252,11 @@ theme Appearance अपीयरेंस @msg A panel is not joined to the rest by a crease. कोई पैनल किसी क्रीज़ लाइन से बाकी से जुड़ा नहीं है। @msg A fold line is on a non-printing layer. एक फ़ोल्ड लाइन नॉन-प्रिंटिंग लेयर पर है। @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} पैनल: {panels}, हिंज: {hinges}, एरर: {errors}, वॉर्निंग: {warnings} + Image Brush छवि ब्रश + Soft Bloom कोमल खिलावट + Halftone Field हाफ़टोन क्षेत्र + Solar Grain सौर कण + Color Flecks रंगीन छींटे Paper Cutouts कागज़ की कतरनें Coral Layers कोरल परतें Mint Layers मिंट परतें diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 161bbfddcb..6a44adc4a7 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -10634,6 +10634,11 @@ breakText Glyphs Glifák @msg A panel is not joined to the rest by a crease. Egy panelt egyetlen bigvonal sem köt a többihez. @msg A fold line is on a non-printing layer. Egy hajtásvonal nem nyomtatható rétegen van. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Panelek: {panels}, zsanérok: {hinges}, hibák: {errors}, figyelmeztetések: {warnings} + Image Brush Képecsetek + Soft Bloom Lágy virágzás + Halftone Field Féltónusmező + Solar Grain Napszemcse + Color Flecks Színes pettyek Paper Cutouts Papírkivágások Coral Layers Korallrétegek Mint Layers Mentás rétegek diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 6d1b480256..0c99ae6984 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -8492,6 +8492,11 @@ breakText Glyphs Glif @msg A joint does not close by {gap} pt. Sebuah sambungan tidak menutup sejauh {gap} pt. @msg Two panels pass through each other. Dua panel saling menembus. @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer harus "singleLine", "everyLine", "standardSingleLine", atau "standardEveryLine" + Image Brush Kuas gambar + Soft Bloom Mekar lembut + Halftone Field Bidang halftone + Solar Grain Butir surya + Color Flecks Bintik warna Fine Stipple Arsiran titik halus Dense Stipple Arsiran titik rapat Soft Stipple Arsiran titik lembut diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index cd6dbabf33..b372b92a06 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -10292,6 +10292,11 @@ breakText Glyphs Glifi @msg A panel is not joined to the rest by a crease. Un pannello non è unito al resto da alcuna linea di cordonatura. @msg A fold line is on a non-printing layer. Una linea di piega si trova su un livello non stampabile. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Pannelli: {panels}, cerniere: {hinges}, errori: {errors}, avvisi: {warnings} + Image Brush Pennelli immagine + Soft Bloom Fioritura morbida + Halftone Field Campo mezzitoni + Solar Grain Grana solare + Color Flecks Spruzzi di colore Paper Cutouts Ritagli di carta Coral Layers Livelli corallo Mint Layers Livelli menta diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 3f29239bc1..818b598fc6 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -10356,6 +10356,11 @@ breakText Glyphs 字形 @msg A panel is not joined to the rest by a crease. パネルがどの筋入れ線でも他とつながっていません。 @msg A fold line is on a non-printing layer. 折り線が印刷しないレイヤーにあります。 @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} パネル: {panels}、ヒンジ: {hinges}、エラー: {errors}、警告: {warnings} + Image Brush 画像ブラシ + Soft Bloom やわらかな花 + Halftone Field ハーフトーンの面 + Solar Grain 太陽の粒 + Color Flecks 色のしぶき Paper Cutouts 切り絵 Coral Layers コーラルのレイヤー Mint Layers ミントのレイヤー diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index a0ef2bfaa8..da771e9428 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -10932,6 +10932,11 @@ font-script Japanese იაპონური @msg A joint does not close by {gap} pt. შეერთება არ იხურება {gap} pt-ით. @msg Two panels pass through each other. ორი პანელი ერთმანეთში გადის. @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer უნდა იყოს "singleLine", "everyLine", "standardSingleLine" ან "standardEveryLine" + Image Brush გამოსახულების ფუნჯები + Soft Bloom რბილი ყვავილი + Halftone Field ნახევარტონური ველი + Solar Grain მზის მარცვალი + Color Flecks ფერადი ლაქები Fine Stipple წვრილი წერტილოვანი ტექსტურა Dense Stipple მკვრივი წერტილოვანი ტექსტურა Soft Stipple რბილი წერტილოვანი ტექსტურა diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 9639b74fdc..b9dfff8bc6 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -10255,6 +10255,11 @@ breakText Glyphs 글리프 @msg A panel is not joined to the rest by a crease. 패널이 어떤 오시선으로도 나머지와 연결되어 있지 않습니다. @msg A fold line is on a non-printing layer. 접는 선이 인쇄되지 않는 레이어에 있습니다. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} 패널: {panels}, 힌지: {hinges}, 오류: {errors}, 경고: {warnings} + Image Brush 이미지 브러시 + Soft Bloom 부드러운 꽃 + Halftone Field 하프톤 필드 + Solar Grain 태양 입자 + Color Flecks 색 점 Paper Cutouts 종이 오려내기 Coral Layers 산호색 레이어 Mint Layers 민트색 레이어 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 443702c459..99aa4bec91 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -10685,6 +10685,11 @@ breakText Glyphs Glyphs @msg A panel is not joined to the rest by a crease. Een paneel is door geen rillijn met de rest verbonden. @msg A fold line is on a non-printing layer. Een vouwlijn staat op een laag die niet wordt afgedrukt. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Panelen: {panels}, scharnieren: {hinges}, fouten: {errors}, waarschuwingen: {warnings} + Image Brush Afbeeldingspenselen + Soft Bloom Zachte bloei + Halftone Field Halftoonveld + Solar Grain Zonnekorrel + Color Flecks Kleurspikkels Paper Cutouts Papieruitsneden Coral Layers Koraallagen Mint Layers Muntlagen diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 6ac87915b3..75c2b8c735 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -10509,6 +10509,11 @@ breakText Glyphs Glify @msg A panel is not joined to the rest by a crease. Panel nie jest połączony z resztą żadną linią bigowania. @msg A fold line is on a non-printing layer. Linia zgięcia znajduje się na warstwie niedrukowanej. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Panele: {panels}, zawiasy: {hinges}, błędy: {errors}, ostrzeżenia: {warnings} + Image Brush Pędzle obrazkowe + Soft Bloom Miękki kwiat + Halftone Field Pole półtonów + Solar Grain Słoneczne ziarno + Color Flecks Kolorowe plamki Paper Cutouts Wycinanki papierowe Coral Layers Warstwy koralowe Mint Layers Warstwy miętowe diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 8d7ca94571..bb40f9a2d9 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -10718,6 +10718,11 @@ swatch Yellow Green Verde-amarelado @msg A panel is not joined to the rest by a crease. Um painel não está unido ao restante por nenhuma linha de vinco. @msg A fold line is on a non-printing layer. Uma linha de dobra está em uma camada não imprimível. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Painéis: {panels}, dobradiças: {hinges}, erros: {errors}, avisos: {warnings} + Image Brush Pincéis de imagem + Soft Bloom Flor suave + Halftone Field Campo de meios-tons + Solar Grain Grão solar + Color Flecks Respingos de cor Paper Cutouts Recortes de papel Coral Layers Camadas de coral Mint Layers Camadas de menta diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 53658b9cd7..85fcce78dd 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -10701,6 +10701,11 @@ shape Open Открытый @msg Two panels pass through each other. Две панели проходят друг сквозь друга. @msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} пикселей — слишком большой размер для PSD (не более {MAX_SIDE} пикселей по стороне): уменьшите разрешение @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer должен быть "singleLine", "everyLine", "standardSingleLine" или "standardEveryLine" + Image Brush Кисти изображений + Soft Bloom Мягкое цветение + Halftone Field Полутоновое поле + Solar Grain Солнечное зерно + Color Flecks Цветные брызги Fine Stipple Тонкая точечная штриховка Dense Stipple Плотная точечная штриховка Soft Stipple Мягкая точечная штриховка diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 20105a28a4..2ff678bf9c 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -10740,6 +10740,11 @@ digits Hindi Hindi @msg A joint does not close by {gap} pt. En fog sluter inte med {gap} pt. @msg Two panels pass through each other. Två paneler går igenom varandra. @msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} pixlar är för stort för PSD (högst {MAX_SIDE} pixlar per sida): sänk upplösningen + Image Brush Bildpenslar + Soft Bloom Mjuk blomning + Halftone Field Halvtonsfält + Solar Grain Solkorn + Color Flecks Färgstänk Fine Stipple Fin prickning Dense Stipple Tät prickning Soft Stipple Mjuk prickning diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 8bfb5a2357..ce4979fa5b 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -10604,6 +10604,11 @@ breakText Glyphs Glifler @msg A panel is not joined to the rest by a crease. Bir panel geri kalanlara hiçbir pilyaj çizgisiyle bağlı değil. @msg A fold line is on a non-printing layer. Bir katlama çizgisi yazdırılmayan bir katmanda. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Paneller: {panels}, menteşeler: {hinges}, hatalar: {errors}, uyarılar: {warnings} + Image Brush Görsel Fırçaları + Soft Bloom Yumuşak Çiçek + Halftone Field Yarı Ton Alanı + Solar Grain Güneş Tanesi + Color Flecks Renk Benekleri Paper Cutouts Kağıt Kesikleri Coral Layers Mercan Katmanları Mint Layers Nane Katmanları diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index a34a1efeba..c9b19d4796 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -10268,6 +10268,11 @@ breakText Glyphs Гліфи @msg A panel is not joined to the rest by a crease. Панель не з’єднана з рештою жодною лінією біговки. @msg A fold line is on a non-printing layer. Лінія згину лежить на шарі, що не друкується. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Панелі: {panels}, шарніри: {hinges}, помилки: {errors}, попередження: {warnings} + Image Brush Пензлі зображень + Soft Bloom М’яке цвітіння + Halftone Field Напівтонове поле + Solar Grain Сонячна зернина + Color Flecks Кольорові цятки Paper Cutouts Паперові вирізки Coral Layers Коралові шари Mint Layers М’ятні шари diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index c6e342ee68..d59a39f706 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -8466,6 +8466,11 @@ breakText Glyphs Glyph @msg {width} × {height} pixels is too large for Targa (at most 65535 pixels a side): lower the resolution {width} × {height} điểm ảnh quá lớn cho Targa (tối đa 65535 điểm ảnh mỗi cạnh): hãy giảm độ phân giải @msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} điểm ảnh quá lớn cho PSD (tối đa {MAX_SIDE} điểm ảnh mỗi cạnh): hãy giảm độ phân giải @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer phải là "singleLine", "everyLine", "standardSingleLine" hoặc "standardEveryLine" + Image Brush Cọ hình ảnh + Soft Bloom Hoa nở mềm + Halftone Field Vùng bán sắc + Solar Grain Hạt nắng + Color Flecks Đốm màu Fine Stipple Nét chấm mịn Dense Stipple Nét chấm dày Soft Stipple Nét chấm mềm diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 95d7d4462e..7ef0197af8 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -10461,6 +10461,11 @@ breakText Glyphs 字形 @msg A joint does not close by {gap} pt. 有一处接缝相差 {gap} pt 未闭合。 @msg Two panels pass through each other. 两个面板相互穿插。 @msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} 像素对 PSD 而言过大 (每边最多 {MAX_SIDE} 像素):请降低分辨率 + Image Brush 图像画笔 + Soft Bloom 柔和花朵 + Halftone Field 半色调区域 + Solar Grain 太阳颗粒 + Color Flecks 彩色斑点 Fine Stipple 细密点描 Dense Stipple 浓密点描 Soft Stipple 柔和点描 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index d4c9f57896..b4707402c7 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -10276,6 +10276,11 @@ breakText Glyphs 字符 @msg A joint does not close by {gap} pt. 有一處接縫相差 {gap} pt 未閉合。 @msg Two panels pass through each other. 兩個面板相互穿插。 @msg {what} would print on more than {MAX_TILES} tiles: scale it down {what} 會列印在超過 {MAX_TILES} 個拼貼上:請縮小 + Image Brush 影像筆刷 + Soft Bloom 柔和花朵 + Halftone Field 半色調區域 + Solar Grain 太陽顆粒 + Color Flecks 彩色斑點 Fine Stipple 細密點描 Dense Stipple 濃密點描 Soft Stipple 柔和點描 diff --git a/crates/ui-egui/src/panels/tests_brush_libraries.rs b/crates/ui-egui/src/panels/tests_brush_libraries.rs index 30313cd3bd..e1605c0c0e 100644 --- a/crates/ui-egui/src/panels/tests_brush_libraries.rs +++ b/crates/ui-egui/src/panels/tests_brush_libraries.rs @@ -204,7 +204,8 @@ fn the_window_menu_and_the_brushes_panel_open_brush_libraries() { json!("energy-beams"), json!("dry-media"), json!("tech-circuit"), - json!("arrows") + json!("arrows"), + json!("image-brush") ] ); let dry = entries.iter().find(|e| under(e) && e.params["library"] == "dry-media").map(|e| e.label.as_str()); @@ -246,6 +247,12 @@ fn the_window_menu_and_the_brushes_panel_open_brush_libraries() { app.session.doc().unwrap().doc.node(vectorcraft_doc::NodeId(path)).unwrap().appearance.stroke().unwrap().brush.as_deref(), Some("Flex Ribbon") ); + let r = app.run("window.brushLibrary", json!({"library": "Image Brush"})).unwrap(); + assert_eq!((r["open"].as_str(), r["count"].as_u64()), (Some("image-brush"), Some(4))); + let undo = undo_len(&app); + click(&mut app, &ctx, "Soft Bloom", Modifiers::NONE, 4.0); + assert!(has(&app, "Soft Bloom") && !has(&app, "Color Flecks")); + assert_eq!(undo_len(&app), undo + 1); // Without brushes there is nothing to save. let all: Vec = vectorcraft_brush::library(&app.session.doc().unwrap().doc).into_iter().map(|b| b.name).collect(); app.run("brush.delete", json!({ "names": all })).unwrap(); diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 45a5155647..e023ed7db9 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1206,6 +1206,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Stipple library** ([About brushes](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/about-brushes.html)): Window › Brush Libraries › Stipple holds Fine Stipple, Dense Stipple, Soft Stipple and Bold Stipple. These original scatter brushes place filled vector dots or small dot clusters along a path, with varied size, spacing and spread; Soft Stipple uses translucent dots. Their art and settings are VectorCraft's own. Evidence: `stipple_library_draws_dot_textures_and_survives_save` in `crates/engine/src/tests/brushlib.rs` covers listing, finite drawn geometry, dots that take the stroke color with only Soft Stipple's translucent, add and apply, and saved-library reopening. - **Bristle strokes follow recorded pen input** ([brush documentation](https://helpx.adobe.com/pdf/cs6/illustrator_reference.pdf#page=201)): a Bristle brush in VectorCraft widens its strand spread and thickness with pressure along the stroke; pen tilt changes the spread, and bearing and barrel rotation turn it in the path's local frame. Missing pen channels use neutral values, and mouse strokes keep their existing appearance. This is VectorCraft's own rendering model; hardware-specific output has not been verified. `bristle_pen_pressure_changes_its_footprint`, `bristle_pen_pressure_is_sampled_along_the_stroke`, `trimmed_bristle_strands_read_pressure_where_they_begin` and `bristle_pen_orientation_changes_its_footprint` cover the geometry in `crates/brush/src/tests.rs`; `bristle_path_keeps_and_draws_its_pen_pose` covers saving and export in `crates/engine/src/tests/brushsym.rs`; area scores unchanged. - **Tech Circuit library:** Circuit Trace is a chamfered art brush with 45-degree elbows and terminal pads; Bus Lines repeats three parallel conductor lanes; Terminal Nodes repeats solder pads, circular test points and connecting leads. Original vector geometry generated in code, with Tints colorization and continuous pattern tile edges. Evidence: `the_tech_circuit_library_constructs_adds_and_applies_each_brush` in `crates/engine/src/tests/brushlib.rs` covers listing, finite geometry on straight, curved, short and closed paths, add/apply, undo/redo, deduplication and saved-library round trips. G5 remaining estimate 3–13 h (estimated); area scores unchanged. + - **Image Brush library** ([About brushes](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/about-brushes.html)): Window › Brush Libraries › Image Brush offers Soft Bloom, Halftone Field, Solar Grain and Color Flecks as original image stamp designs. Each preset places copies of its embedded, transparent PNG along a path as a scatter brush; adding a brush carries its image resource into the document, and saving a library keeps the pixels. The public page names the category but not these presets. Evidence: `image_brush_stamps_draw_and_carry_their_pixels_when_added_and_saved` in `crates/engine/src/tests/brushlib.rs` covers stamps, add/apply and reopening; `the_window_menu_and_the_brushes_panel_open_brush_libraries` covers the UI. - **Pressure Sensitive library** ([About brushes](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/about-brushes.html)): Window › Brush Libraries › Pressure Sensitive offers Flex Ribbon, Pulse Stroke, Round Flow and Chisel Flow. The first two are art brushes whose width follows recorded pen pressure; the other two are calligraphic nibs whose size follows it. They use the engine's existing pressure input where the device and platform deliver it, and a neutral width for a mouse path. These presets and names are VectorCraft's own. Evidence: `pressure_sensitive_brushes_widen_with_pen_pressure_and_survive_a_saved_library` in `crates/engine/src/tests/brushlib.rs` checks light and heavy pressure, short and curved paths, add/apply and saved-library reopening; `the_window_menu_and_the_brushes_panel_open_brush_libraries` covers opening and clicking from the UI. - **Dry Media library** ([help page](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/about-brushes.html)): Window › Brush Libraries › Dry Media holds four art brushes with textured strokes like dry drawing materials, each 100 pt long: Chalk Grain (about 8 pt high), Graphite Pencil (about 2.3 pt), Wax Crayon (about 5.5 pt) and Charcoal Dust (about 7 pt). The brushes, their names, sizes and art are VectorCraft's own: each is filled vector paths from a fixed seed, at most 80 paths and 500 anchors, stretched along the path with Tints colorization, and the chalk and crayon art has even-odd gaps where the paper shows (`brush.libraries`, `brush.addFromLibrary`; `the_dry_media_library_holds_grainy_art_brushes_with_bounded_art`). - **Arrows library:** Window › Brush Libraries › Arrows holds five art brushes, each 100 pt long: Solid Arrow, Open Arrow (an outlined head), Double Arrow (a head at each end), Chevron Arrow (a second chevron on the shaft) and Dashed Arrow (five separate dashes and a head). Each brush stretches only the part between its guides, so the shaft follows the path's length and the heads keep their proportions, with Tints colorization. The brushes, their names and their art are VectorCraft's own, generated in code (`brush.libraries`, `brush.addFromLibrary`; `arrows_library_lists_renders_and_applies_original_brushes`, `dashed_arrow_keeps_separate_dashes_and_survives_library_save`).