diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md index 8489598a9..b30a27431 100644 --- a/ATTRIBUTION.md +++ b/ATTRIBUTION.md @@ -108,7 +108,7 @@ Editable drawing code, native projects and shipped exports are collected under ` | assets/icons/app/linux/exports/hicolor/48x48/apps/ai.storyteller.solidcraft.png | SolidCraft contributors | Generated from assets/icons/app/shared/source/app_icon.rs with the original CLI/ICO encoders | MIT OR Apache-2.0 | | assets/icons/app/linux/exports/hicolor/512x512/apps/ai.storyteller.solidcraft.png | SolidCraft contributors | Generated from assets/icons/app/shared/source/app_icon.rs with the original CLI/ICO encoders | MIT OR Apache-2.0 | | assets/icons/app/linux/exports/hicolor/64x64/apps/ai.storyteller.solidcraft.png | SolidCraft contributors | Generated from assets/icons/app/shared/source/app_icon.rs with the original CLI/ICO encoders | MIT OR Apache-2.0 | -| assets/icons/app/shared/source/app_icon.rs | SolidCraft contributors | Original SolidCraft resource data or drawing code, collected without redesign | MIT OR Apache-2.0 | +| assets/icons/app/shared/source/app_icon.rs | SolidCraft contributors | Original SolidCraft drawing code: the borderless mark, drawn from the faces and gradients of assets/icons/app/macos/source/SolidCraft.icon/Assets/03-solid-blue-cutout.svg | MIT OR Apache-2.0 | | assets/icons/app/shared/source/windows_ico.rs | SolidCraft contributors | Original SolidCraft resource data or drawing code, collected without redesign | MIT OR Apache-2.0 | | assets/icons/app/windows/exports/solidcraft-executable.ico | SolidCraft contributors | Generated from assets/icons/app/shared/source/app_icon.rs with the original CLI/ICO encoders | MIT OR Apache-2.0 | | assets/icons/app/windows/exports/solidcraft.ico | SolidCraft contributors | Generated from assets/icons/app/shared/source/app_icon.rs with the original CLI/ICO encoders | MIT OR Apache-2.0 | diff --git a/assets/icons/app/linux/exports/hicolor/128x128/apps/ai.storyteller.solidcraft.png b/assets/icons/app/linux/exports/hicolor/128x128/apps/ai.storyteller.solidcraft.png index 4ae842595..1963e0f8e 100644 Binary files a/assets/icons/app/linux/exports/hicolor/128x128/apps/ai.storyteller.solidcraft.png and b/assets/icons/app/linux/exports/hicolor/128x128/apps/ai.storyteller.solidcraft.png differ diff --git a/assets/icons/app/linux/exports/hicolor/16x16/apps/ai.storyteller.solidcraft.png b/assets/icons/app/linux/exports/hicolor/16x16/apps/ai.storyteller.solidcraft.png index 940120d4f..eb8fd3d30 100644 Binary files a/assets/icons/app/linux/exports/hicolor/16x16/apps/ai.storyteller.solidcraft.png and b/assets/icons/app/linux/exports/hicolor/16x16/apps/ai.storyteller.solidcraft.png differ diff --git a/assets/icons/app/linux/exports/hicolor/24x24/apps/ai.storyteller.solidcraft.png b/assets/icons/app/linux/exports/hicolor/24x24/apps/ai.storyteller.solidcraft.png index b54a031b6..57e35f65d 100644 Binary files a/assets/icons/app/linux/exports/hicolor/24x24/apps/ai.storyteller.solidcraft.png and b/assets/icons/app/linux/exports/hicolor/24x24/apps/ai.storyteller.solidcraft.png differ diff --git a/assets/icons/app/linux/exports/hicolor/256x256/apps/ai.storyteller.solidcraft.png b/assets/icons/app/linux/exports/hicolor/256x256/apps/ai.storyteller.solidcraft.png index 3d0a15025..1a61ebc1a 100644 Binary files a/assets/icons/app/linux/exports/hicolor/256x256/apps/ai.storyteller.solidcraft.png and b/assets/icons/app/linux/exports/hicolor/256x256/apps/ai.storyteller.solidcraft.png differ diff --git a/assets/icons/app/linux/exports/hicolor/32x32/apps/ai.storyteller.solidcraft.png b/assets/icons/app/linux/exports/hicolor/32x32/apps/ai.storyteller.solidcraft.png index 9b5ca774d..9d718c459 100644 Binary files a/assets/icons/app/linux/exports/hicolor/32x32/apps/ai.storyteller.solidcraft.png and b/assets/icons/app/linux/exports/hicolor/32x32/apps/ai.storyteller.solidcraft.png differ diff --git a/assets/icons/app/linux/exports/hicolor/48x48/apps/ai.storyteller.solidcraft.png b/assets/icons/app/linux/exports/hicolor/48x48/apps/ai.storyteller.solidcraft.png index 459770fe5..11624a0f3 100644 Binary files a/assets/icons/app/linux/exports/hicolor/48x48/apps/ai.storyteller.solidcraft.png and b/assets/icons/app/linux/exports/hicolor/48x48/apps/ai.storyteller.solidcraft.png differ diff --git a/assets/icons/app/linux/exports/hicolor/512x512/apps/ai.storyteller.solidcraft.png b/assets/icons/app/linux/exports/hicolor/512x512/apps/ai.storyteller.solidcraft.png index 128dd4314..c0c6d79b1 100644 Binary files a/assets/icons/app/linux/exports/hicolor/512x512/apps/ai.storyteller.solidcraft.png and b/assets/icons/app/linux/exports/hicolor/512x512/apps/ai.storyteller.solidcraft.png differ diff --git a/assets/icons/app/linux/exports/hicolor/64x64/apps/ai.storyteller.solidcraft.png b/assets/icons/app/linux/exports/hicolor/64x64/apps/ai.storyteller.solidcraft.png index 26abe266c..bb64dda95 100644 Binary files a/assets/icons/app/linux/exports/hicolor/64x64/apps/ai.storyteller.solidcraft.png and b/assets/icons/app/linux/exports/hicolor/64x64/apps/ai.storyteller.solidcraft.png differ diff --git a/assets/icons/app/shared/source/app_icon.rs b/assets/icons/app/shared/source/app_icon.rs index ce5edb523..e450bac29 100644 --- a/assets/icons/app/shared/source/app_icon.rs +++ b/assets/icons/app/shared/source/app_icon.rs @@ -1,88 +1,93 @@ -//! Original SolidCraft mark, shared by desktop, packaging and CLI. +//! Original SolidCraft mark, shared by desktop, packaging and CLI: the borderless mark, five +//! faces with transparent gaps between them, drawn from the macOS icon's +//! `macos/source/SolidCraft.icon/Assets/03-solid-blue-cutout.svg`. +type P = (f32, f32); + +/// One face in that SVG's units: its outline, and its linear gradient from one point and +/// colour to another. +struct Face { + outline: &'static [P], + from: (P, [u8; 3]), + to: (P, [u8; 3]), +} + +const FACES: [Face; 5] = [ + // Inner side of the upper step. + Face { + outline: &[(547.883, 282.66), (709.797, 188.211), (709.797, 375.985)], + from: ((619.14, 179.734), [29, 99, 198]), + to: ((694.687, 396.761), [21, 73, 158]), + }, + // Top of the lower step. + Face { + outline: &[(727.797, 593.626), (727.797, 407.136), (889.571, 500.381)], + from: ((619.14, 413.244), [69, 159, 255]), + to: ((790.839, 605.547), [35, 121, 231]), + }, + // Right face, with the recess. + Face { + outline: &[(530.0, 521.17), (691.797, 427.912), (691.797, 655.928), (907.594, 531.545), (907.594, 740.159), (530.0, 957.8)], + from: ((632.876, 399.508), [27, 102, 207]), + to: ((783.971, 968.175), [18, 69, 150]), + }, + // Left face, stepped. + Face { + outline: &[(116.406, 510.769), (116.406, 303.529), (494.0, 521.17), (494.0, 957.8), (314.203, 854.167), (314.203, 624.777)], + from: ((207.063, 303.357), [37, 141, 245]), + to: ((426.837, 968.175), [20, 97, 218]), + }, + // Top of the extruded profile. + Face { + outline: &[(134.374, 272.334), (512.0, 53.364), (691.828, 157.015), (476.117, 282.846), (673.752, 396.761), (512.0, 489.993)], + from: ((385.63, 53.364), [81, 173, 255]), + to: ((522.989, 510.769), [43, 131, 241]), + }, +]; + +/// The mark's extent in SVG units: left, top, width, height. +const BOUNDS: (f32, f32, f32, f32) = (116.406, 53.364, 791.188, 904.436); + /// This block is the icon image data pub fn rgba(size: usize) -> Result, String> { if !(1..=2048).contains(&size) { return Err("icon size must be 1..=2048".into()); } - type P = (f32, f32); // Coverage buffer at 4x4 samples per pixel (2x2 for big sizes), averaged down at the end. let ss = if size > 512 { 2 } else { 4 }; let n = size * ss; let mut buf = vec![[0u8; 4]; n * n]; - let s = n as f32 / 412.217; // SVG units -> samples: the logo fills the height - let ox = (n as f32 - 357.0 * s) / 2.0; // and is centred sideways - // Fill a convex polygon given in SVG units. - let mut fill = |pts: &[P], col: [u8; 3]| { - let v: Vec

= pts.iter().map(|p| (ox + p.0 * s, p.1 * s)).collect(); + let (bx, by, bw, bh) = BOUNDS; + let s = n as f32 / bh; // SVG units -> samples: the mark fills the height + let (ox, oy) = ((n as f32 - bw * s) / 2.0 - bx * s, -by * s); // and is centred sideways + // Fill each face's outline (even-odd spans per row, so concave outlines work) with its gradient. + for face in &FACES { + let v: Vec

= face.outline.iter().map(|p| (ox + p.0 * s, oy + p.1 * s)).collect(); + let (((fx, fy), c0), ((tx, ty), c1)) = (face.from, face.to); + let (gx, gy) = (tx - fx, ty - fy); + let g2 = gx * gx + gy * gy; let (top, bottom) = v.iter().fold((f32::MAX, f32::MIN), |(a, b), p| (a.min(p.1), b.max(p.1))); + let mut xs = Vec::with_capacity(v.len()); for y in ((top - 0.5).ceil() as i32).max(0)..=((bottom - 0.5).floor() as i32).min(n as i32 - 1) { let cy = y as f32 + 0.5; - let (mut lo, mut hi) = (f32::MAX, f32::MIN); + xs.clear(); for i in 0..v.len() { let (a, b) = (v[i], v[(i + 1) % v.len()]); if (a.1 <= cy) != (b.1 <= cy) { - let x = a.0 + (cy - a.1) / (b.1 - a.1) * (b.0 - a.0); - lo = lo.min(x); - hi = hi.max(x); + xs.push(a.0 + (cy - a.1) / (b.1 - a.1) * (b.0 - a.0)); } } - if lo > hi { - continue; - } - for x in ((lo - 0.5).ceil() as i32).max(0)..=((hi - 0.5).floor() as i32).min(n as i32 - 1) { - buf[y as usize * n + x as usize] = [col[0], col[1], col[2], 255]; + xs.sort_by(f32::total_cmp); + for &[from, to] in xs.as_chunks::<2>().0 { + for x in ((from - 0.5).ceil() as i32).max(0)..=((to - 0.5).floor() as i32).min(n as i32 - 1) { + // The sample's place along the gradient, in SVG units. + let (px, py) = ((x as f32 + 0.5 - ox) / s, (cy - oy) / s); + let t = (((px - fx) * gx + (py - fy) * gy) / g2).clamp(0.0, 1.0); + let mix = |k: usize| (f32::from(c0[k]) + (f32::from(c1[k]) - f32::from(c0[k])) * t).round() as u8; + buf[y as usize * n + x as usize] = [mix(0), mix(1), mix(2), 255]; + } } } - }; - // Faces: each is a few overlapping convex pieces (the filler only does convex shapes). - let (light, mid, dark) = ([96, 158, 236], [58, 136, 238], [55, 108, 197]); - fill(&[(3.5, 105.9), (177.0, 5.8), (263.4, 55.6), (263.8, 156.0), (177.0, 406.4)], light); - fill(&[(177.0, 206.1), (263.8, 156.0), (350.5, 206.2), (350.5, 306.3), (177.0, 406.4)], light); - fill(&[(3.5, 105.9), (177.0, 206.1), (177.0, 406.4)], mid); - fill(&[(3.5, 105.9), (3.5, 205.7), (90.3, 256.2), (177.0, 206.1)], mid); - fill(&[(177.0, 206.1), (90.3, 256.2), (90.0, 356.2), (177.0, 406.4)], mid); - fill(&[(264.1, 155.8), (177.0, 206.1), (177.0, 406.4), (263.8, 256.2)], dark); - fill(&[(263.8, 256.2), (350.5, 206.2), (350.5, 306.3), (177.0, 406.4)], dark); - fill(&[(177.0, 206.1), (177.0, 406.4), (350.5, 306.3)], dark); - fill(&[(263.8, 55.9), (263.8, 156.0), (177.1, 105.9)], dark); - // White edge lines, 10 units wide: a rectangle per segment and a disc at each inner corner. - let white = [255, 255, 255]; - let mut stroke = |pts: &[P], closed: bool| { - let m = pts.len(); - for i in 0..(if closed { m } else { m - 1 }) { - let (a, b) = (pts[i], pts[(i + 1) % m]); - let l = ((b.0 - a.0).powi(2) + (b.1 - a.1).powi(2)).sqrt(); - let (nx, ny) = (-(b.1 - a.1) / l * 5.0, (b.0 - a.0) / l * 5.0); - fill(&[(a.0 + nx, a.1 + ny), (b.0 + nx, b.1 + ny), (b.0 - nx, b.1 - ny), (a.0 - nx, a.1 - ny)], white); - } - for c in &pts[if closed { 0 } else { 1 }..if closed { m } else { m - 1 }] { - let disc: Vec

= (0..16) - .map(|k| { - let t = k as f32 * std::f32::consts::TAU / 16.0; - (c.0 + 5.0 * t.cos(), c.1 + 5.0 * t.sin()) - }) - .collect(); - fill(&disc, white); - } - }; - stroke(&[(263.8, 55.9), (177.1, 105.9), (263.8, 156.0), (263.8, 256.2), (350.6, 206.1)], false); - stroke(&[(5.0, 105.9), (178.5, 206.1), (178.5, 406.4)], false); - stroke(&[(177.0, 206.1), (263.8, 156.0)], false); - stroke( - &[ - (178.5, 5.8), - (5.0, 105.9), - (5.0, 206.1), - (91.7, 256.2), - (91.7, 356.4), - (178.5, 406.4), - (352.0, 306.3), - (352.0, 206.1), - (265.2, 156.0), - (265.2, 55.9), - ], - true, - ); + } // Average each ss x ss block down to one pixel (straight alpha = covered share). let mut rgba = Vec::with_capacity(size * size * 4); for y in 0..size { @@ -123,4 +128,20 @@ mod tests { assert!(super::rgba(0).is_err()); assert!(super::rgba(2049).is_err()); } + + /// Borderless: no white edge lines, and the gaps between faces are see-through. At 256 px + /// the gap between the left and right faces (SVG x 494..530) is transparent on the row + /// through the middle of the mark, and no opaque pixel is white. + #[test] + fn shared_mark_is_borderless() { + let size = 256; + let pixels = super::rgba(size).expect("valid size"); + let px = |x: usize, y: usize| pixels.as_chunks::<4>().0[y * size + x]; + let s = size as f32 / 904.436; + let gap_x = ((size as f32 - 791.188 * s) / 2.0 + (512.0 - 116.406) * s) as usize; + let row = ((750.0 - 53.364) * s) as usize; + assert_eq!(px(gap_x, row)[3], 0, "the seam between the left and right faces is a gap"); + assert!(px(gap_x - 8, row)[3] == 255 && px(gap_x + 8, row)[3] == 255, "faces on both sides of the gap"); + assert!(pixels.as_chunks::<4>().0.iter().all(|p| p[3] == 0 || p[0] < 200), "no white edges"); + } } diff --git a/assets/icons/app/windows/exports/solidcraft-executable.ico b/assets/icons/app/windows/exports/solidcraft-executable.ico index 92f61f583..bedba2721 100644 Binary files a/assets/icons/app/windows/exports/solidcraft-executable.ico and b/assets/icons/app/windows/exports/solidcraft-executable.ico differ diff --git a/assets/icons/app/windows/exports/solidcraft.ico b/assets/icons/app/windows/exports/solidcraft.ico index 2e2ccc76a..b09da12fc 100644 Binary files a/assets/icons/app/windows/exports/solidcraft.ico and b/assets/icons/app/windows/exports/solidcraft.ico differ diff --git a/assets/icons/ui/source/glyphs.rs b/assets/icons/ui/source/glyphs.rs index fe232b273..d037c47d1 100644 --- a/assets/icons/ui/source/glyphs.rs +++ b/assets/icons/ui/source/glyphs.rs @@ -104,10 +104,10 @@ pub(crate) fn brand_mark(p: &egui::Painter, c: Pos2) { /// The same original mark as a single quiet silhouette, without face seams or outlines. pub(crate) fn brand_mark_silhouette(p: &egui::Painter, c: Pos2, height: f32, ink: Color32) { - brand_mark_styled(p, c, height, [ink; 4], false); + brand_mark_styled(p, c, height, [ink; 3], false); } -fn brand_mark_styled(p: &egui::Painter, c: Pos2, height: f32, colours: [Color32; 4], edges: bool) { +fn brand_mark_styled(p: &egui::Painter, c: Pos2, height: f32, colours: [Color32; 3], edges: bool) { let s = height / 412.217; let m = |pts: &[(f32, f32)]| -> Vec { pts.iter().map(|&(x, y)| pos2(c.x + (x - 178.5) * s, c.y + (y - 206.1) * s)).collect() }; // egui only fills convex shapes, so each face is a few overlapping convex pieces. @@ -115,7 +115,7 @@ fn brand_mark_styled(p: &egui::Painter, c: Pos2, height: f32, colours: [Color32; p.add(egui::Shape::convex_polygon(m(pts), col, Stroke::NONE)); }; // The faces are separated by gaps that show the application bar, not by white lines. - let [light, mid, dark, _] = colours; + let [light, mid, dark] = colours; let edge_col = crate::theme::Tokens::get().app_bar; face(light, &[(3.5, 105.9), (177.0, 5.8), (263.4, 55.6), (263.8, 156.0), (177.0, 406.4)]); face(light, &[(177.0, 206.1), (263.8, 156.0), (350.5, 206.2), (350.5, 306.3), (177.0, 406.4)]); @@ -129,7 +129,7 @@ fn brand_mark_styled(p: &egui::Painter, c: Pos2, height: f32, colours: [Color32; if !edges { return; } - // White edge lines. + // The seams between the faces and around the mark, in the bar's colour, so they read as gaps. let edge = Stroke::new(10.0 * s, edge_col); let line = |pts: &[(f32, f32)]| { p.add(egui::Shape::line(m(pts), edge)); diff --git a/assets/styles/ui/palettes.rs b/assets/styles/ui/palettes.rs index e0404a74a..8c17f893d 100644 --- a/assets/styles/ui/palettes.rs +++ b/assets/styles/ui/palettes.rs @@ -230,7 +230,7 @@ impl Tokens { ], analysis: AnalysisColors::DEFAULT, icons: IconColors { highlight: Color32::WHITE, agent: Color32::from_rgb(168, 85, 247), marker_halo: Color32::from_black_alpha(150) }, - logo: [Color32::from_rgb(96, 158, 236), Color32::from_rgb(58, 136, 238), Color32::from_rgb(55, 108, 197), Color32::WHITE], + logo: [Color32::from_rgb(96, 158, 236), Color32::from_rgb(58, 136, 238), Color32::from_rgb(55, 108, 197)], } } pub const fn dark() -> Tokens { diff --git a/crates/ui-egui/src/colour_tokens_tests.rs b/crates/ui-egui/src/colour_tokens_tests.rs index a8a297c3b..4539244c4 100644 --- a/crates/ui-egui/src/colour_tokens_tests.rs +++ b/crates/ui-egui/src/colour_tokens_tests.rs @@ -29,7 +29,7 @@ fn moved_colours_keep_the_values_they_were_drawn_with() { assert_eq!(t.analysis.access, [[0.20, 0.75, 0.30], [0.85, 0.22, 0.20]]); assert_eq!(t.analysis.curvature, [[0.15, 0.35, 0.95], [0.10, 0.80, 0.25], [0.90, 0.15, 0.10]]); assert!(!t.analysis.hatch); - assert_eq!(t.logo, [Color32::from_rgb(96, 158, 236), Color32::from_rgb(58, 136, 238), Color32::from_rgb(55, 108, 197), Color32::WHITE]); + assert_eq!(t.logo, [Color32::from_rgb(96, 158, 236), Color32::from_rgb(58, 136, 238), Color32::from_rgb(55, 108, 197)]); assert_eq!(t.icons.marker_halo, Color32::from_black_alpha(150)); assert_eq!(t.icons.agent, Color32::from_rgb(168, 85, 247)); } diff --git a/crates/ui-egui/src/colour_vision_tests.rs b/crates/ui-egui/src/colour_vision_tests.rs index 172da1e22..2132323f0 100644 --- a/crates/ui-egui/src/colour_vision_tests.rs +++ b/crates/ui-egui/src/colour_vision_tests.rs @@ -520,16 +520,15 @@ const NO_MEANING: &[(&str, &str)] = &[ ("cube_border", "labelled"), ("cube_text", "labelled"), ("cube_hover", "hover highlight"), - // Not a colour, or the end of a mark that is measured elsewhere. + // Not a colour. ("analysis.hatch", "a flag: stripes on the failing faces"), - ("logo[3]", "the mark's white edge"), // Icon colours that are a shade of a measured one, or one mark alone. ("icons.highlight", "white ink on viewport markers and the agent pointer"), ("icons.agent", "the agent's pointer, alone"), ("icons.marker_halo", "a dark halo under a marker"), ]; -/// Every token field, by path (`sketch`, `analysis.draft`, `logo[3]`…): the arrays of distinct +/// Every token field, by path (`sketch`, `analysis.draft`, `triad`…): the arrays of distinct /// meanings by element where only some elements are measured. fn token_fields(t: &Tokens) -> BTreeSet { let text = format!("{t:#?}"); @@ -565,7 +564,7 @@ fn every_token_is_measured_or_carries_no_meaning() { for t in [Tokens::light(), Tokens::dark()] { let measured: BTreeSet<&str> = groups(&t).iter().flat_map(|g| g.members.iter().chain(&g.grounds).map(|(n, _)| field_of(n))).chain(SHADED).collect(); - // An element of an array (`logo[3]`) is listed for the record; its array is measured. + // An element of an array (`triad[0]`) is listed for the record; its array is measured. let listed: BTreeSet<&str> = NO_MEANING.iter().map(|(n, _)| field_of(n)).collect(); let fields = token_fields(&t); let unplaced: Vec<&String> = fields.iter().filter(|f| !measured.contains(f.as_str()) && !listed.contains(f.as_str())).collect(); diff --git a/crates/ui-egui/src/theme.rs b/crates/ui-egui/src/theme.rs index 125392f04..c564342ad 100644 --- a/crates/ui-egui/src/theme.rs +++ b/crates/ui-egui/src/theme.rs @@ -526,8 +526,9 @@ pub struct Tokens { pub continuity: [Color32; 4], pub analysis: AnalysisColors, pub icons: IconColors, - /// The SolidCraft mark on the application bar: light, mid and dark faces, and its edge. - pub logo: [Color32; 4], + /// The SolidCraft mark on the application bar: light, mid and dark faces (the gaps between + /// them show the bar). + pub logo: [Color32; 3], } impl Tokens {