Concept to Vector: offline Image Trace styles behind a provider boundary

Object > Concept to Vector... (also Window, the context menu, the Contextual
Task Bar, Properties and the Control bar) opens a panel for one selected image
or unexpanded Image Trace object. It makes 1 to 8 styles of the image side by
side and Insert Selected puts the ticked ones to the right of the image as one
undo step, leaving the image as it is.

- Providers register by id in the engine (crates/engine/src/concept_vector.rs).
  The host checks every result (counts, anchors, coordinates, paints) before it
  is previewed or inserted, and never uses another provider in place of the one
  named. The only provider is built in, offline.traceStyles: five styles made
  with Image Trace (Outline, Ink Lines, Flat Color, Detailed Color, Gray Tones),
  with Detail 0 to 100. It takes no prompt and makes vector art only. The
  registry reads a provider's id, name and capabilities once, when it is
  registered, and refuses a provider that panics then.
- Commands: conceptVector.providers, generate, results, cancel and insert.
  Generate keeps a session job and changes nothing in the document; insert
  refuses a job whose image, pixels or placement changed.
- Results go above a clip group or opacity-masked group around the image; an
  image on a layer with a clipping mask or an opacity mask is refused.
  Variations wider than the image keep 24 pt between them.
- Previews keep the image's proportions and paint the paths in their order,
  each path's fill and then its stroke at its width, up to 40,000 points.
- On the web build the run is made a part at a time across frames (the image
  decoded, a style's color layers found, one layer traced), so Cancel takes
  effect inside a style. vectorcraft_trace::TraceSteps traces one layer a step.

The help page:
https://helpx.adobe.com/illustrator/desktop/use-generative-ai/generate-vector-artwork-from-images.html
This commit is contained in:
dotCooCoo committed 2026-11-12 20:41:06 -08:00
1 parent f062dd7ed2
commit 73bef68024
59 files changed
+4241 -67

No files matched your search

+2
View File
@@ -17,6 +17,7 @@ pub mod colormgmt;
pub mod colortheme;
pub mod compositefonts;
mod compoundshape;
pub mod conceptvector;
pub(crate) mod create;
mod css;
mod cut;
@@ -341,6 +342,7 @@ pub fn command_specs() -> &'static [CommandSpec] {
v.extend(panelcmds::specs());
v.extend(artboardalign::specs());
v.extend(buildcmds::specs());
v.extend(conceptvector::specs());
v.extend(shaper::specs());
v.extend(brushsym::specs());
v.extend(patterncmds::specs());
+606
View File
@@ -0,0 +1,606 @@
//! Concept to Vector (`conceptVector.*`): vector variations of one selected image, made by a
//! provider ([`crate::concept_vector`]), compared, and inserted beside the image.
//!
//! `conceptVector.generate` asks the named provider for one variation per style and keeps them as a
//! job of this session; it changes nothing in the document. `conceptVector.insert` puts the chosen
//! variations to the right of the image as one undo step. A job is kept until it is canceled, its
//! document closes, or [`KEEP_JOBS`] newer ones replace it; it is never saved.
use std::collections::VecDeque;
use std::sync::Arc;
use serde_json::{Value, json};
use vectorcraft_color::{Color, Paint};
use vectorcraft_doc::appearance::{AppearanceItem, FillLayer, LineCap, LineJoin, StrokeLayer};
use vectorcraft_doc::{Appearance, ImageObject, Node, NodeId, NodeKind};
use vectorcraft_geom::{Affine, Rect};
use super::buildcmds::TRACE_NAME;
use super::edit::selected_roots;
use super::pathops::shape_node;
use super::{CommandSpec, EngineError, Result, Session, always, bad, checked_id, cmd, has_doc, text_param};
use crate::concept_vector::{self as cv, MAX_STYLES, Output, Provider, ProviderError, Request, Variation};
/// The most jobs a session keeps; a new one drops the oldest.
pub const KEEP_JOBS: usize = 4;
/// The gap, in points, between the image and the first inserted variation, and between variations.
pub const GAP: f64 = 24.0;
/// A job's variations, or that it was canceled.
enum Outcome {
Done(Vec<Variation>),
Canceled,
}
/// What `conceptVector.generate` made, and what it was made of.
struct Job {
id: u64,
/// The document ([`crate::DocState::uid`]) and the object (an image or an Image Trace object).
doc: u64,
source: NodeId,
image: ImageObject,
bytes: Arc<Vec<u8>>,
provider: String,
outcome: Outcome,
}
/// The session's providers and jobs.
pub(crate) struct ConceptState {
pub(crate) registry: cv::Registry,
jobs: VecDeque<Job>,
next: u64,
}
impl Default for ConceptState {
fn default() -> Self {
Self { registry: cv::Registry::default(), jobs: VecDeque::new(), next: 1 }
}
}
impl Session {
/// The Concept to Vector providers this session calls by id.
pub fn concept_providers(&self) -> &cv::Registry {
&self.concept.registry
}
/// The providers, to register another ([`cv::Registry::register`]).
pub fn concept_providers_mut(&mut self) -> &mut cv::Registry {
&mut self.concept.registry
}
/// Job `job`'s variations and the size in pixels of the image they were made of; `None` for a
/// job this session does not keep, or one that was canceled.
pub fn concept_variations(&self, job: u64) -> Option<(&[Variation], (u32, u32))> {
let j = self.concept.jobs.iter().find(|j| j.id == job)?;
match &j.outcome {
Outcome::Done(v) => Some((v.as_slice(), (j.image.width, j.image.height))),
Outcome::Canceled => None,
}
}
/// Drops the jobs whose document is closed.
fn prune_concept_jobs(&mut self) {
let open: Vec<u64> = self.documents().iter().map(|d| d.uid).collect();
self.concept.jobs.retain(|j| open.contains(&j.doc));
}
}
/// The image `n` shows: its own, or the source image of an Image Trace object that wasn't expanded.
fn shown_image(n: &Node) -> Option<&ImageObject> {
match &n.kind {
NodeKind::Image(i) => Some(i),
NodeKind::Group { clip: false, .. } if n.name.as_deref() == Some(TRACE_NAME) => match &n.children()?.first()?.kind {
NodeKind::Image(i) => Some(i),
_ => None,
},
_ => None,
}
}
const NO_SOURCE: &str = "select one image or an unexpanded Image Trace object";
const LOCKED: &str = "the image is locked or hidden";
/// The object `id` names, else the one selected: an image or an unexpanded Image Trace object,
/// shown and unlocked with every layer and group around it, and not on a locked artboard → it, its
/// image and the image's bytes.
fn source(s: &Session, c: &str, p: &Value) -> Result<(NodeId, ImageObject, Arc<Vec<u8>>)> {
let id = match p.get("id").filter(|v| !v.is_null()) {
Some(v) => checked_id(s, v, c)?,
None => match selected_roots(s)?.as_slice() {
[one] => *one,
_ => return Err(bad(c, NO_SOURCE)),
},
};
let d = &s.doc()?.doc;
let n = d.node(id).ok_or(EngineError::NoNode(id))?;
let image = shown_image(n).ok_or_else(|| bad(c, NO_SOURCE))?;
if !d.is_editable(id) {
return Err(bad(c, LOCKED));
}
let blob = d.images.get(&image.key).ok_or_else(|| EngineError::Other(format!("image data `{}` is missing", image.key)))?;
Ok((id, image.clone(), Arc::clone(&blob.bytes)))
}
/// A generation prepared from the session, which runs without it ([`ConceptRun::run`]), on any
/// thread, and is kept as a job with [`ConceptRun::finish`].
pub struct ConceptRun {
provider: Arc<dyn Provider>,
/// The provider's id, as it was registered.
provider_id: &'static str,
request: Request,
doc: u64,
source: NodeId,
image: ImageObject,
}
impl ConceptRun {
/// What `conceptVector.generate` with params `p` makes in the active document, checked as the
/// command checks it.
pub fn prepare(s: &Session, p: &Value) -> Result<ConceptRun> {
const C: &str = "conceptVector.generate";
let name = text_param(p, "provider", C)?.ok_or_else(|| bad(C, "missing `provider` (see conceptVector.providers)"))?;
let found =
s.concept.registry.get(name).ok_or_else(|| bad(C, format!("no Concept to Vector provider `{name}` (see conceptVector.providers)")))?;
let (caps, pid, provider) = (&found.capabilities, found.id, Arc::clone(&found.provider));
let styles_error = || bad(C, format!("`styles` must list 1 to 8 different style ids of `{pid}` (see conceptVector.providers)"));
let styles: Vec<String> = match p.get("styles") {
Some(Value::Array(a)) => a.iter().map(|v| v.as_str().map(str::to_string)).collect::<Option<_>>().ok_or_else(styles_error)?,
_ => return Err(styles_error()),
};
let known = |id: &String| caps.styles.iter().any(|st| st.id == id);
let unique = styles.iter().enumerate().all(|(i, id)| !styles.get(..i).unwrap_or_default().contains(id));
if styles.is_empty() || styles.len() > MAX_STYLES || !unique || !styles.iter().all(known) {
return Err(styles_error());
}
let prompt = text_param(p, "prompt", C)?.map(str::trim).filter(|t| !t.is_empty()).map(str::to_string);
// Results are vector paths, inserted as vector art, whatever else a provider makes.
let output = match text_param(p, "output", C)? {
None | Some("vector") => Output::Vector,
Some(_) => return Err(bad(C, "`output` must be \"vector\"")),
};
let unsupported = (prompt.is_some() && !caps.prompt) || !caps.vector_output;
if unsupported || !caps.image_input {
return Err(bad(C, format!("`{pid}` takes no prompt and makes vector art only")));
}
let detail = match p.get("detail") {
None | Some(Value::Null) => 50,
Some(v) => v.as_u64().filter(|d| *d <= 100).ok_or_else(|| bad(C, "`detail` must be a whole number from 0 to 100"))? as u8,
};
let (source, image, bytes) = source(s, C, p)?;
let request = Request { image: bytes, width: image.width, height: image.height, prompt, styles, detail, output };
Ok(ConceptRun { provider, provider_id: pid, request, doc: s.doc()?.uid, source, image })
}
/// The document it was prepared in ([`crate::DocState::uid`]).
pub fn doc(&self) -> u64 {
self.doc
}
/// The image or Image Trace object it makes variations of.
pub fn source(&self) -> NodeId {
self.source
}
/// Asks the provider for the variations and checks them ([`cv::check_result`]), telling `steps`
/// how far it has got; it touches no document. A panic in the provider is an error.
pub fn run(&self, steps: cv::Steps) -> std::result::Result<Vec<Variation>, ProviderError> {
let made = crate::guard::catch_panic(|| self.provider.generate(&self.request, steps)).map_err(ProviderError::Internal)??;
cv::check_result(&self.request, &made)?;
Ok(made)
}
/// How many styles it makes.
pub fn style_count(&self) -> usize {
self.request.styles.len()
}
/// Does the next part of the run kept in `run`, for a caller with no thread for
/// [`ConceptRun::run`] (the web build), which can run other work, or stop, between the parts
/// → whether every style is made ([`PartRun::made`]). A provider that makes parts
/// ([`cv::Provider::parts`]) does one of its own; the others make one style alone, and the
/// styles made so far are checked together ([`cv::check_result`]) after each one, so the
/// totals stop the run as soon as they are passed. A panic in the provider is an error.
pub fn run_part(&self, run: &mut PartRun, steps: cv::Steps) -> std::result::Result<bool, ProviderError> {
let guard = ProviderError::Internal;
if run.parts.is_none() {
run.parts = Some(crate::guard::catch_panic(|| self.provider.parts(&self.request)).map_err(guard)?);
}
if let Some(Some(parts)) = &mut run.parts {
if !steps(parts.styles_done() as u64, self.style_count() as u64) {
return Err(ProviderError::Canceled);
}
let Some(made) = crate::guard::catch_panic(|| parts.step()).map_err(guard)?? else { return Ok(false) };
cv::check_result(&self.request, &made)?;
run.made = made;
return Ok(true);
}
let Some(style) = self.request.styles.get(run.made.len()) else { return Ok(true) };
let one = Request { styles: vec![style.clone()], ..self.request.clone() };
let next = crate::guard::catch_panic(|| self.provider.generate(&one, steps)).map_err(guard)??;
cv::check_result(&one, &next)?;
run.made.extend(next);
let so_far = Request { styles: self.request.styles.get(..run.made.len()).unwrap_or_default().to_vec(), ..one };
cv::check_result(&so_far, &run.made)?;
Ok(run.made.len() == self.request.styles.len())
}
/// Keeps `variations` as a new job of `s` → the job, as `conceptVector.results` gives it;
/// `None`, keeping nothing, when the document it was prepared in has closed.
pub fn finish(self, s: &mut Session, variations: Vec<Variation>) -> Option<Value> {
s.prune_concept_jobs();
if !s.documents().iter().any(|d| d.uid == self.doc) {
return None;
}
let id = s.concept.next;
s.concept.next += 1;
let job = Job {
id,
doc: self.doc,
source: self.source,
image: self.image,
bytes: self.request.image,
provider: self.provider_id.to_string(),
outcome: Outcome::Done(variations),
};
let out = job_json(&s.concept.registry, &job);
s.concept.jobs.push_back(job);
while s.concept.jobs.len() > KEEP_JOBS {
s.concept.jobs.pop_front();
}
Some(out)
}
}
/// How far a run made a part at a time ([`ConceptRun::run_part`]) has got.
#[derive(Default)]
pub struct PartRun {
/// The provider's parts, once asked for (`None` inside: it makes one style at a time).
parts: Option<Option<Box<dyn cv::Parts>>>,
made: Vec<Variation>,
}
impl PartRun {
/// The styles made so far.
pub fn styles_done(&self) -> usize {
match &self.parts {
Some(Some(parts)) if self.made.is_empty() => parts.styles_done(),
_ => self.made.len(),
}
}
/// The variations made: all of them once [`ConceptRun::run_part`] has said so.
pub fn made(self) -> Vec<Variation> {
self.made
}
}
/// `e` as the engine's error.
pub fn provider_error(e: ProviderError) -> EngineError {
match e {
ProviderError::Canceled => EngineError::Cancelled,
e => EngineError::Other(e.to_string()),
}
}
/// The English name of style `style` of provider `provider`, else the id.
fn style_label(registry: &cv::Registry, provider: &str, style: &str) -> String {
let caps = registry.get(provider).map(|p| &p.capabilities);
caps.and_then(|c| c.styles.iter().find(|s| s.id == style).map(|s| s.label.to_string())).unwrap_or_else(|| style.to_string())
}
/// Where `image`'s pixels lie in the document.
fn image_rect(image: &ImageObject) -> Option<Rect> {
let r = Rect::new(0.0, 0.0, f64::from(image.width.max(1)), f64::from(image.height.max(1)));
let pts = [(r.x0, r.y0), (r.x1, r.y0), (r.x1, r.y1), (r.x0, r.y1)].map(|(x, y)| image.xf * kurbo::Point::new(x, y));
let mut out = Rect::from_points(pts[0], pts[0]);
for q in &pts[1..] {
out = out.union_pt(*q);
}
[out.x0, out.y0, out.x1, out.y1].iter().all(|v| v.is_finite()).then_some(out)
}
fn job_json(registry: &cv::Registry, j: &Job) -> Value {
let (state, variations) = match &j.outcome {
Outcome::Done(v) => ("done", v.as_slice()),
Outcome::Canceled => ("canceled", &[][..]),
};
let variations: Vec<Value> = variations
.iter()
.map(|v| {
let bounds = v.paths.iter().filter_map(|p| p.path.bounds()).reduce(|a, b| a.union(b));
json!({
"style": v.style,
"label": style_label(registry, &j.provider, &v.style),
"paths": v.paths.len(),
"anchors": v.anchors(),
"bounds": bounds.map(|b| [b.x0, b.y0, b.x1, b.y1]),
"warnings": v.warnings,
})
})
.collect();
json!({ "job": j.id, "provider": j.provider, "source": j.source.0, "state": state, "variations": variations })
}
/// The `job` param of command `c`.
fn job_param(c: &str, p: &Value) -> Result<u64> {
p.get("job").and_then(Value::as_u64).ok_or_else(|| bad(c, "`job` must be a job number from conceptVector.generate"))
}
/// The error of command `c` for a job the session does not keep.
fn no_job(c: &str, job: u64) -> EngineError {
bad(c, format!("no Concept to Vector job {job}: it was never made, or was dropped (see conceptVector.results)"))
}
/// The index of job `job` among those `s` keeps.
fn job_index(s: &mut Session, c: &str, job: u64) -> Result<usize> {
s.prune_concept_jobs();
s.concept.jobs.iter().position(|j| j.id == job).ok_or_else(|| no_job(c, job))
}
fn providers(s: &mut Session, _: &Value) -> Result<Value> {
let list: Vec<Value> = s
.concept
.registry
.iter()
.map(|p| {
let c = &p.capabilities;
json!({
"id": p.id,
"name": p.name,
"available": true,
"offline": c.offline,
"imageInput": c.image_input,
"vectorOutput": c.vector_output,
"prompt": c.prompt,
"rasterOutput": c.raster_output,
"maxStyles": MAX_STYLES,
"styles": c.styles,
})
})
.collect();
let selected = s.concept.registry.iter().next().map(|p| p.id);
Ok(json!({ "providers": list, "selected": selected }))
}
fn generate(s: &mut Session, p: &Value) -> Result<Value> {
let run = ConceptRun::prepare(s, p)?;
let made = run.run(&|_, _| true).map_err(provider_error)?;
run.finish(s, made).ok_or(EngineError::NoDocument)
}
fn results(s: &mut Session, p: &Value) -> Result<Value> {
const C: &str = "conceptVector.results";
let job = job_param(C, p)?;
let at = job_index(s, C, job)?;
let j = s.concept.jobs.get(at).ok_or_else(|| no_job(C, job))?;
Ok(job_json(&s.concept.registry, j))
}
fn cancel(s: &mut Session, p: &Value) -> Result<Value> {
const C: &str = "conceptVector.cancel";
let job = job_param(C, p)?;
let at = job_index(s, C, job)?;
if let Some(j) = s.concept.jobs.get_mut(at) {
j.outcome = Outcome::Canceled;
}
Ok(json!({ "job": job, "state": "canceled" }))
}
/// The appearance of variation path `p`, its widths scaled by `unit` (points per pixel).
fn appearance_of(p: &cv::VectorPath, unit: f64) -> Appearance {
let solid = |c: [u8; 3]| Paint::solid(Color::rgb8(c[0], c[1], c[2]));
let mut items = vec![];
if let Some(c) = p.fill {
items.push(AppearanceItem::Fill(FillLayer::new(solid(c))));
}
if let Some((c, w)) = p.stroke {
items.push(AppearanceItem::Stroke(StrokeLayer { cap: LineCap::Round, join: LineJoin::Round, ..StrokeLayer::new(solid(c), w * unit) }));
}
Appearance { items, ..Default::default() }
}
fn insert(s: &mut Session, p: &Value) -> Result<Value> {
const C: &str = "conceptVector.insert";
let job = job_param(C, p)?;
let at = job_index(s, C, job)?;
let list_error = || bad(C, format!("`variations` must list different style ids of job {job}"));
let chosen: Vec<String> = match p.get("variations") {
Some(Value::Array(a)) if !a.is_empty() => a.iter().map(|v| v.as_str().map(str::to_string)).collect::<Option<_>>().ok_or_else(list_error)?,
_ => return Err(list_error()),
};
let stale = || bad(C, format!("job {job} no longer applies: its document, image or image placement changed, so generate again"));
let (doc, source, image, bytes, picked, label_of) = {
let j = s.concept.jobs.get(at).ok_or_else(|| no_job(C, job))?;
let Outcome::Done(all) = &j.outcome else { return Err(bad(C, format!("job {job} has no results to insert: it was canceled"))) };
let unique = chosen.iter().enumerate().all(|(i, id)| !chosen.get(..i).unwrap_or_default().contains(id));
// In the provider's order, whatever order they were listed in.
let picked: Vec<Variation> = all.iter().filter(|v| chosen.contains(&v.style)).cloned().collect();
if !unique || picked.len() != chosen.len() {
return Err(list_error());
}
let labels: Vec<String> = picked.iter().map(|v| style_label(&s.concept.registry, &j.provider, &v.style)).collect();
(j.doc, j.source, j.image.clone(), Arc::clone(&j.bytes), picked, labels)
};
// The same document, the same object showing the same pixels where they were.
let st = s.doc()?;
let now = st.doc.node(source).and_then(shown_image);
let same_pixels = || st.doc.images.get(&image.key).is_some_and(|b| Arc::ptr_eq(&b.bytes, &bytes) || *b.bytes == *bytes);
let current = st.uid == doc && now.is_some_and(|i| i.key == image.key && i.xf == image.xf && i.width == image.width && i.height == image.height);
if !current || !same_pixels() {
return Err(stale());
}
if !st.doc.is_editable(source) {
return Err(bad(C, LOCKED));
}
// The results go above the outermost group around the image that clips or masks it, so that
// it hides none of them; a layer that clips or masks its art leaves them nowhere to go.
let mut anchor = source;
for &id in st.doc.ancestry(source).ok_or_else(stale)?.iter().rev().skip(1) {
let n = st.doc.node(id).ok_or_else(stale)?;
let masked = n.extras().mask.as_ref().is_some_and(|m| !m.disabled);
if matches!(n.kind, NodeKind::Layer { clip: true, .. }) {
return Err(bad(C, "the image is on a layer with a clipping mask, which would hide the results"));
}
if n.is_layer() && masked {
return Err(bad(C, "the image is on a layer with an opacity mask, which would hide the results"));
}
if !n.is_layer() && (masked || matches!(n.kind, NodeKind::Group { clip: true, .. })) {
anchor = id;
}
}
let src = image_rect(&image).ok_or_else(stale)?;
let unit = image.xf.determinant().abs().sqrt();
// Each chosen variation's box over the image: the image's box and the variation's painted
// bounds, which may reach past it.
let boxes: Vec<Rect> = picked
.iter()
.map(|v| {
v.paths
.iter()
.filter_map(|vp| {
let half = vp.stroke.map_or(0.0, |(_, w)| w * unit / 2.0);
vp.path.transformed(image.xf).bounds().map(|b| b.inflate(half, half))
})
.fold(src, |a, b| a.union(b))
})
.collect();
// How far each variation's box is moved past the first's: each box starts GAP to the right of
// the one before it (`width + GAP` further right for boxes the image's size).
let mut offsets = Vec::with_capacity(boxes.len());
let mut next = 0.0;
for (k, b) in boxes.iter().enumerate() {
if let Some(prev) = k.checked_sub(1).and_then(|j| boxes.get(j)) {
next += prev.x1 - b.x0 + GAP;
}
offsets.push(next);
}
// The first box's left edge, which may lie left of the image's where its variation paints there.
let first = boxes.first().map_or(src.x0, |b| b.x0);
// The boxes with the first one's left edge moved to `x0`, the others after it.
let row = |x0: f64| -> Vec<Rect> {
boxes
.iter()
.zip(&offsets)
.map(|(b, off)| {
let dx = x0 + off - first;
Rect::new(b.x0 + dx, b.y0, b.x1 + dx, b.y1)
})
.collect()
};
// The painted bounds of every other visible object, by its outermost object in each layer,
// and the image's own box.
let mut obstacles: Vec<Rect> = vec![src];
let mut stack: Vec<&Arc<Node>> = st.doc.layers.iter().collect();
while let Some(node) = stack.pop() {
if !node.visible || node.id == source {
continue;
}
if node.is_layer() {
stack.extend(node.children().into_iter().flatten());
} else if let Some(b) = vectorcraft_render::painted_bounds(&st.doc, node) {
obstacles.push(b);
}
}
let meets = |a: &Rect, b: &Rect| a.x0 < b.x1 && b.x0 < a.x1 && a.y0 < b.y1 && b.y0 < a.y1;
// Only objects level with some box can be in the row's way.
let top = boxes.iter().map(|b| b.y0).fold(src.y0, f64::min);
let bottom = boxes.iter().map(|b| b.y1).fold(src.y1, f64::max);
obstacles.retain(|o| o.y0 < bottom && top < o.y1);
let mut x0 = src.x1 + GAP;
let mut placed = false;
// Each move takes one box past one obstacle for good, as the row only moves right.
for _ in 0..=obstacles.len() * boxes.len() {
// The first box in the way, moved past the rightmost object it meets.
let shift =
row(x0).iter().find_map(|r| obstacles.iter().filter(|o| meets(o, r)).map(|o| o.x1).reduce(f64::max).map(|right| right + GAP - r.x0));
match shift {
None => {
placed = true;
break;
}
Some(by) => x0 += by,
}
}
let right = row(x0).iter().map(|r| r.x1).fold(f64::NEG_INFINITY, f64::max);
let room = || bad(C, "there is no room for the results to the right of the image");
if !placed || !x0.is_finite() || right > crate::MAX_COORD {
return Err(room());
}
let ids = s.edit("Concept to Vector", |d, sel| {
let mut groups = vec![];
for ((v, label), off) in picked.into_iter().zip(label_of).zip(&offsets) {
let dx = x0 + off - first;
let xf = Affine::translate((dx, 0.0)) * image.xf;
let mut members = Vec::with_capacity(v.paths.len());
for vp in &v.paths {
let path = vp.path.transformed(xf);
if path.bounds().is_some_and(|b| [b.x0, b.y0, b.x1, b.y1].iter().any(|c| c.abs() > crate::MAX_COORD)) {
return Err(room());
}
let mut node = shape_node(d, path, None);
node.appearance = appearance_of(vp, unit).into();
members.push(Arc::new(node));
}
let mut g = Node::group(d.alloc_id(), members);
g.name = Some(label);
groups.push(g);
}
let ids: Vec<NodeId> = groups.iter().map(|g| g.id).collect();
d.insert_beside(vec![(anchor, groups)], false)?;
sel.set(ids.iter().copied());
Ok(ids)
})?;
Ok(json!({ "ids": ids.iter().map(|i| i.0).collect::<Vec<_>>() }))
}
pub fn specs() -> Vec<CommandSpec> {
vec![
cmd!(
query "conceptVector.providers",
"Concept to Vector Providers",
[],
None,
"{} → {providers: [{id, name, available, offline, imageInput, vectorOutput, prompt, rasterOutput, maxStyles: 8, styles: [{id, label}]}], selected: the id the panel uses} the providers conceptVector.generate can call by id; the built-in offline.traceStyles makes its styles with Image Trace on this computer (outline, inkLines, flatColor, detailedColor, grayTones), takes no prompt and makes vector art only",
always,
providers
),
cmd!(
query "conceptVector.generate",
"Generate Concept to Vector Styles",
[],
None,
"{id?: image or unexpanded Image Trace object (default: the one selected object), provider: id (conceptVector.providers; no other provider is used in its place), styles: [style id…] (1 to 8 different ids of that provider), detail?: 0-100 (50: how much of the image's detail each style keeps), prompt?: text (an error for a provider without prompts unless empty), output?: \"vector\" (the only output; any other value is an error)} one variation of the image for each style, kept by this session as a job and not put in the document; an object that is locked or hidden, itself or by a layer or group around it, or on a locked artboard, is refused → {job, provider, source: id, state: \"done\", variations: [{style, label, paths, anchors, bounds: [x0,y0,x1,y1] in the image's pixels, warnings: [text…]}]}",
has_doc,
generate
),
cmd!(
query "conceptVector.results",
"Concept to Vector Results",
[],
None,
"{job} a job conceptVector.generate made, as it returned it, or with state \"canceled\" and no variations; the session keeps the 4 newest jobs, until their document closes → {job, provider, source, state, variations}",
has_doc,
results
),
cmd!(
query "conceptVector.cancel",
"Cancel Concept to Vector Job",
[],
None,
"{job} drop a job's variations, so that it can't be inserted; canceling it again does the same → {job, state: \"canceled\"}",
has_doc,
cancel
),
cmd!(
"conceptVector.insert",
"Insert Concept to Vector Styles",
[],
None,
"{job, variations: [style id…] (different styles of the job)} put a group of each chosen variation, named after its style and in the provider's order, in a row to the right of the job's image, each the image's size with 24 pt between them, moved further right past other visible art in their way, where a variation reaches past its box too (the next one then starts 24 pt past what it paints); the groups go above the outermost clip group or opacity-masked group around the image; the image and other art stay as they are; one undo step; an error when the job's document is not the active one, the object, its image or its placement changed, the object is now locked or hidden, or it is on a layer with a clipping mask or an opacity mask → {ids: the groups, selected}",
has_doc,
insert
),
]
}
@@ -687,12 +687,17 @@ pub(super) const ALLOWED: &[&str] = &[
];
/// Commands a plug-in may not call although no rule refuses them, in order: they change the
/// preferences, a tool's options, a drag's state or the font names the whole app knows, or run
/// plug-ins again.
/// preferences, a tool's options, a drag's state or the font names the whole app knows, run
/// plug-ins again, or hand an image to a Concept to Vector provider and its results.
pub(super) const DENIED: &[&str] = &[
"addon.cleanup.splitText",
"addon.pathtools.movePointsTogether",
"addon.pen.nextSegment",
"conceptVector.cancel",
"conceptVector.generate",
"conceptVector.insert",
"conceptVector.providers",
"conceptVector.results",
"effect.refreshDeferred",
"graphicStyle.setOptions",
"object.blend.createSpine",
+259
View File
@@ -0,0 +1,259 @@
//! Concept to Vector providers: what makes vector variations of a selected image.
//!
//! A provider ([`Provider`]) takes one image's encoded pixels and up to [`MAX_STYLES`] of its own
//! style ids ([`Request`]), and returns one [`Variation`] per style, in the order asked, as paths
//! in the image's pixel space with explicit paints. It sees nothing else of the session or the
//! document. The session keeps the providers in a [`Registry`] and calls one only by its id: an
//! unknown or incapable provider is an error, never a substitute.
//!
//! The host checks every result again ([`check_result`]) before it keeps it, whatever provider
//! made it: the number and order of the variations, finite coordinates and widths within bounds,
//! and the totals [`MAX_ANCHORS`] and [`MAX_PATHS`] across all styles.
//!
//! The one built-in provider ([`offline::ID`]) makes its styles with Image Trace, on this
//! computer: it takes no prompt and makes vector art only.
pub mod offline;
#[cfg(test)]
mod tests;
use std::sync::Arc;
use vectorcraft_geom::{PathData, Point};
/// The most styles one request may ask for.
pub const MAX_STYLES: usize = 8;
/// The most anchor points all the variations of one request may hold together.
pub const MAX_ANCHORS: usize = 1_000_000;
/// The most paths all the variations of one request may hold together.
pub const MAX_PATHS: usize = 250_000;
/// The most warnings a variation may carry, and the most characters in each.
pub const MAX_WARNINGS: usize = 16;
const MAX_WARNING_CHARS: usize = 500;
/// One of a provider's styles: its stable id and its English name.
#[derive(Clone, Debug, PartialEq, Eq, serde::Serialize)]
pub struct Style {
pub id: &'static str,
pub label: &'static str,
}
/// What a provider takes and makes.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Capabilities {
/// It takes an image as its input.
pub image_input: bool,
/// It makes editable vector paths.
pub vector_output: bool,
/// It takes a text prompt.
pub prompt: bool,
/// It makes raster images.
pub raster_output: bool,
/// It runs on this computer without a network.
pub offline: bool,
/// Its styles, in the order it lists them.
pub styles: Vec<Style>,
}
/// The kind of result a request asks for. `conceptVector.generate` asks only for
/// [`Output::Vector`]: a [`Variation`] holds vector paths.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Output {
Vector,
Raster,
}
/// One request: the encoded pixels of an image, and how to make its variations.
#[derive(Clone, Debug)]
pub struct Request {
/// The image's encoded bytes (PNG, JPEG, WebP or GIF), as the document holds them.
pub image: Arc<Vec<u8>>,
/// The image's size in pixels: the space the variations' paths are in.
pub width: u32,
pub height: u32,
/// The prompt, trimmed; `None` when there is none.
pub prompt: Option<String>,
/// The provider's style ids, 1 to [`MAX_STYLES`] of them, each once.
pub styles: Vec<String>,
/// How much of the image's detail to keep, 0 (least) to 100 (most).
pub detail: u8,
pub output: Output,
}
/// One path of a variation, in the image's pixel space (`(0, 0)` top left, `(width, height)` bottom
/// right).
#[derive(Clone, Debug, PartialEq)]
pub struct VectorPath {
pub path: PathData,
/// The fill color (sRGB), if it is filled.
pub fill: Option<[u8; 3]>,
/// The stroke color (sRGB) and width in pixels, if it is stroked.
pub stroke: Option<([u8; 3], f64)>,
}
/// The variation a provider made for one style.
#[derive(Clone, Debug, PartialEq)]
pub struct Variation {
/// The style id it was made for.
pub style: String,
/// Its paths, bottom-most first.
pub paths: Vec<VectorPath>,
/// Notes for the person who asked (a scaled-down image, nothing traced).
pub warnings: Vec<String>,
}
impl Variation {
/// Its anchor points, every path counted.
pub fn anchors(&self) -> usize {
self.paths.iter().map(|p| p.path.anchor_count()).sum()
}
}
/// Why a provider made nothing.
#[derive(Clone, Debug, PartialEq, thiserror::Error)]
pub enum ProviderError {
/// The image or the request cannot be used.
#[error("{0}")]
InvalidInput(String),
/// The provider does not do what the request asks.
#[error("{0}")]
Unsupported(String),
/// The provider cannot run now.
#[error("{0}")]
Unavailable(String),
/// The caller stopped it.
#[error("cancelled; nothing was changed")]
Canceled,
/// The results would pass a limit.
#[error("the results would have more than {0} anchor points: lower Detail or choose fewer styles")]
ResourceLimit(usize),
/// The provider's results do not match the request, or are out of bounds.
#[error("the provider's results do not match the request or are malformed")]
InvalidResult,
/// The provider stopped on a fault of its own.
#[error("the provider stopped with an internal error: {0}")]
Internal(String),
}
/// How far a provider has got: `steps(done, total)`; it stops with [`ProviderError::Canceled`]
/// once this answers `false`.
pub type Steps<'a> = &'a (dyn Fn(u64, u64) -> bool + Sync);
/// Something that makes vector variations of an image.
pub trait Provider: Send + Sync {
/// Its stable id, such as `offline.traceStyles`.
fn id(&self) -> &'static str;
/// Its English name.
fn name(&self) -> &'static str;
fn capabilities(&self) -> Capabilities;
/// One variation for each of `request.styles`, in that order.
fn generate(&self, request: &Request, steps: Steps) -> Result<Vec<Variation>, ProviderError>;
/// What [`Provider::generate`] makes, made a part at a time ([`Parts`]), for a caller with no
/// thread to wait on; `None` (the default) when it makes no parts smaller than one style.
fn parts(&self, _request: &Request) -> Option<Box<dyn Parts>> {
None
}
}
/// A request's variations made a part at a time: each call of [`Parts::step`] does a part and
/// returns, so that the caller can run other work, or stop, between parts.
pub trait Parts: Send {
/// Does the next part → the variations once the last part is done, `None` before it.
fn step(&mut self) -> Result<Option<Vec<Variation>>, ProviderError>;
/// The styles made so far.
fn styles_done(&self) -> usize;
}
/// The providers a session can call, by id.
#[derive(Clone)]
pub struct Registry {
providers: Vec<Registered>,
}
/// A provider in a [`Registry`], with the id, name and capabilities it gave when it was
/// registered.
#[derive(Clone)]
pub struct Registered {
pub id: &'static str,
pub name: &'static str,
pub capabilities: Capabilities,
pub provider: Arc<dyn Provider>,
}
impl Default for Registry {
/// The built-in provider only.
fn default() -> Self {
let p = offline::TraceStyles;
Self { providers: vec![Registered { id: p.id(), name: p.name(), capabilities: p.capabilities(), provider: Arc::new(p) }] }
}
}
impl Registry {
/// A registry with no provider.
pub fn empty() -> Self {
Self { providers: vec![] }
}
/// Add `provider`, reading its id, name and capabilities once; an error when one with its id
/// is registered already, or when the provider panics while giving them.
pub fn register(&mut self, provider: Arc<dyn Provider>) -> Result<(), String> {
let (id, name, capabilities) = crate::guard::catch_panic(|| (provider.id(), provider.name(), provider.capabilities()))
.map_err(|e| ProviderError::Internal(e).to_string())?;
if self.get(id).is_some() {
return Err(format!("a provider with the id `{id}` is registered already"));
}
self.providers.push(Registered { id, name, capabilities, provider });
Ok(())
}
/// The provider `id` (exactly so spelled).
pub fn get(&self, id: &str) -> Option<&Registered> {
self.providers.iter().find(|p| p.id == id)
}
/// The providers in the order they were registered.
pub fn iter(&self) -> impl Iterator<Item = &Registered> {
self.providers.iter()
}
}
/// Whether `p` is a finite point within `limit` of the image's pixel space.
fn within(p: Point, limit: f64, size: (f64, f64)) -> bool {
p.x.is_finite() && p.y.is_finite() && p.x >= -limit && p.y >= -limit && p.x <= size.0 + limit && p.y <= size.1 + limit
}
/// Checks the variations a provider returned for `request`: one per style in the order asked, at
/// most [`MAX_PATHS`] paths and [`MAX_ANCHORS`] anchors together, each path with an anchor and a
/// fill or a stroke, every anchor and handle finite and within one image side of the image, every
/// stroke width finite, over 0 and at most the image's larger side, and at most [`MAX_WARNINGS`]
/// warnings of at most 500 characters on each variation.
pub fn check_result(request: &Request, variations: &[Variation]) -> Result<(), ProviderError> {
if variations.len() != request.styles.len() || variations.iter().zip(&request.styles).any(|(v, s)| v.style != *s) {
return Err(ProviderError::InvalidResult);
}
let size = (f64::from(request.width.max(1)), f64::from(request.height.max(1)));
let side = size.0.max(size.1);
let (mut paths, mut anchors) = (0usize, 0usize);
for v in variations {
paths += v.paths.len();
anchors += v.anchors();
if anchors > MAX_ANCHORS {
return Err(ProviderError::ResourceLimit(MAX_ANCHORS));
}
if paths > MAX_PATHS || v.warnings.len() > MAX_WARNINGS || v.warnings.iter().any(|w| w.chars().count() > MAX_WARNING_CHARS) {
return Err(ProviderError::InvalidResult);
}
for p in &v.paths {
let width_ok = p.stroke.is_none_or(|(_, w)| w.is_finite() && w > 0.0 && w <= side);
let painted = p.fill.is_some() || p.stroke.is_some();
let points_ok = p.path.anchors().all(|(_, _, a)| [a.p, a.h_in, a.h_out].into_iter().all(|q| within(q, side, size)));
if !width_ok || !painted || p.path.anchor_count() == 0 || !points_ok {
return Err(ProviderError::InvalidResult);
}
}
}
Ok(())
}
+280
View File
@@ -0,0 +1,280 @@
//! The built-in provider: Concept to Vector styles made with Image Trace on this computer.
//!
//! Each style is a fixed set of Image Trace settings of VectorCraft's own, and Detail (0 to 100)
//! moves its Paths, Noise and color count within that style's range. The image is decoded once and
//! traced once per style; an image over [`MAX_PIXELS`] is scaled down first, aspect kept, and
//! each variation says so. The paths are mapped back to the image's own pixel size.
use std::sync::Arc;
use vectorcraft_geom::Affine;
use vectorcraft_trace as tr;
use super::{Capabilities, MAX_ANCHORS, Output, Parts, ProviderError, Request, Steps, Style, Variation, VectorPath};
/// The built-in provider's id.
pub const ID: &str = "offline.traceStyles";
/// The most pixels the built-in provider traces an image at (16 megapixels).
pub const MAX_PIXELS: u64 = 16 << 20;
/// The built-in provider's styles, in the order it lists them.
pub const STYLES: [Style; 5] = [
Style { id: "outline", label: "Outline" },
Style { id: "inkLines", label: "Ink Lines" },
Style { id: "flatColor", label: "Flat Color" },
Style { id: "detailedColor", label: "Detailed Color" },
Style { id: "grayTones", label: "Gray Tones" },
];
/// Concept to Vector styles made with Image Trace ([`ID`]).
pub struct TraceStyles;
/// `lo` at Detail 0 to `hi` at Detail 100.
fn between(lo: f64, hi: f64, t: f64) -> f64 {
lo + (hi - lo) * t
}
/// The trace settings of style `id` at Detail `detail` (0 to 100); `None` for an id that isn't one
/// of [`STYLES`].
pub fn style_params(id: &str, detail: u8) -> Option<tr::TraceParams> {
let t = f64::from(detail.min(100)) / 100.0;
let noise = |lo: f64, hi: f64| between(hi, lo, t).round().max(1.0) as u32;
let count = |lo: f64, hi: f64| between(lo, hi, t).round() as u32;
let base = tr::TraceParams { shapes: false, gradients: false, auto_grouping: false, ..tr::TraceParams::default() };
Some(match id {
// Black stroked lines only: thin lines as center lines, wider areas as outlines.
"outline" => {
tr::TraceParams { fills: false, strokes: true, ignore_white: true, paths: between(50.0, 90.0, t), noise: noise(4.0, 40.0), ..base }
}
// Black filled ink on no background, the straight runs straightened.
"inkLines" => tr::TraceParams {
ignore_white: true,
snap_curves_to_lines: true,
paths: between(50.0, 95.0, t),
corners: 80.0,
noise: noise(4.0, 30.0),
..base
},
// A few flat colors, abutting.
"flatColor" => tr::TraceParams {
mode: tr::Mode::Color,
colors: count(3.0, 8.0),
paths: between(40.0, 80.0, t),
corners: 60.0,
noise: noise(8.0, 40.0),
snap_curves_to_lines: true,
..base
},
// Many colors, stacked so no hairline gaps show.
"detailedColor" => tr::TraceParams {
mode: tr::Mode::Color,
colors: count(12.0, 32.0),
paths: between(70.0, 95.0, t),
corners: 40.0,
noise: noise(2.0, 12.0),
method: tr::Method::Overlapping,
..base
},
// Grays, stacked.
"grayTones" => tr::TraceParams {
mode: tr::Mode::Grayscale,
colors: count(4.0, 12.0),
paths: between(55.0, 90.0, t),
corners: 50.0,
noise: noise(4.0, 20.0),
method: tr::Method::Overlapping,
..base
},
_ => return None,
})
}
/// `img` box-filtered down to at most [`MAX_PIXELS`], aspect kept; `img` itself when it fits.
fn fit(img: tr::Raster) -> tr::Raster {
let (w, h) = (u64::from(img.width), u64::from(img.height));
if w * h <= MAX_PIXELS || w == 0 || h == 0 {
return img;
}
let k = (MAX_PIXELS as f64 / (w * h) as f64).sqrt();
let nw = ((w as f64 * k).floor() as u32).clamp(1, img.width);
let nh = ((h as f64 * k).floor() as u32).clamp(1, img.height);
let mut rgba = Vec::with_capacity(nw as usize * nh as usize * 4);
for y in 0..nh {
let (y0, y1) = (u64::from(y) * h / u64::from(nh), (u64::from(y + 1) * h / u64::from(nh)).max(u64::from(y) * h / u64::from(nh) + 1));
for x in 0..nw {
let (x0, x1) = (u64::from(x) * w / u64::from(nw), (u64::from(x + 1) * w / u64::from(nw)).max(u64::from(x) * w / u64::from(nw) + 1));
let mut sum = [0u64; 4];
for sy in y0..y1.min(h) {
for sx in x0..x1.min(w) {
for (s, v) in sum.iter_mut().zip(img.pixel(sx as u32, sy as u32)) {
*s += u64::from(v);
}
}
}
let n = ((y1.min(h) - y0) * (x1.min(w) - x0)).max(1);
rgba.extend(sum.map(|s| (s / n) as u8));
}
}
tr::Raster { width: nw, height: nh, rgba }
}
impl super::Provider for TraceStyles {
fn id(&self) -> &'static str {
ID
}
fn name(&self) -> &'static str {
"Offline Image Trace Styles"
}
fn capabilities(&self) -> Capabilities {
Capabilities { image_input: true, vector_output: true, prompt: false, raster_output: false, offline: true, styles: STYLES.to_vec() }
}
fn generate(&self, request: &Request, steps: Steps) -> Result<Vec<Variation>, ProviderError> {
let params = checked(request)?;
let total = params.len() as u64;
if !steps(0, total) {
return Err(ProviderError::Canceled);
}
let image = Decoded::new(request)?;
let mut left = MAX_ANCHORS;
let mut out = Vec::with_capacity(params.len());
for (i, (style, p)) in request.styles.iter().zip(&params).enumerate() {
let go_on = |_: u64, _: u64| steps(i as u64, total);
let res = tr::trace_watched(&image.raster, p, left, &go_on).map_err(trace_error)?;
left = left.saturating_sub(res.anchor_count());
out.push(image.variation(style, res));
}
if !steps(total, total) {
return Err(ProviderError::Canceled);
}
Ok(out)
}
/// The image decoded in the first part; then for each style, its colour layers found in one
/// part and each layer traced in a part of its own ([`tr::TraceSteps`]).
fn parts(&self, request: &Request) -> Option<Box<dyn Parts>> {
Some(Box::new(TraceParts { request: request.clone(), image: None, trace: None, left: MAX_ANCHORS, out: vec![], ended: false }))
}
}
/// The trace settings of each of `request`'s styles; an error for a prompt, an output other than
/// vector art, or a style that isn't one of [`STYLES`]. The host refuses these first; a direct
/// caller gets the same answer.
fn checked(request: &Request) -> Result<Vec<tr::TraceParams>, ProviderError> {
let pid = ID;
if request.prompt.is_some() || request.output != Output::Vector {
return Err(ProviderError::Unsupported(format!("`{pid}` takes no prompt and makes vector art only")));
}
request
.styles
.iter()
.map(|s| style_params(s, request.detail))
.collect::<Option<_>>()
.ok_or_else(|| ProviderError::InvalidInput(format!("`styles` must list 1 to 8 different style ids of `{pid}` (see conceptVector.providers)")))
}
fn trace_error(e: tr::TraceError) -> ProviderError {
match e {
tr::TraceError::Cancelled => ProviderError::Canceled,
tr::TraceError::TooComplex { .. } => ProviderError::ResourceLimit(MAX_ANCHORS),
e => ProviderError::InvalidInput(e.to_string()),
}
}
/// A request's image decoded for tracing, with what maps its traced paths back.
struct Decoded {
raster: Arc<tr::Raster>,
/// The decoded raster's pixels → the image's own pixel space.
back: Affine,
unit: f64,
warnings: Vec<String>,
}
impl Decoded {
/// `request`'s image decoded, scaled down to at most [`MAX_PIXELS`].
fn new(request: &Request) -> Result<Self, ProviderError> {
let raster = fit(tr::Raster::decode_to_fit(&request.image).map_err(|e| ProviderError::InvalidInput(e.to_string()))?);
let mut warnings = vec![];
let (iw, ih) = (request.width.max(1), request.height.max(1));
if u64::from(raster.width) * u64::from(raster.height) < u64::from(iw) * u64::from(ih) {
warnings.push(format!("The image was traced at {} × {} pixels, scaled down from {iw} × {ih}.", raster.width, raster.height));
}
let back = Affine::scale_non_uniform(f64::from(iw) / f64::from(raster.width.max(1)), f64::from(ih) / f64::from(raster.height.max(1)));
let unit = back.determinant().abs().sqrt();
Ok(Self { raster: Arc::new(raster), back, unit, warnings })
}
/// The variation of `style` that the trace `res` of this image makes.
fn variation(&self, style: &str, res: tr::TraceResult) -> Variation {
let paths = res
.paths
.into_iter()
.map(|tp| {
let path = tp.path.transformed(self.back);
match tp.stroke {
Some(w) => VectorPath { path, fill: None, stroke: Some((tp.color, w * self.unit)) },
None => VectorPath { path, fill: Some(tp.color), stroke: None },
}
})
.collect();
Variation { style: style.to_string(), paths, warnings: self.warnings.clone() }
}
}
/// [`TraceStyles`]' variations made a part at a time.
struct TraceParts {
request: Request,
image: Option<Decoded>,
/// The trace of the style after those in `out`, once started.
trace: Option<tr::TraceSteps>,
/// The anchor points the styles not made yet may have.
left: usize,
out: Vec<Variation>,
/// The variations or an error have been given.
ended: bool,
}
impl Parts for TraceParts {
/// After the variations or an error, each call gives `None`.
fn step(&mut self) -> Result<Option<Vec<Variation>>, ProviderError> {
if self.ended {
return Ok(None);
}
let part = self.next_part();
self.ended = !matches!(part, Ok(None));
part
}
fn styles_done(&self) -> usize {
self.out.len()
}
}
impl TraceParts {
fn next_part(&mut self) -> Result<Option<Vec<Variation>>, ProviderError> {
let Some(image) = &self.image else {
checked(&self.request)?;
self.image = Some(Decoded::new(&self.request)?);
return Ok(None);
};
let Some(style) = self.request.styles.get(self.out.len()) else { return Ok(Some(std::mem::take(&mut self.out))) };
let trace = match &mut self.trace {
Some(t) => t,
None => {
let params = style_params(style, self.request.detail).ok_or(ProviderError::InvalidResult)?;
self.trace.insert(tr::TraceSteps::new(Arc::clone(&image.raster), params, self.left))
}
};
let Some(res) = trace.step().map_err(trace_error)? else { return Ok(None) };
self.trace = None;
self.left = self.left.saturating_sub(res.anchor_count());
self.out.push(image.variation(style, res));
if self.out.len() < self.request.styles.len() {
return Ok(None);
}
Ok(Some(std::mem::take(&mut self.out)))
}
}
+816
View File
@@ -0,0 +1,816 @@
use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering};
use serde_json::{Value, json};
use vectorcraft_doc::{ImageBlob, ImageObject, Node, NodeId, NodeKind, OpacityMask};
use vectorcraft_geom::{Affine, PathData, Point, SubPath};
use vectorcraft_trace::Raster;
use super::offline::{self, ID};
use super::*;
use crate::Session;
use crate::cmd::conceptvector::{ConceptRun, GAP, KEEP_JOBS, PartRun};
/// Shapes in four colors on white: a red disc, a blue bar, a green square and a thin black line.
fn art() -> Raster {
Raster::from_fn(120, 90, |x, y| {
let (fx, fy) = (f64::from(x) + 0.5, f64::from(y) + 0.5);
if (fx - 30.0).powi(2) + (fy - 30.0).powi(2) <= 400.0 {
[220, 30, 30, 255]
} else if (60.0..110.0).contains(&fx) && (10.0..25.0).contains(&fy) {
[30, 60, 200, 255]
} else if (70.0..100.0).contains(&fx) && (45.0..75.0).contains(&fy) {
[40, 160, 60, 255]
} else if (10.0..110.0).contains(&fx) && (82.0..84.0).contains(&fy) {
[0, 0, 0, 255]
} else {
[255, 255, 255, 255]
}
})
}
/// A document with `r` placed at (100, 100), scaled ×2, and selected.
fn doc_with(r: &Raster) -> (Session, NodeId) {
let mut s = Session::new();
s.execute("file.new", &json!({"width": 2000, "height": 1000})).unwrap();
let png = r.encode_png();
let (w, h) = (r.width, r.height);
let id = s
.edit("img", |d, sel| {
d.images.insert("img1".into(), ImageBlob::new("image/png", png));
let id = d.alloc_id();
let l = d.default_layer();
let image = ImageObject {
key: "img1".into(),
width: w,
height: h,
xf: Affine::translate((100.0, 100.0)) * Affine::scale(2.0),
link: None,
placement: Default::default(),
pixels: None,
};
d.insert(l, 0, Node::new(id, NodeKind::Image(Box::new(image))))?;
sel.set([id]);
Ok(id)
})
.unwrap();
(s, id)
}
fn all_styles() -> Vec<&'static str> {
offline::STYLES.iter().map(|s| s.id).collect()
}
fn generate(s: &mut Session, p: Value) -> crate::Result<Value> {
s.execute("conceptVector.generate", &p)
}
fn undo_len(s: &Session) -> usize {
s.doc().unwrap().history.undo.len()
}
/// A provider for the tests: `styles` ids `s0`, `s1`…, answering with `answer`.
struct Fake {
id: &'static str,
styles: usize,
prompt: bool,
raster: bool,
answer: fn(&Request, Steps) -> Result<Vec<Variation>, ProviderError>,
}
const FAKE_STYLES: [&str; 10] = ["s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", "s8", "s9"];
impl Provider for Fake {
fn id(&self) -> &'static str {
self.id
}
fn name(&self) -> &'static str {
"Fake"
}
fn capabilities(&self) -> Capabilities {
let styles = FAKE_STYLES.iter().take(self.styles).map(|id| Style { id, label: id }).collect();
Capabilities { image_input: true, vector_output: true, prompt: self.prompt, raster_output: self.raster, offline: true, styles }
}
fn generate(&self, request: &Request, steps: Steps) -> Result<Vec<Variation>, ProviderError> {
(self.answer)(request, steps)
}
}
/// A square in the image's top-left quarter for each style asked.
fn squares(r: &Request, _: Steps) -> Result<Vec<Variation>, ProviderError> {
let side = f64::from(r.width.min(r.height)) / 2.0;
let sq = PathData::single(SubPath::polyline(&[Point::new(0.0, 0.0), Point::new(side, 0.0), Point::new(side, side), Point::new(0.0, side)], true));
Ok(r.styles
.iter()
.map(|st| Variation {
style: st.clone(),
paths: vec![VectorPath { path: sq.clone(), fill: Some([9, 9, 9]), stroke: None }],
warnings: vec![],
})
.collect())
}
fn with_fake(s: &mut Session, fake: Fake) {
s.concept_providers_mut().register(Arc::new(fake)).unwrap();
}
fn fake(answer: fn(&Request, Steps) -> Result<Vec<Variation>, ProviderError>) -> Fake {
Fake { id: "test.fake", styles: 10, prompt: false, raster: false, answer }
}
#[test]
fn the_registry_holds_the_built_in_provider_and_refuses_a_second_id() {
let mut r = Registry::default();
assert_eq!(r.iter().map(|p| p.id).collect::<Vec<_>>(), [ID]);
assert!(r.register(Arc::new(offline::TraceStyles)).is_err());
assert!(r.register(Arc::new(fake(squares))).is_ok());
assert!(r.register(Arc::new(fake(squares))).is_err());
assert!(r.get("test.fake").is_some() && r.get("TEST.FAKE").is_none());
let caps = offline::TraceStyles.capabilities();
assert!(caps.offline && caps.vector_output && !caps.prompt && !caps.raster_output);
}
/// A provider whose capabilities panic from the `fails_from`th call on.
struct Faulty {
calls: AtomicUsize,
fails_from: usize,
}
impl Provider for Faulty {
fn id(&self) -> &'static str {
"test.faulty"
}
fn name(&self) -> &'static str {
"Faulty"
}
fn capabilities(&self) -> Capabilities {
if self.calls.fetch_add(1, Ordering::SeqCst) >= self.fails_from {
panic!("capabilities failed");
}
fake(squares).capabilities()
}
fn generate(&self, request: &Request, steps: Steps) -> Result<Vec<Variation>, ProviderError> {
squares(request, steps)
}
}
/// A provider's capabilities are read once, when it is registered: one that panics then is not
/// registered, and one that would panic later is not asked again.
#[test]
fn a_provider_is_asked_its_capabilities_once_when_it_is_registered() {
let mut r = Registry::default();
let e = r.register(Arc::new(Faulty { calls: AtomicUsize::new(0), fails_from: 0 })).unwrap_err();
assert!(e.contains("capabilities failed"), "{e}");
assert!(r.get("test.faulty").is_none());
let (mut s, img) = doc_with(&art());
let faulty = Arc::new(Faulty { calls: AtomicUsize::new(0), fails_from: 1 });
s.concept_providers_mut().register(Arc::clone(&faulty) as Arc<dyn Provider>).unwrap();
let list = s.execute("conceptVector.providers", &json!({})).unwrap();
assert_eq!(list["providers"][1]["styles"][0]["id"], "s0");
let job = generate(&mut s, json!({"provider": "test.faulty", "styles": ["s0", "s1"], "id": img.0})).unwrap();
assert_eq!(job["variations"][1]["label"], "s1");
let r = s.execute("conceptVector.insert", &json!({"job": job["job"], "variations": ["s0"]})).unwrap();
assert_eq!(r["ids"].as_array().map(Vec::len), Some(1));
assert_eq!(faulty.calls.load(Ordering::SeqCst), 1);
}
#[test]
fn providers_lists_each_provider_and_its_styles() {
let mut s = Session::new();
let r = s.execute("conceptVector.providers", &json!({})).unwrap();
assert_eq!(r["selected"], ID);
let p = &r["providers"][0];
assert_eq!(p["id"], ID);
assert_eq!(p["prompt"], false);
assert_eq!(p["rasterOutput"], false);
assert_eq!(p["maxStyles"], 8);
let ids: Vec<&str> = p["styles"].as_array().unwrap().iter().map(|v| v["id"].as_str().unwrap()).collect();
assert_eq!(ids, all_styles());
}
/// The checks on a result, whatever provider made it.
#[test]
fn results_are_checked_whatever_provider_made_them() {
let r = Request {
image: Arc::new(vec![]),
width: 100,
height: 50,
prompt: None,
styles: vec!["a".into(), "b".into()],
detail: 50,
output: Output::Vector,
};
let sq = |x: f64| PathData::single(SubPath::polyline(&[Point::new(x, 0.0), Point::new(x + 10.0, 0.0), Point::new(x + 10.0, 10.0)], true));
let v = |style: &str, path: PathData, fill: Option<[u8; 3]>, stroke: Option<([u8; 3], f64)>| Variation {
style: style.into(),
paths: vec![VectorPath { path, fill, stroke }],
warnings: vec![],
};
let ok = vec![v("a", sq(0.0), Some([1, 2, 3]), None), v("b", sq(0.0), None, Some(([0, 0, 0], 2.0)))];
assert_eq!(check_result(&r, &ok), Ok(()));
// One for each style, in the order asked.
assert_eq!(check_result(&r, &ok[..1]), Err(ProviderError::InvalidResult));
let swapped = vec![ok[1].clone(), ok[0].clone()];
assert_eq!(check_result(&r, &swapped), Err(ProviderError::InvalidResult));
// Coordinates finite and within one image side of the image.
for bad in [f64::NAN, f64::INFINITY, -101.0, 201.0] {
let far = vec![ok[0].clone(), v("b", sq(bad), Some([0, 0, 0]), None)];
assert_eq!(check_result(&r, &far), Err(ProviderError::InvalidResult), "{bad}");
}
// Stroke widths over 0, finite, at most the larger side.
for w in [0.0, -1.0, f64::NAN, 101.0] {
let wide = vec![ok[0].clone(), v("b", sq(0.0), None, Some(([0, 0, 0], w)))];
assert_eq!(check_result(&r, &wide), Err(ProviderError::InvalidResult), "{w}");
}
// Painted, with an anchor.
let unpainted = vec![ok[0].clone(), v("b", sq(0.0), None, None)];
assert_eq!(check_result(&r, &unpainted), Err(ProviderError::InvalidResult));
let empty = vec![ok[0].clone(), v("b", PathData::default(), Some([0, 0, 0]), None)];
assert_eq!(check_result(&r, &empty), Err(ProviderError::InvalidResult));
// Warnings bounded.
let mut chatty = ok.clone();
chatty[1].warnings = vec!["x".into(); MAX_WARNINGS + 1];
assert_eq!(check_result(&r, &chatty), Err(ProviderError::InvalidResult));
// The anchors of all the styles together.
let many = PathData::single(SubPath::polyline(&vec![Point::new(1.0, 1.0); MAX_ANCHORS / 2 + 1], true));
let heavy = vec![v("a", many.clone(), Some([0, 0, 0]), None), v("b", many, Some([0, 0, 0]), None)];
assert_eq!(check_result(&r, &heavy), Err(ProviderError::ResourceLimit(MAX_ANCHORS)));
}
#[test]
fn generate_calls_only_the_named_provider() {
let (mut s, _) = doc_with(&art());
with_fake(&mut s, fake(squares));
let r = generate(&mut s, json!({"provider": "test.fake", "styles": ["s1", "s0"]})).unwrap();
assert_eq!(r["provider"], "test.fake");
assert_eq!(r["variations"].as_array().unwrap().iter().map(|v| v["style"].as_str().unwrap()).collect::<Vec<_>>(), ["s1", "s0"]);
// An unknown provider is an error, not the built-in one.
let e = generate(&mut s, json!({"provider": "cloud.missing", "styles": ["outline"]})).unwrap_err().to_string();
assert!(e.contains("no Concept to Vector provider `cloud.missing`"), "{e}");
let e = generate(&mut s, json!({"styles": ["outline"]})).unwrap_err().to_string();
assert!(e.contains("missing `provider`"), "{e}");
// A session without the built-in provider does not use another in its place.
let (mut bare, _) = doc_with(&art());
*bare.concept_providers_mut() = Registry::empty();
assert!(generate(&mut bare, json!({"provider": ID, "styles": ["outline"]})).is_err());
}
#[test]
fn styles_are_one_to_eight_different_ids_of_the_provider() {
let (mut s, _) = doc_with(&art());
with_fake(&mut s, fake(squares));
let ids = |n: usize| FAKE_STYLES[..n].to_vec();
for styles in [json!([]), json!(ids(9)), json!(["s0", "s0"]), json!(["s0", "nope"]), json!("s0"), json!([1]), json!(null)] {
let e = generate(&mut s, json!({"provider": "test.fake", "styles": styles})).unwrap_err().to_string();
assert!(e.contains("`styles` must list 1 to 8 different style ids of `test.fake`"), "{styles}: {e}");
}
assert_eq!(generate(&mut s, json!({"provider": "test.fake", "styles": ids(1)})).unwrap()["variations"].as_array().unwrap().len(), 1);
assert_eq!(generate(&mut s, json!({"provider": "test.fake", "styles": ids(8)})).unwrap()["variations"].as_array().unwrap().len(), 8);
}
#[test]
fn a_prompt_is_refused_by_a_provider_without_prompts_and_raster_output_by_every_provider() {
let (mut s, _) = doc_with(&art());
let p = |extra: Value| {
let mut p = json!({"provider": ID, "styles": ["flatColor"], "detail": 10});
p.as_object_mut().unwrap().extend(extra.as_object().unwrap().clone());
p
};
let e = generate(&mut s, p(json!({"prompt": "a dragon"}))).unwrap_err().to_string();
assert!(e.contains("takes no prompt and makes vector art only"), "{e}");
assert!(generate(&mut s, p(json!({"prompt": " "}))).is_ok());
assert!(generate(&mut s, p(json!({"output": "vector"}))).is_ok());
for output in ["svg", "raster"] {
let e = generate(&mut s, p(json!({"output": output}))).unwrap_err().to_string();
assert!(e.contains("`output` must be \"vector\""), "{output}: {e}");
}
// Results are vector art, so raster output is refused even from a provider that makes it.
let (mut r, _) = doc_with(&art());
with_fake(&mut r, Fake { raster: true, ..fake(squares) });
let e = generate(&mut r, json!({"provider": "test.fake", "styles": ["s0"], "output": "raster"})).unwrap_err().to_string();
assert!(e.contains("`output` must be \"vector\""), "{e}");
for detail in [json!(101), json!(-1), json!(2.5), json!("50")] {
assert!(generate(&mut s, p(json!({"detail": detail}))).unwrap_err().to_string().contains("`detail` must be a whole number"), "{detail}");
}
// A provider that takes prompts gets the prompt, trimmed.
fn echo(r: &Request, steps: Steps) -> Result<Vec<Variation>, ProviderError> {
if r.prompt.as_deref() != Some("a dragon") {
return Err(ProviderError::InvalidInput("no prompt".into()));
}
squares(r, steps)
}
with_fake(&mut s, Fake { prompt: true, ..fake(echo) });
assert!(generate(&mut s, json!({"provider": "test.fake", "styles": ["s0"], "prompt": " a dragon "})).is_ok());
}
#[test]
fn the_source_is_one_shown_unlocked_image() {
let (mut s, id) = doc_with(&art());
s.execute("select.none", &json!({})).unwrap();
let e = generate(&mut s, json!({"provider": ID, "styles": ["outline"]})).unwrap_err().to_string();
assert!(e.contains("select one image or an unexpanded Image Trace object"), "{e}");
// By id, with nothing selected.
assert!(generate(&mut s, json!({"provider": ID, "styles": ["outline"], "id": id.0})).is_ok());
let rect = s.execute("shape.rectangle", &json!({"x": 0, "y": 0, "width": 10, "height": 10})).unwrap()["id"].as_u64().unwrap();
let e = generate(&mut s, json!({"provider": ID, "styles": ["outline"], "id": rect})).unwrap_err().to_string();
assert!(e.contains("select one image"), "{e}");
// Two objects selected.
s.execute("select.set", &json!({"ids": [id.0, rect]})).unwrap();
assert!(generate(&mut s, json!({"provider": ID, "styles": ["outline"]})).is_err());
// Locked.
s.execute("select.set", &json!({"ids": [id.0]})).unwrap();
s.execute("object.lock", &json!({})).unwrap();
let e = generate(&mut s, json!({"provider": ID, "styles": ["outline"], "id": id.0})).unwrap_err().to_string();
assert!(e.contains("locked or hidden"), "{e}");
// An Image Trace object that wasn't expanded uses its source image.
let (mut t, img) = doc_with(&art());
let traced = t.execute("imageTrace.make", &json!({"preset": "Default"})).unwrap()["id"].as_u64().unwrap();
let r = generate(&mut t, json!({"provider": ID, "styles": ["flatColor"], "id": traced})).unwrap();
assert_eq!(r["source"], traced);
assert_ne!(traced, img.0);
}
/// A group around the image that is locked or hidden refuses it, when generating and again when
/// inserting a job made before the group was locked.
#[test]
fn a_locked_or_hidden_group_around_the_image_refuses_it() {
for change in ["object.lock", "object.hide"] {
let (mut s, id) = doc_with(&art());
let rect = s.execute("shape.rectangle", &json!({"x": 0, "y": 0, "width": 10, "height": 10})).unwrap()["id"].as_u64().unwrap();
s.execute("select.set", &json!({"ids": [id.0, rect]})).unwrap();
let group = s.execute("object.group", &json!({})).unwrap()["id"].as_u64().unwrap();
let p = json!({"provider": ID, "styles": ["outline"], "id": id.0});
let job = generate(&mut s, p.clone()).unwrap()["job"].as_u64().unwrap();
s.execute(change, &json!({"ids": [group]})).unwrap();
let e = generate(&mut s, p.clone()).unwrap_err().to_string();
assert!(e.contains("locked or hidden"), "{change}: {e}");
let (before, depth) = (s.doc().unwrap().doc.clone(), undo_len(&s));
let e = s.execute("conceptVector.insert", &json!({"job": job, "variations": ["outline"]})).unwrap_err().to_string();
assert!(e.contains("locked or hidden"), "{change}: {e}");
assert!(s.doc().unwrap().doc == before && undo_len(&s) == depth);
}
}
#[test]
fn malformed_results_panics_and_cancels_keep_no_job_and_change_nothing() {
fn wrong_count(_: &Request, _: Steps) -> Result<Vec<Variation>, ProviderError> {
Ok(vec![])
}
#[allow(clippy::panic)]
fn panics(_: &Request, _: Steps) -> Result<Vec<Variation>, ProviderError> {
panic!("provider fault")
}
fn stops(r: &Request, steps: Steps) -> Result<Vec<Variation>, ProviderError> {
if steps(0, 1) { squares(r, steps) } else { Err(ProviderError::Canceled) }
}
for (answer, expect) in [(wrong_count as fn(&Request, Steps) -> _, "do not match the request"), (panics, "internal error: provider fault")] {
let (mut s, _) = doc_with(&art());
with_fake(&mut s, fake(answer));
let (before, depth) = (s.doc().unwrap().doc.clone(), undo_len(&s));
let e = generate(&mut s, json!({"provider": "test.fake", "styles": ["s0"]})).unwrap_err().to_string();
assert!(e.contains(expect), "{e}");
assert!(s.doc().unwrap().doc == before && undo_len(&s) == depth);
assert!(s.execute("conceptVector.results", &json!({"job": 1})).is_err(), "no job kept");
}
// Cancel: the run stops when its steps say so.
let (mut s, _) = doc_with(&art());
with_fake(&mut s, fake(stops));
let run = ConceptRun::prepare(&s, &json!({"provider": "test.fake", "styles": ["s0"]})).unwrap();
assert_eq!(run.run(&|_, _| false), Err(ProviderError::Canceled));
assert!(run.run(&|_, _| true).is_ok());
// The built-in provider stops too, before and between its styles.
let run = ConceptRun::prepare(&s, &json!({"provider": ID, "styles": all_styles()})).unwrap();
let calls = AtomicUsize::new(0);
let stop_later = |_: u64, _: u64| calls.fetch_add(1, Ordering::Relaxed) < 3;
assert_eq!(run.run(&stop_later), Err(ProviderError::Canceled));
}
/// A part at a time (the web build's way): the built-in provider decodes the image in one part,
/// finds a style's colour layers in another and traces one layer a part, and makes the variations
/// one call makes; Cancel takes effect before the next part, inside a style.
#[test]
fn the_built_in_styles_are_made_a_part_at_a_time() {
let (s, _) = doc_with(&art());
let run = ConceptRun::prepare(&s, &json!({"provider": ID, "styles": ["flatColor", "outline"]})).unwrap();
let mut parts = PartRun::default();
let mut calls = 0;
let mut first_style_parts = 0;
while !run.run_part(&mut parts, &|_, _| true).unwrap() {
calls += 1;
assert!(calls < 1000, "the parts never end");
if parts.styles_done() == 0 {
first_style_parts = calls;
}
}
// The decode, the layers found, and the four colours' layers each a part.
assert!(first_style_parts >= 5, "{first_style_parts} parts before the first style was made");
assert_eq!(parts.made(), run.run(&|_, _| true).unwrap());
// Stopped after the layers are found, inside the first style.
let mut parts = PartRun::default();
for _ in 0..3 {
assert_eq!(run.run_part(&mut parts, &|_, _| true), Ok(false));
}
assert_eq!(parts.styles_done(), 0);
assert_eq!(run.run_part(&mut parts, &|_, _| false), Err(ProviderError::Canceled));
}
/// One style at a time, for a provider that makes no smaller parts: the same variations as one
/// call, each call adding one; results that don't match their style, or totals past a limit, stop
/// it.
#[test]
fn styles_made_one_at_a_time_match_one_call_and_are_checked_as_they_come() {
fn many_anchors(r: &Request, _: Steps) -> Result<Vec<Variation>, ProviderError> {
let pts: Vec<Point> = (0..600_000).map(|i| Point::new(f64::from(i % 100), f64::from(i / 100 % 80))).collect();
let path = PathData::single(SubPath::polyline(&pts, true));
Ok(r.styles
.iter()
.map(|st| Variation {
style: st.clone(),
paths: vec![VectorPath { path: path.clone(), fill: Some([0; 3]), stroke: None }],
warnings: vec![],
})
.collect())
}
fn renamed(r: &Request, steps: Steps) -> Result<Vec<Variation>, ProviderError> {
let mut v = squares(r, steps)?;
if r.styles == ["s1"] {
v[0].style = "s0".into();
}
Ok(v)
}
let (mut s, _) = doc_with(&art());
with_fake(&mut s, fake(squares));
let run = ConceptRun::prepare(&s, &json!({"provider": "test.fake", "styles": ["s2", "s0", "s1"]})).unwrap();
assert_eq!(run.style_count(), 3);
let mut made = PartRun::default();
for k in 1..=3 {
assert_eq!(run.run_part(&mut made, &|_, _| true), Ok(k == 3));
assert_eq!(made.styles_done(), k);
}
assert_eq!(run.run_part(&mut made, &|_, _| true), Ok(true), "nothing is left to make");
assert_eq!(made.made(), run.run(&|_, _| true).unwrap());
let (mut s, _) = doc_with(&art());
with_fake(&mut s, fake(renamed));
let run = ConceptRun::prepare(&s, &json!({"provider": "test.fake", "styles": ["s0", "s1"]})).unwrap();
let mut made = PartRun::default();
assert_eq!(run.run_part(&mut made, &|_, _| true), Ok(false));
assert_eq!(run.run_part(&mut made, &|_, _| true), Err(ProviderError::InvalidResult));
// Each style is under the anchor limit alone; the second passes it with the first.
let (mut s, _) = doc_with(&art());
with_fake(&mut s, fake(many_anchors));
let run = ConceptRun::prepare(&s, &json!({"provider": "test.fake", "styles": ["s0", "s1"]})).unwrap();
let mut made = PartRun::default();
assert_eq!(run.run_part(&mut made, &|_, _| true), Ok(false));
assert_eq!(run.run_part(&mut made, &|_, _| true), Err(ProviderError::ResourceLimit(MAX_ANCHORS)));
}
#[test]
fn the_built_in_styles_differ_and_repeat_exactly() {
let raster = art();
let png = Arc::new(raster.encode_png());
let req = |styles: Vec<&str>, detail: u8| Request {
image: Arc::clone(&png),
width: raster.width,
height: raster.height,
prompt: None,
styles: styles.into_iter().map(String::from).collect(),
detail,
output: Output::Vector,
};
let p = offline::TraceStyles;
let made = p.generate(&req(all_styles(), 50), &|_, _| true).unwrap();
check_result(&req(all_styles(), 50), &made).unwrap();
assert_eq!(made, p.generate(&req(all_styles(), 50), &|_, _| true).unwrap(), "the same request makes the same paths");
for v in &made {
assert!(!v.paths.is_empty(), "{} made nothing", v.style);
}
let by = |id: &str| made.iter().find(|v| v.style == id).unwrap();
// Outline: stroked lines only; Ink Lines: black fills only.
assert!(by("outline").paths.iter().all(|p| p.fill.is_none() && p.stroke.is_some()));
assert!(by("inkLines").paths.iter().all(|p| p.stroke.is_none() && p.fill == Some([0, 0, 0])));
// Flat and Detailed Color keep the art's hues; Gray Tones only grays.
let colors = |id: &str| by(id).paths.iter().filter_map(|p| p.fill).collect::<std::collections::BTreeSet<_>>();
assert!(colors("flatColor").iter().any(|c| c[0] > 150 && c[1] < 100), "red kept: {:?}", colors("flatColor"));
assert!(colors("detailedColor").len() >= colors("flatColor").len());
assert!(colors("grayTones").iter().all(|c| c[0] == c[1] && c[1] == c[2]), "{:?}", colors("grayTones"));
// The paths differ from style to style.
for (i, a) in made.iter().enumerate() {
for b in made.iter().skip(i + 1) {
assert_ne!(a.paths, b.paths, "{} and {}", a.style, b.style);
}
}
// The paths are in the image's pixel space.
for v in &made {
for path in &v.paths {
let b = path.path.bounds().unwrap();
assert!(b.x0 >= -1.0 && b.y0 >= -1.0 && b.x1 <= 121.0 && b.y1 <= 91.0, "{}: {b:?}", v.style);
}
}
}
#[test]
fn detail_moves_each_style_within_its_range() {
for style in all_styles() {
let (lo, hi) = (offline::style_params(style, 0).unwrap(), offline::style_params(style, 100).unwrap());
assert!(lo.paths < hi.paths && lo.noise > hi.noise, "{style}");
assert!(lo.colors <= hi.colors, "{style}");
assert_eq!(offline::style_params(style, 255), offline::style_params(style, 100), "{style}: clamped");
}
assert!(offline::style_params("nope", 50).is_none());
// A photo-like gradient keeps more anchors at Detail 100 than at Detail 0.
let raster = Raster::from_fn(96, 96, |x, y| [(x * 2) as u8, (y * 2) as u8, ((x + y) % 256) as u8, 255]);
let png = Arc::new(raster.encode_png());
let anchors = |detail: u8| {
let r = Request {
image: Arc::clone(&png),
width: 96,
height: 96,
prompt: None,
styles: vec!["detailedColor".into()],
detail,
output: Output::Vector,
};
offline::TraceStyles.generate(&r, &|_, _| true).unwrap()[0].anchors()
};
assert!(anchors(100) > anchors(0), "{} vs {}", anchors(100), anchors(0));
}
#[test]
fn generate_and_results_change_nothing_in_the_document() {
let (mut s, _) = doc_with(&art());
let (before, depth) = (s.doc().unwrap().doc.clone(), undo_len(&s));
let r = generate(&mut s, json!({"provider": ID, "styles": ["outline", "flatColor"]})).unwrap();
let job = r["job"].as_u64().unwrap();
assert_eq!(r["state"], "done");
assert_eq!(s.execute("conceptVector.results", &json!({"job": job})).unwrap(), r);
assert!(s.doc().unwrap().doc == before && undo_len(&s) == depth);
assert_eq!(s.concept_variations(job).unwrap().1, (120, 90));
}
/// The bounds of object `id` in the document.
fn bounds(s: &Session, id: u64) -> vectorcraft_geom::Rect {
let d = &s.doc().unwrap().doc;
vectorcraft_render::painted_bounds(d, d.node(NodeId(id)).unwrap()).unwrap()
}
#[test]
fn insert_puts_the_chosen_styles_right_of_the_image_as_one_undo_step() {
let (mut s, img) = doc_with(&art());
let job = generate(&mut s, json!({"provider": ID, "styles": all_styles()})).unwrap()["job"].as_u64().unwrap();
let (before, depth) = (s.doc().unwrap().doc.clone(), undo_len(&s));
// Chosen in another order: inserted in the provider's.
let r = s.execute("conceptVector.insert", &json!({"job": job, "variations": ["grayTones", "outline"]})).unwrap();
let ids: Vec<u64> = r["ids"].as_array().unwrap().iter().map(|v| v.as_u64().unwrap()).collect();
assert_eq!(ids.len(), 2);
assert_eq!(undo_len(&s), depth + 1);
let d = &s.doc().unwrap().doc;
let names: Vec<_> = ids.iter().map(|i| d.node(NodeId(*i)).unwrap().name.clone().unwrap()).collect();
assert_eq!(names, ["Outline", "Gray Tones"]);
assert!(d.node(img).is_some(), "the image stays");
assert_eq!(s.doc().unwrap().selection.objects, ids.iter().map(|i| NodeId(*i)).collect::<Vec<_>>());
// In a row to the right: the image is 240 × 180 pt from (100, 100).
let (a, b) = (bounds(&s, ids[0]), bounds(&s, ids[1]));
assert!(a.x0 >= 340.0 + GAP - 2.0 && a.x1 <= 364.0 + 240.0 + 2.0, "{a:?}");
assert!(b.x0 >= 364.0 + 240.0 + GAP - 2.0, "{b:?}");
assert!(a.y0 >= 98.0 && a.y1 <= 282.0, "{a:?}");
let after = s.doc().unwrap().doc.clone();
s.execute("edit.undo", &json!({})).unwrap();
assert!(s.doc().unwrap().doc == before, "undo restores the document");
s.execute("edit.redo", &json!({})).unwrap();
assert!(s.doc().unwrap().doc == after, "redo restores the same groups");
}
#[test]
fn insert_moves_the_row_past_art_in_its_way() {
let (mut s, img) = doc_with(&art());
let block = s.execute("shape.rectangle", &json!({"x": 380, "y": 150, "width": 300, "height": 40})).unwrap()["id"].as_u64().unwrap();
let job = generate(&mut s, json!({"provider": ID, "styles": ["flatColor"], "id": img.0})).unwrap()["job"].as_u64().unwrap();
let r = s.execute("conceptVector.insert", &json!({"job": job, "variations": ["flatColor"]})).unwrap();
let placed = bounds(&s, r["ids"][0].as_u64().unwrap());
assert!(placed.x0 >= bounds(&s, block).x1 + GAP - 2.0, "{placed:?}");
}
/// A variation's paths reaching past the image's box keep clear of art there too.
#[test]
fn insert_moves_the_row_past_art_that_a_variation_reaches_beyond_the_image_box() {
/// A bar from the image's left edge to 1.5 image widths, over its top half.
fn wide(r: &Request, _: Steps) -> Result<Vec<Variation>, ProviderError> {
let (w, h) = (f64::from(r.width) * 1.5, f64::from(r.height) / 2.0);
let bar = PathData::single(SubPath::polyline(&[Point::new(0.0, 0.0), Point::new(w, 0.0), Point::new(w, h), Point::new(0.0, h)], true));
Ok(r.styles
.iter()
.map(|st| Variation {
style: st.clone(),
paths: vec![VectorPath { path: bar.clone(), fill: Some([9, 9, 9]), stroke: None }],
warnings: vec![],
})
.collect())
}
let (mut s, img) = doc_with(&art());
with_fake(&mut s, fake(wide));
// The image is 240 pt wide from x 100, so the row starts at 364 with boxes 240 pt wide, and
// the bar reaches 360 pt from there; this block is past the box but under the bar.
let block = s.execute("shape.rectangle", &json!({"x": 640, "y": 110, "width": 30, "height": 30})).unwrap()["id"].as_u64().unwrap();
let job = generate(&mut s, json!({"provider": "test.fake", "styles": ["s0"], "id": img.0})).unwrap()["job"].as_u64().unwrap();
let r = s.execute("conceptVector.insert", &json!({"job": job, "variations": ["s0"]})).unwrap();
let placed = bounds(&s, r["ids"][0].as_u64().unwrap());
assert!(placed.x0 >= bounds(&s, block).x1 + GAP - 2.0, "{placed:?}");
// Two such variations: the second starts GAP past what the first paints.
let job = generate(&mut s, json!({"provider": "test.fake", "styles": ["s0", "s1"], "id": img.0})).unwrap()["job"].as_u64().unwrap();
let r = s.execute("conceptVector.insert", &json!({"job": job, "variations": ["s0", "s1"]})).unwrap();
let (a, b) = (bounds(&s, r["ids"][0].as_u64().unwrap()), bounds(&s, r["ids"][1].as_u64().unwrap()));
assert!(b.x0 >= a.x1 + GAP - 0.5, "{a:?} {b:?}");
}
/// A variation that paints left of the image's box still starts GAP past the image.
#[test]
fn insert_keeps_the_gap_when_a_variation_reaches_left_of_the_image_box() {
/// A bar from 10 pixels left of the image to its right edge, over its top half.
fn left(r: &Request, _: Steps) -> Result<Vec<Variation>, ProviderError> {
let (w, h) = (f64::from(r.width), f64::from(r.height) / 2.0);
let bar = PathData::single(SubPath::polyline(&[Point::new(-10.0, 0.0), Point::new(w, 0.0), Point::new(w, h), Point::new(-10.0, h)], true));
Ok(r.styles
.iter()
.map(|st| Variation {
style: st.clone(),
paths: vec![VectorPath { path: bar.clone(), fill: Some([9, 9, 9]), stroke: None }],
warnings: vec![],
})
.collect())
}
let (mut s, img) = doc_with(&art());
with_fake(&mut s, fake(left));
let job = generate(&mut s, json!({"provider": "test.fake", "styles": ["s0", "s1"], "id": img.0})).unwrap()["job"].as_u64().unwrap();
let r = s.execute("conceptVector.insert", &json!({"job": job, "variations": ["s0", "s1"]})).unwrap();
let (a, b) = (bounds(&s, r["ids"][0].as_u64().unwrap()), bounds(&s, r["ids"][1].as_u64().unwrap()));
let image = bounds(&s, img.0);
assert!((a.x0 - (image.x1 + GAP)).abs() < 0.5, "{a:?} after {image:?}");
assert!((b.x0 - (a.x1 + GAP)).abs() < 0.5, "{a:?} {b:?}");
}
/// The results go above the outermost clip group around the image, where it does not hide them,
/// and a layer that clips its art refuses them.
#[test]
fn insert_puts_the_results_outside_a_clip_group_around_the_image() {
let (mut s, img) = doc_with(&art());
// A clipping path over the image alone, in a group that clips it.
let mask = s.execute("shape.rectangle", &json!({"x": 100, "y": 100, "width": 240, "height": 180})).unwrap()["id"].as_u64().unwrap();
s.execute("select.set", &json!({"ids": [img.0, mask]})).unwrap();
s.execute("object.clippingMask.make", &json!({})).unwrap();
let d = &s.doc().unwrap().doc;
let clip = d.parent_of(img).unwrap();
assert!(matches!(d.node(clip).unwrap().kind, NodeKind::Group { clip: true, .. }));
let layer = d.parent_of(clip).unwrap();
let job = generate(&mut s, json!({"provider": ID, "styles": ["outline"], "id": img.0})).unwrap()["job"].as_u64().unwrap();
let r = s.execute("conceptVector.insert", &json!({"job": job, "variations": ["outline"]})).unwrap();
let group = NodeId(r["ids"][0].as_u64().unwrap());
let d = &s.doc().unwrap().doc;
assert_eq!(d.parent_of(group), Some(layer), "beside the clip group, not in it");
assert_eq!(d.parent_of(img), Some(clip), "the image stays in it");
// A clipping layer.
let (mut s, img) = doc_with(&art());
let job = generate(&mut s, json!({"provider": ID, "styles": ["outline"], "id": img.0})).unwrap()["job"].as_u64().unwrap();
s.execute("shape.rectangle", &json!({"x": 100, "y": 100, "width": 240, "height": 180})).unwrap();
let layer = s.doc().unwrap().doc.parent_of(img).unwrap();
s.execute("layer.clippingMask.toggle", &json!({"id": layer.0})).unwrap();
let (before, depth) = (s.doc().unwrap().doc.clone(), undo_len(&s));
let e = s.execute("conceptVector.insert", &json!({"job": job, "variations": ["outline"]})).unwrap_err().to_string();
assert!(e.contains("clipping mask"), "{e}");
assert!(s.doc().unwrap().doc == before && undo_len(&s) == depth);
}
/// The results go above a group around the image whose opacity mask is on, and into it when
/// the mask is off; a layer whose opacity mask is on is refused.
#[test]
fn insert_puts_the_results_outside_an_opacity_masked_group_around_the_image() {
let (mut s, img) = doc_with(&art());
let other = s.execute("shape.rectangle", &json!({"x": 120, "y": 120, "width": 40, "height": 40})).unwrap()["id"].as_u64().unwrap();
let mask = s.execute("shape.rectangle", &json!({"x": 100, "y": 100, "width": 120, "height": 90})).unwrap()["id"].as_u64().unwrap();
s.execute("select.set", &json!({"ids": [img.0, other, mask]})).unwrap();
let masked = NodeId(s.execute("transparency.makeOpacityMask", &json!({"clip": true})).unwrap()["id"].as_u64().unwrap());
let d = &s.doc().unwrap().doc;
assert_eq!(d.parent_of(img), Some(masked));
assert!(d.node(masked).unwrap().extras().mask.as_ref().is_some_and(|m| !m.disabled));
let layer = d.parent_of(masked).unwrap();
let job = generate(&mut s, json!({"provider": ID, "styles": ["outline"], "id": img.0})).unwrap()["job"].as_u64().unwrap();
let r = s.execute("conceptVector.insert", &json!({"job": job, "variations": ["outline"]})).unwrap();
let group = NodeId(r["ids"][0].as_u64().unwrap());
let d = &s.doc().unwrap().doc;
assert_eq!(d.parent_of(group), Some(layer), "beside the masked group, not in it");
assert_eq!(d.parent_of(img), Some(masked), "the image stays in it");
// With the mask off, the group hides nothing, so the results go beside the image.
s.execute("transparency.disableOpacityMask", &json!({"id": masked.0})).unwrap();
let job = generate(&mut s, json!({"provider": ID, "styles": ["outline"], "id": img.0})).unwrap()["job"].as_u64().unwrap();
let r = s.execute("conceptVector.insert", &json!({"job": job, "variations": ["outline"]})).unwrap();
let group = NodeId(r["ids"][0].as_u64().unwrap());
assert_eq!(s.doc().unwrap().doc.parent_of(group), Some(masked));
// A layer whose opacity mask is on is refused, and one whose mask is off is not.
let (mut s, img) = doc_with(&art());
let layer = s.doc().unwrap().doc.parent_of(img).unwrap();
let art = s.doc().unwrap().doc.node(img).unwrap().clone();
let mask_layer = |s: &mut Session, disabled: bool| {
let m = OpacityMask { disabled, ..OpacityMask::new(art.clone(), true) };
s.edit("mask", |d, _| {
d.node_mut(layer).ok_or(crate::EngineError::NoNode(layer))?.extras_mut().mask = Some(Box::new(m));
Ok(())
})
.unwrap();
};
mask_layer(&mut s, false);
let job = generate(&mut s, json!({"provider": ID, "styles": ["outline"], "id": img.0})).unwrap()["job"].as_u64().unwrap();
let (before, depth) = (s.doc().unwrap().doc.clone(), undo_len(&s));
let e = s.execute("conceptVector.insert", &json!({"job": job, "variations": ["outline"]})).unwrap_err().to_string();
assert!(e.contains("opacity mask"), "{e}");
assert!(s.doc().unwrap().doc == before && undo_len(&s) == depth);
mask_layer(&mut s, true);
let job = generate(&mut s, json!({"provider": ID, "styles": ["outline"], "id": img.0})).unwrap()["job"].as_u64().unwrap();
let r = s.execute("conceptVector.insert", &json!({"job": job, "variations": ["outline"]})).unwrap();
assert_eq!(s.doc().unwrap().doc.parent_of(NodeId(r["ids"][0].as_u64().unwrap())), Some(layer));
}
/// A run whose document closed before it finished keeps no job.
#[test]
fn a_run_finished_after_its_document_closed_keeps_nothing() {
let (mut s, _) = doc_with(&art());
let run = ConceptRun::prepare(&s, &json!({"provider": ID, "styles": ["outline"]})).unwrap();
let made = run.run(&|_, _| true).unwrap();
s.execute("file.new", &json!({"width": 100, "height": 100})).unwrap();
s.execute("file.close", &json!({"index": 0})).unwrap();
assert!(run.finish(&mut s, made).is_none());
assert!(s.execute("conceptVector.results", &json!({"job": 1})).is_err(), "no job kept");
}
#[test]
fn insert_refuses_a_stale_canceled_or_unknown_job_and_changes_nothing() {
let (mut s, img) = doc_with(&art());
let job = |s: &mut Session| generate(s, json!({"provider": ID, "styles": ["inkLines"], "id": img.0})).unwrap()["job"].as_u64().unwrap();
let insert = |s: &mut Session, job: u64, v: Value| s.execute("conceptVector.insert", &json!({"job": job, "variations": v}));
let unchanged = |s: &mut Session, job: u64, v: Value, expect: &str| {
let (before, depth) = (s.doc().unwrap().doc.clone(), undo_len(s));
let e = insert(s, job, v).unwrap_err().to_string();
assert!(e.contains(expect), "{e}");
assert!(s.doc().unwrap().doc == before && undo_len(s) == depth);
};
let j = job(&mut s);
for v in [json!([]), json!(["inkLines", "inkLines"]), json!(["outline"]), json!("inkLines")] {
unchanged(&mut s, j, v, "`variations` must list different style ids");
}
unchanged(&mut s, 999, json!(["inkLines"]), "no Concept to Vector job 999");
// A selection change alone leaves it current.
s.execute("select.none", &json!({})).unwrap();
assert!(insert(&mut s, j, json!(["inkLines"])).is_ok());
s.execute("edit.undo", &json!({})).unwrap();
// Other pixels under the same key.
let other = Raster::from_fn(120, 90, |_, _| [10, 10, 10, 255]).encode_png();
s.edit("pixels", |d, _| {
d.images.insert("img1".into(), ImageBlob::new("image/png", other));
Ok(())
})
.unwrap();
unchanged(&mut s, j, json!(["inkLines"]), "no longer applies");
s.execute("edit.undo", &json!({})).unwrap();
// The image moved.
s.execute("object.transform", &json!({"ids": [img.0], "matrix": [1, 0, 0, 1, 5, 0]})).unwrap();
unchanged(&mut s, j, json!(["inkLines"]), "no longer applies");
s.execute("edit.undo", &json!({})).unwrap();
// The image removed.
s.execute("edit.clear", &json!({"ids": [img.0]})).unwrap();
unchanged(&mut s, j, json!(["inkLines"]), "no longer applies");
s.execute("edit.undo", &json!({})).unwrap();
// Another document active.
s.execute("file.new", &json!({})).unwrap();
unchanged(&mut s, j, json!(["inkLines"]), "no longer applies");
s.set_active(0);
assert!(insert(&mut s, j, json!(["inkLines"])).is_ok(), "current again");
s.execute("edit.undo", &json!({})).unwrap();
// Canceled: twice is the same.
for _ in 0..2 {
assert_eq!(s.execute("conceptVector.cancel", &json!({"job": j})).unwrap()["state"], "canceled");
}
assert_eq!(s.execute("conceptVector.results", &json!({"job": j})).unwrap()["state"], "canceled");
unchanged(&mut s, j, json!(["inkLines"]), "it was canceled");
// A closed document's jobs are dropped.
let j = job(&mut s);
s.close_document(0);
assert!(s.execute("conceptVector.results", &json!({"job": j})).is_err());
}
#[test]
fn the_session_keeps_the_newest_jobs() {
let (mut s, _) = doc_with(&art());
with_fake(&mut s, fake(squares));
let jobs: Vec<u64> =
(0..KEEP_JOBS + 1).map(|_| generate(&mut s, json!({"provider": "test.fake", "styles": ["s0"]})).unwrap()["job"].as_u64().unwrap()).collect();
assert!(s.execute("conceptVector.results", &json!({"job": jobs[0]})).is_err());
for j in &jobs[1..] {
assert!(s.execute("conceptVector.results", &json!({"job": j})).is_ok());
}
}
+4
View File
@@ -7,6 +7,7 @@
#![forbid(unsafe_code)]
pub mod cmd;
pub mod concept_vector;
pub mod file_access;
pub mod guard;
pub mod inspect;
@@ -247,6 +248,9 @@ pub struct Session {
/// What a [`cmd::TraceRun`] traced, until the next `imageTrace.make` or
/// `imageTrace.makeAndExpand` takes it ([`cmd::Traced::hand_in`]).
pub(crate) trace_hand_off: Option<cmd::Traced>,
/// The Concept to Vector providers and the jobs made with them ([`cmd::conceptvector`]); not
/// saved.
pub(crate) concept: cmd::conceptvector::ConceptState,
/// Whether a click or drag of the place cursor asks the frontend to place its file
/// ([`UiRequest::Place`]) instead of running `file.place`: the desktop app sets it to read the
/// file off the UI thread. False: the file is placed at once.
+1
View File
@@ -111,6 +111,7 @@ impl Session {
place_queue_roots: None,
image_hand_off: None,
trace_hand_off: None,
concept: Default::default(),
place_cursor_requests: false,
package_hand_off: None,
screens_hand_off: None,
+1 -1
View File
@@ -79,7 +79,7 @@ use layers::parallel_map_at_most;
#[cfg(test)]
pub(crate) use layers::shift_probe;
pub use params::{Method, Mode, PRESET_NAMES, Palette, TraceParams, enhanced_preset, preset, presets};
pub use pipeline::{TraceResult, TracedPath, trace, trace_watched, trace_within};
pub use pipeline::{TraceResult, TraceSteps, TracedPath, trace, trace_watched, trace_within};
#[cfg(test)]
use pipeline::{clear_background, label_extents};
#[cfg(test)]
+223 -61
View File
@@ -1,3 +1,4 @@
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
use super::layers::{Layers, parallel_map_at_most};
@@ -175,21 +176,220 @@ pub fn trace_watched(
max_anchors: usize,
steps: &(dyn Fn(u64, u64) -> bool + Sync),
) -> Result<TraceResult, TraceError> {
let (w, h) = (img.width as usize, img.height as usize);
if w == 0 || h == 0 || w.checked_mul(h).and_then(|n| n.checked_mul(4)) != Some(img.rgba.len()) {
if !traceable(img) {
return Ok(TraceResult::default());
}
let mut out = trace_paths(img, params, max_anchors, steps)?;
let out = trace_paths(img, params, max_anchors, steps)?;
Ok(grouped(out, img, params))
}
/// Whether `img` has pixels, as many as its size says.
fn traceable(img: &Raster) -> bool {
let (w, h) = (img.width as usize, img.height as usize);
w > 0 && h > 0 && w.checked_mul(h).and_then(|n| n.checked_mul(4)) == Some(img.rgba.len())
}
/// `out` with Auto Grouping's parents (see [`TraceResult::parents`]) when `params` asks for them.
fn grouped(mut out: TraceResult, img: &Raster, params: &TraceParams) -> TraceResult {
if params.auto_grouping {
// Abutting areas cannot overlap; stacked layers, Logo's shapes and stroked lines can.
let stacked = params.method == Method::Overlapping || params.mode == Mode::Logo || params.strokes;
out.parents = group::parents(&out.paths, img.width as usize, img.height as usize, stacked);
}
Ok(out)
out
}
fn trace_paths(img: &Raster, params: &TraceParams, max_anchors: usize, steps: &(dyn Fn(u64, u64) -> bool + Sync)) -> Result<TraceResult, TraceError> {
let (w, h) = (img.width as usize, img.height as usize);
/// How far a trace has got: see [`trace_watched`].
type Steps<'s> = &'s (dyn Fn(u64, u64) -> bool + Sync);
fn trace_paths(img: &Raster, params: &TraceParams, max_anchors: usize, steps: Steps) -> Result<TraceResult, TraceError> {
let p = match prepare(Source::Borrowed(img), params, max_anchors, steps)? {
Begun::Done(out) => return Ok(out),
Begun::Layers(p) => p,
};
let traced = {
let job = p.job(0);
// A layer takes about ten bytes a pixel of its box while it is traced (its mask, the labels
// of its components, the stack that fills them, its edges): as many layers at a time as fit
// in half a gigabyte, so that a large image is not traced at the cost of gigabytes.
// (Overlapping labels a layer's mask once more before it is traced, with its labels and stack
// freed before the trace starts.)
let largest = job.boxes.iter().flatten().map(|b| (b.2 - b.0) * (b.3 - b.1)).max().unwrap_or(1).max(1);
let at_a_time = ((512 << 20) / (largest * 10)).max(1);
let total = p.layers.len() as u64;
if !steps(0, total) {
return Err(TraceError::Cancelled);
}
// Once stopped, the layers not started yet are skipped.
let (done, stopped) = (AtomicU64::new(0), AtomicBool::new(false));
let traced = parallel_map_at_most(at_a_time, &p.layers, |&(r, ci)| {
if stopped.load(Ordering::Relaxed) {
return None;
}
let paths = job.layer(r, ci);
if !steps(done.fetch_add(1, Ordering::Relaxed) + 1, total) {
stopped.store(true, Ordering::Relaxed);
}
paths
});
if stopped.load(Ordering::Relaxed) {
return Err(TraceError::Cancelled);
}
traced
};
(*p).finish(traced)
}
/// The image a trace works from: borrowed for the length of one call, or shared, for a trace
/// made a part at a time ([`TraceSteps`]).
enum Source<'a> {
Borrowed(&'a Raster),
Shared(Arc<Raster>),
}
impl std::ops::Deref for Source<'_> {
type Target = Raster;
fn deref(&self) -> &Raster {
match self {
Source::Borrowed(img) => img,
Source::Shared(img) => img,
}
}
}
/// A trace with its colour layers found and ordered, none of them traced yet.
struct Prepared<'a> {
src: Source<'a>,
/// A photo's copy with its noise smoothed away, traced in its place (see `smooth`).
smoothed: Option<Raster>,
params: TraceParams,
q: Quantized,
/// Ignore Color, background only: `q.labels` with the background [`TRANSPARENT`].
cleared: Option<Vec<u16>>,
rank: Vec<usize>,
left_out: Vec<bool>,
boxes: Vec<Option<PixelBox>>,
gradients: Vec<Option<TracedGradient>>,
bw_tones: [f64; 2],
/// The layers to trace, bottom first: `(rank, palette entry)`.
layers: Vec<(usize, usize)>,
keep_unmatched: Vec<String>,
keep_ignored: bool,
max_anchors: usize,
}
/// What preparing a trace gives: the whole result (Logo mode), or its layers to trace.
enum Begun<'a> {
Done(TraceResult),
Layers(Box<Prepared<'a>>),
}
impl Prepared<'_> {
/// What tracing one of the layers needs, with `anchors` anchor points made so far.
fn job(&self, anchors: usize) -> Layers<'_> {
Layers {
q: &self.q,
traced: self.cleared.as_deref().unwrap_or(&self.q.labels),
rank: &self.rank,
params: &self.params,
img: self.smoothed.as_ref().unwrap_or(&*self.src),
left_out: self.left_out.clone(),
boxes: self.boxes.clone(),
gradients: &self.gradients,
bw_tones: self.bw_tones,
style: self.params.outline_style(),
w: self.src.width as usize,
h: self.src.height as usize,
anchors: AtomicUsize::new(anchors),
max_anchors: self.max_anchors,
}
}
/// The result of `traced`, the paths of each of [`Prepared::layers`] in order (`None` for a
/// layer that passed the anchor maximum).
fn finish(self, traced: Vec<Option<Vec<TracedPath>>>) -> Result<TraceResult, TraceError> {
let mut out = TraceResult { keep_unmatched: self.keep_unmatched, keep_ignored: self.keep_ignored, ..TraceResult::default() };
for (paths, &(_, ci)) in traced.into_iter().zip(&self.layers) {
let paths = paths.ok_or(TraceError::TooComplex { max: self.max_anchors })?;
// A layer with no paths adds no color to the palette.
if paths.is_empty() {
continue;
}
out.paths.extend(paths);
let color = self.q.palette[ci];
if !out.palette.contains(&color) {
out.palette.push(color);
}
}
Ok(out)
}
}
/// A trace made a part at a time, for a caller with no thread to trace on that must let other
/// work run between the parts (the web build). The first [`TraceSteps::step`] finds the colour
/// layers and each later one traces one layer, bottom first, one at a time; the result is the
/// one [`trace_within`] gives.
pub struct TraceSteps {
img: Arc<Raster>,
params: TraceParams,
max_anchors: usize,
state: StepState,
}
enum StepState {
Start,
/// The layers found, the paths of those traced so far, and their anchor points.
Layers(Box<Prepared<'static>>, Vec<Option<Vec<TracedPath>>>, usize),
Finished,
}
impl TraceSteps {
/// A trace of `img` with `params` that gives up with [`TraceError::TooComplex`] once the paths
/// have more than `max_anchors` anchor points; nothing is done until [`TraceSteps::step`].
pub fn new(img: Arc<Raster>, params: TraceParams, max_anchors: usize) -> Self {
Self { img, params, max_anchors, state: StepState::Start }
}
/// Does the next part → the result once the last part is done, `None` before it. After the
/// result or an error, each call gives `None`.
pub fn step(&mut self) -> Result<Option<TraceResult>, TraceError> {
let (prepared, mut traced, anchors) = match std::mem::replace(&mut self.state, StepState::Finished) {
StepState::Finished => return Ok(None),
StepState::Start => {
if !traceable(&self.img) {
return Ok(Some(TraceResult::default()));
}
match prepare(Source::Shared(Arc::clone(&self.img)), &self.params, self.max_anchors, &|_, _| true)? {
Begun::Done(out) => return Ok(Some(grouped(out, &self.img, &self.params))),
Begun::Layers(p) if p.layers.is_empty() => return (*p).finish(vec![]).map(|out| Some(grouped(out, &self.img, &self.params))),
Begun::Layers(p) => {
let traced = Vec::with_capacity(p.layers.len());
self.state = StepState::Layers(p, traced, 0);
return Ok(None);
}
}
}
StepState::Layers(p, traced, anchors) => (p, traced, anchors),
};
let Some(&(r, ci)) = prepared.layers.get(traced.len()) else { return Ok(None) };
let (paths, anchors) = {
let job = prepared.job(anchors);
let paths = job.layer(r, ci);
(paths, job.anchors.load(Ordering::Relaxed))
};
traced.push(Some(paths.ok_or(TraceError::TooComplex { max: self.max_anchors })?));
if traced.len() < prepared.layers.len() {
self.state = StepState::Layers(prepared, traced, anchors);
return Ok(None);
}
(*prepared).finish(traced).map(|out| Some(grouped(out, &self.img, &self.params)))
}
}
/// Finds the colour layers of `src` traced with `params` and the order they stack in, telling
/// `steps(0, 0)` after each stage; Logo mode traces the whole image at once.
fn prepare<'a>(src: Source<'a>, params: &TraceParams, max_anchors: usize, steps: Steps) -> Result<Begun<'a>, TraceError> {
let (w, h) = (src.width as usize, src.height as usize);
// The colors Keep Colors traces (checked in every mode).
let listed = params
.keep_colors
@@ -200,7 +400,7 @@ fn trace_paths(img: &Raster, params: &TraceParams, max_anchors: usize, steps: &(
let go_on = || if steps(0, 0) { Ok(()) } else { Err(TraceError::Cancelled) };
if params.mode == Mode::Logo {
go_on()?;
return logo::trace_logo(img, params, max_anchors);
return logo::trace_logo(&src, params, max_anchors).map(Begun::Done);
}
// The colour Ignore Color leaves out, if not white.
let ignore = match &params.ignore_color {
@@ -208,8 +408,8 @@ fn trace_paths(img: &Raster, params: &TraceParams, max_anchors: usize, steps: &(
_ => None,
};
// A photo is traced from a copy with its noise smoothed away (see `smooth`).
let smoothed = (params.mode != Mode::BlackAndWhite && quantize::continuous_tone(img)).then(|| smooth::smoothed(img));
let img = smoothed.as_ref().unwrap_or(img);
let smoothed = (params.mode != Mode::BlackAndWhite && quantize::continuous_tone(&src)).then(|| smooth::smoothed(&src));
let img = smoothed.as_ref().unwrap_or(&*src);
go_on()?;
// Gradients are found first and kept out of the palette: no colour is spent on bands of them.
// Grayscale finds them in the image's grays (as its flat colours are), so their stops are gray.
@@ -316,62 +516,24 @@ fn trace_paths(img: &Raster, params: &TraceParams, max_anchors: usize, steps: &(
.collect();
// Every layer is left out although a listed color matches one: Ignore Color left those out.
let keep_ignored = !listed.is_empty() && layers.is_empty() && order.iter().any(|&ci| is_kept(q.palette[ci], &listed));
let job = Layers {
q: &q,
traced: cleared.as_deref().unwrap_or(&q.labels),
rank: &rank,
let tones = bw_tones(img, &q);
let params = params.clone();
Ok(Begun::Layers(Box::new(Prepared {
src,
smoothed,
params,
img,
q,
cleared,
rank,
left_out,
boxes,
gradients: &gradients,
bw_tones: bw_tones(img, &q),
style: params.outline_style(),
w,
h,
anchors: AtomicUsize::new(0),
gradients,
bw_tones: tones,
layers,
keep_unmatched,
keep_ignored,
max_anchors,
};
let mut out = TraceResult { keep_unmatched, keep_ignored, ..TraceResult::default() };
// A layer takes about ten bytes a pixel of its box while it is traced (its mask, the labels
// of its components, the stack that fills them, its edges): as many layers at a time as fit
// in half a gigabyte, so that a large image is not traced at the cost of gigabytes.
// (Overlapping labels a layer's mask once more before it is traced, with its labels and stack
// freed before the trace starts.)
let largest = job.boxes.iter().flatten().map(|b| (b.2 - b.0) * (b.3 - b.1)).max().unwrap_or(1).max(1);
let at_a_time = ((512 << 20) / (largest * 10)).max(1);
let total = layers.len() as u64;
if !steps(0, total) {
return Err(TraceError::Cancelled);
}
// Once stopped, the layers not started yet are skipped.
let (done, stopped) = (AtomicU64::new(0), AtomicBool::new(false));
let traced = parallel_map_at_most(at_a_time, &layers, |&(r, ci)| {
if stopped.load(Ordering::Relaxed) {
return None;
}
let paths = job.layer(r, ci);
if !steps(done.fetch_add(1, Ordering::Relaxed) + 1, total) {
stopped.store(true, Ordering::Relaxed);
}
paths
});
if stopped.load(Ordering::Relaxed) {
return Err(TraceError::Cancelled);
}
for (paths, &(_, ci)) in traced.into_iter().zip(&layers) {
let paths = paths.ok_or(TraceError::TooComplex { max: max_anchors })?;
// A layer with no paths adds no color to the palette.
if paths.is_empty() {
continue;
}
out.paths.extend(paths);
let color = q.palette[ci];
if !out.palette.contains(&color) {
out.palette.push(color);
}
}
Ok(out)
})))
}
/// The luminance of white and of black in a Black and White quantisation: what its lightest
+40
View File
@@ -657,6 +657,46 @@ fn a_watched_trace_counts_its_layers_and_stops_when_told() {
assert!(matches!(trace_watched(&img, &p, usize::MAX, &|done, _| done == 0), Err(TraceError::Cancelled)));
}
/// A trace made a part at a time finds its layers in the first part and traces one layer a part
/// after it, and gives what one call gives, Auto Grouping, Logo mode and the anchor budget included.
#[test]
fn a_trace_made_a_part_at_a_time_matches_one_made_at_once() {
fn parts(img: &Raster, p: &TraceParams, max: usize) -> (usize, Result<TraceResult, TraceError>) {
let mut s = TraceSteps::new(std::sync::Arc::new(img.clone()), p.clone(), max);
let mut n = 0;
loop {
n += 1;
assert!(n < 1000, "the parts never end");
match s.step() {
Ok(None) => {}
Ok(Some(r)) => return (n, Ok(r)),
Err(e) => return (n, Err(e)),
}
}
}
let img = stripes(120, 8);
for p in [
TraceParams { mode: Mode::Color, colors: 16, noise: 1, ..TraceParams::default() },
TraceParams { mode: Mode::Color, colors: 16, noise: 1, method: Method::Overlapping, auto_grouping: true, ..TraceParams::default() },
] {
let at_once = trace_within(&img, &p, usize::MAX).unwrap();
let (n, made) = parts(&img, &p, usize::MAX);
assert_eq!(made.unwrap(), at_once, "{p:?}");
assert!(at_once.palette.len() > 1 && n > 2, "{n} parts for {} colors", at_once.palette.len());
}
let logo = TraceParams { mode: Mode::Logo, ..TraceParams::default() };
let round = disc(64, 32.0, 32.0, 20.0);
let (n, made) = parts(&round, &logo, usize::MAX);
assert_eq!((n, made.unwrap()), (1, trace_within(&round, &logo, usize::MAX).unwrap()), "Logo mode is one part");
let p = TraceParams { mode: Mode::Color, colors: 16, noise: 1, ..TraceParams::default() };
let anchors = trace(&img, &p).anchor_count();
assert!(matches!(parts(&img, &p, anchors / 2).1, Err(TraceError::TooComplex { max }) if max == anchors / 2));
assert_eq!(parts(&img, &p, anchors).1.unwrap(), trace(&img, &p));
let mut done = TraceSteps::new(std::sync::Arc::new(Raster::from_fn(0, 0, |_, _| WHITE)), p, usize::MAX);
assert_eq!(done.step().unwrap(), Some(TraceResult::default()), "an empty image");
assert_eq!(done.step().unwrap(), None, "nothing after the result");
}
/// Layers traced in parallel come out in the same order every time: bottom (largest) first.
#[test]
fn parallel_layers_keep_their_order() {
+3
View File
@@ -156,6 +156,7 @@ impl VectorcraftApp {
plugin_runs: Default::default(),
placing: Default::default(),
trace_runs: Default::default(),
concept_runs: Default::default(),
recovery: Default::default(),
host_modifiers: Default::default(),
forwarded: Vec::new(),
@@ -249,6 +250,7 @@ impl VectorcraftApp {
opening::poll(self);
plugin_runs::poll(self);
trace_runs::poll(self);
crate::panels::concept_vector::poll(self);
placing::poll(self);
}
@@ -360,6 +362,7 @@ impl VectorcraftApp {
|| !self.plugin_runs.running.is_empty()
|| !self.placing.pending.is_empty()
|| !self.trace_runs.running.is_empty()
|| self.concept_runs.busy()
{
// Keep the status bar's progress moving and pick the result up when it arrives.
ctx.request_repaint_after(std::time::Duration::from_millis(100));
+2
View File
@@ -103,6 +103,7 @@ pub(super) fn task_bar(app: &mut VectorcraftApp, ui: &mut Ui, xf: &Xf) {
items.push((tl!("Image Trace"), "image", TASK_BAR_IMAGE_TRACE, none()));
items.push((tl!("Crop Image"), "dc-pf-crop", "ui.cropImage", none()));
items.push((tl!("Remove Background"), "eraser", crate::addons::image::REMOVE_BACKGROUND, none()));
items.push((tl!("Concept to Vector"), "sparkles", crate::panels::concept_vector::OPEN, none()));
}
// Direct-selected anchors take the place of a path's Offset Path and Simplify. For them the bar
// offers Remove, Connect, Cut and Convert to corner or smooth, as the reference app does
@@ -132,6 +133,7 @@ pub(super) fn task_bar(app: &mut VectorcraftApp, ui: &mut Ui, xf: &Xf) {
}
} else if is_trace {
items.push((tl!("Expand"), "maximize-2", "imageTrace.expand", none()));
items.push((tl!("Concept to Vector"), "sparkles", crate::panels::concept_vector::OPEN, none()));
} else if is_clip_group {
items.push((tl!("Edit Clipping Path"), "dc-direct", "object.clippingMask.editMask", none()));
items.push((tl!("Release Clipping Mask"), "ungroup", "object.clippingMask.release", none()));
+25
View File
@@ -9847,6 +9847,31 @@ fn the_task_bar_removes_a_selected_images_background() {
assert_eq!((px.get_pixel(0, 0).0[3], px.get_pixel(10, 10).0[3]), (0, 255), "the white background is cleared, the red dot kept");
}
/// For one selected image the Contextual Task Bar offers Concept to Vector, which opens its panel;
/// a rectangle gets no such item.
#[test]
fn the_task_bar_opens_concept_to_vector_for_a_selected_image() {
let mut app = VectorcraftApp::new(Session::new(), Default::default());
app.session.execute("file.new", &json!({"width": 400, "height": 300})).unwrap();
let img = image::RgbaImage::from_fn(20, 20, |x, _| image::Rgba(if x < 10 { [0, 0, 0, 255] } else { [255; 4] }));
let mut png = vec![];
img.write_to(&mut std::io::Cursor::new(&mut png), image::ImageFormat::Png).unwrap();
let data = vectorcraft_format::base64_encode(&png);
app.run("file.place", json!({"name": "half.png", "dataBase64": data, "link": false, "at": [200, 150]})).unwrap();
app.select_tool("selection");
let ctx = egui::Context::default();
let labels = task_bar_labels(&mut app, &ctx);
let at = labels.iter().find(|(t, _)| t == "Concept to Vector").map(|(_, r)| r.center()).expect("Concept to Vector is offered");
let button = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() };
frame(&mut app, &ctx, vec![egui::Event::PointerMoved(at)]);
frame(&mut app, &ctx, vec![button(true)]);
frame(&mut app, &ctx, vec![button(false)]);
assert!(crate::panel_docking::showing(&app.ui, crate::panels::concept_vector::ID), "{}", app.ui.status);
app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 40, "height": 40})).unwrap();
let labels = task_bar_labels(&mut app, &ctx);
assert!(!labels.is_empty() && !labels.iter().any(|(t, _)| t == "Concept to Vector"), "{labels:?}");
}
/// The labels the Contextual Task Bar draws in a headless frame (after one to lay it out), with
/// their rects; none while it isn't shown. The SVG loaders are installed so the icons draw as
/// images instead of egui's ⚠ placeholder, which the label list would otherwise pick up.
+16
View File
@@ -6744,3 +6744,19 @@ breakText Glyphs Глифи
Box Рамка
Swatch Образец
Direction Посока
Concept to Vector Концепция към вектор
Concept to Vector… Концепция към вектор…
Cancel Concept to Vector Job Отказ от задачата „Концепция към вектор“
Concept to Vector Providers Доставчици за „Концепция към вектор“
Concept to Vector Results Резултати от „Концепция към вектор“
Generate Concept to Vector Styles Създаване на стилове „Концепция към вектор“
Insert Concept to Vector Styles Вмъкване на стилове „Концепция към вектор“
Offline Image Trace styles, made on this computer Офлайн стилове за трасиране на изображение, създадени на този компютър
Offline styles do not use prompts Офлайн стиловете не използват подкани
Styles Стилове
Ink Lines Линии с туш
Flat Color Плосък цвят
Detailed Color Детайлен цвят
Gray Tones Сиви тонове
Generate Създаване
Insert Selected Вмъкване на избраните
Can't render this file because it contains an unexpected character in line 2 and column 73.
+16
View File
@@ -6798,3 +6798,19 @@ shape Open Otvoren
Box Okvir
Swatch Uzorak boje
Direction Smjer
Concept to Vector Koncept u vektor
Concept to Vector… Koncept u vektor…
Cancel Concept to Vector Job Otkaži zadatak Koncept u vektor
Concept to Vector Providers Pružaoci za Koncept u vektor
Concept to Vector Results Rezultati za Koncept u vektor
Generate Concept to Vector Styles Napravi stilove Koncept u vektor
Insert Concept to Vector Styles Umetni stilove Koncept u vektor
Offline Image Trace styles, made on this computer Offline stilovi praćenja slike, napravljeni na ovom računaru
Offline styles do not use prompts Offline stilovi ne koriste upite
Styles Stilovi
Ink Lines Linije tušem
Flat Color Ravna boja
Detailed Color Detaljna boja
Gray Tones Sivi tonovi
Generate Napravi
Insert Selected Umetni odabrano
Can't render this file because it contains an unexpected character in line 2 and column 73.
+38
View File
@@ -7237,3 +7237,41 @@ breakText Glyphs Glifs
Margin Marge
Box Caixa
Swatch Mostra
Concept to Vector Concepte a vector
Concept to Vector… Concepte a vector…
Cancel Concept to Vector Job Cancel·la la tasca de Concepte a vector
Concept to Vector Providers Proveïdors de Concepte a vector
Concept to Vector Results Resultats de Concepte a vector
Generate Concept to Vector Styles Genera els estils de Concepte a vector
Insert Concept to Vector Styles Insereix els estils de Concepte a vector
Offline Image Trace styles, made on this computer Estils de traçat d’imatge fora de línia, fets en aquest ordinador
Offline styles do not use prompts Els estils fora de línia no fan servir indicacions
Styles Estils
Ink Lines Línies de tinta
Flat Color Color pla
Detailed Color Color detallat
Gray Tones Tons de gris
Generate Genera
Insert Selected Insereix la selecció
@msg Concept to Vector stopped: its thread ended without results (please report this bug) Concepte a vector s’ha aturat: el seu fil ha acabat sense resultats (informeu d’aquest error)
@msg `detail` must be a whole number from 0 to 100 `detail` ha de ser un nombre enter de 0 a 100
@msg `job` must be a job number from conceptVector.generate `job` ha de ser un número de tasca de conceptVector.generate
@msg `styles` must list 1 to 8 different style ids of `{pid}` (see conceptVector.providers) `styles` ha de llistar d’1 a 8 identificadors d’estil diferents de `{pid}` (vegeu conceptVector.providers)
@msg `variations` must list different style ids of job {job} `variations` ha de llistar identificadors d’estil diferents de la tasca {job}
@msg a provider with the id `{id}` is registered already Ja hi ha registrat un proveïdor amb l’identificador `{id}`
@msg job {job} has no results to insert: it was canceled La tasca {job} no té resultats per inserir: s’ha cancel·lat
@msg job {job} no longer applies: its document, image or image placement changed, so generate again La tasca {job} ja no és vàlida: ha canviat el document, la imatge o la col·locació de la imatge; torneu-la a generar
@msg missing `provider` (see conceptVector.providers) Falta `provider` (vegeu conceptVector.providers)
@msg no Concept to Vector job {job}: it was never made, or was dropped (see conceptVector.results) No hi ha cap tasca de Concepte a vector {job}: no s’ha creat mai o s’ha descartat (vegeu conceptVector.results)
@msg no Concept to Vector provider `{name}` (see conceptVector.providers) No hi ha cap proveïdor de Concepte a vector `{name}` (vegeu conceptVector.providers)
@msg select one image or an unexpanded Image Trace object Seleccioneu una imatge o un objecte de traçat d’imatge sense expandir
@msg the image is locked or hidden La imatge està bloquejada o oculta
@msg the provider stopped with an internal error: {0} El proveïdor s’ha aturat amb un error intern: {0}
@msg the provider's results do not match the request or are malformed Els resultats del proveïdor no coincideixen amb la sol·licitud o estan mal formats
@msg the results would have more than {0} anchor points: lower Detail or choose fewer styles Els resultats tindrien més de {0} punts d’ancoratge: reduïu Detall o trieu menys estils
@msg there is no room for the results to the right of the image No hi ha espai per als resultats a la dreta de la imatge
@msg the image is on a layer with a clipping mask, which would hide the results La imatge és en una capa amb una màscara de retall, que amagaria els resultats
@msg the image is on a layer with an opacity mask, which would hide the results La imatge és en una capa amb una màscara d’opacitat, que amagaria els resultats
@msg `output` must be "vector" `output` ha de ser "vector"
@msg `{pid}` takes no prompt and makes vector art only `{pid}` no admet indicacions i només fa art vectorial
@msg Making the Concept to Vector styles S’estan fent els estils de Concepte a vector
Can't render this file because it contains an unexpected character in line 2 and column 73.
+38
View File
@@ -7256,3 +7256,41 @@ breakText Glyphs Glyfy
Margin Okraj
Box Rámeček
Swatch Vzorek
Concept to Vector Koncept na vektor
Concept to Vector… Koncept na vektor…
Cancel Concept to Vector Job Zrušit úlohu Koncept na vektor
Concept to Vector Providers Poskytovatelé Koncept na vektor
Concept to Vector Results Výsledky Koncept na vektor
Generate Concept to Vector Styles Vytvořit styly Koncept na vektor
Insert Concept to Vector Styles Vložit styly Koncept na vektor
Offline Image Trace styles, made on this computer Offline styly vektorizace obrazu, vytvořené na tomto počítači
Offline styles do not use prompts Offline styly nepoužívají výzvy
Styles Styly
Ink Lines Linky tuší
Flat Color Plochá barva
Detailed Color Podrobná barva
Gray Tones Odstíny šedi
Generate Vytvořit
Insert Selected Vložit vybrané
@msg Concept to Vector stopped: its thread ended without results (please report this bug) Koncept na vektor se zastavil: jeho vlákno skončilo bez výsledků (nahlaste prosím tuto chybu)
@msg `detail` must be a whole number from 0 to 100 `detail` musí být celé číslo od 0 do 100
@msg `job` must be a job number from conceptVector.generate `job` musí být číslo úlohy z conceptVector.generate
@msg `styles` must list 1 to 8 different style ids of `{pid}` (see conceptVector.providers) `styles` musí uvádět 1 až 8 různých ID stylů poskytovatele `{pid}` (viz conceptVector.providers)
@msg `variations` must list different style ids of job {job} `variations` musí uvádět různá ID stylů úlohy {job}
@msg a provider with the id `{id}` is registered already Poskytovatel s ID `{id}` je již zaregistrován
@msg job {job} has no results to insert: it was canceled Úloha {job} nemá žádné výsledky k vložení: byla zrušena
@msg job {job} no longer applies: its document, image or image placement changed, so generate again Úloha {job} již neplatí: změnil se její dokument, obraz nebo umístění obrazu; vytvořte ji znovu
@msg missing `provider` (see conceptVector.providers) Chybí `provider` (viz conceptVector.providers)
@msg no Concept to Vector job {job}: it was never made, or was dropped (see conceptVector.results) Úloha Koncept na vektor {job} neexistuje: nikdy nevznikla nebo byla zahozena (viz conceptVector.results)
@msg no Concept to Vector provider `{name}` (see conceptVector.providers) Poskytovatel Koncept na vektor `{name}` neexistuje (viz conceptVector.providers)
@msg select one image or an unexpanded Image Trace object Vyberte jeden obraz nebo nerozdělený objekt vektorizace obrazu
@msg the image is locked or hidden Obraz je zamčený nebo skrytý
@msg the provider stopped with an internal error: {0} Poskytovatel se zastavil s vnitřní chybou: {0}
@msg the provider's results do not match the request or are malformed Výsledky poskytovatele neodpovídají požadavku nebo jsou poškozené
@msg the results would have more than {0} anchor points: lower Detail or choose fewer styles Výsledky by měly více než {0} kotevních bodů: snižte Detail nebo zvolte méně stylů
@msg there is no room for the results to the right of the image Vpravo od obrazu není pro výsledky místo
@msg the image is on a layer with a clipping mask, which would hide the results Obraz je ve vrstvě s ořezovou maskou, která by výsledky skryla
@msg the image is on a layer with an opacity mask, which would hide the results Obraz je ve vrstvě s maskou krytí, která by výsledky skryla
@msg `output` must be "vector" `output` musí být "vector"
@msg `{pid}` takes no prompt and makes vector art only `{pid}` nepřijímá výzvu a vytváří jen vektorovou grafiku
@msg Making the Concept to Vector styles Vytvářejí se styly Koncept na vektor
Can't render this file because it contains an unexpected character in line 2 and column 73.
+16
View File
@@ -6760,3 +6760,19 @@ breakText Glyphs Glyffer
Box Ramme
Swatch Farveprøve
Direction Retning
Concept to Vector Koncept til vektor
Concept to Vector… Koncept til vektor…
Cancel Concept to Vector Job Annuller jobbet Koncept til vektor
Concept to Vector Providers Udbydere til Koncept til vektor
Concept to Vector Results Resultater fra Koncept til vektor
Generate Concept to Vector Styles Lav stilarter til Koncept til vektor
Insert Concept to Vector Styles Indsæt stilarter fra Koncept til vektor
Offline Image Trace styles, made on this computer Offline-stilarter til billedsporing, lavet på denne computer
Offline styles do not use prompts Offline-stilarter bruger ikke prompter
Styles Stilarter
Ink Lines Tuschstreger
Flat Color Flad farve
Detailed Color Detaljeret farve
Gray Tones Gråtoner
Generate Lav
Insert Selected Indsæt valgte
Can't render this file because it contains an unexpected character in line 2 and column 73.
+38
View File
@@ -6851,3 +6851,41 @@ breakText Glyphs Glyphen
Margin Rand
Box Rahmen
Swatch Farbfeld
Concept to Vector Konzept zu Vektor
Concept to Vector… Konzept zu Vektor…
Cancel Concept to Vector Job Konzept-zu-Vektor-Auftrag abbrechen
Concept to Vector Providers Konzept-zu-Vektor-Anbieter
Concept to Vector Results Konzept-zu-Vektor-Ergebnisse
Generate Concept to Vector Styles Konzept-zu-Vektor-Stile erzeugen
Insert Concept to Vector Styles Konzept-zu-Vektor-Stile einfügen
Offline Image Trace styles, made on this computer Offline-Bildnachzeichner-Stile, auf diesem Computer erstellt
Offline styles do not use prompts Offline-Stile verwenden keine Prompts
Styles Stile
Ink Lines Tintenlinien
Flat Color Flächige Farbe
Detailed Color Detaillierte Farbe
Gray Tones Grautöne
Generate Erzeugen
Insert Selected Auswahl einfügen
@msg Concept to Vector stopped: its thread ended without results (please report this bug) Konzept zu Vektor wurde beendet: Sein Thread endete ohne Ergebnisse (bitte melden Sie diesen Fehler)
@msg `detail` must be a whole number from 0 to 100 `detail` muss eine ganze Zahl von 0 bis 100 sein
@msg `job` must be a job number from conceptVector.generate `job` muss eine Auftragsnummer aus conceptVector.generate sein
@msg `styles` must list 1 to 8 different style ids of `{pid}` (see conceptVector.providers) `styles` muss 1 bis 8 verschiedene Stil-IDs von `{pid}` auflisten (siehe conceptVector.providers)
@msg `variations` must list different style ids of job {job} `variations` muss verschiedene Stil-IDs von Auftrag {job} auflisten
@msg a provider with the id `{id}` is registered already Ein Anbieter mit der ID `{id}` ist bereits registriert
@msg job {job} has no results to insert: it was canceled Auftrag {job} hat keine Ergebnisse zum Einfügen: Er wurde abgebrochen
@msg job {job} no longer applies: its document, image or image placement changed, so generate again Auftrag {job} gilt nicht mehr: Sein Dokument, Bild oder die Platzierung des Bildes hat sich geändert; erzeugen Sie ihn erneut
@msg missing `provider` (see conceptVector.providers) `provider` fehlt (siehe conceptVector.providers)
@msg no Concept to Vector job {job}: it was never made, or was dropped (see conceptVector.results) Kein Konzept-zu-Vektor-Auftrag {job}: Er wurde nie erstellt oder wurde verworfen (siehe conceptVector.results)
@msg no Concept to Vector provider `{name}` (see conceptVector.providers) Kein Konzept-zu-Vektor-Anbieter `{name}` (siehe conceptVector.providers)
@msg select one image or an unexpanded Image Trace object Wählen Sie ein Bild oder ein nicht umgewandeltes Bildnachzeichner-Objekt aus
@msg the image is locked or hidden Das Bild ist gesperrt oder ausgeblendet
@msg the provider stopped with an internal error: {0} Der Anbieter wurde mit einem internen Fehler beendet: {0}
@msg the provider's results do not match the request or are malformed Die Ergebnisse des Anbieters passen nicht zur Anfrage oder sind fehlerhaft
@msg the results would have more than {0} anchor points: lower Detail or choose fewer styles Die Ergebnisse hätten mehr als {0} Ankerpunkte: Verringern Sie Detail oder wählen Sie weniger Stile
@msg there is no room for the results to the right of the image Rechts neben dem Bild ist kein Platz für die Ergebnisse
@msg the image is on a layer with a clipping mask, which would hide the results Das Bild liegt auf einer Ebene mit Schnittmaske, die die Ergebnisse verbergen würde
@msg the image is on a layer with an opacity mask, which would hide the results Das Bild liegt auf einer Ebene mit Deckkraftmaske, die die Ergebnisse verbergen würde
@msg `output` must be "vector" `output` muss "vector" sein
@msg `{pid}` takes no prompt and makes vector art only `{pid}` nimmt keinen Prompt an und erstellt nur Vektorgrafik
@msg Making the Concept to Vector styles Konzept-zu-Vektor-Stile werden erstellt
Can't render this file because it contains an unexpected character in line 2 and column 73.
+38
View File
@@ -7208,3 +7208,41 @@ breakText Glyphs Γλύφοι
Margin Περιθώριο
Box Πλαίσιο
Swatch Δείγμα χρώματος
Concept to Vector Από ιδέα σε διάνυσμα
Concept to Vector… Από ιδέα σε διάνυσμα…
Cancel Concept to Vector Job Ακύρωση εργασίας «Από ιδέα σε διάνυσμα»
Concept to Vector Providers Πάροχοι «Από ιδέα σε διάνυσμα»
Concept to Vector Results Αποτελέσματα «Από ιδέα σε διάνυσμα»
Generate Concept to Vector Styles Δημιουργία στυλ «Από ιδέα σε διάνυσμα»
Insert Concept to Vector Styles Εισαγωγή στυλ «Από ιδέα σε διάνυσμα»
Offline Image Trace styles, made on this computer Στυλ ανίχνευσης περιγραμμάτων εικόνας εκτός σύνδεσης, που δημιουργούνται σε αυτόν τον υπολογιστή
Offline styles do not use prompts Τα στυλ εκτός σύνδεσης δεν χρησιμοποιούν προτροπές
Styles Στυλ
Ink Lines Γραμμές μελανιού
Flat Color Επίπεδο χρώμα
Detailed Color Λεπτομερές χρώμα
Gray Tones Τόνοι του γκρι
Generate Δημιουργία
Insert Selected Εισαγωγή επιλεγμένων
@msg Concept to Vector stopped: its thread ended without results (please report this bug) Το «Από ιδέα σε διάνυσμα» σταμάτησε: το νήμα του τελείωσε χωρίς αποτελέσματα (αναφέρετε αυτό το σφάλμα)
@msg `detail` must be a whole number from 0 to 100 Το `detail` πρέπει να είναι ακέραιος από 0 έως 100
@msg `job` must be a job number from conceptVector.generate Το `job` πρέπει να είναι αριθμός εργασίας από το conceptVector.generate
@msg `styles` must list 1 to 8 different style ids of `{pid}` (see conceptVector.providers) Το `styles` πρέπει να περιέχει 1 έως 8 διαφορετικά αναγνωριστικά στυλ του `{pid}` (δείτε το conceptVector.providers)
@msg `variations` must list different style ids of job {job} Το `variations` πρέπει να περιέχει διαφορετικά αναγνωριστικά στυλ της εργασίας {job}
@msg a provider with the id `{id}` is registered already Ένας πάροχος με αναγνωριστικό `{id}` είναι ήδη καταχωρισμένος
@msg job {job} has no results to insert: it was canceled Η εργασία {job} δεν έχει αποτελέσματα για εισαγωγή: ακυρώθηκε
@msg job {job} no longer applies: its document, image or image placement changed, so generate again Η εργασία {job} δεν ισχύει πια: άλλαξε το έγγραφο, η εικόνα ή η θέση της εικόνας· δημιουργήστε την ξανά
@msg missing `provider` (see conceptVector.providers) Λείπει το `provider` (δείτε το conceptVector.providers)
@msg no Concept to Vector job {job}: it was never made, or was dropped (see conceptVector.results) Δεν υπάρχει εργασία «Από ιδέα σε διάνυσμα» {job}: δεν δημιουργήθηκε ποτέ ή απορρίφθηκε (δείτε το conceptVector.results)
@msg no Concept to Vector provider `{name}` (see conceptVector.providers) Δεν υπάρχει πάροχος «Από ιδέα σε διάνυσμα» `{name}` (δείτε το conceptVector.providers)
@msg select one image or an unexpanded Image Trace object Επιλέξτε μία εικόνα ή ένα μη αναπτυγμένο αντικείμενο ανίχνευσης περιγραμμάτων εικόνας
@msg the image is locked or hidden Η εικόνα είναι κλειδωμένη ή κρυφή
@msg the provider stopped with an internal error: {0} Ο πάροχος σταμάτησε με εσωτερικό σφάλμα: {0}
@msg the provider's results do not match the request or are malformed Τα αποτελέσματα του παρόχου δεν ταιριάζουν με το αίτημα ή είναι κακοσχηματισμένα
@msg the results would have more than {0} anchor points: lower Detail or choose fewer styles Τα αποτελέσματα θα είχαν περισσότερα από {0} σημεία αγκύρωσης: μειώστε τη Λεπτομέρεια ή επιλέξτε λιγότερα στυλ
@msg there is no room for the results to the right of the image Δεν υπάρχει χώρος για τα αποτελέσματα δεξιά από την εικόνα
@msg the image is on a layer with a clipping mask, which would hide the results Η εικόνα βρίσκεται σε επίπεδο με μάσκα αποκοπής, η οποία θα έκρυβε τα αποτελέσματα
@msg the image is on a layer with an opacity mask, which would hide the results Η εικόνα βρίσκεται σε επίπεδο με μάσκα αδιαφάνειας, η οποία θα έκρυβε τα αποτελέσματα
@msg `output` must be "vector" Το `output` πρέπει να είναι "vector"
@msg `{pid}` takes no prompt and makes vector art only Το `{pid}` δεν δέχεται προτροπή και δημιουργεί μόνο διανυσματικά γραφικά
@msg Making the Concept to Vector styles Δημιουργία των στυλ «Από ιδέα σε διάνυσμα»
Can't render this file because it is too large.
+38
View File
@@ -7199,3 +7199,41 @@ breakText Glyphs Glifos
Margin Margen
Box Caja
Swatch Muestra
Concept to Vector Concepto a vector
Concept to Vector… Concepto a vector…
Cancel Concept to Vector Job Cancelar tarea de Concepto a vector
Concept to Vector Providers Proveedores de Concepto a vector
Concept to Vector Results Resultados de Concepto a vector
Generate Concept to Vector Styles Generar estilos de Concepto a vector
Insert Concept to Vector Styles Insertar estilos de Concepto a vector
Offline Image Trace styles, made on this computer Estilos de calco de imagen sin conexión, creados en este equipo
Offline styles do not use prompts Los estilos sin conexión no usan indicaciones
Styles Estilos
Ink Lines Líneas de tinta
Flat Color Color plano
Detailed Color Color detallado
Gray Tones Tonos de gris
Generate Generar
Insert Selected Insertar selección
@msg Concept to Vector stopped: its thread ended without results (please report this bug) Concepto a vector se detuvo: su hilo terminó sin resultados (informe de este error)
@msg `detail` must be a whole number from 0 to 100 `detail` debe ser un número entero entre 0 y 100
@msg `job` must be a job number from conceptVector.generate `job` debe ser un número de tarea de conceptVector.generate
@msg `styles` must list 1 to 8 different style ids of `{pid}` (see conceptVector.providers) `styles` debe incluir de 1 a 8 identificadores de estilo distintos de `{pid}` (consulte conceptVector.providers)
@msg `variations` must list different style ids of job {job} `variations` debe incluir identificadores de estilo distintos de la tarea {job}
@msg a provider with the id `{id}` is registered already Ya hay registrado un proveedor con el identificador `{id}`
@msg job {job} has no results to insert: it was canceled La tarea {job} no tiene resultados que insertar: se canceló
@msg job {job} no longer applies: its document, image or image placement changed, so generate again La tarea {job} ya no es válida: cambió su documento, su imagen o la colocación de la imagen; vuelva a generarla
@msg missing `provider` (see conceptVector.providers) Falta `provider` (consulte conceptVector.providers)
@msg no Concept to Vector job {job}: it was never made, or was dropped (see conceptVector.results) No hay ninguna tarea de Concepto a vector {job}: nunca se creó o se descartó (consulte conceptVector.results)
@msg no Concept to Vector provider `{name}` (see conceptVector.providers) No hay ningún proveedor de Concepto a vector `{name}` (consulte conceptVector.providers)
@msg select one image or an unexpanded Image Trace object Seleccione una imagen o un objeto de calco de imagen sin expandir
@msg the image is locked or hidden La imagen está bloqueada u oculta
@msg the provider stopped with an internal error: {0} El proveedor se detuvo con un error interno: {0}
@msg the provider's results do not match the request or are malformed Los resultados del proveedor no coinciden con la solicitud o están mal formados
@msg the results would have more than {0} anchor points: lower Detail or choose fewer styles Los resultados tendrían más de {0} puntos de ancla: reduzca Detalle o elija menos estilos
@msg there is no room for the results to the right of the image No hay espacio para los resultados a la derecha de la imagen
@msg the image is on a layer with a clipping mask, which would hide the results La imagen está en una capa con una máscara de recorte, que ocultaría los resultados
@msg the image is on a layer with an opacity mask, which would hide the results La imagen está en una capa con una máscara de opacidad, que ocultaría los resultados
@msg `output` must be "vector" `output` debe ser "vector"
@msg `{pid}` takes no prompt and makes vector art only `{pid}` no admite indicaciones y solo crea ilustraciones vectoriales
@msg Making the Concept to Vector styles Creando los estilos de Concepto a vector
Can't render this file because it contains an unexpected character in line 2 and column 73.
+38
View File
@@ -7291,3 +7291,41 @@ breakText Glyphs Merkit
Margin Marginaali
Box Kehys
Swatch Värimalli
Concept to Vector Konseptista vektoriksi
Concept to Vector… Konseptista vektoriksi…
Cancel Concept to Vector Job Peruuta Konseptista vektoriksi -työ
Concept to Vector Providers Konseptista vektoriksi -palveluntarjoajat
Concept to Vector Results Konseptista vektoriksi -tulokset
Generate Concept to Vector Styles Luo Konseptista vektoriksi -tyylit
Insert Concept to Vector Styles Lisää Konseptista vektoriksi -tyylit
Offline Image Trace styles, made on this computer Kuvan jäljityksen offline-tyylit, tehty tällä tietokoneella
Offline styles do not use prompts Offline-tyylit eivät käytä kehotteita
Styles Tyylit
Ink Lines Musteviivat
Flat Color Tasainen väri
Detailed Color Yksityiskohtainen väri
Gray Tones Harmaasävyt
Generate Luo
Insert Selected Lisää valitut
@msg Concept to Vector stopped: its thread ended without results (please report this bug) Konseptista vektoriksi pysähtyi: sen säie päättyi ilman tuloksia (ilmoita tästä virheestä)
@msg `detail` must be a whole number from 0 to 100 `detail` on oltava kokonaisluku 0–100
@msg `job` must be a job number from conceptVector.generate `job` on oltava conceptVector.generate-komennon antama työn numero
@msg `styles` must list 1 to 8 different style ids of `{pid}` (see conceptVector.providers) `styles` on luetteloitava 1–8 eri tyylitunnusta palveluntarjoajalta `{pid}` (katso conceptVector.providers)
@msg `variations` must list different style ids of job {job} `variations` on luetteloitava työn {job} eri tyylitunnukset
@msg a provider with the id `{id}` is registered already Palveluntarjoaja, jonka tunnus on `{id}`, on jo rekisteröity
@msg job {job} has no results to insert: it was canceled Työllä {job} ei ole lisättäviä tuloksia: se peruutettiin
@msg job {job} no longer applies: its document, image or image placement changed, so generate again Työ {job} ei ole enää voimassa: sen asiakirja, kuva tai kuvan sijoitus muuttui; luo se uudelleen
@msg missing `provider` (see conceptVector.providers) `provider` puuttuu (katso conceptVector.providers)
@msg no Concept to Vector job {job}: it was never made, or was dropped (see conceptVector.results) Konseptista vektoriksi -työtä {job} ei ole: sitä ei koskaan tehty tai se hylättiin (katso conceptVector.results)
@msg no Concept to Vector provider `{name}` (see conceptVector.providers) Konseptista vektoriksi -palveluntarjoajaa `{name}` ei ole (katso conceptVector.providers)
@msg select one image or an unexpanded Image Trace object Valitse yksi kuva tai laajentamaton kuvan jäljitysobjekti
@msg the image is locked or hidden Kuva on lukittu tai piilotettu
@msg the provider stopped with an internal error: {0} Palveluntarjoaja pysähtyi sisäiseen virheeseen: {0}
@msg the provider's results do not match the request or are malformed Palveluntarjoajan tulokset eivät vastaa pyyntöä tai ovat virheellisiä
@msg the results would have more than {0} anchor points: lower Detail or choose fewer styles Tuloksissa olisi yli {0} ankkuripistettä: pienennä Yksityiskohta-arvoa tai valitse vähemmän tyylejä
@msg there is no room for the results to the right of the image Kuvan oikealla puolella ei ole tilaa tuloksille
@msg the image is on a layer with a clipping mask, which would hide the results Kuva on tasolla, jolla on leikkausmaski, joka piilottaisi tulokset
@msg the image is on a layer with an opacity mask, which would hide the results Kuva on tasolla, jolla on peittävyysmaski, joka piilottaisi tulokset
@msg `output` must be "vector" `output` on oltava "vector"
@msg `{pid}` takes no prompt and makes vector art only `{pid}` ei ota kehotetta ja tekee vain vektorigrafiikkaa
@msg Making the Concept to Vector styles Luodaan Konseptista vektoriksi -tyylejä
Can't render this file because it contains an unexpected character in line 2 and column 73.
+38
View File
@@ -7251,3 +7251,41 @@ breakText Glyphs Glyphes
Margin Marge
Box Cadre
Swatch Nuance
Concept to Vector Du concept au vecteur
Concept to Vector… Du concept au vecteur…
Cancel Concept to Vector Job Annuler la tâche Du concept au vecteur
Concept to Vector Providers Fournisseurs Du concept au vecteur
Concept to Vector Results Résultats Du concept au vecteur
Generate Concept to Vector Styles Générer les styles Du concept au vecteur
Insert Concept to Vector Styles Insérer les styles Du concept au vecteur
Offline Image Trace styles, made on this computer Styles de vectorisation de l’image hors ligne, créés sur cet ordinateur
Offline styles do not use prompts Les styles hors ligne n’utilisent pas d’invite
Styles Styles
Ink Lines Traits d’encre
Flat Color Couleur en aplat
Detailed Color Couleur détaillée
Gray Tones Tons de gris
Generate Générer
Insert Selected Insérer la sélection
@msg Concept to Vector stopped: its thread ended without results (please report this bug) Du concept au vecteur s’est arrêté : son thread s’est terminé sans résultat (veuillez signaler ce bogue)
@msg `detail` must be a whole number from 0 to 100 `detail` doit être un nombre entier compris entre 0 et 100
@msg `job` must be a job number from conceptVector.generate `job` doit être un numéro de tâche de conceptVector.generate
@msg `styles` must list 1 to 8 different style ids of `{pid}` (see conceptVector.providers) `styles` doit lister de 1 à 8 identifiants de style différents de `{pid}` (voir conceptVector.providers)
@msg `variations` must list different style ids of job {job} `variations` doit lister des identifiants de style différents de la tâche {job}
@msg a provider with the id `{id}` is registered already Un fournisseur avec l’identifiant `{id}` est déjà enregistré
@msg job {job} has no results to insert: it was canceled La tâche {job} n’a aucun résultat à insérer : elle a été annulée
@msg job {job} no longer applies: its document, image or image placement changed, so generate again La tâche {job} ne s’applique plus : son document, son image ou le placement de l’image a changé ; générez-la à nouveau
@msg missing `provider` (see conceptVector.providers) `provider` manquant (voir conceptVector.providers)
@msg no Concept to Vector job {job}: it was never made, or was dropped (see conceptVector.results) Aucune tâche Du concept au vecteur {job} : elle n’a jamais été créée ou a été supprimée (voir conceptVector.results)
@msg no Concept to Vector provider `{name}` (see conceptVector.providers) Aucun fournisseur Du concept au vecteur `{name}` (voir conceptVector.providers)
@msg select one image or an unexpanded Image Trace object Sélectionnez une image ou un objet de vectorisation de l’image non décomposé
@msg the image is locked or hidden L’image est verrouillée ou masquée
@msg the provider stopped with an internal error: {0} Le fournisseur s’est arrêté sur une erreur interne : {0}
@msg the provider's results do not match the request or are malformed Les résultats du fournisseur ne correspondent pas à la demande ou sont mal formés
@msg the results would have more than {0} anchor points: lower Detail or choose fewer styles Les résultats auraient plus de {0} points d’ancrage : réduisez Détail ou choisissez moins de styles
@msg there is no room for the results to the right of the image Il n’y a pas de place pour les résultats à droite de l’image
@msg the image is on a layer with a clipping mask, which would hide the results L’image est sur un calque avec un masque d’écrêtage, qui masquerait les résultats
@msg the image is on a layer with an opacity mask, which would hide the results L’image est sur un calque avec un masque d’opacité, qui masquerait les résultats
@msg `output` must be "vector" `output` doit être "vector"
@msg `{pid}` takes no prompt and makes vector art only `{pid}` n’accepte pas d’invite et ne crée que des illustrations vectorielles
@msg Making the Concept to Vector styles Création des styles Du concept au vecteur
Can't render this file because it contains an unexpected character in line 2 and column 73.
+38
View File
@@ -8652,3 +8652,41 @@ theme Appearance अपीयरेंस
Margin मार्जिन
Box बॉक्स
Swatch स्वॉच
Concept to Vector कॉन्सेप्ट से वेक्टर
Concept to Vector… कॉन्सेप्ट से वेक्टर…
Cancel Concept to Vector Job कॉन्सेप्ट से वेक्टर जॉब रद्द करें
Concept to Vector Providers कॉन्सेप्ट से वेक्टर प्रदाता
Concept to Vector Results कॉन्सेप्ट से वेक्टर परिणाम
Generate Concept to Vector Styles कॉन्सेप्ट से वेक्टर स्टाइल बनाएँ
Insert Concept to Vector Styles कॉन्सेप्ट से वेक्टर स्टाइल डालें
Offline Image Trace styles, made on this computer ऑफ़लाइन इमेज ट्रेस स्टाइल, इसी कंप्यूटर पर बनाई जाती हैं
Offline styles do not use prompts ऑफ़लाइन स्टाइल प्रॉम्प्ट का उपयोग नहीं करतीं
Styles स्टाइल
Ink Lines स्याही रेखाएँ
Flat Color सपाट रंग
Detailed Color विस्तृत रंग
Gray Tones ग्रे टोन
Generate बनाएँ
Insert Selected चुने हुए डालें
@msg Concept to Vector stopped: its thread ended without results (please report this bug) कॉन्सेप्ट से वेक्टर रुक गया: उसका थ्रेड बिना परिणाम के समाप्त हुआ (कृपया इस बग की रिपोर्ट करें)
@msg `detail` must be a whole number from 0 to 100 `detail` 0 से 100 तक पूरी संख्या होना चाहिए
@msg `job` must be a job number from conceptVector.generate `job` conceptVector.generate से मिला जॉब नंबर होना चाहिए
@msg `styles` must list 1 to 8 different style ids of `{pid}` (see conceptVector.providers) `styles` में `{pid}` की 1 से 8 अलग-अलग स्टाइल ID होनी चाहिए (conceptVector.providers देखें)
@msg `variations` must list different style ids of job {job} `variations` में जॉब {job} की अलग-अलग स्टाइल ID होनी चाहिए
@msg a provider with the id `{id}` is registered already ID `{id}` वाला प्रदाता पहले से पंजीकृत है
@msg job {job} has no results to insert: it was canceled जॉब {job} में डालने के लिए कोई परिणाम नहीं है: इसे रद्द किया गया था
@msg job {job} no longer applies: its document, image or image placement changed, so generate again जॉब {job} अब लागू नहीं होता: उसका दस्तावेज़, इमेज या इमेज का स्थान बदल गया, इसलिए फिर से बनाएँ
@msg missing `provider` (see conceptVector.providers) `provider` नहीं दिया गया (conceptVector.providers देखें)
@msg no Concept to Vector job {job}: it was never made, or was dropped (see conceptVector.results) कॉन्सेप्ट से वेक्टर जॉब {job} नहीं है: यह कभी नहीं बना या हटा दिया गया (conceptVector.results देखें)
@msg no Concept to Vector provider `{name}` (see conceptVector.providers) कॉन्सेप्ट से वेक्टर प्रदाता `{name}` नहीं है (conceptVector.providers देखें)
@msg select one image or an unexpanded Image Trace object एक इमेज या एक बिना एक्सपैंड किया इमेज ट्रेस ऑब्जेक्ट चुनें
@msg the image is locked or hidden इमेज लॉक या छिपी हुई है
@msg the provider stopped with an internal error: {0} प्रदाता एक आंतरिक त्रुटि के साथ रुक गया: {0}
@msg the provider's results do not match the request or are malformed प्रदाता के परिणाम अनुरोध से मेल नहीं खाते या गलत बने हैं
@msg the results would have more than {0} anchor points: lower Detail or choose fewer styles परिणामों में {0} से अधिक एंकर पॉइंट होंगे: डिटेल कम करें या कम स्टाइल चुनें
@msg there is no room for the results to the right of the image इमेज के दाईं ओर परिणामों के लिए जगह नहीं है
@msg the image is on a layer with a clipping mask, which would hide the results इमेज क्लिपिंग मास्क वाली लेयर पर है, जो परिणामों को छिपा देगा
@msg the image is on a layer with an opacity mask, which would hide the results इमेज opacity मास्क वाली लेयर पर है, जो परिणामों को छिपा देगा
@msg `output` must be "vector" `output` "vector" होना चाहिए
@msg `{pid}` takes no prompt and makes vector art only `{pid}` प्रॉम्प्ट नहीं लेता और केवल वेक्टर आर्ट बनाता है
@msg Making the Concept to Vector styles कॉन्सेप्ट से वेक्टर स्टाइल बनाई जा रही हैं
Can't render this file because it is too large.
+38
View File
@@ -7240,3 +7240,41 @@ breakText Glyphs Glifák
Margin Margó
Box Keret
Swatch Színminta
Concept to Vector Koncepcióból vektor
Concept to Vector… Koncepcióból vektor…
Cancel Concept to Vector Job Koncepcióból vektor feladat megszakítása
Concept to Vector Providers Koncepcióból vektor szolgáltatók
Concept to Vector Results Koncepcióból vektor eredmények
Generate Concept to Vector Styles Koncepcióból vektor stílusok létrehozása
Insert Concept to Vector Styles Koncepcióból vektor stílusok beszúrása
Offline Image Trace styles, made on this computer Offline képvektorizálási stílusok, ezen a számítógépen készítve
Offline styles do not use prompts Az offline stílusok nem használnak promptot
Styles Stílusok
Ink Lines Tusvonalak
Flat Color Sík szín
Detailed Color Részletes szín
Gray Tones Szürke árnyalatok
Generate Létrehozás
Insert Selected Kijelöltek beszúrása
@msg Concept to Vector stopped: its thread ended without results (please report this bug) A Koncepcióból vektor leállt: a szála eredmény nélkül ért véget (kérjük, jelentse ezt a hibát)
@msg `detail` must be a whole number from 0 to 100 `detail`: 0 és 100 közötti egész szám kell
@msg `job` must be a job number from conceptVector.generate `job`: a conceptVector.generate által adott feladatszám kell
@msg `styles` must list 1 to 8 different style ids of `{pid}` (see conceptVector.providers) `styles`: `{pid}` 1–8 különböző stílusazonosítóját kell felsorolni (lásd conceptVector.providers)
@msg `variations` must list different style ids of job {job} `variations`: a(z) {job} feladat különböző stílusazonosítóit kell felsorolni
@msg a provider with the id `{id}` is registered already Már regisztrálva van egy `{id}` azonosítójú szolgáltató
@msg job {job} has no results to insert: it was canceled A(z) {job} feladatnak nincs beszúrható eredménye: megszakították
@msg job {job} no longer applies: its document, image or image placement changed, so generate again A(z) {job} feladat már nem érvényes: megváltozott a dokumentuma, a képe vagy a kép elhelyezése; hozza létre újra
@msg missing `provider` (see conceptVector.providers) Hiányzik a `provider` (lásd conceptVector.providers)
@msg no Concept to Vector job {job}: it was never made, or was dropped (see conceptVector.results) Nincs {job} Koncepcióból vektor feladat: soha nem készült el, vagy elvetették (lásd conceptVector.results)
@msg no Concept to Vector provider `{name}` (see conceptVector.providers) Nincs `{name}` Koncepcióból vektor szolgáltató (lásd conceptVector.providers)
@msg select one image or an unexpanded Image Trace object Jelöljön ki egy képet vagy egy ki nem bontott képvektorizálási objektumot
@msg the image is locked or hidden A kép zárolva van vagy rejtett
@msg the provider stopped with an internal error: {0} A szolgáltató belső hibával leállt: {0}
@msg the provider's results do not match the request or are malformed A szolgáltató eredményei nem felelnek meg a kérésnek, vagy hibásak
@msg the results would have more than {0} anchor points: lower Detail or choose fewer styles Az eredményekben több mint {0} horgonypont lenne: csökkentse a Részletességet, vagy válasszon kevesebb stílust
@msg there is no room for the results to the right of the image A kép jobb oldalán nincs hely az eredményeknek
@msg the image is on a layer with a clipping mask, which would hide the results A kép vágómaszkos rétegen van, amely elrejtené az eredményeket
@msg the image is on a layer with an opacity mask, which would hide the results A kép átlátszósági maszkos rétegen van, amely elrejtené az eredményeket
@msg `output` must be "vector" `output`: "vector" kell
@msg `{pid}` takes no prompt and makes vector art only `{pid}` nem fogad promptot, és csak vektorgrafikát készít
@msg Making the Concept to Vector styles Koncepcióból vektor stílusok készítése
Can't render this file because it contains an unexpected character in line 2 and column 73.
+16
View File
@@ -6760,3 +6760,19 @@ breakText Glyphs Glif
Box Kotak
Swatch Sampel warna
Direction Arah
Concept to Vector Konsep ke Vektor
Concept to Vector… Konsep ke Vektor…
Cancel Concept to Vector Job Batalkan Tugas Konsep ke Vektor
Concept to Vector Providers Penyedia Konsep ke Vektor
Concept to Vector Results Hasil Konsep ke Vektor
Generate Concept to Vector Styles Buat Gaya Konsep ke Vektor
Insert Concept to Vector Styles Sisipkan Gaya Konsep ke Vektor
Offline Image Trace styles, made on this computer Gaya Image Trace luring, dibuat di komputer ini
Offline styles do not use prompts Gaya luring tidak memakai prompt
Styles Gaya
Ink Lines Garis Tinta
Flat Color Warna Datar
Detailed Color Warna Detail
Gray Tones Nada Abu-abu
Generate Buat
Insert Selected Sisipkan yang Dipilih
Can't render this file because it contains an unexpected character in line 2412 and column 5.
+38
View File
@@ -6885,3 +6885,41 @@ breakText Glyphs Glifi
Margin Margine
Box Riquadro
Swatch Campione
Concept to Vector Da concetto a vettore
Concept to Vector… Da concetto a vettore…
Cancel Concept to Vector Job Annulla attività Da concetto a vettore
Concept to Vector Providers Fornitori Da concetto a vettore
Concept to Vector Results Risultati Da concetto a vettore
Generate Concept to Vector Styles Genera stili Da concetto a vettore
Insert Concept to Vector Styles Inserisci stili Da concetto a vettore
Offline Image Trace styles, made on this computer Stili di ricalco immagine offline, creati su questo computer
Offline styles do not use prompts Gli stili offline non usano prompt
Styles Stili
Ink Lines Linee a inchiostro
Flat Color Colore piatto
Detailed Color Colore dettagliato
Gray Tones Toni di grigio
Generate Genera
Insert Selected Inserisci selezionati
@msg Concept to Vector stopped: its thread ended without results (please report this bug) Da concetto a vettore si è interrotto: il suo thread è terminato senza risultati (segnala questo bug)
@msg `detail` must be a whole number from 0 to 100 `detail` deve essere un numero intero compreso tra 0 e 100
@msg `job` must be a job number from conceptVector.generate `job` deve essere un numero di attività di conceptVector.generate
@msg `styles` must list 1 to 8 different style ids of `{pid}` (see conceptVector.providers) `styles` deve elencare da 1 a 8 ID di stile diversi di `{pid}` (vedi conceptVector.providers)
@msg `variations` must list different style ids of job {job} `variations` deve elencare ID di stile diversi dell’attività {job}
@msg a provider with the id `{id}` is registered already Un fornitore con l’ID `{id}` è già registrato
@msg job {job} has no results to insert: it was canceled L’attività {job} non ha risultati da inserire: è stata annullata
@msg job {job} no longer applies: its document, image or image placement changed, so generate again L’attività {job} non è più valida: il suo documento, l’immagine o la posizione dell’immagine sono cambiati; generala di nuovo
@msg missing `provider` (see conceptVector.providers) Manca `provider` (vedi conceptVector.providers)
@msg no Concept to Vector job {job}: it was never made, or was dropped (see conceptVector.results) Nessuna attività Da concetto a vettore {job}: non è mai stata creata o è stata scartata (vedi conceptVector.results)
@msg no Concept to Vector provider `{name}` (see conceptVector.providers) Nessun fornitore Da concetto a vettore `{name}` (vedi conceptVector.providers)
@msg select one image or an unexpanded Image Trace object Seleziona un’immagine o un oggetto di ricalco immagine non espanso
@msg the image is locked or hidden L’immagine è bloccata o nascosta
@msg the provider stopped with an internal error: {0} Il fornitore si è interrotto con un errore interno: {0}
@msg the provider's results do not match the request or are malformed I risultati del fornitore non corrispondono alla richiesta o sono malformati
@msg the results would have more than {0} anchor points: lower Detail or choose fewer styles I risultati avrebbero più di {0} punti di ancoraggio: riduci Dettaglio o scegli meno stili
@msg there is no room for the results to the right of the image Non c’è spazio per i risultati a destra dell’immagine
@msg the image is on a layer with a clipping mask, which would hide the results L’immagine è su un livello con una maschera di ritaglio, che nasconderebbe i risultati
@msg the image is on a layer with an opacity mask, which would hide the results L’immagine è su un livello con una maschera di opacità, che nasconderebbe i risultati
@msg `output` must be "vector" `output` deve essere "vector"
@msg `{pid}` takes no prompt and makes vector art only `{pid}` non accetta prompt e crea solo grafica vettoriale
@msg Making the Concept to Vector styles Creazione degli stili Da concetto a vettore
Can't render this file because it contains an unexpected character in line 2 and column 73.
+38
View File
@@ -6950,3 +6950,41 @@ breakText Glyphs 字形
Margin マージン
Box 枠
Swatch スウォッチ
Concept to Vector コンセプトからベクター
Concept to Vector… コンセプトからベクター…
Cancel Concept to Vector Job コンセプトからベクターのジョブをキャンセル
Concept to Vector Providers コンセプトからベクターのプロバイダー
Concept to Vector Results コンセプトからベクターの結果
Generate Concept to Vector Styles コンセプトからベクターのスタイルを生成
Insert Concept to Vector Styles コンセプトからベクターのスタイルを挿入
Offline Image Trace styles, made on this computer このコンピューターで作成するオフラインの画像トレーススタイル
Offline styles do not use prompts オフラインスタイルはプロンプトを使用しません
Styles スタイル
Ink Lines インクの線
Flat Color フラットカラー
Detailed Color 詳細カラー
Gray Tones グレートーン
Generate 生成
Insert Selected 選択項目を挿入
@msg Concept to Vector stopped: its thread ended without results (please report this bug) コンセプトからベクターが停止しました: スレッドが結果なしで終了しました (このバグを報告してください)
@msg `detail` must be a whole number from 0 to 100 `detail` には 0 から 100 の整数を指定してください
@msg `job` must be a job number from conceptVector.generate `job` には conceptVector.generate のジョブ番号を指定してください
@msg `styles` must list 1 to 8 different style ids of `{pid}` (see conceptVector.providers) `styles` には `{pid}` の異なるスタイル ID を 1 から 8 個指定してください (conceptVector.providers を参照)
@msg `variations` must list different style ids of job {job} `variations` にはジョブ {job} の異なるスタイル ID を指定してください
@msg a provider with the id `{id}` is registered already ID `{id}` のプロバイダーはすでに登録されています
@msg job {job} has no results to insert: it was canceled ジョブ {job} には挿入する結果がありません: キャンセルされました
@msg job {job} no longer applies: its document, image or image placement changed, so generate again ジョブ {job} は無効になりました: ドキュメント、画像、または画像の配置が変更されたため、もう一度生成してください
@msg missing `provider` (see conceptVector.providers) `provider` がありません (conceptVector.providers を参照)
@msg no Concept to Vector job {job}: it was never made, or was dropped (see conceptVector.results) コンセプトからベクターのジョブ {job} はありません: 作成されていないか、破棄されました (conceptVector.results を参照)
@msg no Concept to Vector provider `{name}` (see conceptVector.providers) コンセプトからベクターのプロバイダー `{name}` はありません (conceptVector.providers を参照)
@msg select one image or an unexpanded Image Trace object 画像、または拡張されていない画像トレースオブジェクトを 1 つ選択してください
@msg the image is locked or hidden 画像がロックされているか、非表示です
@msg the provider stopped with an internal error: {0} プロバイダーが内部エラーで停止しました: {0}
@msg the provider's results do not match the request or are malformed プロバイダーの結果が要求と一致しないか、不正です
@msg the results would have more than {0} anchor points: lower Detail or choose fewer styles 結果のアンカーポイントが {0} 個を超えます: ディテールを下げるか、スタイルを減らしてください
@msg there is no room for the results to the right of the image 画像の右側に結果を置く場所がありません
@msg the image is on a layer with a clipping mask, which would hide the results 画像はクリッピングマスクのあるレイヤー上にあり、結果が隠れてしまいます
@msg the image is on a layer with an opacity mask, which would hide the results 画像は不透明マスクのあるレイヤー上にあり、結果が隠れてしまいます
@msg `output` must be "vector" `output` には "vector" を指定してください
@msg `{pid}` takes no prompt and makes vector art only `{pid}` はプロンプトを受け付けず、ベクターアートのみを作成します
@msg Making the Concept to Vector styles コンセプトからベクターのスタイルを作成中
Can't render this file because it contains an unexpected character in line 2 and column 73.
+38
View File
@@ -7370,3 +7370,41 @@ font-script Japanese იაპონური
Margin ზღვარი
Box ჩარჩო
Swatch ფერის ნიმუში
Concept to Vector კონცეფციიდან ვექტორამდე
Concept to Vector… კონცეფციიდან ვექტორამდე…
Cancel Concept to Vector Job „კონცეფციიდან ვექტორამდე“ დავალების გაუქმება
Concept to Vector Providers „კონცეფციიდან ვექტორამდე“ მომწოდებლები
Concept to Vector Results „კონცეფციიდან ვექტორამდე“ შედეგები
Generate Concept to Vector Styles „კონცეფციიდან ვექტორამდე“ სტილების შექმნა
Insert Concept to Vector Styles „კონცეფციიდან ვექტორამდე“ სტილების ჩასმა
Offline Image Trace styles, made on this computer გამოსახულების ვექტორიზაციის ოფლაინ სტილები, შექმნილი ამ კომპიუტერზე
Offline styles do not use prompts ოფლაინ სტილები მოთხოვნებს არ იყენებს
Styles სტილები
Ink Lines მელნის ხაზები
Flat Color ბრტყელი ფერი
Detailed Color დეტალური ფერი
Gray Tones ნაცრისფერი ტონები
Generate შექმნა
Insert Selected მონიშნულის ჩასმა
@msg Concept to Vector stopped: its thread ended without results (please report this bug) „კონცეფციიდან ვექტორამდე“ შეჩერდა: მისი ნაკადი შედეგების გარეშე დასრულდა (გთხოვთ, შეგვატყობინოთ ამ შეცდომის შესახებ)
@msg `detail` must be a whole number from 0 to 100 `detail` უნდა იყოს მთელი რიცხვი 0-დან 100-მდე
@msg `job` must be a job number from conceptVector.generate `job` უნდა იყოს conceptVector.generate-ის დავალების ნომერი
@msg `styles` must list 1 to 8 different style ids of `{pid}` (see conceptVector.providers) `styles` უნდა შეიცავდეს `{pid}`-ის 1-დან 8-მდე განსხვავებულ სტილის ID-ს (იხ. conceptVector.providers)
@msg `variations` must list different style ids of job {job} `variations` უნდა შეიცავდეს {job} დავალების განსხვავებულ სტილის ID-ებს
@msg a provider with the id `{id}` is registered already მომწოდებელი ID-ით `{id}` უკვე რეგისტრირებულია
@msg job {job} has no results to insert: it was canceled {job} დავალებას ჩასასმელი შედეგები არ აქვს: ის გაუქმდა
@msg job {job} no longer applies: its document, image or image placement changed, so generate again {job} დავალება აღარ მოქმედებს: შეიცვალა მისი დოკუმენტი, გამოსახულება ან გამოსახულების განთავსება; შექმენით ხელახლა
@msg missing `provider` (see conceptVector.providers) `provider` აკლია (იხ. conceptVector.providers)
@msg no Concept to Vector job {job}: it was never made, or was dropped (see conceptVector.results) „კონცეფციიდან ვექტორამდე“ დავალება {job} არ არსებობს: არასდროს შექმნილა ან გაუქმდა (იხ. conceptVector.results)
@msg no Concept to Vector provider `{name}` (see conceptVector.providers) „კონცეფციიდან ვექტორამდე“ მომწოდებელი `{name}` არ არსებობს (იხ. conceptVector.providers)
@msg select one image or an unexpanded Image Trace object მონიშნეთ ერთი გამოსახულება ან ვექტორიზაციის გაუშლელი ობიექტი
@msg the image is locked or hidden გამოსახულება ჩაკეტილი ან დამალულია
@msg the provider stopped with an internal error: {0} მომწოდებელი შიდა შეცდომით შეჩერდა: {0}
@msg the provider's results do not match the request or are malformed მომწოდებლის შედეგები მოთხოვნას არ შეესაბამება ან დაზიანებულია
@msg the results would have more than {0} anchor points: lower Detail or choose fewer styles შედეგებს {0}-ზე მეტი საყრდენი წერტილი ექნებოდა: შეამცირეთ დეტალი ან აირჩიეთ ნაკლები სტილი
@msg there is no room for the results to the right of the image გამოსახულების მარჯვნივ შედეგებისთვის ადგილი არ არის
@msg the image is on a layer with a clipping mask, which would hide the results გამოსახულება მოჭრის ნიღბიან ფენაზეა, რომელიც შედეგებს დამალავდა
@msg the image is on a layer with an opacity mask, which would hide the results გამოსახულება გაუმჭვირვალობის ნიღბიან ფენაზეა, რომელიც შედეგებს დამალავდა
@msg `output` must be "vector" `output` უნდა იყოს "vector"
@msg `{pid}` takes no prompt and makes vector art only `{pid}` მოთხოვნას არ იღებს და მხოლოდ ვექტორულ გრაფიკას ქმნის
@msg Making the Concept to Vector styles იქმნება „კონცეფციიდან ვექტორამდე“ სტილები
Can't render this file because it is too large.
+38
View File
@@ -6846,3 +6846,41 @@ breakText Glyphs 글리프
Margin 여백
Box 상자
Swatch 견본
Concept to Vector 콘셉트를 벡터로
Concept to Vector… 콘셉트를 벡터로…
Cancel Concept to Vector Job 콘셉트를 벡터로 작업 취소
Concept to Vector Providers 콘셉트를 벡터로 공급자
Concept to Vector Results 콘셉트를 벡터로 결과
Generate Concept to Vector Styles 콘셉트를 벡터로 스타일 생성
Insert Concept to Vector Styles 콘셉트를 벡터로 스타일 삽입
Offline Image Trace styles, made on this computer 이 컴퓨터에서 만드는 오프라인 이미지 추적 스타일
Offline styles do not use prompts 오프라인 스타일은 프롬프트를 사용하지 않습니다
Styles 스타일
Ink Lines 잉크 선
Flat Color 단색
Detailed Color 세밀한 색
Gray Tones 회색 톤
Generate 생성
Insert Selected 선택 항목 삽입
@msg Concept to Vector stopped: its thread ended without results (please report this bug) 콘셉트를 벡터로가 중지되었습니다: 스레드가 결과 없이 끝났습니다(이 버그를 신고해 주세요)
@msg `detail` must be a whole number from 0 to 100 `detail`은 0에서 100 사이의 정수여야 합니다
@msg `job` must be a job number from conceptVector.generate `job`은 conceptVector.generate의 작업 번호여야 합니다
@msg `styles` must list 1 to 8 different style ids of `{pid}` (see conceptVector.providers) `styles`에는 `{pid}`의 서로 다른 스타일 ID를 1~8개 지정해야 합니다(conceptVector.providers 참조)
@msg `variations` must list different style ids of job {job} `variations`에는 작업 {job}의 서로 다른 스타일 ID를 지정해야 합니다
@msg a provider with the id `{id}` is registered already ID가 `{id}`인 공급자가 이미 등록되어 있습니다
@msg job {job} has no results to insert: it was canceled 작업 {job}에는 삽입할 결과가 없습니다: 취소되었습니다
@msg job {job} no longer applies: its document, image or image placement changed, so generate again 작업 {job}은 더 이상 유효하지 않습니다: 문서, 이미지 또는 이미지 배치가 바뀌었으니 다시 생성하세요
@msg missing `provider` (see conceptVector.providers) `provider`가 없습니다(conceptVector.providers 참조)
@msg no Concept to Vector job {job}: it was never made, or was dropped (see conceptVector.results) 콘셉트를 벡터로 작업 {job}이 없습니다: 만들어진 적이 없거나 삭제되었습니다(conceptVector.results 참조)
@msg no Concept to Vector provider `{name}` (see conceptVector.providers) 콘셉트를 벡터로 공급자 `{name}`이 없습니다(conceptVector.providers 참조)
@msg select one image or an unexpanded Image Trace object 이미지 하나 또는 확장하지 않은 이미지 추적 개체 하나를 선택하세요
@msg the image is locked or hidden 이미지가 잠겨 있거나 숨겨져 있습니다
@msg the provider stopped with an internal error: {0} 공급자가 내부 오류로 중지되었습니다: {0}
@msg the provider's results do not match the request or are malformed 공급자의 결과가 요청과 맞지 않거나 형식이 잘못되었습니다
@msg the results would have more than {0} anchor points: lower Detail or choose fewer styles 결과의 고정점이 {0}개를 넘습니다: 세부를 낮추거나 스타일을 줄이세요
@msg there is no room for the results to the right of the image 이미지 오른쪽에 결과를 놓을 공간이 없습니다
@msg the image is on a layer with a clipping mask, which would hide the results 이미지가 클리핑 마스크가 있는 레이어에 있어 결과가 가려집니다
@msg the image is on a layer with an opacity mask, which would hide the results 이미지가 불투명 마스크가 있는 레이어에 있어 결과가 가려집니다
@msg `output` must be "vector" `output`은 "vector"여야 합니다
@msg `{pid}` takes no prompt and makes vector art only `{pid}`은 프롬프트를 받지 않으며 벡터 아트만 만듭니다
@msg Making the Concept to Vector styles 콘셉트를 벡터로 스타일을 만드는 중
Can't render this file because it contains an unexpected character in line 2 and column 73.
+16
View File
@@ -6811,3 +6811,19 @@ breakText Glyphs Glyphs
Box Kader
Swatch Staal
Direction Richting
Concept to Vector Concept naar vector
Concept to Vector… Concept naar vector…
Cancel Concept to Vector Job Taak Concept naar vector annuleren
Concept to Vector Providers Aanbieders voor Concept naar vector
Concept to Vector Results Resultaten van Concept naar vector
Generate Concept to Vector Styles Stijlen voor Concept naar vector maken
Insert Concept to Vector Styles Stijlen van Concept naar vector invoegen
Offline Image Trace styles, made on this computer Offline stijlen voor afbeelding traceren, gemaakt op deze computer
Offline styles do not use prompts Offline stijlen gebruiken geen prompts
Styles Stijlen
Ink Lines Inktlijnen
Flat Color Egale kleur
Detailed Color Gedetailleerde kleur
Gray Tones Grijstinten
Generate Maken
Insert Selected Selectie invoegen
Can't render this file because it contains an unexpected character in line 2 and column 73.
+38
View File
@@ -7112,3 +7112,41 @@ breakText Glyphs Glify
Margin Margines
Box Ramka
Swatch Próbka
Concept to Vector Koncepcja na wektor
Concept to Vector… Koncepcja na wektor…
Cancel Concept to Vector Job Anuluj zadanie Koncepcja na wektor
Concept to Vector Providers Dostawcy Koncepcja na wektor
Concept to Vector Results Wyniki Koncepcja na wektor
Generate Concept to Vector Styles Generuj style Koncepcja na wektor
Insert Concept to Vector Styles Wstaw style Koncepcja na wektor
Offline Image Trace styles, made on this computer Style obrysu obrazu offline, tworzone na tym komputerze
Offline styles do not use prompts Style offline nie używają promptów
Styles Style
Ink Lines Linie tuszem
Flat Color Płaski kolor
Detailed Color Szczegółowy kolor
Gray Tones Odcienie szarości
Generate Generuj
Insert Selected Wstaw zaznaczone
@msg Concept to Vector stopped: its thread ended without results (please report this bug) Koncepcja na wektor zatrzymała się: jej wątek zakończył się bez wyników (zgłoś ten błąd)
@msg `detail` must be a whole number from 0 to 100 `detail` musi być liczbą całkowitą od 0 do 100
@msg `job` must be a job number from conceptVector.generate `job` musi być numerem zadania z conceptVector.generate
@msg `styles` must list 1 to 8 different style ids of `{pid}` (see conceptVector.providers) `styles` musi zawierać od 1 do 8 różnych identyfikatorów stylów `{pid}` (zobacz conceptVector.providers)
@msg `variations` must list different style ids of job {job} `variations` musi zawierać różne identyfikatory stylów zadania {job}
@msg a provider with the id `{id}` is registered already Dostawca o identyfikatorze `{id}` jest już zarejestrowany
@msg job {job} has no results to insert: it was canceled Zadanie {job} nie ma wyników do wstawienia: zostało anulowane
@msg job {job} no longer applies: its document, image or image placement changed, so generate again Zadanie {job} jest już nieaktualne: zmienił się jego dokument, obraz lub położenie obrazu; wygeneruj je ponownie
@msg missing `provider` (see conceptVector.providers) Brak `provider` (zobacz conceptVector.providers)
@msg no Concept to Vector job {job}: it was never made, or was dropped (see conceptVector.results) Brak zadania Koncepcja na wektor {job}: nigdy nie powstało albo zostało odrzucone (zobacz conceptVector.results)
@msg no Concept to Vector provider `{name}` (see conceptVector.providers) Brak dostawcy Koncepcja na wektor `{name}` (zobacz conceptVector.providers)
@msg select one image or an unexpanded Image Trace object Zaznacz jeden obraz lub nierozwinięty obiekt obrysu obrazu
@msg the image is locked or hidden Obraz jest zablokowany lub ukryty
@msg the provider stopped with an internal error: {0} Dostawca zatrzymał się z błędem wewnętrznym: {0}
@msg the provider's results do not match the request or are malformed Wyniki dostawcy nie pasują do żądania lub są nieprawidłowe
@msg the results would have more than {0} anchor points: lower Detail or choose fewer styles Wyniki miałyby więcej niż {0} punktów kontrolnych: zmniejsz Szczegóły lub wybierz mniej stylów
@msg there is no room for the results to the right of the image Po prawej stronie obrazu nie ma miejsca na wyniki
@msg the image is on a layer with a clipping mask, which would hide the results Obraz jest na warstwie z maską przycinającą, która ukryłaby wyniki
@msg the image is on a layer with an opacity mask, which would hide the results Obraz jest na warstwie z maską krycia, która ukryłaby wyniki
@msg `output` must be "vector" `output` musi mieć wartość "vector"
@msg `{pid}` takes no prompt and makes vector art only `{pid}` nie przyjmuje promptu i tworzy tylko grafikę wektorową
@msg Making the Concept to Vector styles Tworzenie stylów Koncepcja na wektor
Can't render this file because it contains an unexpected character in line 2 and column 73.
+38
View File
@@ -7329,3 +7329,41 @@ swatch Yellow Green Verde-amarelado
Margin Margem
Box Caixa
Swatch Amostra
Concept to Vector Conceito para vetor
Concept to Vector… Conceito para vetor…
Cancel Concept to Vector Job Cancelar tarefa de Conceito para vetor
Concept to Vector Providers Provedores de Conceito para vetor
Concept to Vector Results Resultados de Conceito para vetor
Generate Concept to Vector Styles Gerar estilos de Conceito para vetor
Insert Concept to Vector Styles Inserir estilos de Conceito para vetor
Offline Image Trace styles, made on this computer Estilos de Rastreamento de Imagem offline, feitos neste computador
Offline styles do not use prompts Estilos offline não usam prompts
Styles Estilos
Ink Lines Linhas de tinta
Flat Color Cor chapada
Detailed Color Cor detalhada
Gray Tones Tons de cinza
Generate Gerar
Insert Selected Inserir selecionados
@msg Concept to Vector stopped: its thread ended without results (please report this bug) Conceito para vetor parou: seu thread terminou sem resultados (relate este bug)
@msg `detail` must be a whole number from 0 to 100 `detail` deve ser um número inteiro de 0 a 100
@msg `job` must be a job number from conceptVector.generate `job` deve ser um número de tarefa de conceptVector.generate
@msg `styles` must list 1 to 8 different style ids of `{pid}` (see conceptVector.providers) `styles` deve listar de 1 a 8 IDs de estilo diferentes de `{pid}` (consulte conceptVector.providers)
@msg `variations` must list different style ids of job {job} `variations` deve listar IDs de estilo diferentes da tarefa {job}
@msg a provider with the id `{id}` is registered already Já existe um provedor registrado com o ID `{id}`
@msg job {job} has no results to insert: it was canceled A tarefa {job} não tem resultados para inserir: ela foi cancelada
@msg job {job} no longer applies: its document, image or image placement changed, so generate again A tarefa {job} não se aplica mais: o documento, a imagem ou o posicionamento da imagem mudou; gere novamente
@msg missing `provider` (see conceptVector.providers) `provider` ausente (consulte conceptVector.providers)
@msg no Concept to Vector job {job}: it was never made, or was dropped (see conceptVector.results) Nenhuma tarefa de Conceito para vetor {job}: ela nunca foi criada ou foi descartada (consulte conceptVector.results)
@msg no Concept to Vector provider `{name}` (see conceptVector.providers) Nenhum provedor de Conceito para vetor `{name}` (consulte conceptVector.providers)
@msg select one image or an unexpanded Image Trace object Selecione uma imagem ou um objeto de Rastreamento de Imagem não expandido
@msg the image is locked or hidden A imagem está bloqueada ou oculta
@msg the provider stopped with an internal error: {0} O provedor parou com um erro interno: {0}
@msg the provider's results do not match the request or are malformed Os resultados do provedor não correspondem à solicitação ou estão malformados
@msg the results would have more than {0} anchor points: lower Detail or choose fewer styles Os resultados teriam mais de {0} pontos de ancoragem: reduza Detalhe ou escolha menos estilos
@msg there is no room for the results to the right of the image Não há espaço para os resultados à direita da imagem
@msg the image is on a layer with a clipping mask, which would hide the results A imagem está em uma camada com máscara de corte, que ocultaria os resultados
@msg the image is on a layer with an opacity mask, which would hide the results A imagem está em uma camada com máscara de opacidade, que ocultaria os resultados
@msg `output` must be "vector" `output` deve ser "vector"
@msg `{pid}` takes no prompt and makes vector art only `{pid}` não aceita prompt e cria apenas arte vetorial
@msg Making the Concept to Vector styles Criando os estilos de Conceito para vetor
Can't render this file because it contains an unexpected character in line 6 and column 47.
+38
View File
@@ -7345,3 +7345,41 @@ shape Open Открытый
Margin Поле
Box Рамка
Swatch Образец
Concept to Vector Концепт в вектор
Concept to Vector… Концепт в вектор…
Cancel Concept to Vector Job Отменить задание «Концепт в вектор»
Concept to Vector Providers Поставщики «Концепт в вектор»
Concept to Vector Results Результаты «Концепт в вектор»
Generate Concept to Vector Styles Создать стили «Концепт в вектор»
Insert Concept to Vector Styles Вставить стили «Концепт в вектор»
Offline Image Trace styles, made on this computer Офлайн-стили трассировки изображения, созданные на этом компьютере
Offline styles do not use prompts Офлайн-стили не используют запросы
Styles Стили
Ink Lines Линии тушью
Flat Color Плоский цвет
Detailed Color Детальный цвет
Gray Tones Оттенки серого
Generate Создать
Insert Selected Вставить выбранные
@msg Concept to Vector stopped: its thread ended without results (please report this bug) «Концепт в вектор» остановлен: его поток завершился без результатов (сообщите об этой ошибке)
@msg `detail` must be a whole number from 0 to 100 `detail` должно быть целым числом от 0 до 100
@msg `job` must be a job number from conceptVector.generate `job` должно быть номером задания из conceptVector.generate
@msg `styles` must list 1 to 8 different style ids of `{pid}` (see conceptVector.providers) `styles` должно содержать от 1 до 8 разных идентификаторов стилей `{pid}` (см. conceptVector.providers)
@msg `variations` must list different style ids of job {job} `variations` должно содержать разные идентификаторы стилей задания {job}
@msg a provider with the id `{id}` is registered already Поставщик с идентификатором `{id}` уже зарегистрирован
@msg job {job} has no results to insert: it was canceled У задания {job} нет результатов для вставки: оно отменено
@msg job {job} no longer applies: its document, image or image placement changed, so generate again Задание {job} больше не действует: изменились его документ, изображение или положение изображения; создайте его заново
@msg missing `provider` (see conceptVector.providers) Не указан `provider` (см. conceptVector.providers)
@msg no Concept to Vector job {job}: it was never made, or was dropped (see conceptVector.results) Нет задания «Концепт в вектор» {job}: оно не создавалось или было удалено (см. conceptVector.results)
@msg no Concept to Vector provider `{name}` (see conceptVector.providers) Нет поставщика «Концепт в вектор» `{name}` (см. conceptVector.providers)
@msg select one image or an unexpanded Image Trace object Выделите одно изображение или неразобранный объект трассировки изображения
@msg the image is locked or hidden Изображение заблокировано или скрыто
@msg the provider stopped with an internal error: {0} Поставщик остановился с внутренней ошибкой: {0}
@msg the provider's results do not match the request or are malformed Результаты поставщика не соответствуют запросу или повреждены
@msg the results would have more than {0} anchor points: lower Detail or choose fewer styles В результатах было бы больше {0} опорных точек: уменьшите «Детали» или выберите меньше стилей
@msg there is no room for the results to the right of the image Справа от изображения нет места для результатов
@msg the image is on a layer with a clipping mask, which would hide the results Изображение находится на слое с обтравочной маской, которая скрыла бы результаты
@msg the image is on a layer with an opacity mask, which would hide the results Изображение находится на слое с непрозрачной маской, которая скрыла бы результаты
@msg `output` must be "vector" `output` должно быть "vector"
@msg `{pid}` takes no prompt and makes vector art only `{pid}` не принимает запрос и создаёт только векторную графику
@msg Making the Concept to Vector styles Создание стилей «Концепт в вектор»
Can't render this file because it is too large.
+38
View File
@@ -8698,3 +8698,41 @@ digits Hindi Hindi
Margin Marginal
Box Ram
Swatch Färgruta
Concept to Vector Koncept till vektor
Concept to Vector… Koncept till vektor…
Cancel Concept to Vector Job Avbryt jobbet Koncept till vektor
Concept to Vector Providers Leverantörer för Koncept till vektor
Concept to Vector Results Resultat för Koncept till vektor
Generate Concept to Vector Styles Skapa stilar för Koncept till vektor
Insert Concept to Vector Styles Infoga stilar för Koncept till vektor
Offline Image Trace styles, made on this computer Offlinestilar för bildkalkering, skapade på den här datorn
Offline styles do not use prompts Offlinestilar använder inga prompter
Styles Stilar
Ink Lines Tuschlinjer
Flat Color Platt färg
Detailed Color Detaljerad färg
Gray Tones Gråtoner
Generate Skapa
Insert Selected Infoga markerade
@msg Concept to Vector stopped: its thread ended without results (please report this bug) Koncept till vektor stoppades: dess tråd slutade utan resultat (rapportera felet)
@msg `detail` must be a whole number from 0 to 100 `detail` måste vara ett heltal från 0 till 100
@msg `job` must be a job number from conceptVector.generate `job` måste vara ett jobbnummer från conceptVector.generate
@msg `styles` must list 1 to 8 different style ids of `{pid}` (see conceptVector.providers) `styles` måste ange 1 till 8 olika stil-id:n för `{pid}` (se conceptVector.providers)
@msg `variations` must list different style ids of job {job} `variations` måste ange olika stil-id:n för jobb {job}
@msg a provider with the id `{id}` is registered already En leverantör med id `{id}` är redan registrerad
@msg job {job} has no results to insert: it was canceled Jobb {job} har inga resultat att infoga: det avbröts
@msg job {job} no longer applies: its document, image or image placement changed, so generate again Jobb {job} gäller inte längre: dess dokument, bild eller bildens placering har ändrats; skapa det igen
@msg missing `provider` (see conceptVector.providers) `provider` saknas (se conceptVector.providers)
@msg no Concept to Vector job {job}: it was never made, or was dropped (see conceptVector.results) Det finns inget jobb {job} för Koncept till vektor: det skapades aldrig eller har tagits bort (se conceptVector.results)
@msg no Concept to Vector provider `{name}` (see conceptVector.providers) Det finns ingen leverantör `{name}` för Koncept till vektor (se conceptVector.providers)
@msg select one image or an unexpanded Image Trace object Markera en bild eller ett bildkalkeringsobjekt som inte har expanderats
@msg the image is locked or hidden Bilden är låst eller dold
@msg the provider stopped with an internal error: {0} Leverantören stoppades av ett internt fel: {0}
@msg the provider's results do not match the request or are malformed Leverantörens resultat stämmer inte med begäran eller är felaktiga
@msg the results would have more than {0} anchor points: lower Detail or choose fewer styles Resultaten skulle ha fler än {0} ankarpunkter: sänk Detalj eller välj färre stilar
@msg there is no room for the results to the right of the image Det finns ingen plats för resultaten till höger om bilden
@msg the image is on a layer with a clipping mask, which would hide the results Bilden ligger på ett lager med urklippsmask, som skulle dölja resultaten
@msg the image is on a layer with an opacity mask, which would hide the results Bilden ligger på ett lager med opacitetsmask, som skulle dölja resultaten
@msg `output` must be "vector" `output` måste vara "vector"
@msg `{pid}` takes no prompt and makes vector art only `{pid}` tar ingen prompt och skapar bara vektorgrafik
@msg Making the Concept to Vector styles Skapar stilar för Koncept till vektor
Can't render this file because it is too large.
+38
View File
@@ -7212,3 +7212,41 @@ breakText Glyphs Glifler
Margin Kenar Boşluğu
Box Kutu
Swatch Renk Örneği
Concept to Vector Konseptten Vektöre
Concept to Vector… Konseptten Vektöre…
Cancel Concept to Vector Job Konseptten Vektöre İşini İptal Et
Concept to Vector Providers Konseptten Vektöre Sağlayıcıları
Concept to Vector Results Konseptten Vektöre Sonuçları
Generate Concept to Vector Styles Konseptten Vektöre Stilleri Oluştur
Insert Concept to Vector Styles Konseptten Vektöre Stillerini Ekle
Offline Image Trace styles, made on this computer Çevrimdışı Görüntü İzleme stilleri, bu bilgisayarda yapılır
Offline styles do not use prompts Çevrimdışı stiller istem kullanmaz
Styles Stiller
Ink Lines Mürekkep Çizgileri
Flat Color Düz Renk
Detailed Color Ayrıntılı Renk
Gray Tones Gri Tonlar
Generate Oluştur
Insert Selected Seçilenleri Ekle
@msg Concept to Vector stopped: its thread ended without results (please report this bug) Konseptten Vektöre durdu: iş parçacığı sonuç vermeden sona erdi (lütfen bu hatayı bildirin)
@msg `detail` must be a whole number from 0 to 100 `detail` 0 ile 100 arasında bir tam sayı olmalıdır
@msg `job` must be a job number from conceptVector.generate `job` conceptVector.generate tarafından verilen bir iş numarası olmalıdır
@msg `styles` must list 1 to 8 different style ids of `{pid}` (see conceptVector.providers) `styles`, `{pid}` için 1 ile 8 arasında farklı stil kimliği listelemelidir (bkz. conceptVector.providers)
@msg `variations` must list different style ids of job {job} `variations`, {job} işinin farklı stil kimliklerini listelemelidir
@msg a provider with the id `{id}` is registered already `{id}` kimlikli bir sağlayıcı zaten kayıtlı
@msg job {job} has no results to insert: it was canceled {job} işinin eklenecek sonucu yok: iptal edildi
@msg job {job} no longer applies: its document, image or image placement changed, so generate again {job} işi artık geçerli değil: belgesi, görüntüsü veya görüntünün yerleşimi değişti; yeniden oluşturun
@msg missing `provider` (see conceptVector.providers) `provider` eksik (bkz. conceptVector.providers)
@msg no Concept to Vector job {job}: it was never made, or was dropped (see conceptVector.results) {job} numaralı Konseptten Vektöre işi yok: hiç yapılmadı veya atıldı (bkz. conceptVector.results)
@msg no Concept to Vector provider `{name}` (see conceptVector.providers) `{name}` adlı Konseptten Vektöre sağlayıcısı yok (bkz. conceptVector.providers)
@msg select one image or an unexpanded Image Trace object Bir görüntü veya genişletilmemiş bir Görüntü İzleme nesnesi seçin
@msg the image is locked or hidden Görüntü kilitli veya gizli
@msg the provider stopped with an internal error: {0} Sağlayıcı dahili bir hatayla durdu: {0}
@msg the provider's results do not match the request or are malformed Sağlayıcının sonuçları istekle eşleşmiyor veya bozuk
@msg the results would have more than {0} anchor points: lower Detail or choose fewer styles Sonuçlarda {0} bağlantı noktasından fazlası olurdu: Ayrıntı'yı düşürün veya daha az stil seçin
@msg there is no room for the results to the right of the image Görüntünün sağında sonuçlar için yer yok
@msg the image is on a layer with a clipping mask, which would hide the results Görüntü, sonuçları gizleyecek bir kırpma maskesi olan bir katmanda
@msg the image is on a layer with an opacity mask, which would hide the results Görüntü, sonuçları gizleyecek bir opaklık maskesi olan bir katmanda
@msg `output` must be "vector" `output` "vector" olmalıdır
@msg `{pid}` takes no prompt and makes vector art only `{pid}` istem almaz ve yalnızca vektör çizim yapar
@msg Making the Concept to Vector styles Konseptten Vektöre stilleri yapılıyor
Can't render this file because it contains an unexpected character in line 5 and column 25.
+38
View File
@@ -6865,3 +6865,41 @@ breakText Glyphs Гліфи
Margin Поле
Box Рамка
Swatch Зразок
Concept to Vector Концепт у вектор
Concept to Vector… Концепт у вектор…
Cancel Concept to Vector Job Скасувати завдання «Концепт у вектор»
Concept to Vector Providers Постачальники «Концепт у вектор»
Concept to Vector Results Результати «Концепт у вектор»
Generate Concept to Vector Styles Створити стилі «Концепт у вектор»
Insert Concept to Vector Styles Вставити стилі «Концепт у вектор»
Offline Image Trace styles, made on this computer Офлайн-стилі трасування зображення, створені на цьому комп’ютері
Offline styles do not use prompts Офлайн-стилі не використовують запити
Styles Стилі
Ink Lines Лінії тушшю
Flat Color Плаский колір
Detailed Color Детальний колір
Gray Tones Відтінки сірого
Generate Створити
Insert Selected Вставити вибрані
@msg Concept to Vector stopped: its thread ended without results (please report this bug) «Концепт у вектор» зупинено: його потік завершився без результатів (повідомте про цю помилку)
@msg `detail` must be a whole number from 0 to 100 `detail` має бути цілим числом від 0 до 100
@msg `job` must be a job number from conceptVector.generate `job` має бути номером завдання з conceptVector.generate
@msg `styles` must list 1 to 8 different style ids of `{pid}` (see conceptVector.providers) `styles` має містити від 1 до 8 різних ідентифікаторів стилів `{pid}` (див. conceptVector.providers)
@msg `variations` must list different style ids of job {job} `variations` має містити різні ідентифікатори стилів завдання {job}
@msg a provider with the id `{id}` is registered already Постачальника з ідентифікатором `{id}` уже зареєстровано
@msg job {job} has no results to insert: it was canceled Завдання {job} не має результатів для вставлення: його скасовано
@msg job {job} no longer applies: its document, image or image placement changed, so generate again Завдання {job} більше не чинне: змінилися його документ, зображення або розташування зображення; створіть його знову
@msg missing `provider` (see conceptVector.providers) Не вказано `provider` (див. conceptVector.providers)
@msg no Concept to Vector job {job}: it was never made, or was dropped (see conceptVector.results) Немає завдання «Концепт у вектор» {job}: його не створювали або відкинули (див. conceptVector.results)
@msg no Concept to Vector provider `{name}` (see conceptVector.providers) Немає постачальника «Концепт у вектор» `{name}` (див. conceptVector.providers)
@msg select one image or an unexpanded Image Trace object Виберіть одне зображення або нерозібраний об’єкт трасування зображення
@msg the image is locked or hidden Зображення заблоковане або приховане
@msg the provider stopped with an internal error: {0} Постачальник зупинився з внутрішньою помилкою: {0}
@msg the provider's results do not match the request or are malformed Результати постачальника не відповідають запиту або пошкоджені
@msg the results would have more than {0} anchor points: lower Detail or choose fewer styles Результати мали б понад {0} опорних точок: зменште «Деталі» або виберіть менше стилів
@msg there is no room for the results to the right of the image Праворуч від зображення немає місця для результатів
@msg the image is on a layer with a clipping mask, which would hide the results Зображення на шарі з обтравною маскою, яка приховала б результати
@msg the image is on a layer with an opacity mask, which would hide the results Зображення на шарі з маскою непрозорості, яка приховала б результати
@msg `output` must be "vector" `output` має бути "vector"
@msg `{pid}` takes no prompt and makes vector art only `{pid}` не приймає запиту і створює лише векторну графіку
@msg Making the Concept to Vector styles Створення стилів «Концепт у вектор»
Can't render this file because it is too large.
+38
View File
@@ -6866,3 +6866,41 @@ breakText Glyphs Glyph
Margin Lề
Box Khung
Swatch Mẫu màu
Concept to Vector Ý tưởng thành vector
Concept to Vector… Ý tưởng thành vector…
Cancel Concept to Vector Job Hủy tác vụ Ý tưởng thành vector
Concept to Vector Providers Nhà cung cấp Ý tưởng thành vector
Concept to Vector Results Kết quả Ý tưởng thành vector
Generate Concept to Vector Styles Tạo kiểu Ý tưởng thành vector
Insert Concept to Vector Styles Chèn kiểu Ý tưởng thành vector
Offline Image Trace styles, made on this computer Kiểu vector hóa ảnh ngoại tuyến, tạo trên máy tính này
Offline styles do not use prompts Kiểu ngoại tuyến không dùng lời nhắc
Styles Kiểu
Ink Lines Nét mực
Flat Color Màu phẳng
Detailed Color Màu chi tiết
Gray Tones Tông xám
Generate Tạo
Insert Selected Chèn mục đã chọn
@msg Concept to Vector stopped: its thread ended without results (please report this bug) Ý tưởng thành vector đã dừng: luồng của nó kết thúc mà không có kết quả (vui lòng báo cáo lỗi này)
@msg `detail` must be a whole number from 0 to 100 `detail` phải là số nguyên từ 0 đến 100
@msg `job` must be a job number from conceptVector.generate `job` phải là số tác vụ từ conceptVector.generate
@msg `styles` must list 1 to 8 different style ids of `{pid}` (see conceptVector.providers) `styles` phải liệt kê từ 1 đến 8 ID kiểu khác nhau của `{pid}` (xem conceptVector.providers)
@msg `variations` must list different style ids of job {job} `variations` phải liệt kê các ID kiểu khác nhau của tác vụ {job}
@msg a provider with the id `{id}` is registered already Đã đăng ký một nhà cung cấp có ID `{id}`
@msg job {job} has no results to insert: it was canceled Tác vụ {job} không có kết quả để chèn: tác vụ đã bị hủy
@msg job {job} no longer applies: its document, image or image placement changed, so generate again Tác vụ {job} không còn hiệu lực: tài liệu, ảnh hoặc vị trí ảnh của nó đã thay đổi, hãy tạo lại
@msg missing `provider` (see conceptVector.providers) Thiếu `provider` (xem conceptVector.providers)
@msg no Concept to Vector job {job}: it was never made, or was dropped (see conceptVector.results) Không có tác vụ Ý tưởng thành vector {job}: tác vụ chưa từng được tạo hoặc đã bị loại bỏ (xem conceptVector.results)
@msg no Concept to Vector provider `{name}` (see conceptVector.providers) Không có nhà cung cấp Ý tưởng thành vector `{name}` (xem conceptVector.providers)
@msg select one image or an unexpanded Image Trace object Hãy chọn một ảnh hoặc một đối tượng vector hóa ảnh chưa mở rộng
@msg the image is locked or hidden Ảnh đang bị khóa hoặc bị ẩn
@msg the provider stopped with an internal error: {0} Nhà cung cấp đã dừng do lỗi nội bộ: {0}
@msg the provider's results do not match the request or are malformed Kết quả của nhà cung cấp không khớp với yêu cầu hoặc bị sai định dạng
@msg the results would have more than {0} anchor points: lower Detail or choose fewer styles Kết quả sẽ có hơn {0} điểm neo: hãy giảm Chi tiết hoặc chọn ít kiểu hơn
@msg there is no room for the results to the right of the image Không còn chỗ cho kết quả ở bên phải ảnh
@msg the image is on a layer with a clipping mask, which would hide the results Ảnh nằm trên một lớp có mặt nạ cắt, mặt nạ này sẽ che các kết quả
@msg the image is on a layer with an opacity mask, which would hide the results Ảnh nằm trên một lớp có mặt nạ độ mờ, mặt nạ này sẽ che các kết quả
@msg `output` must be "vector" `output` phải là "vector"
@msg `{pid}` takes no prompt and makes vector art only `{pid}` không nhận lời nhắc và chỉ tạo hình vector
@msg Making the Concept to Vector styles Đang tạo kiểu Ý tưởng thành vector
Can't render this file because it contains an unexpected character in line 204 and column 5.
+38
View File
@@ -7094,3 +7094,41 @@ breakText Glyphs 字形
Margin 边距
Box 框
Swatch 色板
Concept to Vector 概念转矢量
Concept to Vector… 概念转矢量…
Cancel Concept to Vector Job 取消概念转矢量任务
Concept to Vector Providers 概念转矢量提供程序
Concept to Vector Results 概念转矢量结果
Generate Concept to Vector Styles 生成概念转矢量样式
Insert Concept to Vector Styles 插入概念转矢量样式
Offline Image Trace styles, made on this computer 离线图像描摹样式,在此计算机上生成
Offline styles do not use prompts 离线样式不使用提示词
Styles 样式
Ink Lines 墨线
Flat Color 平涂色
Detailed Color 细节色彩
Gray Tones 灰色调
Generate 生成
Insert Selected 插入所选项
@msg Concept to Vector stopped: its thread ended without results (please report this bug) 概念转矢量已停止:其线程未产生结果就结束了(请报告此错误)
@msg `detail` must be a whole number from 0 to 100 `detail` 必须是 0 到 100 之间的整数
@msg `job` must be a job number from conceptVector.generate `job` 必须是 conceptVector.generate 给出的任务编号
@msg `styles` must list 1 to 8 different style ids of `{pid}` (see conceptVector.providers) `styles` 必须列出 `{pid}` 的 1 到 8 个不同样式 ID(参见 conceptVector.providers)
@msg `variations` must list different style ids of job {job} `variations` 必须列出任务 {job} 的不同样式 ID
@msg a provider with the id `{id}` is registered already ID 为 `{id}` 的提供程序已注册
@msg job {job} has no results to insert: it was canceled 任务 {job} 没有可插入的结果:它已被取消
@msg job {job} no longer applies: its document, image or image placement changed, so generate again 任务 {job} 已失效:其文档、图像或图像位置已更改,请重新生成
@msg missing `provider` (see conceptVector.providers) 缺少 `provider`(参见 conceptVector.providers)
@msg no Concept to Vector job {job}: it was never made, or was dropped (see conceptVector.results) 没有概念转矢量任务 {job}:它从未生成或已被丢弃(参见 conceptVector.results)
@msg no Concept to Vector provider `{name}` (see conceptVector.providers) 没有概念转矢量提供程序 `{name}`(参见 conceptVector.providers)
@msg select one image or an unexpanded Image Trace object 请选择一个图像或一个未扩展的图像描摹对象
@msg the image is locked or hidden 图像已锁定或隐藏
@msg the provider stopped with an internal error: {0} 提供程序因内部错误而停止:{0}
@msg the provider's results do not match the request or are malformed 提供程序的结果与请求不符或格式错误
@msg the results would have more than {0} anchor points: lower Detail or choose fewer styles 结果将超过 {0} 个锚点:请降低细节或选择较少的样式
@msg there is no room for the results to the right of the image 图像右侧没有放置结果的空间
@msg the image is on a layer with a clipping mask, which would hide the results 图像位于带剪切蒙版的图层上,剪切蒙版会遮住结果
@msg the image is on a layer with an opacity mask, which would hide the results 图像位于带不透明度蒙版的图层上,不透明度蒙版会遮住结果
@msg `output` must be "vector" `output` 必须是 "vector"
@msg `{pid}` takes no prompt and makes vector art only `{pid}` 不接受提示词,且只生成矢量图稿
@msg Making the Concept to Vector styles 正在生成概念转矢量样式
Can't render this file because it contains an unexpected character in line 2 and column 73.
+38
View File
@@ -6900,3 +6900,41 @@ breakText Glyphs 字符
Margin 邊距
Box 框
Swatch 色票
Concept to Vector 概念轉向量
Concept to Vector… 概念轉向量…
Cancel Concept to Vector Job 取消概念轉向量工作
Concept to Vector Providers 概念轉向量提供者
Concept to Vector Results 概念轉向量結果
Generate Concept to Vector Styles 產生概念轉向量樣式
Insert Concept to Vector Styles 插入概念轉向量樣式
Offline Image Trace styles, made on this computer 離線影像描圖樣式,在這部電腦上製作
Offline styles do not use prompts 離線樣式不使用提示詞
Styles 樣式
Ink Lines 墨線
Flat Color 平塗色
Detailed Color 細節色彩
Gray Tones 灰色調
Generate 產生
Insert Selected 插入所選項目
@msg Concept to Vector stopped: its thread ended without results (please report this bug) 概念轉向量已停止:其執行緒未產生結果就結束了(請回報此錯誤)
@msg `detail` must be a whole number from 0 to 100 `detail` 必須是介於 0 到 100 的整數
@msg `job` must be a job number from conceptVector.generate `job` 必須是 conceptVector.generate 提供的工作編號
@msg `styles` must list 1 to 8 different style ids of `{pid}` (see conceptVector.providers) `styles` 必須列出 `{pid}` 的 1 到 8 個不同樣式 ID(請參閱 conceptVector.providers)
@msg `variations` must list different style ids of job {job} `variations` 必須列出工作 {job} 的不同樣式 ID
@msg a provider with the id `{id}` is registered already ID 為 `{id}` 的提供者已經註冊
@msg job {job} has no results to insert: it was canceled 工作 {job} 沒有可插入的結果:它已取消
@msg job {job} no longer applies: its document, image or image placement changed, so generate again 工作 {job} 已失效:其文件、影像或影像位置已變更,請重新產生
@msg missing `provider` (see conceptVector.providers) 未提供 `provider`(請參閱 conceptVector.providers)
@msg no Concept to Vector job {job}: it was never made, or was dropped (see conceptVector.results) 沒有概念轉向量工作 {job}:它從未產生或已被捨棄(請參閱 conceptVector.results)
@msg no Concept to Vector provider `{name}` (see conceptVector.providers) 沒有概念轉向量提供者 `{name}`(請參閱 conceptVector.providers)
@msg select one image or an unexpanded Image Trace object 請選取一個影像或一個未展開的影像描圖物件
@msg the image is locked or hidden 影像已鎖定或隱藏
@msg the provider stopped with an internal error: {0} 提供者因內部錯誤而停止:{0}
@msg the provider's results do not match the request or are malformed 提供者的結果與要求不符或格式錯誤
@msg the results would have more than {0} anchor points: lower Detail or choose fewer styles 結果將超過 {0} 個錨點:請降低細節或選擇較少的樣式
@msg there is no room for the results to the right of the image 影像右側沒有放置結果的空間
@msg the image is on a layer with a clipping mask, which would hide the results 影像位於帶有剪裁遮色片的圖層上,剪裁遮色片會遮住結果
@msg the image is on a layer with an opacity mask, which would hide the results 影像位於帶有不透明度遮色片的圖層上,不透明度遮色片會遮住結果
@msg `output` must be "vector" `output` 必須是 "vector"
@msg `{pid}` takes no prompt and makes vector art only `{pid}` 不接受提示詞,且只製作向量圖稿
@msg Making the Concept to Vector styles 正在製作概念轉向量樣式
Can't render this file because it contains an unexpected character in line 6 and column 47.
+2
View File
@@ -275,6 +275,8 @@ pub struct VectorcraftApp {
pub placing: placing::Placing,
/// Image Traces running off the UI thread ([`trace_runs`]).
pub trace_runs: trace_runs::TraceRuns,
/// The Concept to Vector panel's settings and its run off the UI thread ([`panels::concept_vector`]).
pub concept_runs: panels::concept_vector::ConceptRuns,
/// Data Recovery's timer and startup question ([`recovery`]).
pub recovery: recovery::Timer,
/// Modifiers the keyboard holds (from the host's input), given back after synthetic input.
+3
View File
@@ -97,6 +97,9 @@ pub fn context_items(app: &VectorcraftApp) -> Vec<Item> {
// page. Its submenu holds only toggles, so it shows the check mark (`render_items`).
v.push(sub("Spelling", vec![c("Auto Spell Check", "edit.autoSpellCheck")]));
}
// One image or unexpanded Image Trace object; left out otherwise, as the menu leaves out
// every command that can't run.
v.push(c("Concept to Vector…", crate::panels::concept_vector::OPEN));
v.extend([c("Make Guides", "view.guides.make"), Sep, sub("Transform", transform_items())]);
if intertwine.is_none() {
v.push(sub("Arrange", arrange_items()));
+1
View File
@@ -694,6 +694,7 @@ fn run_ui_part6(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option<Result<
"tool.setOption" => app.session.set_tool_option_cmd(p),
"effect.dialog" => crate::dialogs::open_effect_dialog(app, p),
"ui.recolorDialog" => crate::dialogs::recolor::open(app, p),
crate::panels::concept_vector::OPEN => crate::panels::concept_vector::open(app),
"ui.cropImage" if !selected_image(app, |_| true) => Err("select an image".into()),
"ui.cropImage" => {
app.select_tool(vectorcraft_tools::cropimage::ID);
+1
View File
@@ -255,6 +255,7 @@ pub fn enabled(app: &VectorcraftApp, id: &str) -> bool {
id if saved_view_slot(id).is_some() => saved_view(app, id).is_some(),
"effect.dialog" | "ui.recolorDialog" | "ui.effectGalleryDialog" => app.session.active().is_some_and(|d| !d.selection.is_empty()),
"ui.cropImage" => selected_image(app, |_| true),
crate::panels::concept_vector::OPEN => crate::panels::concept_vector::eligible(app).is_ok(),
"effect.applyLast" | "effect.last" => app.last_effect.is_some() && app.session.active().is_some_and(|d| !d.selection.is_empty()),
"pathfinder.repeat" => app.last_pathfinder.as_ref().is_some_and(|op| {
let min = crate::panels::pathfinder::minimum_operands(op);
+3
View File
@@ -324,6 +324,8 @@ pub fn menu_tree_named(english_names: bool) -> Vec<(&'static str, Vec<Item>)> {
c("Expand", "imageTrace.expand"),
],
),
// Opens the Concept to Vector panel for the selected image or Image Trace object.
c("Concept to Vector…", crate::panels::concept_vector::OPEN),
sub(
"Text Wrap",
vec![
@@ -664,6 +666,7 @@ pub fn menu_tree_named(english_names: bool) -> Vec<(&'static str, Vec<Item>)> {
panel("Color Guide", "colorGuide"),
panel("Color Themes", "colorThemes"),
panel("Color Wheel", crate::panels::color_wheel::ID),
panel("Concept to Vector", crate::panels::concept_vector::ID),
panel("CSS Properties", crate::panels::css_properties::ID),
panel("Document Info", "docInfo"),
panel("Flattener Preview", crate::panels::flattener_preview::ID),
+6
View File
@@ -745,6 +745,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
"",
"{colors?: n (an n-colour job: n rows, Scale Tints) | [colour] (new colours to assign, in order; with no art selected and no group they are the rows, and OK saves them as a new colour group, field `groupName`: the Color Guide's Edit or Apply Colors), library?: id or name; or \"document\" (Limit to Library; \"\" the first library), group?: colour group (Edit or Apply Color Group: OK rewrites the group with the new colours and recolours the selected art, if any)} open Recolor Artwork (dialog `recolor`; engine: recolor.reduce / recolor.apply)",
),
(
"ui.conceptVector",
"Concept to Vector…",
"",
"{} open the Concept to Vector panel for the selected image or unexpanded Image Trace object; an error when the selection is not one such object, unlocked and shown (engine: conceptVector.generate / conceptVector.insert)",
),
(
"ui.cropImage",
"Crop Image",
+1
View File
@@ -56,6 +56,7 @@ pub fn long_operation_busy(app: &VectorcraftApp) -> bool {
|| !app.plugin_runs.running.is_empty()
|| !app.placing.pending.is_empty()
|| !app.trace_runs.running.is_empty()
|| app.concept_runs.busy()
}
/// Does opening happen off the UI thread here? Not on wasm (no threads), in unit tests (they look
+2
View File
@@ -16,6 +16,7 @@ pub mod color;
pub mod color_guide;
pub mod color_themes;
pub mod color_wheel;
pub mod concept_vector;
pub mod css_properties;
pub mod doc_info;
pub mod flattener_preview;
@@ -181,6 +182,7 @@ pub fn show_icon_panel(app: &mut VectorcraftApp, ui: &mut Ui, id: &str) {
variables::ID => variables::show(app, ui),
"colorThemes" => color_themes::show(app, ui),
color_wheel::ID => color_wheel::show(app, ui),
concept_vector::ID => concept_vector::show(app, ui),
links::ID => links::show(app, ui),
asset_export::ID => asset_export::show(app, ui),
css_properties::ID => css_properties::show(app, ui),
+582
View File
@@ -0,0 +1,582 @@
//! Concept to Vector panel (Window › Concept to Vector, Object › Concept to Vector…): vector
//! variations of the selected image or unexpanded Image Trace object, one for each ticked style,
//! compared side by side and inserted to the right of the image.
//!
//! The panel calls the built-in provider ([`offline::ID`]), whose styles are made with Image Trace
//! on this computer: its prompt field is disabled and it makes vector art only. Generate prepares
//! the request at once (`conceptVector.generate`'s checks) and runs the provider on a thread of its
//! own ([`ConceptRuns`]); a new Generate cancels the one running. Results from another provider
//! are named as that provider names its styles. The results stay in this session
//! until Insert Selected puts the ticked ones in the document as one undo step
//! (`conceptVector.insert`). The web build has no thread for it, so it makes one part a frame
//! (the built-in provider: the image decoded, a style's colour layers found, or one colour layer
//! traced), and Cancel takes effect before the next part. Unit tests that set neither
//! `off_the_ui_thread` nor `by_frames` run the command at once.
use std::sync::Arc;
use std::sync::atomic::{AtomicU64, Ordering};
use std::sync::mpsc::{Receiver, TryRecvError, channel};
use egui::{Color32, Pos2, Rect, Sense, Stroke, Ui, vec2};
use serde_json::{Value, json};
use vectorcraft_doc::cancel::CancelToken;
use vectorcraft_engine::cmd::conceptvector::{ConceptRun, PartRun, provider_error};
use vectorcraft_engine::concept_vector::{MAX_STYLES, ProviderError, Variation, offline};
use crate::VectorcraftApp;
use crate::widgets::{self, dim_label};
pub const ID: &str = "conceptVector";
/// The UI command that opens the panel for the selected image.
pub const OPEN: &str = "ui.conceptVector";
/// What the status bar says while styles are made.
const LABEL: &str = "Making the Concept to Vector styles";
/// The most points a preview draws; the points past them are left out of it.
const PREVIEW_POINTS: usize = 40_000;
/// A preview's height in points.
const PREVIEW_H: f32 = 110.0;
/// Pixels per point of a preview's painted image.
const PREVIEW_SCALE: f32 = 2.0;
/// The thinnest a preview draws a stroke, in points, so that thin lines still show.
const MIN_STROKE: f32 = 0.5;
/// What a run's thread hands back.
type Done = (ConceptRun, Result<Vec<Variation>, ProviderError>);
/// How a Generate runs.
enum Work {
/// On a thread of its own, which hands back its results.
Thread(Receiver<Done>),
/// On the UI thread, one part a frame ([`ConceptRun::run_part`]), where no thread can run it.
Frames(Box<ConceptRun>, PartRun),
}
/// A Generate running.
struct Running {
token: CancelToken,
/// Styles made and in all.
steps: Arc<[AtomicU64; 2]>,
work: Work,
}
/// One variation as the panel draws it: its fills and strokes painted into `image` in the order of
/// its paths.
struct Preview {
style: String,
label: String,
aspect: f32,
image: egui::ColorImage,
/// `image`, once drawn.
texture: Option<egui::TextureHandle>,
warnings: Vec<String>,
}
/// The job the panel shows.
struct Shown {
job: u64,
previews: Vec<Preview>,
/// The styles ticked for Insert Selected.
picked: Vec<String>,
}
/// The panel's settings and its run.
pub struct ConceptRuns {
styles: Vec<String>,
detail: u8,
running: Option<Running>,
shown: Option<Shown>,
/// Set by unit tests whose app makes styles off the UI thread.
pub(crate) off_the_ui_thread: bool,
/// Set by unit tests whose app makes styles one a frame, as the web build does.
pub(crate) by_frames: bool,
}
impl Default for ConceptRuns {
fn default() -> Self {
Self {
styles: offline::STYLES.iter().map(|s| s.id.to_string()).collect(),
detail: 50,
running: None,
shown: None,
off_the_ui_thread: false,
by_frames: false,
}
}
}
impl ConceptRuns {
/// Is a Generate running?
pub fn busy(&self) -> bool {
self.running.is_some()
}
/// The job the panel shows.
pub fn job(&self) -> Option<u64> {
self.shown.as_ref().map(|s| s.job)
}
}
/// The params of `conceptVector.generate` for the panel's settings.
fn params(app: &VectorcraftApp) -> Value {
json!({ "provider": offline::ID, "styles": app.concept_runs.styles, "detail": app.concept_runs.detail })
}
/// Whether the panel can make styles of the selection; else why not.
pub fn eligible(app: &VectorcraftApp) -> Result<(), String> {
let p = json!({ "provider": offline::ID, "styles": [offline::STYLES[0].id] });
ConceptRun::prepare(&app.session, &p).map(|_| ()).map_err(|e| match e {
vectorcraft_engine::EngineError::BadParams { msg, .. } => msg,
e => e.to_string(),
})
}
/// `ui.conceptVector`: opens the panel for the selection; an error when it has nothing to use.
pub fn open(app: &mut VectorcraftApp) -> Result<Value, String> {
eligible(app)?;
app.run("window.panel.activate", json!({ "panel": ID }))
}
/// Makes the ticked styles of the selection: off the UI thread where it can; on the web, one part
/// a frame; else (unit tests, `VECTORCRAFT_SYNC_OPEN`) at once.
pub fn generate(app: &mut VectorcraftApp) -> Result<(), String> {
let p = params(app);
let frames = cfg!(target_arch = "wasm32") || app.concept_runs.by_frames;
if !(frames || app.concept_runs.off_the_ui_thread || crate::opening::available()) {
let v = app.run("conceptVector.generate", p)?;
show_job(app, &v);
return Ok(());
}
let run = ConceptRun::prepare(&app.session, &p).map_err(|e| e.to_string())?;
cancel(app);
let token = CancelToken::new();
let steps = Arc::new([AtomicU64::new(0), AtomicU64::new(run.style_count() as u64)]);
let work = if frames {
Work::Frames(Box::new(run), PartRun::default())
} else {
let (tx, done) = channel();
let stop = token.clone();
let counts = Arc::clone(&steps);
std::thread::Builder::new()
.name("vectorcraft-concept".into())
.spawn(move || {
let [done_now, total_now] = &*counts;
let report = |done: u64, total: u64| {
done_now.store(done, Ordering::Relaxed);
total_now.store(total, Ordering::Relaxed);
!stop.is_cancelled()
};
let made = run.run(&report);
// The app may have quit meanwhile: nothing to hand it to.
let _ = tx.send((run, made));
})
.map_err(|e| e.to_string())?;
Work::Thread(done)
};
app.concept_runs.running = Some(Running { token, steps, work });
if let Some(ctx) = &app.ui_ctx {
ctx.request_repaint();
}
app.status(format!("{}…", crate::i18n::msg(LABEL)));
Ok(())
}
/// Cancel: the run stops at its next check (on the web, before its next part), and its results
/// are dropped.
pub fn cancel(app: &mut VectorcraftApp) {
if let Some(r) = app.concept_runs.running.take() {
r.token.cancel();
if app.ui.status == format!("{}…", crate::i18n::msg(LABEL)) {
app.ui.status.clear();
}
}
}
/// Each frame: makes the next part of a run made one part a frame, and keeps a finished run's
/// results as a job and shows it. Not while a dialog or an interaction is open, as
/// [`crate::trace_runs::poll`].
pub fn poll(app: &mut VectorcraftApp) {
if app.ui.dialog.is_some() || app.session.in_interaction() {
return;
}
let Some(r) = app.concept_runs.running.as_mut() else { return };
let ended = match &mut r.work {
Work::Thread(_) => None,
Work::Frames(run, made) => {
let stop = r.token.clone();
match run.run_part(made, &|_, _| !stop.is_cancelled()) {
Ok(false) => {
r.steps[0].store(made.styles_done() as u64, Ordering::Relaxed);
if let Some(ctx) = &app.ui_ctx {
ctx.request_repaint();
}
return;
}
Ok(true) => Some(Ok(())),
Err(e) => Some(Err(e)),
}
}
};
let received = match (&ended, &r.work) {
(None, Work::Thread(rx)) => match rx.try_recv() {
Ok(done) => Some(done),
Err(TryRecvError::Empty) => return,
Err(TryRecvError::Disconnected) => None,
},
_ => None,
};
let Some(r) = app.concept_runs.running.take() else { return };
let done = match (ended, r.work) {
(Some(end), Work::Frames(run, made)) => Some((*run, end.map(|()| made.made()))),
_ => received,
};
finish(app, &r.token, done);
}
/// Keeps a run's results `done` as a job and shows it; else why there are none, in the status bar.
/// Nothing when `token` was canceled.
fn finish(app: &mut VectorcraftApp, token: &CancelToken, done: Option<Done>) {
if app.ui.status == format!("{}…", crate::i18n::msg(LABEL)) {
app.ui.status.clear();
}
if token.is_cancelled() {
return;
}
match done {
// Nothing is kept or shown when the run's document has closed.
Some((run, Ok(made))) => {
if let Some(v) = run.finish(&mut app.session, made) {
show_job(app, &v);
}
}
Some((_, Err(e))) => app.status(provider_error(e).to_string()),
None => app.status("Concept to Vector stopped: its thread ended without results (please report this bug)"),
}
}
/// Shows the variations of `job` (a job as `conceptVector.generate` returns it), every one ticked,
/// each named as the job names its style: by the name its provider gives the style.
fn show_job(app: &mut VectorcraftApp, job: &Value) {
let Some(id) = job["job"].as_u64() else { return };
let Some((variations, (w, h))) = app.session.concept_variations(id) else { return };
let listed = job["variations"].as_array().map(Vec::as_slice).unwrap_or_default();
let label_of = |style: &str| listed.iter().find(|v| v["style"] == style).and_then(|v| v["label"].as_str());
let previews: Vec<Preview> = variations
.iter()
.map(|v| {
let label = label_of(&v.style).map_or_else(|| v.style.clone(), str::to_string);
preview(v, label, (w, h))
})
.collect();
let picked = previews.iter().map(|p| p.style.clone()).collect();
app.concept_runs.shown = Some(Shown { job: id, previews, picked });
}
/// A preview's width in points, `height` high, for an image `aspect` wide per unit high.
fn preview_width(aspect: f32, height: f32) -> f32 {
(height * aspect).clamp(height * 0.4, height * 2.5)
}
/// The box an image `aspect` wide per unit high takes inside `inner`: as large as fits, centered,
/// so a preview whose width [`preview_width`] clamps keeps the image's proportions.
fn art_rect(inner: Rect, aspect: f32) -> Rect {
let size = vec2(inner.width().min(inner.height() * aspect), inner.height().min(inner.width() / aspect));
Rect::from_center_size(inner.center(), size)
}
/// The size in pixels of the fills of a preview of an image `aspect` wide per unit high: its
/// [`art_rect`] inside the 4 pt margin, at [`PREVIEW_SCALE`].
fn image_size(aspect: f32) -> [usize; 2] {
let inner = Rect::from_min_size(Pos2::ZERO, vec2(preview_width(aspect, PREVIEW_H), PREVIEW_H)).shrink(4.0);
let art = art_rect(inner, aspect);
let px = |pt: f32| (pt * PREVIEW_SCALE).round().max(1.0) as usize;
[px(art.width()), px(art.height())]
}
/// Paints `rings` (polylines in 0..1 of the image's box, each closed, nonzero winding) in `color`
/// over `img`, antialiased with four samples a pixel high.
fn fill_rings(img: &mut egui::ColorImage, rings: &[Vec<Pos2>], color: Color32) {
const SUB: usize = 4;
let [w, h] = img.size;
let (sx, sy) = (w as f32, h as f32);
let mut edges: Vec<(f32, f32, f32, f32)> = vec![];
for ring in rings {
for (a, b) in ring.iter().zip(ring.iter().skip(1).chain(ring.first())) {
edges.push((a.x * sx, a.y * sy, b.x * sx, b.y * sy));
}
}
let top = edges.iter().map(|e| e.1.min(e.3)).fold(f32::INFINITY, f32::min);
let bottom = edges.iter().map(|e| e.1.max(e.3)).fold(f32::NEG_INFINITY, f32::max);
let left = edges.iter().map(|e| e.0.min(e.2)).fold(f32::INFINITY, f32::min);
let right = edges.iter().map(|e| e.0.max(e.2)).fold(f32::NEG_INFINITY, f32::max);
if !(top.is_finite() && bottom.is_finite() && left.is_finite() && right.is_finite()) {
return;
}
let (y0, y1) = (top.floor().clamp(0.0, sy) as usize, bottom.ceil().clamp(0.0, sy) as usize);
// Only the columns the rings reach: `cover[i]` is column `c0 + i`.
let (c0, c1) = (left.floor().clamp(0.0, sx) as usize, right.ceil().clamp(0.0, sx) as usize);
let mut cover = vec![0f32; c1.saturating_sub(c0)];
let mut xs: Vec<(f32, i32)> = vec![];
for row in y0..y1 {
cover.fill(0.0);
for k in 0..SUB {
let y = row as f32 + (k as f32 + 0.5) / SUB as f32;
xs.clear();
for &(x0, ya, x1, yb) in &edges {
if (ya <= y) != (yb <= y) {
xs.push((x0 + (y - ya) / (yb - ya) * (x1 - x0), if yb > ya { 1 } else { -1 }));
}
}
xs.sort_by(|a, b| a.0.total_cmp(&b.0));
let mut wind = 0;
for pair in xs.windows(2) {
wind += pair[0].1;
let (a, b) = (pair[0].0.max(0.0), pair[1].0.min(sx));
if wind == 0 || b <= a {
continue;
}
let (start, end) = ((a.floor() as usize).saturating_sub(c0), (b.ceil() as usize).min(c1).saturating_sub(c0));
for (i, c) in cover.iter_mut().enumerate().take(end).skip(start) {
let px = (c0 + i) as f32;
*c += (b.min(px + 1.0) - a.max(px)).max(0.0) / SUB as f32;
}
}
}
for (i, c) in cover.iter().enumerate().filter(|(_, c)| **c > 0.0) {
let px = c0 + i;
let a = c.min(1.0);
let mix = |s: u8, t: u8| (f32::from(t) * a + f32::from(s) * (1.0 - a)).round() as u8;
if let Some(d) = img.pixels.get_mut(row * w + px) {
*d = Color32::from_rgb(mix(d.r(), color.r()), mix(d.g(), color.g()), mix(d.b(), color.b()));
}
}
}
}
/// Paints `rings` (polylines in 0..1 of the image's box) stroked `width` pixels wide in `color`
/// over `img`: each segment as a rectangle, with a disc at each point for round joins and caps
/// once the stroke is wide enough for them to show.
fn stroke_rings(img: &mut egui::ColorImage, rings: &[Vec<Pos2>], width: f32, color: Color32) {
let (sx, sy) = (img.size[0] as f32, img.size[1] as f32);
let r = width / 2.0;
let unit = |p: Pos2| Pos2::new(p.x / sx, p.y / sy);
for ring in rings {
let pts: Vec<Pos2> = ring.iter().map(|q| Pos2::new(q.x * sx, q.y * sy)).collect();
for (k, a) in pts.iter().enumerate() {
if r > 0.75 {
let disc: Vec<Pos2> = (0..8)
.map(|i| {
let t = i as f32 * std::f32::consts::TAU / 8.0;
unit(*a + vec2(t.cos(), t.sin()) * r)
})
.collect();
fill_rings(img, &[disc], color);
}
let Some(b) = pts.get(k + 1) else { continue };
let d = *b - *a;
let len = d.length();
if len > 0.0 {
let n = vec2(-d.y, d.x) * (r / len);
fill_rings(img, &[vec![unit(*a + n), unit(*b + n), unit(*b - n), unit(*a - n)]], color);
}
}
}
}
/// `path`'s elements, made as they are taken, so that taking the first few of a long path does
/// not convert the rest.
fn elements(path: &vectorcraft_geom::PathData) -> impl Iterator<Item = vectorcraft_geom::PathEl> + '_ {
use vectorcraft_geom::PathEl;
path.subpaths.iter().filter_map(|sp| sp.anchors.first().map(|first| (sp, first.p))).flat_map(|(sp, start)| {
let segments = (0..sp.segment_count()).map(move |i| {
let c = sp.segment(i);
if sp.segment_is_line(i) { PathEl::LineTo(c.p3) } else { PathEl::CurveTo(c.p1, c.p2, c.p3) }
});
std::iter::once(PathEl::MoveTo(start)).chain(segments).chain(sp.closed.then_some(PathEl::ClosePath))
})
}
/// Variation `v` of an image `size` pixels big: its paths painted in order, each path's fill and
/// then its stroke, stopping after [`PREVIEW_POINTS`] points in all.
fn preview(v: &Variation, label: String, size: (u32, u32)) -> Preview {
let (w, h) = (f64::from(size.0.max(1)), f64::from(size.1.max(1)));
let aspect = (w / h) as f32;
let mut image = egui::ColorImage::filled(image_size(aspect), Color32::WHITE);
let mut left = PREVIEW_POINTS;
let at = |q: vectorcraft_geom::Point| Pos2::new((q.x / w) as f32, (q.y / h) as f32);
let rgb = |[r, g, b]: [u8; 3]| Color32::from_rgb(r, g, b);
for p in &v.paths {
if left == 0 {
break;
}
let mut rings: Vec<Vec<Pos2>> = vec![];
let mut ring: Vec<Pos2> = vec![];
// Each element adds at least one point, and `flatten` makes a bounded number of each curve,
// so the elements past the points left are neither made nor flattened.
vectorcraft_geom::flatten(elements(&p.path).take(left.saturating_add(1)), (w.max(h) / 400.0).max(0.25), |el| {
let q = match el {
vectorcraft_geom::PathEl::MoveTo(q) => {
if ring.len() > 1 {
rings.push(std::mem::take(&mut ring));
}
ring.clear();
q
}
vectorcraft_geom::PathEl::LineTo(q) => q,
vectorcraft_geom::PathEl::ClosePath => {
if let Some(first) = ring.first().copied() {
ring.push(first);
}
if ring.len() > 1 {
rings.push(std::mem::take(&mut ring));
}
ring.clear();
return;
}
_ => return,
};
if left > 0 {
left -= 1;
ring.push(at(q));
}
});
if ring.len() > 1 {
rings.push(ring);
}
if let Some(c) = p.fill {
fill_rings(&mut image, &rings, rgb(c));
}
if let Some((c, width)) = p.stroke {
// To scale with the image, and at least MIN_STROKE points.
let px = ((width / w) as f32 * image.size[0] as f32).max(MIN_STROKE * PREVIEW_SCALE);
stroke_rings(&mut image, &rings, px, rgb(c));
}
}
Preview { style: v.style.clone(), label, aspect, image, texture: None, warnings: v.warnings.clone() }
}
/// Insert Selected: the ticked variations go to the right of the image, as one undo step.
pub fn insert(app: &mut VectorcraftApp) -> Result<Value, String> {
let Some(shown) = &app.concept_runs.shown else { return Err("`job` must be a job number from conceptVector.generate".into()) };
let p = json!({ "job": shown.job, "variations": shown.picked });
app.run("conceptVector.insert", p)
}
/// A style's name as shown: translated as Image Trace's preset of that name where the catalog has
/// one (the Outline style is not the Outline view), as any other string else.
fn style_name(label: &str) -> &str {
crate::i18n::tr_ctx(crate::i18n::current(), "imageTrace", label)
}
/// Draws preview `p`, `height` points high.
fn draw_preview(ui: &mut Ui, p: &mut Preview, height: f32) {
let t = crate::theme::Tokens::get(ui.ctx());
let ctx = ui.ctx().clone();
let width = preview_width(p.aspect, height);
let (rect, _) = ui.allocate_exact_size(vec2(width, height), Sense::hover());
ui.painter().rect_filled(rect, 3.0, Color32::WHITE);
let inner = art_rect(rect.shrink(4.0), p.aspect);
let texture =
p.texture.get_or_insert_with(|| ctx.load_texture(format!("concept-vector-{}", p.style), p.image.clone(), egui::TextureOptions::LINEAR));
ui.painter().image(texture.id(), inner, Rect::from_min_max(Pos2::ZERO, Pos2::new(1.0, 1.0)), Color32::WHITE);
ui.painter().rect_stroke(rect, 3.0, Stroke::new(1.0, t.border), egui::StrokeKind::Inside);
}
pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
dim_label(ui, tl!("Offline Image Trace styles, made on this computer"));
ui.add_space(4.0);
let ready = eligible(app);
// The styles, at most eight of them.
let count = app.concept_runs.styles.len();
ui.horizontal(|ui| {
dim_label(ui, tl!("Styles"));
ui.label(format!("{count} / {MAX_STYLES}"));
});
for s in &offline::STYLES {
let mut on = app.concept_runs.styles.iter().any(|id| id == s.id);
let allowed = on || count < MAX_STYLES;
if ui.add_enabled(allowed, egui::Checkbox::new(&mut on, style_name(s.label))).changed() {
let styles = &mut app.concept_runs.styles;
styles.retain(|id| id != s.id);
if on {
styles.push(s.id.to_string());
// In the provider's order.
styles.sort_by_key(|id| offline::STYLES.iter().position(|st| st.id == id));
}
}
}
ui.add_space(4.0);
let mut detail = app.concept_runs.detail;
ui.horizontal(|ui| {
dim_label(ui, tl!("Detail"));
if widgets::slider(ui, egui::Slider::new(&mut detail, 0..=100)).changed() {
app.concept_runs.detail = detail;
}
});
let mut no_prompt = String::new();
ui.add_enabled(false, egui::TextEdit::singleline(&mut no_prompt).hint_text(tl!("Offline styles do not use prompts")));
ui.add_space(6.0);
if let Some(r) = &app.concept_runs.running {
let (done, total) = (r.steps[0].load(Ordering::Relaxed), r.steps[1].load(Ordering::Relaxed));
let frac = if total > 0 { done.min(total) as f32 / total as f32 } else { 0.0 };
ui.add(egui::ProgressBar::new(frac).desired_height(6.0));
if widgets::flat_button(ui, "Cancel", 80.0).clicked() {
cancel(app);
app.status(vectorcraft_engine::EngineError::Cancelled.to_string());
}
ui.ctx().request_repaint_after(std::time::Duration::from_millis(100));
} else {
let can = ready.is_ok() && count > 0;
let resp = ui.add_enabled_ui(can, |ui| widgets::flat_button_fit(ui, "Generate", 90.0)).inner;
if resp.clicked()
&& let Err(e) = generate(app)
{
app.status(e);
}
}
if let Err(why) = &ready {
ui.label(egui::RichText::new(crate::i18n::msg(why)).small());
}
show_results(app, ui);
}
/// The comparison strip of the job shown, with a tick on each and Insert Selected.
fn show_results(app: &mut VectorcraftApp, ui: &mut Ui) {
let Some(Shown { previews, picked, .. }) = &mut app.concept_runs.shown else { return };
ui.separator();
egui::ScrollArea::horizontal().id_salt("concept-vector-strip").show(ui, |ui| {
ui.horizontal_top(|ui| {
for p in previews.iter_mut() {
ui.vertical(|ui| {
draw_preview(ui, p, PREVIEW_H);
let mut on = picked.contains(&p.style);
if ui.checkbox(&mut on, style_name(&p.label)).changed() {
picked.retain(|s| *s != p.style);
if on {
picked.push(p.style.clone());
}
}
for w in &p.warnings {
ui.label(egui::RichText::new(w).small());
}
});
}
});
});
let any = !picked.is_empty();
let resp = ui.add_enabled_ui(any, |ui| widgets::flat_button_fit(ui, "Insert Selected", 110.0)).inner;
if resp.clicked() {
match insert(app) {
Ok(_) => {}
Err(e) => app.status(e),
}
}
}
#[cfg(test)]
mod tests;
@@ -0,0 +1,413 @@
//! The Concept to Vector panel drawn headless: its routes (Window, Object, the context menu,
//! Properties and the Control bar), why it can't run, the style limit, the disabled prompt,
//! Generate at once and off the UI thread, Cancel, and Insert Selected as one undo step.
use std::sync::Arc;
use egui::{Color32, Pos2, Rect, vec2};
use serde_json::json;
use vectorcraft_doc::NodeKind;
use vectorcraft_engine::Session;
use vectorcraft_engine::concept_vector::{Capabilities, Provider, ProviderError, Request, Steps, Style, Variation, VectorPath, offline};
use vectorcraft_geom::{PathData, Point, SubPath};
use super::{
ID, OPEN, PREVIEW_H, PREVIEW_POINTS, Work, art_rect, cancel, elements, finish, generate, insert, poll, preview, preview_width, show, show_job,
};
use crate::tests_labels::painted_text;
use crate::tests_removeanchors::{at, click_control, control_frame, has, properties_frame};
use crate::{VectorcraftApp, menus};
/// Waits for the run on its thread to end and keeps its results, as `poll` does once they are there.
fn wait(app: &mut VectorcraftApp) {
let Some(r) = app.concept_runs.running.take() else { return };
let Work::Thread(rx) = &r.work else { panic!("the run is not on a thread") };
let done = rx.recv().ok();
finish(app, &r.token, done);
}
/// The styles made so far of a run made one part a frame.
fn made_so_far(app: &VectorcraftApp) -> Option<usize> {
match &app.concept_runs.running.as_ref()?.work {
Work::Frames(_, made) => Some(made.styles_done()),
Work::Thread(_) => None,
}
}
/// A PNG of `w` × `h` pixels: black on the left half, a red square on the right, white elsewhere.
fn png(w: u32, h: u32) -> Vec<u8> {
let img = image::RgbaImage::from_fn(w, h, |x, y| {
image::Rgba(if x < w / 2 {
[0, 0, 0, 255]
} else if (w * 5 / 8..w * 7 / 8).contains(&x) && (h / 4..h * 3 / 4).contains(&y) {
[220, 30, 30, 255]
} else {
[255; 4]
})
});
let mut out = vec![];
img.write_to(&mut std::io::Cursor::new(&mut out), image::ImageFormat::Png).unwrap();
out
}
/// An app with a 400 × 300 document and one embedded image of 40 × 30 pixels, selected.
fn app() -> VectorcraftApp {
let mut app = VectorcraftApp::new(Session::new(), Default::default());
app.run("file.new", json!({"width": 400, "height": 300})).unwrap();
let data = vectorcraft_format::base64_encode(&png(40, 30));
app.run("file.place", json!({"name": "art.png", "dataBase64": data, "link": false, "at": [60, 60]})).unwrap();
app
}
fn undo_steps(app: &VectorcraftApp) -> usize {
app.session.doc().unwrap().history.undo.len()
}
fn root_count(app: &VectorcraftApp) -> usize {
app.session.doc().unwrap().doc.layers.iter().map(|l| l.children().map_or(0, |c| c.len())).sum()
}
#[test]
fn the_panel_is_registered_with_a_bundled_icon_and_opens_from_window() {
let row = crate::state::ICON_PANELS.iter().find(|(id, ..)| *id == ID).expect("registered");
assert_eq!(row.1, "Concept to Vector");
assert!(crate::icons::exists(row.2), "{}", row.2);
let mut app = app();
let item = menus::menu_entries(&app).into_iter().find(|e| e.path == ["Window"] && e.label == "Concept to Vector").expect("Window item");
let (id, p) = menus::click_target(&item.label, item.command.as_deref().unwrap(), &item.params);
menus::invoke(&mut app, &id, p);
assert!(crate::panel_docking::showing(&app.ui, ID));
}
/// Object › Concept to Vector… and the context menu need one image (or Image Trace object) that is
/// shown and unlocked; without one the Object item is disabled, the context menu leaves it out and
/// the command says why.
#[test]
fn object_and_context_menus_open_it_for_one_image_only() {
let mut app = app();
let object = |app: &VectorcraftApp| {
menus::menu_entries(app).into_iter().find(|e| e.path == ["Object"] && e.label == "Concept to Vector…").expect("Object item")
};
let in_context = |app: &VectorcraftApp| menus::context_entries(app).iter().any(|e| e.label == "Concept to Vector…");
assert!(object(&app).enabled && in_context(&app));
let item = object(&app);
let (id, p) = menus::click_target(&item.label, item.command.as_deref().unwrap(), &item.params);
menus::invoke(&mut app, &id, p);
assert!(crate::panel_docking::showing(&app.ui, ID), "{}", app.ui.status);
app.run("object.lock", json!({})).unwrap();
app.run("select.none", json!({})).unwrap();
assert!(!object(&app).enabled && !in_context(&app));
let e = app.run(OPEN, json!({})).unwrap_err();
assert!(e.contains("select one image or an unexpanded Image Trace object"), "{e}");
app.run("object.unlockAll", json!({})).unwrap();
app.run("shape.rectangle", json!({"x": 250, "y": 200, "width": 20, "height": 20})).unwrap();
assert!(!object(&app).enabled && !in_context(&app), "a rectangle is not a source");
app.run("select.all", json!({})).unwrap();
assert!(!object(&app).enabled, "two objects are not one source");
}
/// Properties' Quick Actions and the Control bar offer it for a selected image, and the Control
/// bar's button opens the panel.
#[test]
fn properties_and_the_control_bar_offer_it() {
let mut app = app();
assert!(has(&properties_frame(&mut app, 280.0), "Concept to Vector"));
let ctx = egui::Context::default();
crate::theme::install_fonts(&ctx);
let bar = control_frame(&mut app, &ctx, vec![]);
click_control(&mut app, &ctx, at(&bar, "Concept to Vector"));
assert!(crate::panel_docking::showing(&app.ui, ID), "{}", app.ui.status);
}
/// The panel says its styles are offline Image Trace styles, disables the prompt, allows 1 to 8
/// styles, and shows why it can't run with nothing to use.
#[test]
fn the_panel_shows_offline_styles_a_disabled_prompt_and_why_it_cannot_run() {
let mut app = app();
let text = painted_text(&mut app, show);
for s in ["Offline Image Trace styles, made on this computer", "Offline styles do not use prompts", "Detail", "5 / 8", "Generate"] {
assert!(text.contains(s), "{s}: {text}");
}
for s in &offline::STYLES {
assert!(text.contains(s.label), "{}: {text}", s.label);
}
app.run("select.none", json!({})).unwrap();
let text = painted_text(&mut app, show);
assert!(text.contains("select one image or an unexpanded Image Trace object"), "{text}");
}
/// Generate at once (no thread): a preview for each ticked style, every one ticked, the document
/// unchanged; Insert Selected puts the ticked ones beside the image as one undo step.
#[test]
fn generate_previews_every_style_and_insert_adds_the_ticked_ones_as_one_step() {
let mut app = app();
app.concept_runs.styles = vec!["outline".into(), "flatColor".into(), "grayTones".into()];
let (steps, roots) = (undo_steps(&app), root_count(&app));
generate(&mut app).unwrap();
assert_eq!((undo_steps(&app), root_count(&app)), (steps, roots), "Generate changes nothing");
let shown = app.concept_runs.shown.as_ref().expect("a job is shown");
let styles: Vec<&str> = shown.previews.iter().map(|p| p.style.as_str()).collect();
assert_eq!(styles, ["outline", "flatColor", "grayTones"]);
let painted = |p: &super::Preview| p.image.pixels.iter().any(|c| *c != Color32::WHITE);
assert!(shown.previews.iter().all(painted), "every style paints its preview");
assert_eq!(shown.picked.len(), 3);
let text = painted_text(&mut app, show);
assert!(text.contains("Insert Selected") && text.contains("Flat Color"), "{text}");
app.concept_runs.shown.as_mut().unwrap().picked = vec!["grayTones".into(), "outline".into()];
let v = insert(&mut app).unwrap();
assert_eq!(v["ids"].as_array().unwrap().len(), 2);
assert_eq!((undo_steps(&app), root_count(&app)), (steps + 1, roots + 2), "one step, two groups");
let st = app.session.doc().unwrap();
let names: Vec<Option<&str>> = st.selection.objects.iter().map(|id| st.doc.node(*id).and_then(|n| n.name.as_deref())).collect();
assert_eq!(names, [Some("Outline"), Some("Gray Tones")], "in the provider's order");
assert!(st.selection.objects.iter().all(|id| matches!(st.doc.node(*id).map(|n| &n.kind), Some(NodeKind::Group { .. }))));
app.run("edit.undo", json!({})).unwrap();
assert_eq!(root_count(&app), roots);
}
/// At most eight styles: a ninth tick is refused by the command, and none is refused too.
#[test]
fn no_style_or_too_many_are_refused() {
let mut app = app();
app.concept_runs.styles.clear();
let e = generate(&mut app).unwrap_err();
assert!(e.contains("must list 1 to 8 different style ids"), "{e}");
app.concept_runs.styles = (0..9).map(|_| "outline".to_string()).collect();
assert!(generate(&mut app).is_err());
assert!(app.concept_runs.shown.is_none());
}
/// Off the UI thread: Generate returns at once with the run going; its results are kept when it
/// ends. Cancel drops a run, and nothing is shown or changed.
#[test]
fn generate_runs_off_the_ui_thread_and_cancel_drops_it() {
let mut app = app();
app.concept_runs.off_the_ui_thread = true;
let steps = undo_steps(&app);
generate(&mut app).unwrap();
assert!(app.concept_runs.busy());
let text = painted_text(&mut app, show);
assert!(text.contains("Cancel"), "{text}");
wait(&mut app);
assert!(!app.concept_runs.busy());
let job = app.concept_runs.job().expect("results shown");
assert!(app.session.concept_variations(job).is_some());
app.concept_runs.shown = None;
generate(&mut app).unwrap();
cancel(&mut app);
assert!(!app.concept_runs.busy() && app.concept_runs.shown.is_none());
assert_eq!(undo_steps(&app), steps);
}
fn one_path(points: &[Point], fill: Option<[u8; 3]>, stroke: Option<([u8; 3], f64)>) -> Variation {
Variation {
style: "s".into(),
paths: vec![VectorPath { path: PathData::single(SubPath::polyline(points, true)), fill, stroke }],
warnings: vec![],
}
}
/// A filled path paints its color inside its outline and leaves the rest white; a stroked one
/// paints its outline and leaves the inside white.
#[test]
fn previews_paint_fills_and_strokes() {
let square = [Point::new(25.0, 25.0), Point::new(75.0, 25.0), Point::new(75.0, 75.0), Point::new(25.0, 75.0)];
let red = [200, 20, 20];
let p = preview(&one_path(&square, Some(red), None), "s".into(), (100, 100));
let [w, h] = p.image.size;
let px = |p: &super::Preview, x: usize, y: usize| p.image.pixels[y * w + x];
assert_eq!(px(&p, w / 2, h / 2), Color32::from_rgb(200, 20, 20));
assert_eq!((px(&p, 2, 2), px(&p, w - 3, h - 3)), (Color32::WHITE, Color32::WHITE));
let p = preview(&one_path(&square, None, Some((red, 4.0))), "s".into(), (100, 100));
assert_eq!((px(&p, w / 2, h / 2), px(&p, 2, 2)), (Color32::WHITE, Color32::WHITE));
assert_eq!(px(&p, w / 2, h / 4), Color32::from_rgb(200, 20, 20), "the top edge");
}
/// The pixels a preview paints across the top edge of a square stroked `width` wide, in an image
/// 200 by 100 pixels.
fn stroke_cover(width: f64) -> usize {
let square = [Point::new(25.0, 25.0), Point::new(75.0, 25.0), Point::new(75.0, 75.0), Point::new(25.0, 75.0)];
let p = preview(&one_path(&square, None, Some(([0, 0, 0], width))), "s".into(), (200, 100));
let [w, h] = p.image.size;
let x = w / 4;
(0..h / 2).filter(|y| p.image.pixels[y * w + x] != Color32::WHITE).count()
}
/// Preview strokes are painted to scale with the image, and at least half a point wide.
#[test]
fn preview_strokes_keep_their_widths() {
// The image's 200 pixels are about 408 preview pixels wide: a 10-pixel stroke is about 20.
let (thin, thick) = (stroke_cover(1.0), stroke_cover(10.0));
assert!((19..=23).contains(&thick), "{thick}");
assert!((1..=4).contains(&thin), "{thin}");
assert!(stroke_cover(0.01) >= 1, "thin lines still show");
}
/// Paths are painted in their order: a fill above a stroke covers it, and a stroke above a fill
/// shows.
#[test]
fn previews_paint_paths_in_their_order() {
let square = [Point::new(25.0, 25.0), Point::new(75.0, 25.0), Point::new(75.0, 75.0), Point::new(25.0, 75.0)];
let cover = [Point::new(0.0, 0.0), Point::new(100.0, 0.0), Point::new(100.0, 100.0), Point::new(0.0, 100.0)];
let path = |pts: &[Point]| PathData::single(SubPath::polyline(pts, true));
let stroke = VectorPath { path: path(&square), fill: None, stroke: Some(([0, 0, 0], 4.0)) };
let fill = VectorPath { path: path(&cover), fill: Some([200, 20, 20]), stroke: None };
let on_edge = |paths: Vec<VectorPath>| {
let p = preview(&Variation { style: "s".into(), paths, warnings: vec![] }, "s".into(), (100, 100));
let [w, h] = p.image.size;
p.image.pixels[(h / 4) * w + w / 2]
};
assert_eq!(on_edge(vec![stroke.clone(), fill.clone()]), Color32::from_rgb(200, 20, 20), "the fill covers the stroke below it");
assert_eq!(on_edge(vec![fill, stroke]), Color32::BLACK, "the stroke shows above the fill");
}
/// A path's elements, made as they are taken, are the elements of its converted path.
#[test]
fn preview_elements_match_the_converted_path() {
let mut bp = vectorcraft_geom::BezPath::new();
bp.move_to((0.0, 0.0));
bp.line_to((10.0, 0.0));
bp.curve_to((15.0, 0.0), (20.0, 5.0), (20.0, 10.0));
bp.close_path();
bp.move_to((30.0, 30.0));
bp.line_to((40.0, 35.0));
let path = PathData::from_bezpath(&bp);
let made: Vec<_> = elements(&path).collect();
assert_eq!(made, path.to_bezpath().elements().to_vec());
assert_eq!(elements(&path).take(2).count(), 2);
}
/// A preview of an image wider or taller than its box allows keeps the image's proportions, with
/// margins, instead of stretching the image to the box.
#[test]
fn a_preview_of_a_wide_or_tall_image_keeps_its_proportions() {
let square = [Point::new(0.0, 0.0), Point::new(100.0, 0.0), Point::new(100.0, 100.0), Point::new(0.0, 100.0)];
for (size, aspect) in [((1000, 100), 10.0f32), ((100, 1000), 0.1)] {
let p = preview(&one_path(&square, Some([9, 9, 9]), None), "s".into(), size);
let [w, h] = p.image.size;
assert!(((w as f32 / h as f32) / aspect - 1.0).abs() < 0.06, "{size:?}: {w} x {h}");
let inner = Rect::from_min_size(Pos2::ZERO, vec2(preview_width(aspect, PREVIEW_H), PREVIEW_H)).shrink(4.0);
let art = art_rect(inner, aspect);
assert!(inner.expand(0.01).contains_rect(art), "{art:?} in {inner:?}");
assert!((art.aspect_ratio() / aspect - 1.0).abs() < 1e-3, "{art:?}");
assert!((art.center() - inner.center()).length() < 1e-3, "{art:?}");
}
}
/// One path with more points than a preview draws is cut off within the path: its points in the
/// top quarter are painted, and those past the limit, in the bottom quarter, are not.
#[test]
fn a_preview_stops_at_its_point_limit_within_one_path() {
let zigzag: Vec<Point> =
(0..PREVIEW_POINTS * 3).map(|i| Point::new((i % 100) as f64, if i < PREVIEW_POINTS { 10.0 } else { 90.0 } + (i % 2) as f64 * 0.5)).collect();
let mut path = one_path(&zigzag, None, Some(([0, 0, 0], 1.0)));
if let Some(sp) = path.paths[0].path.subpaths.first_mut() {
sp.closed = false;
}
let p = preview(&path, "s".into(), (100, 100));
let [w, h] = p.image.size;
let painted = |rows: std::ops::Range<usize>| rows.flat_map(|y| (0..w).map(move |x| y * w + x)).any(|i| p.image.pixels[i] != Color32::WHITE);
assert!(painted(0..h / 4), "the points before the limit");
assert!(!painted(h * 3 / 4..h), "the points past it");
}
/// As on the web (no thread): Generate returns with the run going and nothing made; each frame
/// makes one part (the image decoded, a style's colour layers found, one layer traced), the styles
/// are made in order, and the last part's frame shows them all.
#[test]
fn on_the_web_generate_makes_one_part_a_frame() {
let mut app = app();
app.concept_runs.by_frames = true;
app.concept_runs.styles = vec!["outline".into(), "flatColor".into(), "grayTones".into()];
let (steps, roots) = (undo_steps(&app), root_count(&app));
generate(&mut app).unwrap();
assert!(app.concept_runs.busy() && app.concept_runs.shown.is_none());
assert_eq!(made_so_far(&app), Some(0), "made one part a frame, not on a thread");
let text = painted_text(&mut app, show);
assert!(text.contains("Cancel"), "{text}");
let mut seen = vec![];
while let Some(k) = made_so_far(&app) {
assert!(seen.len() < 1000, "the parts never end");
seen.push(k);
assert!(app.concept_runs.shown.is_none());
poll(&mut app);
}
assert!(seen.windows(2).all(|w| w[0] <= w[1]) && seen.contains(&1) && seen.contains(&2), "{seen:?}");
assert!(seen.len() > 3, "more than one part a style: {seen:?}");
assert!(!app.concept_runs.busy());
let shown = app.concept_runs.shown.as_ref().expect("results shown");
let styles: Vec<&str> = shown.previews.iter().map(|p| p.style.as_str()).collect();
assert_eq!(styles, ["outline", "flatColor", "grayTones"]);
assert!(app.session.concept_variations(shown.job).is_some());
assert_eq!((undo_steps(&app), root_count(&app)), (steps, roots), "Generate changes nothing");
}
/// On the web, Cancel takes effect inside a style: after the image's colour layers are found and
/// one is traced, the run is dropped, and nothing is shown or changed.
#[test]
fn on_the_web_cancel_stops_a_style_part_way() {
let mut app = app();
app.concept_runs.by_frames = true;
app.concept_runs.styles = vec!["flatColor".into()];
let (steps, roots) = (undo_steps(&app), root_count(&app));
generate(&mut app).unwrap();
// The image decoded, its colour layers found, and the first layer traced.
for _ in 0..3 {
poll(&mut app);
assert_eq!(made_so_far(&app), Some(0), "the one style is still being made");
}
cancel(&mut app);
poll(&mut app);
assert!(!app.concept_runs.busy() && app.concept_runs.shown.is_none());
assert_eq!((undo_steps(&app), root_count(&app)), (steps, roots));
}
/// A provider with one style, `sketch`, named "Pencil Sketch": a square for each style asked.
struct Sketches;
impl Provider for Sketches {
fn id(&self) -> &'static str {
"test.sketches"
}
fn name(&self) -> &'static str {
"Sketches"
}
fn capabilities(&self) -> Capabilities {
let styles = vec![Style { id: "sketch", label: "Pencil Sketch" }];
Capabilities { image_input: true, vector_output: true, prompt: false, raster_output: false, offline: true, styles }
}
fn generate(&self, r: &Request, _: Steps) -> Result<Vec<Variation>, ProviderError> {
let sq = [Point::new(0.0, 0.0), Point::new(10.0, 0.0), Point::new(10.0, 10.0), Point::new(0.0, 10.0)];
Ok(r.styles.iter().map(|s| Variation { style: s.clone(), ..one_path(&sq, Some([0; 3]), None) }).collect())
}
}
/// The results of another provider are named as that provider names its styles.
#[test]
fn results_are_named_as_their_provider_names_its_styles() {
let mut app = app();
app.session.concept_providers_mut().register(Arc::new(Sketches)).unwrap();
let v = app.run("conceptVector.generate", json!({"provider": "test.sketches", "styles": ["sketch"]})).unwrap();
show_job(&mut app, &v);
let shown = app.concept_runs.shown.as_ref().expect("a job is shown");
let labels: Vec<&str> = shown.previews.iter().map(|p| p.label.as_str()).collect();
assert_eq!(labels, ["Pencil Sketch"]);
let text = painted_text(&mut app, show);
assert!(text.contains("Pencil Sketch"), "{text}");
}
/// Insert Selected after the image moved: the job no longer applies, and nothing changes.
#[test]
fn insert_after_the_image_moved_changes_nothing() {
let mut app = app();
generate(&mut app).unwrap();
app.run("object.transform", json!({"matrix": [1, 0, 0, 1, 5, 0]})).unwrap();
let (steps, roots) = (undo_steps(&app), root_count(&app));
let e = insert(&mut app).unwrap_err();
assert!(e.contains("no longer applies"), "{e}");
assert_eq!((undo_steps(&app), root_count(&app)), (steps, roots));
}
+1
View File
@@ -158,6 +158,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
if is_image {
crate::panels::image_trace::trace_button(app, ui, ui.available_width());
actions.push((tl!("Crop Image"), "ui.cropImage"));
actions.push((tl!("Concept to Vector"), crate::panels::concept_vector::OPEN));
actions.push((tl!("Mask"), "object.maskImage"));
// Remove Background at once with its defaults, as the reference app's Quick Actions do
// (<https://community.adobe.com/announcements-651/ai-powered-image-editing-features-in-illustrator-1624061>).
+1
View File
@@ -598,6 +598,7 @@ pub fn control_bar_details(app: &mut VectorcraftApp, ui: &mut egui::Ui) -> bool
for (label, cmd, w) in [
(tl!("Mask"), "object.maskImage", 52.0),
(tl!("Crop Image"), "ui.cropImage", 84.0),
(tl!("Concept to Vector"), crate::panels::concept_vector::OPEN, 120.0),
(tl!("Remove Background"), crate::addons::image::REMOVE_BACKGROUND, 128.0),
] {
if widgets::flat_button(ui, label, w).clicked() {
+1
View File
@@ -212,6 +212,7 @@ pub const ICON_PANELS: &[(&str, &str, &str)] = &[
("navigator", "Navigator", "map"),
("separations", "Separations Preview", "printer"),
("imageTrace", "Image Trace", "image"),
(crate::panels::concept_vector::ID, "Concept to Vector", "sparkles"),
("magicWand", "Magic Wand", "wand-sparkles"),
(crate::panels::flattener_preview::ID, "Flattener Preview", "eye"),
("attributes", "Attributes", "settings"),
+6 -2
View File
@@ -820,9 +820,13 @@ macOS cursor delivery (#2292) is narrowed to a native host adapter using the exi
## G18 Generative AI features
- **Done:** Concept to Vector in part: Window › Concept to Vector makes 1 to 8 styles of one selected image
side by side and inserts the ticked ones beside it as one undo step (`conceptVector.*`). Providers plug in
by id (`crates/engine/src/concept_vector.rs`); the only one is built in and makes five offline Image Trace
styles.
- **Missing:** Text to Vector Graphic, Generative Recolor, Generative Shape Fill (#766), Generative Expand,
Concept to Vector, Prompt to Edit, Rewrite Text. Adobe's run on its cloud models; ours would be a pluggable
provider.
Concept to Vector's prompt-led generation and raster output, Prompt to Edit, Rewrite Text. Adobe's run on
its cloud models; ours would be a pluggable provider.
- **Needs:** an owner decision on models and providers.
- **Estimate:** 30–60 h after that decision.
+30
View File
@@ -3172,6 +3172,36 @@ already walks Image Trace. Short agent entry points:
Its journal entry records the saved preset's settings as `savedPreset`, so a replay traces with them after the preset
is changed, renamed or deleted. In the app,
`ui.imageTracePresetDialog {params?, rename?}` opens the Image Trace panel's Save as New Preset… or Rename… dialog.
- Concept to Vector: `conceptVector.providers` lists the providers that `conceptVector.generate` can call by id, with
their styles. The built-in `offline.traceStyles` makes the styles `outline`, `inkLines`, `flatColor`, `detailedColor`
and `grayTones` with Image Trace on this computer; it takes no prompt and makes vector art only. A provider is used
only when it is named: an unknown one, or a non-empty `prompt` that it does not support, is an error, and no other
provider is used in its place. Results are vector art, so `output` other than `"vector"` is an error for every
provider.
`conceptVector.generate {id?, provider, styles: [style id…], detail?: 0-100, prompt?, output?: "vector"}` makes one
variation of the image (or unexpanded Image Trace object) for each of 1 to 8 different styles and keeps them as a job of
the session; it does not change the document and is not journaled. A source that is locked or hidden, itself or by a
layer or group around it, or that is on a locked artboard, is refused. Results are
checked whatever provider made them: one variation per style in the order asked, every point finite and near the
image, at most 250,000 paths and 1,000,000 anchor points in all. The reply lists each variation's `style`, `label`,
`paths`, `anchors`, `bounds` in the image's pixels and `warnings` (for example that a large image was traced scaled
down to 16 megapixels). `conceptVector.results {job}` returns the job again, and `conceptVector.cancel {job}` drops
its variations. The session keeps the 4 newest jobs until their document closes.
`conceptVector.insert {job, variations: [style id…]}` puts a group of each chosen variation, named after its style and
in the provider's order, to the right of the image, each the image's size with 24 pt between them, moved further
right past other visible art, also where a variation reaches past its image-sized box (the next one then starts 24
pt past what it paints); it is one undo step and selects the groups. The groups go above the outermost clip group or
opacity-masked group around the image, so that it does not hide them. It is an error when the job was canceled
or dropped, when its document is not the active one, when the object, its pixels or its placement changed, when
the object is now locked or hidden, or when it is on a layer with a clipping mask or an opacity mask. Example:
```json
{"command": "conceptVector.generate", "params": {"provider": "offline.traceStyles", "styles": ["outline", "flatColor"], "detail": 60}}
{"command": "conceptVector.insert", "params": {"job": 1, "variations": ["flatColor"]}}
```
In the app, `ui.conceptVector` opens the Concept to Vector panel, which runs the same commands; Generate runs off the
UI thread with a progress bar and Cancel.
- Live Paint: `livePaint.make`, `livePaint.merge`, `livePaint.fill {group?, point}`, `livePaint.strokeEdge`,
`livePaint.info {group}`, `livePaint.release`, `livePaint.expand`, and `livePaint.gapOptions {ids?, detect?, size?,
color?, closeGaps?}` (Object › Live Paint › Gap Options). Make gives each covered face the fill of its front-most
+1 -1
View File
@@ -157,7 +157,7 @@ native wording review, layout checks and a web Devanagari font remain. [Notes](l
| M9 | Live effects (+ 3D & Materials) | 🟡 2D effects done incl. Effect → Pathfinder, Color Adjustments and Document Raster Effects Settings; PDF export warns when the pixel cap lowers raster-effect resolution; Artistic › Colored Pencil, Cutout, Dry Brush, Film Grain, Fresco, Neon Glow, Paint Daubs, Palette Knife, Poster Edges, Rough Pastels, Smudge Stick, Sponge, Underpainting and Watercolor and Sketch › Halftone Pattern, Bas Relief, Charcoal, Conté Crayon, Photocopy, Stamp, Torn Edges and Water Paper done (57/57 Photoshop filters); Revolve with automatic smooth vector shading, default-on circular caps and continuous rims, Extrude & Bevel, Inflate and Rotate with one to ten colored directional lights and four original lighting presets; SVG Filters, remaining raster effects and 3D materials and shadows pending | 81–130 |
| M10 | Brushes, symbols, patterns, Repeat | 🟡 pattern swatches (5 tile types, Pattern Options, editing mode, SVG `<pattern>`/PDF export) and live Repeat (radial/grid/mirror) done; interactive selected mirror axis implemented (focused and native checks passed; full CI blocked by an unrelated text test); symbol libraries done (Window › Symbol Libraries, five generated libraries (Basic Shapes, UI Frames, Map Markers, Inventory Icons, Skill Icons), User Defined, Other Library…, Save Symbols); brush libraries done (Window › Brush Libraries, nine generated libraries including Ink and Wash, Bristle Brushes and Dry Media, User Defined, Other Library…, Save Brushes); symbol editing shows draggable 9-slice guides (#5280), with guides outside the artwork still unsupported; brushes/symbols in progress | 23–37 |
| M11 | Artboards & views (selected-set deletion shared by Artboards menu, trash and Properties, retaining artboard 1 when all are selected; Artboard deletion keys keep the first of an all-selected set and protect artwork; history prunes invalid indices while preserving valid multiselection (history tests and full workspace CI pass); click-to-fit objects with the Artboard tool (#1227), artboard escape routing and document setup modal handoff done; artboard panel/tool with Move Artwork for X/Y fields and Artboard Options, Trim View, middle-button pan, print tiling and the status bar's artboard navigator with synchronized Artboard tool selection done; Window › Arrange › Tile and Consolidate All Windows done; multiple windows, presentation polish) (cached canvas reprojection preserves scale during resize, rotation and DPI changes; regression-tested and contributor-confirmed 2026-10-19; estimates unchanged) (cached canvas dimensions match the renderer limit before cache-key creation, view construction and worker submission; regression-tested; estimates unchanged); status-bar pointer coordinates follow the active ruler origin and General units | 🟡; Artboard Options shares existing presets and orientation controls and can fit artwork without moving it; artwork fitting includes all drawn document art across artboards and off-board; artwork bounds are cached by active document and revision, and selection uses the shared bounds cache across artboards | 15–25 |
| M12 | Advanced color & art (CMYK/ICC, separations, Gradient Mesh, Live Paint, Image Trace, Graphs) | 🟡 Gradient Mesh, Live Paint, Image Trace (junction-returning pieces retain their positioned boundaries; a simpler contour walk with identical output; an edge's sub-pixel shift is the same from either side; notches read only their own piece; collapsed loops keep few segments; large images trace with a warning; Auto Color keeps rare distinct colours; quick presets trace at once and the Image Trace button opens the adjustment controls; Properties reopens them; tiny fitted contours retain islands and holes; Create Strokes: exact crop EDT, Guo–Hall thinning and maximal-disc graph simplification; 15 presets, the 14 documented ones each with an enhanced version; Ignore Color, Shapes, Auto Grouping and Gradients options; measured in `image-trace-quality.md`; closed outlines retain their interior after straightening; the Flat Logo mode places edges to a fraction of a pixel, restores sharp corners, snaps lines and circles, and refuses gradients; live trace result bounds and selection highlights exclude the retained bitmap except in source-image views), Recolor Artwork, colour management (ICC, soft proofing, separations preview), Graphs (all 9 tools, Graph Data/Type, group-selected series colours persist through regenerate/save/open) done; Graph Design and Marker designs, Transpose and Switch x/y, `\|` label line breaks, the pie options, drop shadows, the legend across the top, overlapping widths, First Row/Column in Front, filled lines, kept label formatting and the Graph Data worksheet done; graph Column designs pending; Vector Halftone Preview keeps the selection box without drawing dot selection marks (#6369); Live Paint Bucket fills faces crossed in one drag (#6373) | 6–10 |
| M12 | Advanced color & art (CMYK/ICC, separations, Gradient Mesh, Live Paint, Image Trace, Graphs) | 🟡 Gradient Mesh, Live Paint, Image Trace (junction-returning pieces retain their positioned boundaries; a simpler contour walk with identical output; an edge's sub-pixel shift is the same from either side; notches read only their own piece; collapsed loops keep few segments; large images trace with a warning; Auto Color keeps rare distinct colours; quick presets trace at once and the Image Trace button opens the adjustment controls; Properties reopens them; tiny fitted contours retain islands and holes; Create Strokes: exact crop EDT, Guo–Hall thinning and maximal-disc graph simplification; 15 presets, the 14 documented ones each with an enhanced version; Ignore Color, Shapes, Auto Grouping and Gradients options; measured in `image-trace-quality.md`; closed outlines retain their interior after straightening; the Flat Logo mode places edges to a fraction of a pixel, restores sharp corners, snaps lines and circles, and refuses gradients; live trace result bounds and selection highlights exclude the retained bitmap except in source-image views), Recolor Artwork, colour management (ICC, soft proofing, separations preview), Graphs (all 9 tools, Graph Data/Type, group-selected series colours persist through regenerate/save/open) done; Graph Design and Marker designs, Transpose and Switch x/y, `\|` label line breaks, the pie options, drop shadows, the legend across the top, overlapping widths, First Row/Column in Front, filled lines, kept label formatting and the Graph Data worksheet done; graph Column designs pending; Vector Halftone Preview keeps the selection box without drawing dot selection marks (#6369); Live Paint Bucket fills faces crossed in one drag (#6373); Concept to Vector in part: 1 to 8 offline Image Trace styles of one image side by side, the ticked ones inserted beside it as one undo step, providers plugged in by id (prompt-led generation and raster output pending) | 6–10 |
| M13 | Automation (Actions ✅ record/playback, persisted; variables, scripting, batch) | 🟡 MCP `add_text` exposes existing vertical point, area and path type; `script.run` and File › Scripts › Other Script… run JavaScript files, and Window › Script Console shows their output; the script document model and batch work remain | 18–27 |
| M14 | 1.0 polish (preferences, shortcut editor, workspaces, accessibility, packaging for all OSes) (status messages and readouts use stable responsive allocations sized for localized labels and ordinary coordinates; sample widths cached by language/unit/DPI; regression-tested and contributor-confirmed 2026-10-19; estimates unchanged) | 🟡 Icon-strip flyouts resize on their free edges and retain sizes (#5713); interim macOS cursor delivery (#2292) uses existing artwork and host-owned AppKit cursors; headless coverage only, native menu/focus/handback and display validation pending. Dock groups collapse to their tabs by a double-click on a tab (UI.8); Preferences › General › Constrain Angle acts for the arrow keys, Shift drags and new objects (#394, 2026-10-21); numeric-field pointer selection and focus regression-tested (#1326; a release more than 1 pt from the press keeps the caret, a tap within 1 pt selects all, #6659); RPM runtime capabilities and glibc floor checked (#1275; real-distro install/start-up pending), Eyedropper cursor with precise-setting checks (#1269), Preferences, shortcut editor (chords with Shift and a punctuation key fire as typed; other apps' text shortcut sets imported), workspaces (each keeps its layout changes until Reset <name>, UI.7), Window › Help Bar shown or hidden apart from the status bar and kept in saved workspaces, panels docked by dragging into any dock group (as tabs or a top/bottom split) or into the icon column, and closed from a dock tab's context menu (UI.6), a custom title bar on Windows/Linux with a Home button, content-sized dialogs, menus that scroll when longer than the window and macOS native menu dismissal done (M14.8), and native macOS save sheets with a Format menu (#866); titled PDF exports set `DisplayDocTitle` for viewers and accessibility checkers (#3646); accessibility and broader Windows/Linux packaging/QA pending; floating tab groups collapse into the side icon rail and opened rail panels fold back into it (#5925, in part), with pointer and native-window regression coverage; estimates unchanged; numeric spinner arrows keep repeating while held with the mouse (#6307) | 18–28 |
| — | Interaction fidelity pass (every tool's modifiers, Properties panel per context, isolation, nuance; width-point creation and adjoining adjustment regression-tested; dialog layout reviewed) | ⬜ (new ruler-guide Alt orientation implemented; existing-guide Escape cancellation regression-tested; broader pass remains) | 60–90 |
+1
View File
@@ -1291,6 +1291,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- **Image Trace, tinted photos:** Color and Grayscale smooth a sepia, single-hue or duotone photo within its tones before choosing its colors, as they do a gray photo. A picture with at least 95% of its opaque pixels within 6 levels of its tone curve counts as continuous tone under the same 0.065 rule as a neutral picture. The tone curve runs through the median color of each 8-level stretch along the direction in which the picture's colors spread the most, and a pixel on it must also lie within 6 levels of the plane the colors spread along most, so art in several unrelated colors is not counted (VectorCraft's own rule and values). The neutral rule's exception for 16 colors leaving at most a fifth of the error of 8 applies to it too. Clean tinted bands of 2, 3 and 9 levels and tinted scans of flat art with up to 8 levels of noise stay on the flat-art route. On the synthetic tinted photos the 16 Colors trace keeps 12 to 15 colors instead of 6 to 13, with 525 to 708 anchors instead of up to 1,402. A duotone with strong noise on each channel can still miss the curve and stay unsmoothed. Tests: `tests::a_tinted_photo_is_continuous_tone_as_a_gray_photo_is`, `tests::small_accents_of_other_colors_leave_a_tinted_photo_continuous_tone`, `tests::tinted_flat_art_stays_flat_art`, `tests::pictures_without_tones_are_not_continuous_tone`, `tests::a_tinted_photo_is_smoothed_before_it_is_traced`. Scores and hours unchanged.
- **Image Trace, Document Library color groups:** with Document Swatches, the panel's Colors menu and `"colorGroup"` trace with one color group's colors instead of every swatch, as the public panel documentation describes Document Library; code-drawn tests in `crates/engine` and the panel.
- **Image Trace, Document Library colors:** with Document Swatches, traced fills and strokes use the displayed colors of process, global, spot and tint swatches without links, so editing a swatch leaves the trace unchanged; swatch-library colors are also unlinked; code-drawn tests in `crates/engine`.
- **Concept to Vector, offline styles (in part):** Window › Concept to Vector and Object › Concept to Vector… (also the context menu, the contextual task bar, Properties and the Control bar for one image or unexpanded Image Trace object) make 1 to 8 styles of the selected image side by side and insert the ticked ones to the right of it as one undo step, as the help page describes for comparing styles ([Generate vector artwork from images](https://helpx.adobe.com/illustrator/desktop/use-generative-ai/generate-vector-artwork-from-images.html)). The only provider is built in: five VectorCraft styles (Outline, Ink Lines, Flat Color, Detailed Color, Gray Tones) made with Image Trace on this computer, with Detail from 0 to 100; it takes no prompt and makes no raster output, so prompt-led generation is still missing. Other providers plug in by id through `crates/engine/src/concept_vector.rs`, and every result is checked before it is kept. Tests: `concept_vector::tests` in `crates/engine` and `panels::concept_vector::tests` in `crates/ui-egui`. Scores and hours unchanged.
- **Image Trace, flattened slivers:** in a Color, Grayscale or Black and White trace with Fills, a traced region whose outline straightens onto one line (a single pixel, or a one-pixel row along an edge, its pieces shared with the regions beside it) is left out instead of becoming a selectable path with no area, which paints nothing. Snap Curves To Lines straightens more outlines, so it leaves out more of these. Without Fills, the region's 1 px stroke draws it, and it is kept. Code-drawn tests in `crates/trace`.
- **Image Trace, Auto Color rare colours:** the Automatic palette keeps colours too rare for its area count when they are distinct (Oklab) and drawn as coherent regions, at most six, protected from mixed-colour merging and Noise; code-drawn stem, highlight, low-contrast and scattered-noise tests (see [quality notes](image-trace-quality.md#auto-color-keeps-rare-colours)).
- **Image Trace, Document Library keeps neutral tones neutral:** each pixel takes the library color nearest in Oklab with differences in hue and chroma counted three times, so a gray or a muted brown traces as a neutral library color instead of a saturated one of similar lightness; a code-drawn test of gray and brown patches with a black, light and blue library in `crates/trace`.
+1
View File
@@ -401,6 +401,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po
| Image Trace panel: holding the eye button next to View down shows the selected Image Trace objects' source image on the canvas | done | Per the public documentation, the control next to View is pressed and held to compare the trace result with the source image (<https://web.archive.org/web/20250831090623/https://helpx.adobe.com/illustrator/using/image-trace.html>). On release the objects show their View again; the document, its View and the undo history are unchanged. `RenderOptions::trace_source`; `panels/image_trace.rs` headless test `holding_the_eye_button_shows_the_source_image_until_released`, render test `trace_source_draws_the_source_image_of_the_listed_objects`. The Control bar and Properties have no such button |
| Live trace result bounds and selection highlights exclude the retained bitmap; source-image views retain it | done | All TraceView modes and rotated result bounds regression-covered; ordinary hidden group behavior retained |
| Image Trace panel: the Preview checkbox before Trace chooses whether a setting change traces the selected Image Trace object again at once | done | Per the public documentation, Preview shows the result of the current settings and Trace traces with them (<https://web.archive.org/web/20250831090623/https://helpx.adobe.com/illustrator/using/image-trace.html>). Preview is on by default and kept with the UI preferences; Reset to Default leaves it. Off, changes wait in the panel until Trace applies them as one undo step, or until Preview is turned on again. Changes stay with the object they were made for while another object is selected, and come back when it is selected again. `imageTrace.preview {on?}`, `ui.set {imageTracePreview}`; `panels/image_trace.rs` headless tests (`with_preview_off_a_slider_change_waits_for_trace`, `turning_preview_on_traces_the_changes_that_waited`, `preview_turned_on_with_nothing_selected_traces_when_the_object_is_selected_again`, `settings_that_wait_stay_with_their_object`, `settings_that_wait_come_back_when_their_object_is_selected_again`, `settings_that_wait_are_dropped_when_their_object_changed_since`, `preview_is_kept_with_the_preferences_and_reset_to_default_leaves_it`) |
| Concept to Vector panel: Window › Concept to Vector and Object › Concept to Vector… (also the context menu, the Contextual Task Bar, Properties' Quick Actions and the Control bar) open it for one image or unexpanded Image Trace object; it makes 1 to 8 styles side by side and Insert Selected puts the ticked ones to the right of the image as one undo step | partial | The help page describes choosing up to 8 styles of the selected image to compare side by side (<https://helpx.adobe.com/illustrator/desktop/use-generative-ai/generate-vector-artwork-from-images.html>). The built-in provider makes five offline Image Trace styles with Detail 0 to 100; its prompt field is disabled and it makes no raster output. On the web build a run is made one part a frame, so Cancel takes effect inside a style. `conceptVector.providers`, `conceptVector.generate`, `conceptVector.results`, `conceptVector.cancel`, `conceptVector.insert`; `panels/concept_vector.rs` headless tests |
| Toolbar without group labels by default, one or two columns; All Tools drawer by flyout group with shortcuts, its menu (Reset, Basic, Advanced) and Show section | done | #1751; a preference brings the labels back; `toolbar.show` sets the Fill/Stroke, Coloring, Draw Mode and Screen Mode controls |
| Actions panel: ≡ › Save Actions… saves the current set with all its actions to a file and ≡ › Load Actions… adds a saved set ([Manage a set of actions](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/manage-a-set-of-actions.html)) | partial | `ui.actionSet.save`, `ui.actionSet.load`; `panels/actions.rs` tests. The file is VectorCraft's own `.vcactions` JSON; Reset, Clear and Replace Actions remain |
| Actions panel: ≡ › Load Actions… also reads action sets saved as `.aia` files ([Actions panel overview](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/actions-panel-overview.html)) | partial | `actionSet.read`, `ui.actionSet.load`; `tests/actionset.rs`, `panels/actions.rs` tests, `import_fuzz`. Only steps with a label and no recorded values come in, as menu commands that run with no values and open no dialog, matched by label; the other steps, recorded menu items included, are left out and counted |