mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-21 01:44:57 +01:00
Merge storytold/main (e9a62670a7) into fix-8711-layers-target-ring
# Conflicts: # docs/target-app-parity.md # docs/ui-parity.md
This commit is contained in:
commit
4fcca3f1d4
142 files changed
+5533
-348
No files matched your search
+22
-8
@@ -34,6 +34,7 @@ const WIDE_LINES: &str =
|
||||
"lines wider than 2.11 mm (the widest lineweight) are written at 2.11 mm: Alter Paths for Appearance writes their true width";
|
||||
const STROKE_EXTRAS: &str = "stroke alignment, width profiles, arrowheads and brushes are left out (Maximize Editability writes strokes as lines)";
|
||||
const CLIPPING: &str = "clipping masks are not applied: the art they clip is written whole";
|
||||
const DISTORTED_IMAGES: &str = "images changed by Perspective Distort or Free Distort are written as the nearest parallelogram";
|
||||
const TYPE_ITEMS: &str = "fills and strokes added to whole type objects are left out of text entities (outline the text to keep them)";
|
||||
/// The warning for an image left out because it can't be decoded: the note raster exports give
|
||||
/// (`vectorcraft-engine`'s `rasterfx::undecoded_warning`).
|
||||
@@ -671,7 +672,18 @@ impl<'a> Scene<'a> {
|
||||
self.shape(n, &bp, *rule);
|
||||
}
|
||||
NodeKind::Text(t) => self.text(n, t),
|
||||
NodeKind::Image(im) => self.image(&self.doc.shown_image(n, im)),
|
||||
NodeKind::Image(im) => match vectorcraft_doc::image_quad::nearest_affine(n) {
|
||||
// DXF clips nothing, so a distorted image is written at the affine placement nearest
|
||||
// its corners, with the warning once it is written.
|
||||
Some(xf) => {
|
||||
if self.image(&ImageObject { xf, ..self.doc.shown_image(n, im).into_owned() }) {
|
||||
self.warn(DISTORTED_IMAGES);
|
||||
}
|
||||
}
|
||||
None => {
|
||||
self.image(&self.doc.shown_image(n, im));
|
||||
}
|
||||
},
|
||||
NodeKind::SymbolInstance { symbol, xf } => {
|
||||
let doc = self.doc;
|
||||
if self.symbol_nodes >= vectorcraft_doc::MAX_SYMBOL_NODES {
|
||||
@@ -1325,18 +1337,19 @@ impl<'a> Scene<'a> {
|
||||
name
|
||||
}
|
||||
|
||||
/// A placed image, linked to its file (written once per image).
|
||||
fn image(&mut self, im: &ImageObject) {
|
||||
/// A placed image, linked to its file (written once per image). False when no `IMAGE` entity is
|
||||
/// written.
|
||||
fn image(&mut self, im: &ImageObject) -> bool {
|
||||
if !self.o.version.handles() {
|
||||
self.warn(NO_IMAGES);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
if !self.o.include_images {
|
||||
self.note_setting(IMAGES_OFF);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
let Some(i) = self.image_def(im) else { return };
|
||||
let Some((dw, dh)) = self.images.get(i).map(|d| (f64::from(d.size.0), f64::from(d.size.1))) else { return };
|
||||
let Some(i) = self.image_def(im) else { return false };
|
||||
let Some((dw, dh)) = self.images.get(i).map(|d| (f64::from(d.size.0), f64::from(d.size.1))) else { return false };
|
||||
let (w, h) = (f64::from(im.width.max(1)), f64::from(im.height.max(1)));
|
||||
let map = self.to_dxf * im.xf;
|
||||
let lin = |v: kurbo::Vec2| (map * v.to_point()) - (map * Point::ZERO);
|
||||
@@ -1349,7 +1362,7 @@ impl<'a> Scene<'a> {
|
||||
let at = map * Point::new(0.0, h);
|
||||
let handle = self.handle();
|
||||
let reactor = self.handle();
|
||||
let Some(def) = self.images.get_mut(i) else { return };
|
||||
let Some(def) = self.images.get_mut(i) else { return false };
|
||||
def.reactors.push((reactor, handle));
|
||||
let def = def.handle;
|
||||
let layer = self.layer.clone();
|
||||
@@ -1375,6 +1388,7 @@ impl<'a> Scene<'a> {
|
||||
if self.o.version >= crate::DxfVersion::R2010 {
|
||||
self.e.int(290, 0);
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
/// The image file for image `im`, encoded once in the chosen format (`None`: left out).
|
||||
|
||||
@@ -984,6 +984,37 @@ fn images_can_be_left_out_with_their_files() {
|
||||
assert!(r12.warnings.iter().any(|w| w.contains("no images")) && r12.setting_notes.is_empty());
|
||||
}
|
||||
|
||||
/// DXF does not clip, so an image changed by Perspective Distort is written as one image at the
|
||||
/// placement nearest its corners, with a warning; an undistorted image gets no warning.
|
||||
#[test]
|
||||
fn a_distorted_image_is_written_as_its_nearest_parallelogram_with_a_warning() {
|
||||
let mut d = image_and_fill_doc(Paint::None);
|
||||
let warned = |o: &DxfOutput| o.warnings.iter().any(|w| w.contains("Perspective Distort or Free Distort"));
|
||||
assert!(!warned(&export(&d, &opts(&d)).unwrap()));
|
||||
let id = d.layers[0].children().unwrap()[1].id;
|
||||
let q = [(12.0, 20.0), (28.0, 20.0), (30.0, 30.0), (10.0, 30.0)].map(|(x, y)| Point::new(x, y));
|
||||
d.node_mut(id).unwrap().set_image_corners(q).unwrap();
|
||||
let out = export(&d, &opts(&d)).unwrap();
|
||||
assert!(warned(&out), "{:?}", out.warnings);
|
||||
assert_eq!(kinds(&out).iter().filter(|k| *k == "IMAGE").count(), 1, "{:?}", kinds(&out));
|
||||
// Placed as an undistorted image with the nearest affine placement as its transform would be.
|
||||
let near = vectorcraft_doc::image_quad::nearest_affine(d.node(id).unwrap()).unwrap();
|
||||
let mut plain = d.clone();
|
||||
let n = plain.node_mut(id).unwrap();
|
||||
n.extras_mut().image_quad = None;
|
||||
if let NodeKind::Image(im) = &mut n.kind {
|
||||
im.xf = near;
|
||||
}
|
||||
let placement = |o: &DxfOutput| {
|
||||
let e = entities(o).into_iter().find(|e| kind(e) == "IMAGE").expect("an IMAGE");
|
||||
[10, 20, 11, 21, 12, 22].map(|c| all(&e, c))
|
||||
};
|
||||
assert_eq!(placement(&out), placement(&export(&plain, &opts(&plain)).unwrap()));
|
||||
// With images left out, no IMAGE is written and the distortion warning does not appear.
|
||||
let left_out = export(&d, &DxfOptions { include_images: false, ..opts(&d) }).unwrap();
|
||||
assert!(!warned(&left_out), "{:?}", left_out.warnings);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn images_and_hatches_are_left_out_independently_and_the_cnc_preset_leaves_out_both() {
|
||||
let d = image_and_fill_doc(Paint::solid(Color::rgb(1.0, 0.0, 0.0)));
|
||||
|
||||
@@ -1156,6 +1156,17 @@ impl Lerp {
|
||||
(NodeKind::PlacedDocument(o), NodeKind::PlacedDocument(x), NodeKind::PlacedDocument(y)) => o.xf = lerp_affine(x.xf, y.xf, t),
|
||||
_ => {}
|
||||
}
|
||||
// Between distorted images, each step's corners lie between the keys' corners. A
|
||||
// step whose corners would fold keeps the nearer key's.
|
||||
if (a.is_distorted_image() || b.is_distorted_image())
|
||||
&& let (Some(qa), Some(qb)) = (a.image_corners(), b.image_corners())
|
||||
{
|
||||
let near = if t < 0.5 { qa } else { qb };
|
||||
if n.set_image_corners([0, 1, 2, 3].map(|i| qa[i].lerp(qb[i], t))).is_err() {
|
||||
// The nearer key's corners passed the same check when it was distorted.
|
||||
let _ = n.set_image_corners(near);
|
||||
}
|
||||
}
|
||||
n.extras_mut().mask = None;
|
||||
n
|
||||
}
|
||||
@@ -2297,6 +2308,43 @@ mod tests {
|
||||
assert_eq!(m.subpaths[0].anchors[0].p, Point::new(55.0, 0.0));
|
||||
}
|
||||
|
||||
/// A step between two distorted images has its corners between the keys' corners.
|
||||
#[test]
|
||||
fn steps_between_distorted_images_have_corners_between_theirs() {
|
||||
let image = |q: [(f64, f64); 4]| {
|
||||
let im = crate::ImageObject {
|
||||
key: "k".into(),
|
||||
width: 10,
|
||||
height: 10,
|
||||
xf: Affine::IDENTITY,
|
||||
link: None,
|
||||
placement: Default::default(),
|
||||
pixels: None,
|
||||
};
|
||||
let mut n = Node::new(NodeId(1), NodeKind::Image(Box::new(im)));
|
||||
n.set_image_corners(q.map(|(x, y)| Point::new(x, y))).unwrap();
|
||||
n
|
||||
};
|
||||
let a = image([(40.0, 0.0), (60.0, 0.0), (100.0, 100.0), (0.0, 100.0)]);
|
||||
let b = image([(200.0, 0.0), (300.0, 0.0), (280.0, 100.0), (220.0, 100.0)]);
|
||||
let mid = Lerp::new(&a, &b, (None, None)).at(0.5);
|
||||
let want = [(120.0, 0.0), (180.0, 0.0), (190.0, 100.0), (110.0, 100.0)];
|
||||
let got = mid.image_corners().unwrap();
|
||||
for (g, (x, y)) in got.iter().zip(want) {
|
||||
assert!(g.distance(Point::new(x, y)) < 1e-9, "{got:?}");
|
||||
}
|
||||
// Toward a key flipped left to right, the middle step's corners would meet: each step
|
||||
// there keeps the nearer key's corners, whether that key is distorted or not.
|
||||
let flipped = image([(60.0, 0.0), (40.0, 0.0), (0.0, 100.0), (100.0, 100.0)]);
|
||||
let mirror = image([(100.0, 0.0), (0.0, 0.0), (0.0, 100.0), (100.0, 100.0)]);
|
||||
assert!(!mirror.is_distorted_image());
|
||||
for (b, t) in [(&flipped, 0.5), (&mirror, 0.5), (&mirror, 0.45)] {
|
||||
let got = Lerp::new(&a, b, (None, None)).at(t).image_corners().unwrap();
|
||||
let near = (if t < 0.5 { &a } else { b }).image_corners().unwrap();
|
||||
assert!(got.iter().zip(near).all(|(g, w)| g.distance(w) < 1e-9), "{t}: {got:?} against {near:?}");
|
||||
}
|
||||
}
|
||||
|
||||
fn key(x: f64) -> Arc<Node> {
|
||||
Arc::new(Node::path(NodeId(1), vectorcraft_geom::shapes::rectangle(Rect::new(x, 0.0, x + 10.0, 10.0)), Appearance::default()))
|
||||
}
|
||||
|
||||
@@ -1503,14 +1503,17 @@ fn hit_leaf(n: &Node, p: Point, opt: HitOptions, symbols: &SymbolBoxes) -> Optio
|
||||
// An image is hit within its frame (on the frame's edge only with Selection by Path Only,
|
||||
// #3291, and in outline mode where the frame is all that is drawn, #6437), and where its
|
||||
// own fills and strokes paint ([`image_paint`]) except in outline mode.
|
||||
NodeKind::Image(im) => {
|
||||
NodeKind::Image(_) => {
|
||||
// The frame joins the image's corners ([`Node::image_frame`]); a plain image is picked
|
||||
// inside by its bounds, without building it.
|
||||
if opt.path_only || (opt.outline && !symbols.document().setup.outline_images) {
|
||||
use vectorcraft_geom::kurbo::Shape;
|
||||
let mut frame = Rect::new(0.0, 0.0, f64::from(im.width), f64::from(im.height)).to_path(0.1);
|
||||
frame.apply_affine(im.xf);
|
||||
if stroke_contains(&frame, 0.0, opt.tol, p) {
|
||||
if n.image_frame().is_some_and(|frame| stroke_contains(&frame, 0.0, opt.tol, p)) {
|
||||
return Some(HitKind::Outline);
|
||||
}
|
||||
} else if let Some(frame) = n.is_distorted_image().then(|| n.image_frame()).flatten() {
|
||||
if fill_contains(&frame, FillRule::NonZero, p) || stroke_contains(&frame, 0.0, opt.tol, p) {
|
||||
return Some(HitKind::Bounds);
|
||||
}
|
||||
} else if n.geometric_bounds_with(symbols).is_some_and(|b| b.inflate(opt.tol, opt.tol).contains(p)) {
|
||||
return Some(HitKind::Bounds);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,599 @@
|
||||
//! Perspective Distort and Free Distort on an image: its pixel rectangle's corners placed anywhere
|
||||
//! on the page, as long as they make a strictly convex quadrilateral.
|
||||
//!
|
||||
//! An image whose corners make a parallelogram is placed by its transform alone
|
||||
//! ([`crate::ImageObject::xf`]). Other corners are kept in the image's extras
|
||||
//! ([`crate::NodeExtras::image_quad`]), and the image is then drawn through the projective map
|
||||
//! that takes its pixel rectangle to them. The renderer, the exporters and printing draw it as a
|
||||
//! raster mesh warp ([`crate::live::mesh_warp_image`]) made from that map ([`distorted_art`]): no
|
||||
//! warped copy of the pixels is kept. The quad stays with the image's transform: moving, scaling,
|
||||
//! rotating or shearing the image maps its corners too ([`crate::Node::transform`]).
|
||||
//!
|
||||
//! The convexity rule, the tolerance of the mesh and its cell limit are VectorCraft's own.
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use vectorcraft_geom::kurbo::BezPath;
|
||||
use vectorcraft_geom::{Affine, Homography, PathData, Point, Rect, SubPath};
|
||||
|
||||
use crate::{Appearance, ImageObject, Node, NodeKind};
|
||||
|
||||
/// Most cells along each side of the mesh an image is drawn with ([`cells`]).
|
||||
pub const MAX_CELLS: usize = 64;
|
||||
|
||||
/// The cells along each side an image with fewer pixels than this may still take ([`cells`]).
|
||||
pub const MIN_CELL_CAP: usize = 8;
|
||||
|
||||
/// How far (in points) the mesh an image is drawn with in files and print may stray from the exact
|
||||
/// projective map ([`Density::PAGE`]).
|
||||
pub const TOLERANCE: f64 = 0.05;
|
||||
|
||||
/// How finely [`distorted_art_at`] cuts a distorted image ([`cells`]), and how far each piece
|
||||
/// reaches into its neighbors. A pixel inside the image draws opaque only when one piece covers
|
||||
/// it whole, so pieces much smaller than a pixel would let the page show through.
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub struct Density {
|
||||
/// How far (in points) the mesh may stray from the exact projective map.
|
||||
pub tolerance: f64,
|
||||
/// The shortest a cell may be along the longest side of the corners, in points.
|
||||
pub min_cell: f64,
|
||||
/// How far (in points) each piece reaches past its triangle.
|
||||
pub overlap: f64,
|
||||
}
|
||||
|
||||
impl Density {
|
||||
/// For files and print, whose viewing size is not known: within [`TOLERANCE`], cells of at
|
||||
/// least 2 pt, and pieces that reach half a point past their triangles.
|
||||
pub const PAGE: Density = Density { tolerance: TOLERANCE, min_cell: 2.0, overlap: 0.5 };
|
||||
|
||||
/// For drawing at `scale` device pixels a point: within a quarter of a pixel, cells of at least
|
||||
/// 4 pixels, and pieces that reach 2 pixels past their triangles.
|
||||
pub fn at_scale(scale: f64) -> Density {
|
||||
let s = if scale.is_finite() && scale > 1e-6 { scale } else { 1.0 };
|
||||
Density { tolerance: 0.25 / s, min_cell: 4.0 / s, overlap: 2.0 / s }
|
||||
}
|
||||
|
||||
/// [`Density::PAGE`] for art that is drawn `scale` times its size (a symbol's art in an
|
||||
/// instance that scales it): the tolerance, the cell size and the overlap measured on the page.
|
||||
pub fn page_at(scale: f64) -> Density {
|
||||
let s = if scale.is_finite() && scale > 1e-6 { scale } else { 1.0 };
|
||||
let p = Density::PAGE;
|
||||
Density { tolerance: p.tolerance / s, min_cell: p.min_cell / s, overlap: p.overlap / s }
|
||||
}
|
||||
}
|
||||
|
||||
/// How much `a` stretches its most stretched direction: the larger singular value of its linear
|
||||
/// part.
|
||||
pub fn max_stretch(a: Affine) -> f64 {
|
||||
let [m0, m1, m2, m3, _, _] = a.as_coeffs();
|
||||
let sum = m0 * m0 + m1 * m1 + m2 * m2 + m3 * m3;
|
||||
let det = m0 * m3 - m1 * m2;
|
||||
((sum + (sum * sum - 4.0 * det * det).max(0.0).sqrt()) / 2.0).sqrt()
|
||||
}
|
||||
|
||||
/// Why corners cannot be an image's.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum QuadError {
|
||||
/// A corner is not a finite point.
|
||||
NotFinite,
|
||||
/// The corners fold over, meet, or lie on one line: the quadrilateral is not strictly convex.
|
||||
NotConvex,
|
||||
/// The corners are convex but so close to a line that the perspective map through them cannot
|
||||
/// place every corner.
|
||||
TooNarrow,
|
||||
}
|
||||
|
||||
impl std::fmt::Display for QuadError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_str(match self {
|
||||
Self::NotFinite => "the corners of a distorted image must be finite points",
|
||||
Self::NotConvex => "the corners of a distorted image must make a convex shape: an image cannot fold over itself or collapse to a line",
|
||||
Self::TooNarrow => "the corners of a distorted image are too close together for a perspective map",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// `im`'s pixel rectangle: (0, 0) to its width and height.
|
||||
fn pixel_rect(im: &ImageObject) -> Rect {
|
||||
Rect::new(0.0, 0.0, f64::from(im.width), f64::from(im.height))
|
||||
}
|
||||
|
||||
/// The corners of `r` in the order a quad keeps them: top left, top right, bottom right, bottom
|
||||
/// left.
|
||||
fn rect_corners(r: Rect) -> [Point; 4] {
|
||||
[Point::new(r.x0, r.y0), Point::new(r.x1, r.y0), Point::new(r.x1, r.y1), Point::new(r.x0, r.y1)]
|
||||
}
|
||||
|
||||
/// Whether the corners `q` (in order around the shape) are finite and make a strictly convex
|
||||
/// quadrilateral, turning either way round. Each turn must be larger than 1e-9 times the product
|
||||
/// of the two sides it joins, a test that gives the same answer at any scale.
|
||||
pub fn check(q: &[Point; 4]) -> Result<(), QuadError> {
|
||||
if q.iter().any(|p| !p.is_finite()) {
|
||||
return Err(QuadError::NotFinite);
|
||||
}
|
||||
let mut sign = 0.0;
|
||||
for i in 0..4 {
|
||||
let (a, b, c) = (q[i], q[(i + 1) % 4], q[(i + 2) % 4]);
|
||||
let (u, v) = (b - a, c - b);
|
||||
let cross = u.cross(v);
|
||||
let scale = u.hypot() * v.hypot();
|
||||
if !cross.is_finite() || !scale.is_finite() || cross.abs() <= 1e-9 * scale || scale == 0.0 {
|
||||
return Err(QuadError::NotConvex);
|
||||
}
|
||||
if sign == 0.0 {
|
||||
sign = cross.signum();
|
||||
} else if cross.signum() != sign {
|
||||
return Err(QuadError::NotConvex);
|
||||
}
|
||||
}
|
||||
// Four turns the same way round can still wind twice (a star); a convex quadrilateral's
|
||||
// diagonals cross.
|
||||
let crosses = |a: Point, b: Point, c: Point, d: Point| (b - a).cross(c - a).signum() != (b - a).cross(d - a).signum();
|
||||
if !crosses(q[0], q[2], q[1], q[3]) || !crosses(q[1], q[3], q[0], q[2]) {
|
||||
return Err(QuadError::NotConvex);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Whether `q` can be image `im`'s corners: [`check`], and either a parallelogram or corners the
|
||||
/// perspective map from its pixels ([`pixel_map`]) places, each within a millionth of `q`'s
|
||||
/// shortest side plus the rounding error of coordinates as far from the origin as `q`'s.
|
||||
pub fn check_for(im: &ImageObject, q: &[Point; 4]) -> Result<(), QuadError> {
|
||||
check(q)?;
|
||||
if parallelogram(im, q).is_some() {
|
||||
return Ok(());
|
||||
}
|
||||
let tol = placement_tolerance(q);
|
||||
let map = pixel_map(im, q);
|
||||
let placed = rect_corners(pixel_rect(im)).iter().zip(q).all(|(c, want)| map.apply(*c).is_some_and(|p| p.distance(*want) <= tol));
|
||||
if placed { Ok(()) } else { Err(QuadError::TooNarrow) }
|
||||
}
|
||||
|
||||
/// How far a map may place a corner from `q`'s: a millionth of `q`'s shortest side plus the
|
||||
/// rounding error of coordinates as far from the origin as `q`'s.
|
||||
fn placement_tolerance(q: &[Point; 4]) -> f64 {
|
||||
let side = (0..4).map(|i| q[i].distance(q[(i + 1) % 4])).fold(f64::INFINITY, f64::min);
|
||||
let far = q.iter().map(|p| p.x.abs().max(p.y.abs())).fold(0.0, f64::max);
|
||||
side * 1e-6 + far * 1e-12
|
||||
}
|
||||
|
||||
/// The affine map from `im`'s pixel space that places its corners at `q`, when `q` is a
|
||||
/// parallelogram (within 1e-9 of the quad's size): the map puts the fourth corner within
|
||||
/// [`placement_tolerance`] of `q`'s. `None` otherwise.
|
||||
fn parallelogram(im: &ImageObject, q: &[Point; 4]) -> Option<Affine> {
|
||||
let size = q.iter().fold(0.0_f64, |m, p| m.max((*p - q[0]).hypot()));
|
||||
// The affine map through the other three corners misses the bottom right one by this much.
|
||||
let gap = (q[0].to_vec2() + q[2].to_vec2() - q[1].to_vec2() - q[3].to_vec2()).hypot();
|
||||
if gap > 1e-9 * size || gap > placement_tolerance(q) {
|
||||
return None;
|
||||
}
|
||||
let (w, h) = (f64::from(im.width.max(1)), f64::from(im.height.max(1)));
|
||||
let (x, y) = ((q[1] - q[0]) / w, (q[3] - q[0]) / h);
|
||||
let a = Affine::new([x.x, x.y, y.x, y.y, q[0].x, q[0].y]);
|
||||
a.is_finite().then_some(a)
|
||||
}
|
||||
|
||||
/// The homography taking the unit square's corners (0,0), (1,0), (1,1), (0,1) to `q`.
|
||||
fn square_to(q: &[Point; 4]) -> Homography {
|
||||
let [p0, p1, p2, p3] = *q;
|
||||
let (sx, sy) = (p0.x - p1.x + p2.x - p3.x, p0.y - p1.y + p2.y - p3.y);
|
||||
let (dx1, dx2, dy1, dy2) = (p1.x - p2.x, p3.x - p2.x, p1.y - p2.y, p3.y - p2.y);
|
||||
let den = dx1 * dy2 - dx2 * dy1;
|
||||
let (g, h) = if den.abs() < 1e-300 { (0.0, 0.0) } else { ((sx * dy2 - dx2 * sy) / den, (dx1 * sy - sx * dy1) / den) };
|
||||
Homography([[p1.x - p0.x + g * p1.x, p3.x - p0.x + h * p3.x, p0.x], [p1.y - p0.y + g * p1.y, p3.y - p0.y + h * p3.y, p0.y], [g, h, 1.0]])
|
||||
}
|
||||
|
||||
impl Node {
|
||||
/// This image's distortion: where its pixel rectangle's corners stand (top left, top right,
|
||||
/// bottom right, bottom left) when they do not make a parallelogram. `None` for an image placed
|
||||
/// by its transform alone, for anything that is not an image, and for corners a file holds
|
||||
/// that [`check_for`] refuses (the image is then placed by its transform).
|
||||
pub fn image_quad(&self) -> Option<[Point; 4]> {
|
||||
let NodeKind::Image(im) = &self.kind else { return None };
|
||||
let q = **self.extras().image_quad.as_ref()?;
|
||||
check_for(im, &q).is_ok().then_some(q)
|
||||
}
|
||||
|
||||
/// Whether this is an image with a distortion ([`Self::image_quad`]).
|
||||
pub fn is_distorted_image(&self) -> bool {
|
||||
self.image_quad().is_some()
|
||||
}
|
||||
|
||||
/// Where this image's pixel rectangle's corners stand: its distortion, or its transform's
|
||||
/// corners. `None` for anything that is not an image.
|
||||
pub fn image_corners(&self) -> Option<[Point; 4]> {
|
||||
let NodeKind::Image(im) = &self.kind else { return None };
|
||||
Some(self.image_quad().unwrap_or_else(|| rect_corners(pixel_rect(im)).map(|p| im.xf * p)))
|
||||
}
|
||||
|
||||
/// Place this image's corners at `q` (top left, top right, bottom right, bottom left): by its
|
||||
/// transform when they make a parallelogram (and the distortion is cleared), else as its
|
||||
/// distortion. An error, and nothing changes, when `q` fails [`check_for`] or this is not an
|
||||
/// image.
|
||||
pub fn set_image_corners(&mut self, q: [Point; 4]) -> Result<(), QuadError> {
|
||||
let NodeKind::Image(im) = &mut self.kind else { return Err(QuadError::NotConvex) };
|
||||
check_for(im, &q)?;
|
||||
match parallelogram(im, &q) {
|
||||
Some(xf) => {
|
||||
im.xf = xf;
|
||||
if self.extras().image_quad.is_some() {
|
||||
self.extras_mut().image_quad = None;
|
||||
}
|
||||
}
|
||||
None => self.extras_mut().image_quad = Some(Box::new(q)),
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// The outline of this image's frame on the page: its corners joined by straight lines.
|
||||
/// `None` for anything that is not an image.
|
||||
pub fn image_frame(&self) -> Option<BezPath> {
|
||||
let q = self.image_corners()?;
|
||||
let mut bp = BezPath::new();
|
||||
bp.move_to(q[0]);
|
||||
for p in &q[1..] {
|
||||
bp.line_to(*p);
|
||||
}
|
||||
bp.close_path();
|
||||
Some(bp)
|
||||
}
|
||||
|
||||
/// The map from this image's pixel space to the page: projective for a distorted image, its
|
||||
/// transform otherwise. `None` for anything that is not an image.
|
||||
pub fn image_map(&self) -> Option<Homography> {
|
||||
let NodeKind::Image(im) = &self.kind else { return None };
|
||||
Some(match self.image_quad() {
|
||||
Some(q) => pixel_map(im, &q),
|
||||
None => Homography::from_affine(im.xf),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// The projective map from `im`'s pixel space to the page that puts its corners at `q`.
|
||||
fn pixel_map(im: &ImageObject, q: &[Point; 4]) -> Homography {
|
||||
let (w, h) = (f64::from(im.width.max(1)), f64::from(im.height.max(1)));
|
||||
square_to(q).then_after(&Homography::from_affine(Affine::scale_non_uniform(1.0 / w, 1.0 / h)))
|
||||
}
|
||||
|
||||
/// How many cells along each side the mesh of a distorted image takes: the fewest (a power of two
|
||||
/// up to [`MAX_CELLS`]) for which the mesh's triangles, each mapped by the affine map through its
|
||||
/// corners, stay within `density`'s tolerance of `map` at the middle of every cell and every cell
|
||||
/// side. An image takes no more cells than it has pixels along its longer side, or
|
||||
/// [`MIN_CELL_CAP`] when that is more, and no more than leave each cell `density.min_cell` along
|
||||
/// the longest side of its corners. A perspective that needs more cells than these limits allow is
|
||||
/// drawn with the cells they allow.
|
||||
pub fn cells(map: &Homography, im: &ImageObject, density: Density) -> usize {
|
||||
let (w, h) = (f64::from(im.width.max(1)), f64::from(im.height.max(1)));
|
||||
let corners = [Point::new(0.0, 0.0), Point::new(w, 0.0), Point::new(w, h), Point::new(0.0, h)].map(|p| map.apply(p));
|
||||
let longest =
|
||||
corners.iter().zip(corners.iter().cycle().skip(1)).filter_map(|(a, b)| Some(a.as_ref()?.distance(*b.as_ref()?))).fold(0.0, f64::max);
|
||||
let by_size = longest / density.min_cell;
|
||||
let by_size = if by_size.is_finite() { (by_size as usize).max(1) } else { MAX_CELLS };
|
||||
let most = MAX_CELLS.min((im.width.max(im.height) as usize).max(MIN_CELL_CAP)).min(by_size);
|
||||
let at = |x: f64, y: f64| map.apply(Point::new(x, y));
|
||||
let mut k = 1;
|
||||
while k < most {
|
||||
let fits = (0..k * k).all(|c| {
|
||||
let (i, j) = ((c % k) as f64, (c / k) as f64);
|
||||
let (x0, y0, x1, y1) = (w * i / k as f64, h * j / k as f64, w * (i + 1.0) / k as f64, h * (j + 1.0) / k as f64);
|
||||
let (Some(a), Some(b), Some(cc), Some(d)) = (at(x0, y0), at(x1, y0), at(x1, y1), at(x0, y1)) else { return false };
|
||||
let near = |exact: Option<Point>, m: Point| exact.is_some_and(|e| e.distance(m) <= density.tolerance);
|
||||
near(at((x0 + x1) / 2.0, (y0 + y1) / 2.0), a.midpoint(cc))
|
||||
&& near(at((x0 + x1) / 2.0, y0), a.midpoint(b))
|
||||
&& near(at(x1, (y0 + y1) / 2.0), b.midpoint(cc))
|
||||
&& near(at((x0 + x1) / 2.0, y1), d.midpoint(cc))
|
||||
&& near(at(x0, (y0 + y1) / 2.0), a.midpoint(d))
|
||||
});
|
||||
if fits {
|
||||
break;
|
||||
}
|
||||
k *= 2;
|
||||
}
|
||||
k.min(most)
|
||||
}
|
||||
|
||||
/// For a format that cannot clip an image into the pieces of [`distorted_art`]: the affine
|
||||
/// placement nearest distorted image `n`'s projective map, the one that matches it at the middle
|
||||
/// of its pixels. `None` when `n` is not a distorted image.
|
||||
pub fn nearest_affine(n: &Node) -> Option<Affine> {
|
||||
let NodeKind::Image(im) = &n.kind else { return None };
|
||||
let q = n.image_quad()?;
|
||||
pixel_map(im, &q).affine_at(pixel_rect(im).center())
|
||||
}
|
||||
|
||||
/// Distorted image `n` as the art that draws it in files and print: [`distorted_art_at`] with
|
||||
/// [`Density::PAGE`].
|
||||
pub fn distorted_art(n: &Node) -> Option<Node> {
|
||||
distorted_art_at(n, Density::PAGE)
|
||||
}
|
||||
|
||||
/// Distorted image `n` as the art that draws it: a clip group, clipped by its corners, around the
|
||||
/// raster mesh warp ([`crate::live::mesh_warp_image`]) of its pixels through its projective map,
|
||||
/// with [`cells`] cells along each side for `density` and each piece reaching `density.overlap`
|
||||
/// past its triangle. The art has `n`'s id but not its name and transparency (which the caller
|
||||
/// keeps on the object around the art). `None` when `n` is not a distorted image.
|
||||
pub fn distorted_art_at(n: &Node, density: Density) -> Option<Node> {
|
||||
let NodeKind::Image(im) = &n.kind else { return None };
|
||||
let q = n.image_quad()?;
|
||||
let map = pixel_map(im, &q);
|
||||
let k = cells(&map, im, density);
|
||||
let mut plain = n.clone();
|
||||
// Whether the image shows is the image's to decide: a hidden source image that a view draws
|
||||
// anyway (Image Trace's Source Image) draws its art.
|
||||
plain.visible = true;
|
||||
// The image's own fills and strokes paint by the image's rules, not on the mesh's group.
|
||||
plain.appearance = Default::default();
|
||||
plain.name = None;
|
||||
plain.opacity = 1.0;
|
||||
plain.blend = Default::default();
|
||||
plain.isolate = false;
|
||||
plain.knockout = Default::default();
|
||||
plain.knockout_shape = false;
|
||||
if let Some(e) = plain.extras_if_any() {
|
||||
e.mask = None;
|
||||
}
|
||||
let mut art = crate::live::mesh_warp_image_with(&plain, im, &|p| p, k, n.extras().pixelated, false, Some(density.overlap));
|
||||
// The pieces along the image's edges reach past its corners too: the corners clip them.
|
||||
let mut edge = Node::path(n.id, PathData::single(SubPath::polyline(&q, true)), Appearance::default());
|
||||
if let NodeKind::Path { clipping, .. } = &mut edge.kind {
|
||||
*clipping = true;
|
||||
}
|
||||
let pieces = std::mem::replace(&mut art.kind, NodeKind::Group { children: vec![], clip: true });
|
||||
let mut mesh = art.clone();
|
||||
mesh.kind = pieces;
|
||||
art.knockout = Default::default();
|
||||
art.kind = NodeKind::Group { children: vec![Arc::new(edge), Arc::new(mesh)], clip: true };
|
||||
Some(art)
|
||||
}
|
||||
|
||||
/// The pieces of [`distorted_art_at`]'s art: the children of its mesh group.
|
||||
pub fn distorted_pieces(art: &Node) -> &[Arc<Node>] {
|
||||
art.children().and_then(|c| c.get(1)).and_then(|m| m.children()).map_or(&[], Vec::as_slice)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::NodeId;
|
||||
|
||||
fn image(w: u32, h: u32) -> Node {
|
||||
let im = ImageObject { key: "k".into(), width: w, height: h, xf: Affine::IDENTITY, link: None, placement: Default::default(), pixels: None };
|
||||
Node::new(NodeId(1), NodeKind::Image(Box::new(im)))
|
||||
}
|
||||
|
||||
fn pts(v: [(f64, f64); 4]) -> [Point; 4] {
|
||||
v.map(|(x, y)| Point::new(x, y))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_convex_quad_either_way_round_passes_and_a_fold_or_line_does_not() {
|
||||
assert_eq!(check(&pts([(0.0, 0.0), (10.0, 0.0), (10.0, 10.0), (0.0, 10.0)])), Ok(()));
|
||||
assert_eq!(check(&pts([(0.0, 0.0), (0.0, 10.0), (10.0, 10.0), (10.0, 0.0)])), Ok(()));
|
||||
// Two corners swapped: the sides cross.
|
||||
assert_eq!(check(&pts([(0.0, 0.0), (10.0, 0.0), (0.0, 10.0), (10.0, 10.0)])), Err(QuadError::NotConvex));
|
||||
// A dent.
|
||||
assert_eq!(check(&pts([(0.0, 0.0), (10.0, 0.0), (2.0, 2.0), (0.0, 10.0)])), Err(QuadError::NotConvex));
|
||||
// Three on a line, and two corners at one point.
|
||||
assert_eq!(check(&pts([(0.0, 0.0), (5.0, 0.0), (10.0, 0.0), (0.0, 10.0)])), Err(QuadError::NotConvex));
|
||||
assert_eq!(check(&pts([(0.0, 0.0), (0.0, 0.0), (10.0, 10.0), (0.0, 10.0)])), Err(QuadError::NotConvex));
|
||||
assert_eq!(check(&pts([(f64::NAN, 0.0), (10.0, 0.0), (10.0, 10.0), (0.0, 10.0)])), Err(QuadError::NotFinite));
|
||||
}
|
||||
|
||||
/// A convex quad with one edge so short that the perspective map through it cannot place the
|
||||
/// other corners: refused when set, and a file's copy of it leaves the image undistorted.
|
||||
#[test]
|
||||
fn corners_the_perspective_map_cannot_place_are_refused() {
|
||||
let q = pts([(50.0, 0.0), (50.000000005, 0.0), (100.0, 100.0), (0.0, 100.0)]);
|
||||
assert_eq!(check(&q), Ok(()));
|
||||
let mut n = image(100, 100);
|
||||
assert_eq!(n.set_image_corners(q), Err(QuadError::TooNarrow));
|
||||
assert!(n.extras().image_quad.is_none());
|
||||
n.extras_mut().image_quad = Some(Box::new(q));
|
||||
assert_eq!(n.image_quad(), None);
|
||||
assert!(distorted_art(&n).is_none());
|
||||
assert_eq!(n.image_corners(), Some(rect_corners(Rect::new(0.0, 0.0, 100.0, 100.0))));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_parallelogram_goes_into_the_transform_and_other_corners_into_the_quad() {
|
||||
let mut n = image(100, 50);
|
||||
n.set_image_corners(pts([(10.0, 0.0), (110.0, 10.0), (100.0, 60.0), (0.0, 50.0)])).unwrap();
|
||||
assert_eq!(n.image_quad(), None);
|
||||
let NodeKind::Image(im) = &n.kind else { panic!("an image") };
|
||||
assert!((im.xf * Point::new(100.0, 50.0)).distance(Point::new(100.0, 60.0)) < 1e-9);
|
||||
let q = pts([(40.0, 0.0), (60.0, 0.0), (100.0, 100.0), (0.0, 100.0)]);
|
||||
n.set_image_corners(q).unwrap();
|
||||
assert_eq!(n.image_quad(), Some(q));
|
||||
assert_eq!(n.image_corners(), Some(q));
|
||||
let map = n.image_map().unwrap();
|
||||
for (c, want) in rect_corners(Rect::new(0.0, 0.0, 100.0, 50.0)).iter().zip(q) {
|
||||
assert!(map.apply(*c).unwrap().distance(want) < 1e-9, "{c:?}");
|
||||
}
|
||||
// Back to a rectangle: the quad is cleared.
|
||||
n.set_image_corners(pts([(0.0, 0.0), (100.0, 0.0), (100.0, 50.0), (0.0, 50.0)])).unwrap();
|
||||
assert!(n.extras().image_quad.is_none());
|
||||
}
|
||||
|
||||
/// Corners whose gap from a parallelogram is tiny next to the quad's size but not next to its
|
||||
/// shortest side stay a distortion: the affine map would put the bottom right corner twice as
|
||||
/// low as asked.
|
||||
#[test]
|
||||
fn corners_the_affine_map_misses_stay_a_distortion() {
|
||||
let mut n = image(100, 100);
|
||||
let q = pts([(0.0, 0.0), (100000.0, 0.0), (100000.0, 0.00005), (0.0, 0.0001)]);
|
||||
n.set_image_corners(q).unwrap();
|
||||
assert_eq!(n.image_quad(), Some(q));
|
||||
let map = n.image_map().unwrap();
|
||||
for (c, want) in rect_corners(Rect::new(0.0, 0.0, 100.0, 100.0)).iter().zip(q) {
|
||||
assert!(map.apply(*c).unwrap().distance(want) < 1e-9, "{c:?}");
|
||||
}
|
||||
}
|
||||
|
||||
/// A scale that squeezes valid corners past what a perspective map can place leaves the image
|
||||
/// at the placement nearest them, scaled, not at the rectangle it had before.
|
||||
#[test]
|
||||
fn a_scale_past_the_perspective_limit_keeps_the_nearest_placement() {
|
||||
let mut n = image(100, 100);
|
||||
n.set_image_corners(pts([(0.0, 0.0), (100.0, 0.0), (200.0, 2e-7), (0.0, 2e-7)])).unwrap();
|
||||
assert!(n.is_distorted_image());
|
||||
n.transform(Affine::scale_non_uniform(1.0, 0.25), false);
|
||||
assert!(n.extras().image_quad.is_none());
|
||||
let b = n.geometric_bounds().unwrap();
|
||||
assert!(b.height() < 1e-6 && (b.width() - 150.0).abs() < 60.0, "{b:?}");
|
||||
}
|
||||
|
||||
/// A file's corners that the image cannot take are dropped as it is read, so a later scale
|
||||
/// that would make them valid leaves the image placed by its transform; a list of three
|
||||
/// points is dropped too, and the rest of the image is read.
|
||||
#[test]
|
||||
fn corners_a_file_holds_that_are_refused_or_not_four_are_dropped_as_it_is_read() {
|
||||
let mut n = image(100, 100);
|
||||
n.extras_mut().image_quad = Some(Box::new(pts([(0.0, 0.0), (100.0, 0.0), (200.0, 5e-8), (0.0, 5e-8)])));
|
||||
assert_eq!(n.image_quad(), None);
|
||||
let mut read: Node = serde_json::from_value(serde_json::to_value(&n).unwrap()).unwrap();
|
||||
assert!(read.extras().image_quad.is_none());
|
||||
read.transform(Affine::scale_non_uniform(1.0, 4.0), false);
|
||||
assert!(!read.is_distorted_image());
|
||||
assert_eq!(read.geometric_bounds(), Some(Rect::new(0.0, 0.0, 100.0, 400.0)));
|
||||
let mut v = serde_json::to_value(&n).unwrap();
|
||||
v["image_quad"] = serde_json::json!([[0.0, 0.0], [10.0, 0.0], [10.0, 10.0]]);
|
||||
let read: Node = serde_json::from_value(v).unwrap();
|
||||
assert!(read.extras().image_quad.is_none());
|
||||
assert!(matches!(read.kind, NodeKind::Image(_)));
|
||||
// Past a fourth point the rest is skipped without being read as points.
|
||||
for extra in [serde_json::json!([5.0, 5.0]), serde_json::json!("not a point")] {
|
||||
let mut v = serde_json::to_value(&n).unwrap();
|
||||
v["image_quad"] = serde_json::json!([[40.0, 0.0], [60.0, 0.0], [100.0, 100.0], [0.0, 100.0], extra, {"x": 1}]);
|
||||
let read: Node = serde_json::from_value(v).unwrap();
|
||||
assert!(read.extras().image_quad.is_none());
|
||||
}
|
||||
// Valid corners read back.
|
||||
let q = pts([(40.0, 0.0), (60.0, 0.0), (100.0, 100.0), (0.0, 100.0)]);
|
||||
n.set_image_corners(q).unwrap();
|
||||
let read: Node = serde_json::from_value(serde_json::to_value(&n).unwrap()).unwrap();
|
||||
assert_eq!(read.image_quad(), Some(q));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn refused_corners_change_nothing_and_a_bad_quad_in_a_file_is_ignored() {
|
||||
let mut n = image(10, 10);
|
||||
let before = n.clone();
|
||||
assert!(n.set_image_corners(pts([(0.0, 0.0), (10.0, 0.0), (0.0, 10.0), (10.0, 10.0)])).is_err());
|
||||
assert_eq!(n, before);
|
||||
n.extras_mut().image_quad = Some(Box::new(pts([(0.0, 0.0), (10.0, 0.0), (0.0, 10.0), (10.0, 10.0)])));
|
||||
assert_eq!(n.image_quad(), None);
|
||||
assert_eq!(n.image_corners(), Some(pts([(0.0, 0.0), (10.0, 0.0), (10.0, 10.0), (0.0, 10.0)])));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_mesh_is_as_fine_as_the_perspective_needs() {
|
||||
let mut n = image(400, 400);
|
||||
n.set_image_corners(pts([(10.0, 0.0), (400.0, 5.0), (390.0, 400.0), (0.0, 395.0)])).unwrap();
|
||||
let NodeKind::Image(im) = n.kind.clone() else { panic!("an image") };
|
||||
let gentle = cells(&n.image_map().unwrap(), &im, Density::PAGE);
|
||||
n.set_image_corners(pts([(160.0, 0.0), (240.0, 0.0), (400.0, 400.0), (0.0, 400.0)])).unwrap();
|
||||
let strong = cells(&n.image_map().unwrap(), &im, Density::PAGE);
|
||||
assert!(gentle < strong && strong <= MAX_CELLS, "{gentle} {strong}");
|
||||
// Three by two pixels drawn as large still bend, in up to MIN_CELL_CAP cells.
|
||||
let mut tiny = image(3, 2);
|
||||
tiny.set_image_corners(pts([(160.0, 0.0), (240.0, 0.0), (400.0, 400.0), (0.0, 400.0)])).unwrap();
|
||||
let NodeKind::Image(tim) = &tiny.kind else { panic!("an image") };
|
||||
assert_eq!(cells(&tiny.image_map().unwrap(), tim, Density::PAGE), MIN_CELL_CAP.min(strong));
|
||||
// Drawn small, the same corners take only cells of at least 4 pixels: their longest side,
|
||||
// about 431 pt, is about 17 pixels at 1/25 px a point, room for 4 cells.
|
||||
let map = n.image_map().unwrap();
|
||||
assert!(cells(&map, &im, Density::at_scale(1.0 / 25.0)) <= 4);
|
||||
// Drawn large, a quarter of a pixel is finer than 0.05 pt, so no fewer cells than on the page.
|
||||
assert!(cells(&map, &im, Density::at_scale(8.0)) >= strong);
|
||||
// Each cell of the page's mesh is at least 2 pt along the longest side: about 32 pt takes
|
||||
// 16 at most.
|
||||
let mut small = image(400, 400);
|
||||
small.set_image_corners(pts([(12.0, 0.0), (18.0, 0.0), (30.0, 30.0), (0.0, 30.0)])).unwrap();
|
||||
assert!(cells(&small.image_map().unwrap(), &im, Density::PAGE) <= 16);
|
||||
}
|
||||
|
||||
/// Each piece of the art reaches the density's overlap past its triangle, and the corners clip
|
||||
/// the art, so nothing draws outside them.
|
||||
#[test]
|
||||
fn the_pieces_overlap_and_the_corners_clip_them() {
|
||||
let mut n = image(100, 100);
|
||||
let q = pts([(40.0, 0.0), (60.0, 0.0), (100.0, 100.0), (0.0, 100.0)]);
|
||||
n.set_image_corners(q).unwrap();
|
||||
let art = distorted_art_at(&n, Density { tolerance: 1.0, min_cell: 1.0, overlap: 3.0 }).unwrap();
|
||||
let Some([edge, _]) = art.children().map(Vec::as_slice) else { panic!("an edge and a mesh") };
|
||||
assert!(matches!(edge.kind, NodeKind::Path { clipping: true, .. }));
|
||||
assert_eq!(edge.geometric_bounds(), Some(Rect::new(0.0, 0.0, 100.0, 100.0)));
|
||||
let pieces = distorted_pieces(&art);
|
||||
assert!(pieces.len() >= 2);
|
||||
// The first piece's clip triangle reaches 3 pt past the image's top left corner.
|
||||
let Some([clip, _]) = pieces[0].children().map(Vec::as_slice) else { panic!("a clip and an image") };
|
||||
let b = clip.geometric_bounds().unwrap();
|
||||
assert!(b.y0 < -2.0, "{b:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_art_puts_the_pixel_corners_on_the_quad() {
|
||||
let mut n = image(100, 100);
|
||||
n.opacity = 0.5;
|
||||
let q = pts([(40.0, 0.0), (60.0, 0.0), (100.0, 100.0), (0.0, 100.0)]);
|
||||
n.set_image_corners(q).unwrap();
|
||||
let art = distorted_art(&n).unwrap();
|
||||
assert_eq!(art.opacity, 1.0);
|
||||
let mut corners_seen = [false; 4];
|
||||
art.walk(&mut |c| {
|
||||
if let NodeKind::Image(im) = &c.kind {
|
||||
for (i, (p, want)) in rect_corners(Rect::new(0.0, 0.0, 100.0, 100.0)).iter().zip(q).enumerate() {
|
||||
if (im.xf * *p).distance(want) < 1e-9 {
|
||||
corners_seen[i] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
assert_eq!(corners_seen, [true; 4]);
|
||||
assert!(distorted_art(&image(4, 4)).is_none());
|
||||
// A hidden image that a view draws anyway gives art that draws.
|
||||
n.visible = false;
|
||||
assert!(distorted_art(&n).unwrap().visible);
|
||||
// The image's own fills and strokes stay off the mesh's group.
|
||||
let stroke = vectorcraft_color::Paint::solid(vectorcraft_color::Color::BLACK);
|
||||
n.appearance = crate::Appearance::basic(vectorcraft_color::Paint::None, stroke, 1.0).into();
|
||||
assert!(distorted_art(&n).unwrap().appearance.items.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn deep_expansion_reaches_a_distorted_image_inside_a_group() {
|
||||
let mut n = image(100, 100);
|
||||
n.set_image_corners(pts([(40.0, 0.0), (60.0, 0.0), (100.0, 100.0), (0.0, 100.0)])).unwrap();
|
||||
let inner = Node::new(NodeId(2), NodeKind::Group { children: vec![std::sync::Arc::new(n)], clip: false });
|
||||
let outer = Node::new(NodeId(3), NodeKind::Group { children: vec![std::sync::Arc::new(inner)], clip: false });
|
||||
let out = crate::live::expand_deep(&outer, None);
|
||||
let mut distorted = 0;
|
||||
let mut pieces = 0;
|
||||
out.walk(&mut |c| {
|
||||
distorted += usize::from(c.is_distorted_image());
|
||||
pieces += usize::from(matches!(c.kind, NodeKind::Image(_)));
|
||||
});
|
||||
assert_eq!(distorted, 0);
|
||||
assert!(pieces > 1, "{pieces}");
|
||||
}
|
||||
|
||||
/// A distorted image with an effect of its own stays an image with its appearance when the
|
||||
/// art around it is expanded, so the effect still applies where the art is drawn.
|
||||
#[test]
|
||||
fn deep_expansion_keeps_a_distorted_image_with_its_own_appearance() {
|
||||
let mut n = image(100, 100);
|
||||
n.set_image_corners(pts([(40.0, 0.0), (60.0, 0.0), (100.0, 100.0), (0.0, 100.0)])).unwrap();
|
||||
let effect = crate::Effect { id: "distort.transform".into(), params: serde_json::json!({"moveH": 40}), visible: true };
|
||||
n.appearance = crate::Appearance { effects: vec![effect], ..Default::default() }.into();
|
||||
let inner = Node::new(NodeId(2), NodeKind::Group { children: vec![std::sync::Arc::new(n.clone())], clip: false });
|
||||
let outer = Node::new(NodeId(3), NodeKind::Group { children: vec![std::sync::Arc::new(inner)], clip: false });
|
||||
let out = crate::live::expand_deep(&outer, None);
|
||||
let mut kept = vec![];
|
||||
out.walk(&mut |c| {
|
||||
if c.is_distorted_image() {
|
||||
kept.push(c.appearance.clone());
|
||||
}
|
||||
});
|
||||
assert_eq!(kept, vec![n.appearance]);
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ pub mod graph;
|
||||
mod halftone_radii;
|
||||
pub mod hit;
|
||||
mod id_index;
|
||||
pub mod image_quad;
|
||||
pub use id_index::{path_lookups, tree_walks};
|
||||
pub mod inks;
|
||||
mod inline;
|
||||
|
||||
@@ -57,11 +57,11 @@ pub use envelope::{
|
||||
envelope_content_boxes, envelope_content_boxes_with, envelope_expand, envelope_frame, envelope_grid, envelope_mapper, envelope_of,
|
||||
envelope_overlay, envelope_stroke_margin, set_type_ink, smooth_handles, warp_grid,
|
||||
};
|
||||
pub(crate) use expand::max_outset;
|
||||
pub use expand::{
|
||||
Hooks, MAX_GENERATED, Outliner, PatternTiles, affine_near, expand_deep, expand_deep_hooks, expand_live, expand_live_hooks, expand_live_with,
|
||||
expanded_group, expanded_group_hooks, is_live, mesh_quad_nodes, mesh_warp_cost, mesh_warp_image, subtree_has_live,
|
||||
expanded_group, expanded_group_hooks, is_drawn_live, is_live, mesh_quad_nodes, mesh_warp_cost, mesh_warp_image, subtree_has_live,
|
||||
};
|
||||
pub(crate) use expand::{max_outset, mesh_warp_image_with};
|
||||
#[cfg(test)]
|
||||
use mesh::grid_eval;
|
||||
pub use mesh::{Coons, GradientMesh, MeshAppearance, MeshPiece, MeshPoint, MeshQuad, default_fidelity, grid_points, nodes_bounds};
|
||||
|
||||
@@ -212,12 +212,26 @@ pub fn mesh_warp_cost(cells: usize) -> usize {
|
||||
/// partly transparent image keeps its own alpha there. More cells than [`MAX_GENERATED`] objects
|
||||
/// allow make an empty group.
|
||||
pub fn mesh_warp_image(n: &Node, im: &ImageObject, f: &dyn Fn(Point) -> Point, cells: usize, pixelated: bool, masked: bool) -> Node {
|
||||
mesh_warp_image_with(n, im, f, cells, pixelated, masked, None)
|
||||
}
|
||||
|
||||
/// [`mesh_warp_image`], each piece reaching `overlap` points past its edges when given.
|
||||
pub(crate) fn mesh_warp_image_with(
|
||||
n: &Node,
|
||||
im: &ImageObject,
|
||||
f: &dyn Fn(Point) -> Point,
|
||||
cells: usize,
|
||||
pixelated: bool,
|
||||
masked: bool,
|
||||
overlap: Option<f64>,
|
||||
) -> Node {
|
||||
let k = cells.max(1);
|
||||
let mut g = n.clone();
|
||||
g.kind = NodeKind::Group { children: vec![], clip: false };
|
||||
g.knockout = crate::Knockout::On;
|
||||
if let Some(e) = g.extras_if_any() {
|
||||
e.colorize = None;
|
||||
e.image_quad = None;
|
||||
}
|
||||
if mesh_warp_cost(k) > MAX_GENERATED {
|
||||
return g;
|
||||
@@ -228,24 +242,31 @@ pub fn mesh_warp_image(n: &Node, im: &ImageObject, f: &dyn Fn(Point) -> Point, c
|
||||
let color_mask = n.extras().color_mask.clone();
|
||||
let (pw, ph) = (im.width as f64, im.height as f64);
|
||||
let at = |i: usize, j: usize| Point::new(pw * i as f64 / k as f64, ph * j as f64 / k as f64);
|
||||
// A distorted image's pixels reach the page through its projective map.
|
||||
let to_page = n.image_map().filter(|_| n.is_distorted_image());
|
||||
let place = |p: Point| to_page.and_then(|m| m.apply(p)).unwrap_or(im.xf * p);
|
||||
let mut pieces = Vec::with_capacity(2 * k * k);
|
||||
for j in 0..k {
|
||||
for i in 0..k {
|
||||
let s = [at(i, j), at(i + 1, j), at(i + 1, j + 1), at(i, j + 1)];
|
||||
let d = s.map(|p| f(im.xf * p));
|
||||
let d = s.map(|p| f(place(p)));
|
||||
for t in [[0, 1, 2], [0, 2, 3]] {
|
||||
let (st, dt) = (t.map(|v| s[v]), t.map(|v| d[v]));
|
||||
let Some(xf) = affine_between(st, dt) else { continue };
|
||||
let c = Point::new((dt[0].x + dt[1].x + dt[2].x) / 3.0, (dt[0].y + dt[1].y + dt[2].y) / 3.0);
|
||||
let grow = (dt[0].distance(dt[1]).max(dt[1].distance(dt[2])) * 0.02).min(0.5);
|
||||
let tri: Vec<Point> = dt
|
||||
.iter()
|
||||
.map(|p| {
|
||||
let v = *p - c;
|
||||
let len = v.hypot();
|
||||
if len > 1e-12 { *p + v * (grow / len) } else { *p }
|
||||
})
|
||||
.collect();
|
||||
let tri: Vec<Point> = match overlap {
|
||||
Some(g) => grown_triangle(dt, g),
|
||||
None => {
|
||||
let grow = (dt[0].distance(dt[1]).max(dt[1].distance(dt[2])) * 0.02).min(0.5);
|
||||
dt.iter()
|
||||
.map(|p| {
|
||||
let v = *p - c;
|
||||
let len = v.hypot();
|
||||
if len > 1e-12 { *p + v * (grow / len) } else { *p }
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
};
|
||||
let shape = PathData::single(SubPath::polyline(&tri, true));
|
||||
let mut image = Node::new(n.id, NodeKind::Image(Box::new(ImageObject { xf, ..im.clone() })));
|
||||
image.extras_mut().pixelated = pixelated;
|
||||
@@ -274,6 +295,23 @@ pub fn mesh_warp_image(n: &Node, im: &ImageObject, f: &dyn Fn(Point) -> Point, c
|
||||
g
|
||||
}
|
||||
|
||||
/// Triangle `t` with each side moved `g` outward: `t` scaled about its incenter. A corner moves
|
||||
/// at most 8 `g`, so a very thin triangle's sides move less than `g`.
|
||||
fn grown_triangle(t: [Point; 3], g: f64) -> Vec<Point> {
|
||||
let side = |i: usize| t[(i + 1) % 3].distance(t[(i + 2) % 3]);
|
||||
let (a, b, c) = (side(0), side(1), side(2));
|
||||
let perimeter = a + b + c;
|
||||
let area = ((t[1] - t[0]).cross(t[2] - t[0]) / 2.0).abs();
|
||||
if !(perimeter > 1e-12 && area > 0.0 && g.is_finite() && g > 0.0) {
|
||||
return t.to_vec();
|
||||
}
|
||||
let center = Point::new((a * t[0].x + b * t[1].x + c * t[2].x) / perimeter, (a * t[0].y + b * t[1].y + c * t[2].y) / perimeter);
|
||||
let r = 2.0 * area / perimeter;
|
||||
let far = t.iter().map(|p| p.distance(center)).fold(0.0, f64::max);
|
||||
let grow = (g / r).min(8.0 * g / far.max(1e-12));
|
||||
t.iter().map(|p| center + (*p - center) * (1.0 + grow)).collect()
|
||||
}
|
||||
|
||||
/// Distort Pattern Fills: path or compound path `n` with each visible pattern fill turned into the
|
||||
/// tiles it paints in a clip group shaped like `n` (with the fill's opacity and blend mode), its
|
||||
/// other fills and strokes on copies of it, in paint order, under `n`'s transparency. `None`
|
||||
@@ -353,6 +391,13 @@ pub fn is_live(n: &Node) -> bool {
|
||||
)
|
||||
}
|
||||
|
||||
/// Is this drawn and written as evaluated art: a live object ([`is_live`]) or a distorted image
|
||||
/// ([`Node::image_quad`]), whose art is [`crate::image_quad::distorted_art`]. Effects and
|
||||
/// container paint treat a distorted image as an image, not as live art.
|
||||
pub fn is_drawn_live(n: &Node) -> bool {
|
||||
is_live(n) || n.is_distorted_image()
|
||||
}
|
||||
|
||||
/// Mesh tessellation as flat-filled paths (no stroke): each patch cut `n`×`n`, its quads joined
|
||||
/// where the colour hardly changes ([`GradientMesh::pieces`]).
|
||||
pub fn mesh_quad_nodes(m: &GradientMesh, n: usize) -> Vec<Node> {
|
||||
@@ -388,6 +433,7 @@ pub fn expand_live_hooks(n: &Node, hooks: Hooks) -> Vec<Node> {
|
||||
NodeKind::Repeat(r) => r.expand(hooks.symbols),
|
||||
NodeKind::PlacedDocument(p) => p.art(n),
|
||||
NodeKind::Intertwine { children } => crate::intertwine::expand(children),
|
||||
NodeKind::Image(_) => vec![crate::image_quad::distorted_art(n).unwrap_or_else(|| n.clone())],
|
||||
_ => vec![n.clone()],
|
||||
}
|
||||
}
|
||||
@@ -429,7 +475,7 @@ pub fn expand_deep(n: &Node, outline: Outliner) -> Node {
|
||||
/// expands to nothing.
|
||||
pub fn expand_deep_hooks(n: &Node, hooks: Hooks) -> Node {
|
||||
let _generating = Generating::enter();
|
||||
let mut out = if is_live(n) {
|
||||
let mut out = if is_drawn_live(n) {
|
||||
let g = expanded_group_hooks(n, hooks);
|
||||
if !Generating::charge(g.count()) {
|
||||
return Node::new(n.id, NodeKind::Group { children: vec![], clip: false });
|
||||
@@ -440,7 +486,12 @@ pub fn expand_deep_hooks(n: &Node, hooks: Hooks) -> Node {
|
||||
};
|
||||
if let Some(ch) = out.children_mut() {
|
||||
for c in ch.iter_mut() {
|
||||
if subtree_has_live(c) {
|
||||
// A distorted image with fills, strokes or effects of its own stays an image: whoever
|
||||
// draws the art draws it with them, as it draws a distorted image anywhere else.
|
||||
if c.is_distorted_image() && !(c.appearance.items.is_empty() && c.appearance.effects.is_empty()) {
|
||||
continue;
|
||||
}
|
||||
if subtree_has_drawn_live(c) {
|
||||
*c = Arc::new(expand_deep_hooks(c, hooks));
|
||||
}
|
||||
}
|
||||
@@ -497,6 +548,13 @@ pub fn subtree_has_live(n: &Node) -> bool {
|
||||
any
|
||||
}
|
||||
|
||||
/// Does `n` or any descendant draw as evaluated art ([`is_drawn_live`])?
|
||||
fn subtree_has_drawn_live(n: &Node) -> bool {
|
||||
let mut any = false;
|
||||
n.walk(&mut |c| any |= is_drawn_live(c));
|
||||
any
|
||||
}
|
||||
|
||||
/// Largest stroke outset in a subtree (for visual bounds of envelopes, blends and repeats, and the
|
||||
/// reach of symbol art), type's character strokes included as type's own visual bounds measure them
|
||||
/// ([`crate::TextObject::char_stroke_outset`]): in an envelope they paint at their own weight
|
||||
|
||||
@@ -44,8 +44,12 @@ impl Node {
|
||||
}
|
||||
}
|
||||
NodeKind::Image(im) => {
|
||||
let frame = shapes::rectangle(Rect::new(0.0, 0.0, im.width as f64, im.height as f64)).transformed(im.xf);
|
||||
out.push((frame.to_bezpath(), FillRule::NonZero));
|
||||
// A distorted image's frame joins its corners.
|
||||
let frame = match self.image_frame().filter(|_| self.is_distorted_image()) {
|
||||
Some(bp) => bp,
|
||||
None => shapes::rectangle(Rect::new(0.0, 0.0, im.width as f64, im.height as f64)).transformed(im.xf).to_bezpath(),
|
||||
};
|
||||
out.push((frame, FillRule::NonZero));
|
||||
}
|
||||
NodeKind::PlacedDocument(p) => {
|
||||
let frame = shapes::rectangle(p.natural()).transformed(p.xf);
|
||||
|
||||
@@ -3,6 +3,7 @@ use super::kind::NodeKind;
|
||||
use super::live_shape::LiveShape;
|
||||
use super::opacity::OpacityMask;
|
||||
use super::{Node, PathData};
|
||||
use vectorcraft_geom::Point;
|
||||
|
||||
/// The parts of a [`Node`] that few objects have: kept out of line, so that the nodes without
|
||||
/// them stay small ([`Node::extras`]).
|
||||
@@ -87,6 +88,10 @@ pub struct NodeExtras {
|
||||
/// are applied, one path or compound path per fill and stroke: as the clipping path of a clip group it paints
|
||||
/// those pieces as the path paints its fills and strokes ([`Node::clip_paint`]).
|
||||
pub clip_pieces: bool,
|
||||
/// As an image after Perspective Distort or Free Distort, where its pixel rectangle's corners
|
||||
/// (top left, top right, bottom right, bottom left in pixel space) stand on the page when they
|
||||
/// do not make a parallelogram, which its transform alone could place ([`crate::image_quad`]).
|
||||
pub image_quad: Option<Box<[Point; 4]>>,
|
||||
}
|
||||
|
||||
/// No extras: what [`Node::extras`] gives for a node without any.
|
||||
@@ -118,6 +123,7 @@ pub(super) static NO_EXTRAS: NodeExtras = NodeExtras {
|
||||
color_mask: None,
|
||||
warp_piece: false,
|
||||
clip_pieces: false,
|
||||
image_quad: None,
|
||||
};
|
||||
|
||||
/// A node's [`NodeExtras`], if it has any ([`Node::extras`]). Extras that are all unset equal
|
||||
|
||||
@@ -386,6 +386,10 @@ impl Node {
|
||||
.filter(|c| c.visible || !matches!(self.kind, NodeKind::Layer { .. }))
|
||||
.fold(None, |acc, c| vectorcraft_geom::union_opt(acc, c.geometric(symbols))),
|
||||
NodeKind::Text(t) => self.projected(t.bounds()),
|
||||
// A distorted image is bounded by its corners.
|
||||
NodeKind::Image(_) if self.is_distorted_image() => {
|
||||
self.image_corners().map(|q| q[1..].iter().fold(Rect::from_points(q[0], q[0]), |r, p| r.union_pt(*p)))
|
||||
}
|
||||
NodeKind::Image(im) => Some(im.xf.transform_rect_bbox(Rect::new(0.0, 0.0, im.width as f64, im.height as f64))),
|
||||
NodeKind::SymbolInstance { symbol, xf } => {
|
||||
let art = symbols.and_then(|s| s.art(symbol)).map_or(SYMBOL_SQUARE, |a| a.geometric);
|
||||
@@ -528,6 +532,9 @@ impl Node {
|
||||
}
|
||||
// The path the objects are attached to, before it is transformed.
|
||||
let on_path_before = self.on_path_data().cloned();
|
||||
// A distorted image's placement nearest its corners, before they are transformed (`None`
|
||||
// within when its stored corners are refused, and `None` for anything else).
|
||||
let image_before = self.extras().image_quad.is_some().then(|| crate::image_quad::nearest_affine(self));
|
||||
if !self.is_layer() {
|
||||
self.bbox_angle = crate::orient::transformed_angle(self.bbox_angle, a);
|
||||
}
|
||||
@@ -637,7 +644,8 @@ impl Node {
|
||||
{
|
||||
Arc::make_mut(&mut m.art).transform_scaled(a, sc);
|
||||
}
|
||||
// The area where an Intertwine member is drawn over the others moves with it.
|
||||
// The area where an Intertwine member is drawn over the others moves with it, and so do a
|
||||
// distorted image's corners.
|
||||
if let Some(e) = self.extras_if_any() {
|
||||
if let Some(area) = e.intertwine.as_mut() {
|
||||
area.transform(a);
|
||||
@@ -645,6 +653,23 @@ impl Node {
|
||||
for area in &mut e.intertwine_tiers {
|
||||
area.transform(a);
|
||||
}
|
||||
if let Some(q) = e.image_quad.as_mut() {
|
||||
for p in q.iter_mut() {
|
||||
*p = a * *p;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Corners that a scale squeezes past what a perspective map can place (or that were
|
||||
// refused already) leave the image placed by its transform: for valid corners, the
|
||||
// placement that was nearest them, transformed, rather than the rectangle it had before
|
||||
// it was distorted.
|
||||
if let Some(before) = image_before
|
||||
&& self.image_quad().is_none()
|
||||
{
|
||||
if let (Some(near), NodeKind::Image(im)) = (before, &mut self.kind) {
|
||||
im.xf = a * near;
|
||||
}
|
||||
self.extras_mut().image_quad = None;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ impl Serialize for Node {
|
||||
e.color_mask.is_none(),
|
||||
is_default(&e.warp_piece),
|
||||
is_default(&e.clip_pieces),
|
||||
e.image_quad.is_none(),
|
||||
];
|
||||
let mut st = s.serialize_struct("Node", skips.iter().filter(|s| !**s).count())?;
|
||||
let mut skip = skips.into_iter();
|
||||
@@ -106,6 +107,7 @@ impl Serialize for Node {
|
||||
field!("color_mask", &e.color_mask);
|
||||
field!("warp_piece", &e.warp_piece);
|
||||
field!("clip_pieces", &e.clip_pieces);
|
||||
field!("image_quad", &e.image_quad);
|
||||
st.end()
|
||||
}
|
||||
}
|
||||
@@ -257,10 +259,55 @@ pub(super) struct NodeWire {
|
||||
warp_piece: bool,
|
||||
#[serde(default)]
|
||||
clip_pieces: bool,
|
||||
#[serde(default, deserialize_with = "image_corners")]
|
||||
image_quad: Option<Box<[vectorcraft_geom::Point; 4]>>,
|
||||
}
|
||||
|
||||
/// A distorted image's corners as a file holds them: a list of exactly four points, else none (the
|
||||
/// image is then placed by its transform). At most five points of a longer list are kept while it
|
||||
/// is read.
|
||||
fn image_corners<'de, D: serde::Deserializer<'de>>(d: D) -> Result<Option<Box<[vectorcraft_geom::Point; 4]>>, D::Error> {
|
||||
use vectorcraft_geom::Point;
|
||||
struct Corners;
|
||||
impl<'de> serde::de::Visitor<'de> for Corners {
|
||||
type Value = Option<Box<[Point; 4]>>;
|
||||
fn expecting(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
f.write_str("a list of points")
|
||||
}
|
||||
fn visit_none<E: serde::de::Error>(self) -> Result<Self::Value, E> {
|
||||
Ok(None)
|
||||
}
|
||||
fn visit_unit<E: serde::de::Error>(self) -> Result<Self::Value, E> {
|
||||
Ok(None)
|
||||
}
|
||||
fn visit_some<D: serde::Deserializer<'de>>(self, d: D) -> Result<Self::Value, D::Error> {
|
||||
d.deserialize_seq(Corners)
|
||||
}
|
||||
fn visit_seq<A: serde::de::SeqAccess<'de>>(self, mut seq: A) -> Result<Self::Value, A::Error> {
|
||||
let mut points = Vec::with_capacity(4);
|
||||
while points.len() < 4
|
||||
&& let Some(p) = seq.next_element::<Point>()?
|
||||
{
|
||||
points.push(p);
|
||||
}
|
||||
// A fifth entry drops the field, so the rest is skipped without decoding it.
|
||||
let mut extra = false;
|
||||
while seq.next_element::<serde::de::IgnoredAny>()?.is_some() {
|
||||
extra = true;
|
||||
}
|
||||
Ok(if extra { None } else { <[Point; 4]>::try_from(points).ok().map(Box::new) })
|
||||
}
|
||||
}
|
||||
d.deserialize_option(Corners)
|
||||
}
|
||||
|
||||
impl From<NodeWire> for Node {
|
||||
fn from(w: NodeWire) -> Self {
|
||||
// Corners an image cannot take are dropped, so a later transform cannot make them its own.
|
||||
let image_quad = match &w.kind {
|
||||
NodeKind::Image(im) => w.image_quad.filter(|q| crate::image_quad::check_for(im, q).is_ok()),
|
||||
_ => None,
|
||||
};
|
||||
let extras = NodeExtras {
|
||||
mask: w.mask,
|
||||
trace: w.trace,
|
||||
@@ -289,6 +336,7 @@ impl From<NodeWire> for Node {
|
||||
color_mask: w.color_mask,
|
||||
warp_piece: w.warp_piece,
|
||||
clip_pieces: w.clip_pieces,
|
||||
image_quad,
|
||||
};
|
||||
Node {
|
||||
id: w.id,
|
||||
|
||||
@@ -111,6 +111,8 @@ fn lengths_of(id: &str) -> Lengths {
|
||||
"sketch.tornEdges" => always(&["smoothness"]),
|
||||
"sketch.waterPaper" => always(&["fiberLength"]),
|
||||
TRAP => always(&["thickness", "precision"]),
|
||||
// The Pathfinder Options' refit tolerance.
|
||||
id if crate::takes_pathfinder_options(id) => always(&["precision"]),
|
||||
RASTERIZE => always(&["addAround"]),
|
||||
// The points one unit of the filter measures.
|
||||
crate::SVG_FILTER => always(&["scale"]),
|
||||
@@ -832,15 +834,11 @@ pub fn effect_catalog() -> Vec<EffectInfo> {
|
||||
}
|
||||
for (id, label, _) in PATHFINDER_EFFECTS {
|
||||
if id == "pathfinder.softMix" {
|
||||
v.push(g(
|
||||
id,
|
||||
label,
|
||||
PATHFINDER,
|
||||
"{mixingRate?: 1..100 % (50)} blend overlapping fills in CMYK bottom to top (groups and layers: live Pathfinder over the members)",
|
||||
json!({"mixingRate": 50.0}),
|
||||
));
|
||||
v.push(g(id, label, PATHFINDER, crate::group::SOFT_MIX_PARAMS_DOC, json!({"mixingRate": 50.0})));
|
||||
} else {
|
||||
v.push(g(id, label, PATHFINDER, "{} (groups and layers: live Pathfinder over the members)", json!({})));
|
||||
// No dialog defaults, so the Effect menu applies it directly; effect.apply fills its
|
||||
// Pathfinder Options in.
|
||||
v.push(g(id, label, PATHFINDER, crate::group::PATHFINDER_PARAMS_DOC, json!({})));
|
||||
}
|
||||
}
|
||||
v.extend(crate::addons::color::catalog());
|
||||
|
||||
+121
-8
@@ -51,6 +51,80 @@ fn op_of(id: &str) -> Option<PathfinderOp> {
|
||||
PATHFINDER_EFFECTS.iter().find(|e| e.0 == id).map(|e| e.2)
|
||||
}
|
||||
|
||||
/// Does effect `id` keep Pathfinder Options of its own ([`PathfinderEffectOptions`]): one of
|
||||
/// [`PATHFINDER_EFFECTS`] (Trap has options of its own)?
|
||||
pub fn takes_pathfinder_options(id: &str) -> bool {
|
||||
op_of(id).is_some()
|
||||
}
|
||||
|
||||
/// The parameters holding a Pathfinder effect's Pathfinder Options.
|
||||
pub const PATHFINDER_OPTION_KEYS: [&str; 3] = ["precision", "removeRedundantPoints", "removeUnpainted"];
|
||||
|
||||
/// The range of a Pathfinder effect's `precision` (pt), the Pathfinder panel's range.
|
||||
pub const PATHFINDER_EFFECT_PRECISION: std::ops::RangeInclusive<f64> = 0.001..=10.0;
|
||||
|
||||
/// The documentation of [`PATHFINDER_OPTION_KEYS`], as a literal for `concat!`.
|
||||
macro_rules! options_doc {
|
||||
() => {
|
||||
"precision?: pt 0.001..10 (effect.apply: Pathfinder Options › Precision; 0.01 when missing; results are refit to within it and pieces thinner than it are dropped), removeRedundantPoints?: bool (effect.apply: Pathfinder Options › Remove Redundant Points; false when missing; results lose the anchors that don't change their shape to within precision), removeUnpainted?: bool (effect.apply: Pathfinder Options › Divide and Outline Will Remove Unpainted Artwork; false when missing; Divide and Outline leave out the pieces of members with no visible fill, a compound shape's area going by the shape's own fill, except that Divide keeps every piece when the group or compound shape has a visible fill of its own; the other operations ignore it)"
|
||||
};
|
||||
}
|
||||
|
||||
/// The documentation of [`PATHFINDER_OPTION_KEYS`], shared by the Pathfinder effects' parameters.
|
||||
pub const PATHFINDER_OPTIONS_DOC: &str = options_doc!();
|
||||
|
||||
/// The parameters of a Pathfinder effect other than Soft Mix.
|
||||
pub const PATHFINDER_PARAMS_DOC: &str = concat!("{", options_doc!(), "} (groups and layers: live Pathfinder over the members)");
|
||||
|
||||
/// The parameters of Effect › Pathfinder › Soft Mix.
|
||||
pub const SOFT_MIX_PARAMS_DOC: &str = concat!(
|
||||
"{mixingRate?: 1..100 % (50), ",
|
||||
options_doc!(),
|
||||
"} blend overlapping fills in CMYK bottom to top (groups and layers: live Pathfinder over the members)"
|
||||
);
|
||||
|
||||
/// The Pathfinder Options a Pathfinder effect evaluates with, read from its parameters. An effect
|
||||
/// without them (saved before effects kept their own) evaluates as it did then: the default
|
||||
/// precision, with no points or pieces removed.
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub struct PathfinderEffectOptions {
|
||||
/// Refit tolerance of the results, in points ([`PATHFINDER_EFFECT_PRECISION`]).
|
||||
pub precision: f64,
|
||||
/// Drop anchors that don't change a result's shape.
|
||||
pub remove_redundant_points: bool,
|
||||
/// Divide and Outline leave out the pieces of members with no visible fill.
|
||||
pub remove_unpainted: bool,
|
||||
}
|
||||
|
||||
impl Default for PathfinderEffectOptions {
|
||||
fn default() -> Self {
|
||||
PathfinderEffectOptions { precision: po::DEFAULT_PRECISION, remove_redundant_points: false, remove_unpainted: false }
|
||||
}
|
||||
}
|
||||
|
||||
impl PathfinderEffectOptions {
|
||||
/// The options in `p`: a missing or non-numeric value takes its default and a precision out of
|
||||
/// range its nearest bound, so a live effect always evaluates.
|
||||
pub fn from_params(p: &Value) -> Self {
|
||||
let d = PathfinderEffectOptions::default();
|
||||
let (lo, hi) = (*PATHFINDER_EFFECT_PRECISION.start(), *PATHFINDER_EFFECT_PRECISION.end());
|
||||
PathfinderEffectOptions {
|
||||
precision: crate::util::num(p, "precision", d.precision).clamp(lo, hi),
|
||||
remove_redundant_points: crate::util::flag(p, "removeRedundantPoints", d.remove_redundant_points),
|
||||
remove_unpainted: crate::util::flag(p, "removeUnpainted", d.remove_unpainted),
|
||||
}
|
||||
}
|
||||
|
||||
/// These options as the parameters [`PATHFINDER_OPTION_KEYS`] name.
|
||||
pub fn to_params(self) -> Value {
|
||||
serde_json::json!({
|
||||
"precision": self.precision,
|
||||
"removeRedundantPoints": self.remove_redundant_points,
|
||||
"removeUnpainted": self.remove_unpainted,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// Does `n` (a group or layer) carry a visible Pathfinder effect, or is it a compound shape?
|
||||
pub fn has_pathfinder(n: &Node) -> bool {
|
||||
n.is_compound_shape()
|
||||
@@ -503,6 +577,23 @@ pub fn pathfinder_children(doc: Option<&Document>, group: &Node, hook: Option<Ou
|
||||
out.extend(source.iter().skip(art).cloned());
|
||||
return Some(out);
|
||||
}
|
||||
// When the group has a visible fill of its own, that fill paints its members' geometry, a
|
||||
// compound shape's area included ([`evaluate_container`]), so Remove Unpainted Artwork keeps
|
||||
// every Divide piece. Outline's open segments still go by their source's fill.
|
||||
let own_fill = has_visible_fill(group);
|
||||
// A compound shape's area has no paint of its own: the shape's own appearance paints it. The
|
||||
// shape's top painting fill is the area's fill for Remove Unpainted Artwork and for Outline's
|
||||
// strokes, while Divide pieces stay unpainted so that the fill is not drawn twice.
|
||||
let area_style = group.is_compound_shape().then(|| {
|
||||
let items = group.appearance.items.iter().filter(|i| paints(i)).cloned().collect();
|
||||
Node::path(group.id, PathData::default(), Appearance { items, ..Default::default() })
|
||||
});
|
||||
let style_of = |s: &Node| -> Option<Node> {
|
||||
let a = area_style.as_ref().filter(|_| s.id == group.id && s.appearance.items.is_empty())?;
|
||||
let mut a = a.clone();
|
||||
(a.opacity, a.blend) = (s.opacity, s.blend);
|
||||
Some(a)
|
||||
};
|
||||
let mut stack: Vec<Arc<Node>> = if group.is_compound_shape() {
|
||||
// The group's own appearance paints the area ([`evaluate_container`]), so the art has none.
|
||||
match compound_shape_area(doc, group, hook) {
|
||||
@@ -535,6 +626,7 @@ pub fn pathfinder_children(doc: Option<&Document>, group: &Node, hook: Option<Ou
|
||||
continue;
|
||||
}
|
||||
let Some(op) = op_of(&e.id) else { continue };
|
||||
let options = PathfinderEffectOptions::from_params(&e.params);
|
||||
let shape_mode =
|
||||
matches!(op, PathfinderOp::Unite | PathfinderOp::MinusFront | PathfinderOp::Intersect | PathfinderOp::Exclude | PathfinderOp::MinusBack);
|
||||
let nodes = SymbolNodes::default();
|
||||
@@ -558,7 +650,7 @@ pub fn pathfinder_children(doc: Option<&Document>, group: &Node, hook: Option<Ou
|
||||
let refs: Vec<(&PathData, FillRule)> = parts.iter().map(|(p, r)| (p, *r)).collect();
|
||||
let key = sources.len() as u64;
|
||||
if let Some(top) = lv.pop() {
|
||||
shapes.push(po::Shape::new(po::unite_all(&refs), FillRule::NonZero, key));
|
||||
shapes.push(po::Shape::new(po::unite_all_with(&refs, options.precision), FillRule::NonZero, key));
|
||||
sources.push(top);
|
||||
}
|
||||
} else {
|
||||
@@ -574,24 +666,40 @@ pub fn pathfinder_children(doc: Option<&Document>, group: &Node, hook: Option<Ou
|
||||
if shapes.is_empty() {
|
||||
return Some(vec![]);
|
||||
}
|
||||
// Remove Redundant Points: each result loses the anchors that don't change its shape.
|
||||
let tidy = |path: PathData| if options.remove_redundant_points { po::remove_redundant_points(&path, options.precision) } else { path };
|
||||
stack = if op == PathfinderOp::SoftMix {
|
||||
let rate = mixing_rate(&e.params);
|
||||
po::regions(&shapes)
|
||||
po::regions_with(&shapes, options.precision)
|
||||
.into_iter()
|
||||
.filter(|r| !r.path.is_empty())
|
||||
.map(|r| Arc::new(soft_mix_face(r.path, &r.sources, rate, &shapes, &sources)))
|
||||
.map(|r| Arc::new(soft_mix_face(tidy(r.path), &r.sources, rate, &shapes, &sources)))
|
||||
.collect()
|
||||
} else if op == PathfinderOp::HardMix {
|
||||
po::regions(&shapes)
|
||||
po::regions_with(&shapes, options.precision)
|
||||
.into_iter()
|
||||
.filter(|r| !r.path.is_empty())
|
||||
.map(|r| Arc::new(hard_mix_face(r.path, &r.sources, &shapes, &sources)))
|
||||
.map(|r| Arc::new(hard_mix_face(tidy(r.path), &r.sources, &shapes, &sources)))
|
||||
.collect()
|
||||
} else {
|
||||
po::pathfinder(op, &shapes)
|
||||
// Divide and Outline Will Remove Unpainted Artwork: the pieces of members with no
|
||||
// visible fill go.
|
||||
let unpainted = options.remove_unpainted
|
||||
&& match op {
|
||||
PathfinderOp::Divide => !own_fill,
|
||||
PathfinderOp::Outline => true,
|
||||
_ => false,
|
||||
};
|
||||
let fill_sources: Vec<Option<Node>> = sources.iter().map(style_of).collect();
|
||||
let fill_source = |k: u64| fill_sources[k as usize].as_ref().unwrap_or(&sources[k as usize]);
|
||||
po::pathfinder_with(op, &shapes, options.precision)
|
||||
.into_iter()
|
||||
.filter(|r| !r.path.is_empty())
|
||||
.map(|r| Arc::new(styled(&sources[r.key as usize], r.path, op == PathfinderOp::Outline)))
|
||||
.filter(|r| !r.path.is_empty() && !(unpainted && !has_visible_fill(fill_source(r.key))))
|
||||
.map(|r| {
|
||||
let outline = op == PathfinderOp::Outline;
|
||||
let src = if outline { fill_source(r.key) } else { &sources[r.key as usize] };
|
||||
Arc::new(styled(src, tidy(r.path), outline))
|
||||
})
|
||||
.collect()
|
||||
};
|
||||
}
|
||||
@@ -676,6 +784,11 @@ pub fn paints(item: &AppearanceItem) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
/// Has `n` a visible fill that paints, as the Pathfinder panel's Remove Unpainted Artwork counts it?
|
||||
fn has_visible_fill(n: &Node) -> bool {
|
||||
n.appearance.items.iter().any(|i| matches!(i, AppearanceItem::Fill(f) if f.visible && !f.paint.is_none()))
|
||||
}
|
||||
|
||||
/// Do the own fills or strokes of `n`, a group or layer, paint anything?
|
||||
pub(crate) fn has_own_paint(n: &Node) -> bool {
|
||||
is_container(n) && n.appearance.items.iter().any(paints)
|
||||
|
||||
@@ -213,6 +213,81 @@ fn divide_and_outline_draw_nothing_for_unpainted_members() {
|
||||
}
|
||||
}
|
||||
|
||||
/// With Remove Unpainted Artwork, Divide and Outline keep the area of a compound shape whose own
|
||||
/// appearance has a visible fill and leave out the area of one without.
|
||||
#[test]
|
||||
fn remove_unpainted_keeps_a_filled_compound_shapes_area() {
|
||||
for effect in ["pathfinder.divide", "pathfinder.outline"] {
|
||||
for filled in [true, false] {
|
||||
let mut g = compound_shape(ShapeMode::Add);
|
||||
if !filled {
|
||||
g.appearance = Appearance::basic(Paint::None, Paint::solid(Color::BLACK), 1.0).into();
|
||||
}
|
||||
g.appearance.effects.push(Effect { id: effect.into(), params: serde_json::json!({"removeUnpainted": true}), visible: true });
|
||||
let out = pathfinder_children(None, &g, None).unwrap();
|
||||
assert_eq!(!out.is_empty(), filled, "{effect}, filled {filled}: {out:#?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Outline strokes a compound shape's area in the shape's own fill (its top visible one that
|
||||
/// paints), with Remove Unpainted Artwork on or off, and Divide leaves the area's pieces
|
||||
/// unpainted for the shape's fill to paint.
|
||||
#[test]
|
||||
fn outline_strokes_a_compound_shapes_area_in_its_fill() {
|
||||
let green = Paint::solid(Color::rgb(0.0, 1.0, 0.0));
|
||||
for (remove, covered) in [(false, false), (true, false), (false, true), (true, true)] {
|
||||
for effect in ["pathfinder.divide", "pathfinder.outline"] {
|
||||
let mut g = compound_shape(ShapeMode::Add);
|
||||
if covered {
|
||||
// A hidden fill and an unpainted fill above the green one.
|
||||
let mut hidden = FillLayer::new(Paint::solid(Color::rgb(1.0, 0.0, 0.0)));
|
||||
hidden.visible = false;
|
||||
let mut a = (*g.appearance).clone();
|
||||
a.insert_item(a.items.len(), AppearanceItem::Fill(hidden));
|
||||
a.insert_item(a.items.len(), AppearanceItem::Fill(FillLayer::new(Paint::None)));
|
||||
g.appearance = a.into();
|
||||
}
|
||||
g.appearance.effects.push(Effect { id: effect.into(), params: serde_json::json!({"removeUnpainted": remove}), visible: true });
|
||||
let out = pathfinder_children(None, &g, None).unwrap();
|
||||
assert!(!out.is_empty(), "{effect}, remove {remove}");
|
||||
for n in &out {
|
||||
if effect == "pathfinder.outline" {
|
||||
assert_eq!(n.appearance.stroke_paint(), green, "{effect}, remove {remove}: {n:#?}");
|
||||
assert!(n.appearance.fill_paint().is_none(), "{effect}, remove {remove}: {n:#?}");
|
||||
} else {
|
||||
assert!(n.appearance.items.is_empty(), "{effect}, remove {remove}: {n:#?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// With Remove Unpainted Artwork, Divide keeps the pieces of an unfilled member when its group's
|
||||
/// own visible fill paints them and leaves them out when the group has no fill. Outline leaves out
|
||||
/// the member's segments either way.
|
||||
#[test]
|
||||
fn remove_unpainted_keeps_members_a_groups_own_fill_paints() {
|
||||
let unfilled = Arc::new(Node::path(
|
||||
NodeId(2),
|
||||
shapes::rectangle(Rect::new(5.0, 0.0, 15.0, 10.0)),
|
||||
Appearance::basic(Paint::None, Paint::solid(Color::BLACK), 1.0),
|
||||
));
|
||||
for effect in ["pathfinder.divide", "pathfinder.outline"] {
|
||||
for filled in [true, false] {
|
||||
let mut g = Node::group(NodeId(10), vec![sq(1, 0.0, Color::rgb(1.0, 0.0, 0.0)), unfilled.clone()]);
|
||||
if filled {
|
||||
g.appearance = Appearance::basic(Paint::solid(Color::rgb(0.0, 1.0, 0.0)), Paint::None, 0.0).into();
|
||||
}
|
||||
g.appearance.effects.push(Effect { id: effect.into(), params: serde_json::json!({"removeUnpainted": true}), visible: true });
|
||||
let out = pathfinder_children(None, &g, None).unwrap();
|
||||
assert!(out.iter().any(|n| n.id == NodeId(1)), "{effect}, filled {filled}: {out:#?}");
|
||||
let kept = filled && effect == "pathfinder.divide";
|
||||
assert_eq!(out.iter().any(|n| n.id == NodeId(2)), kept, "{effect}, filled {filled}: {out:#?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns an "H" in blue type at 100 pt on a baseline at y = 80, with its stems on either
|
||||
/// side of x = 100.
|
||||
fn type_h() -> Node {
|
||||
|
||||
@@ -75,8 +75,9 @@ pub use bake::{
|
||||
};
|
||||
pub use clip::{WarpSeams, clip_outline, knockout_silhouette, reshaped_clip_outline, warp_pieces_translucent};
|
||||
pub use group::{
|
||||
OutlineHook, PATHFINDER_EFFECTS, compound_shape_area, compound_shape_art, evaluate_container, has_container_appearance, has_pathfinder,
|
||||
is_pathfinder, member_leaves, member_shapes, paints, pathfinder_children, pinned_container_appearance, shape_art,
|
||||
OutlineHook, PATHFINDER_EFFECT_PRECISION, PATHFINDER_EFFECTS, PATHFINDER_OPTION_KEYS, PATHFINDER_OPTIONS_DOC, PathfinderEffectOptions,
|
||||
compound_shape_area, compound_shape_art, evaluate_container, has_container_appearance, has_pathfinder, is_pathfinder, member_leaves,
|
||||
member_shapes, paints, pathfinder_children, pinned_container_appearance, shape_art, takes_pathfinder_options,
|
||||
};
|
||||
pub use lighting_presets::{LIGHTING_PRESETS, LightingPreset, lighting_preset_params, matching_lighting_preset};
|
||||
pub use live::{expand_live, expand_live_deep, expanded_live_group, outline_object, text_outliner};
|
||||
|
||||
@@ -120,7 +120,10 @@ pub fn new_effect(id: &str, params: &Value) -> Option<Effect> {
|
||||
/// Scale the distance parameters of `e` by `s` (Scale Strokes & Effects; see
|
||||
/// [`EffectInfo::lengths`]), and its sizes in raster pixels ([`crate::raster_px_range`]), which
|
||||
/// keep their share of the object so. A distance left at its default is written out scaled; one
|
||||
/// the effect doesn't have (Outline Stroke's weight following its stroke) stays absent.
|
||||
/// the effect doesn't have (Outline Stroke's weight following its stroke) stays absent. A Pathfinder
|
||||
/// effect without a `precision` gets the precision it evaluates with, scaled. Values are scaled
|
||||
/// as stored, out of range or not, so a scale and its inverse restore them; evaluation applies
|
||||
/// each effect's range.
|
||||
pub fn scale_effect(e: &mut Effect, s: f64) {
|
||||
let Some(info) = catalog_index().get(e.id.as_str()) else { return };
|
||||
let merged = merged_params(&e.id, &e.params);
|
||||
@@ -128,7 +131,9 @@ pub fn scale_effect(e: &mut Effect, s: f64) {
|
||||
let mut keys: Vec<&str> = info.lengths.keys(relative).collect();
|
||||
keys.extend(merged.as_object().into_iter().flat_map(|m| m.keys()).map(String::as_str).filter(|k| crate::raster_px_range(&e.id, k).is_some()));
|
||||
for k in keys {
|
||||
let v = util::num(&merged, k, f64::NAN);
|
||||
let missing =
|
||||
if k == "precision" && crate::takes_pathfinder_options(&e.id) { crate::PathfinderEffectOptions::default().precision } else { f64::NAN };
|
||||
let v = util::num(&merged, k, missing);
|
||||
if v.is_finite() {
|
||||
if !e.params.is_object() {
|
||||
e.params = Value::Object(Map::new());
|
||||
|
||||
@@ -1248,15 +1248,20 @@ fn as_art_opts(
|
||||
let fx = geometry_effects(n);
|
||||
let mut art = match &n.kind {
|
||||
NodeKind::Image(im) => {
|
||||
let frame = shapes::rectangle(Rect::new(0.0, 0.0, im.width as f64, im.height as f64)).transformed(im.xf);
|
||||
// A distorted image's frame joins its corners.
|
||||
let frame = match n.image_frame().filter(|_| n.is_distorted_image()) {
|
||||
Some(bp) => PathData::from_bezpath(&bp),
|
||||
None => shapes::rectangle(Rect::new(0.0, 0.0, im.width as f64, im.height as f64)).transformed(im.xf),
|
||||
};
|
||||
let mut image = Node::new(n.id, n.kind.clone());
|
||||
// Its pixels draw as the image's do: colorized by a grayscale image's fill color,
|
||||
// smoothed or not, and with its color mask's masked pixels.
|
||||
// smoothed or not, with its color mask's masked pixels, and distorted.
|
||||
{
|
||||
let mut e = image.extras_mut();
|
||||
e.colorize = n.extras().colorize.clone();
|
||||
e.pixelated = n.extras().pixelated;
|
||||
e.color_mask = n.extras().color_mask.clone();
|
||||
e.image_quad = n.extras().image_quad.clone();
|
||||
}
|
||||
let clipped = || {
|
||||
let mut clip = Node::path(n.id, frame.clone(), Appearance::default());
|
||||
@@ -1276,6 +1281,17 @@ fn as_art_opts(
|
||||
clipped()
|
||||
} else {
|
||||
let opaque = std::cell::OnceCell::new();
|
||||
// A distorted image's opaque area, traced in its pixels, goes to the page through
|
||||
// its projective map.
|
||||
let opaque_on_page = || match n.image_map().filter(|_| n.is_distorted_image()) {
|
||||
Some(map) => {
|
||||
let plain = ImageObject { xf: Affine::IDENTITY, ..(**im).clone() };
|
||||
let piece = f64::from(im.width.max(im.height).max(1)) / 64.0;
|
||||
opaque_area(&[symbols, paint_doc], &plain)
|
||||
.map(|p| vectorcraft_doc::live::map_nonlinear(&p, piece, |q| map.apply(q).unwrap_or(q)))
|
||||
}
|
||||
None => opaque_area(&[symbols, paint_doc], im),
|
||||
};
|
||||
let rows = |items: Vec<AppearanceItem>| {
|
||||
let mut out = vec![];
|
||||
let mut items = items.into_iter().peekable();
|
||||
@@ -1285,7 +1301,7 @@ fn as_art_opts(
|
||||
while let Some(next) = items.next_if(|i| follows_opaque_area(i) == follows) {
|
||||
run.push(next);
|
||||
}
|
||||
let path = if follows { opaque.get_or_init(|| opaque_area(&[symbols, paint_doc], im)).as_ref() } else { None };
|
||||
let path = if follows { opaque.get_or_init(opaque_on_page).as_ref() } else { None };
|
||||
let path = path.unwrap_or(&frame);
|
||||
if !path.is_empty() {
|
||||
out.push(Arc::new(Node::path(n.id, path.clone(), Appearance { items: run, ..Default::default() })));
|
||||
@@ -3718,8 +3734,21 @@ fn restore_warped_images(n: &mut Node, warped: &WarpedImages, cut: bool) {
|
||||
// The pieces start from the image as it was placed when it took its first warp.
|
||||
let first = warps.first().map(|(_, at)| ImageObject { xf: *at, ..(**own).clone() });
|
||||
let map = warped_map(warps, own.xf);
|
||||
// A placement with no inverse cannot take a distorted image's corners back.
|
||||
let det = own.xf.determinant();
|
||||
let back = warps.first().filter(|_| det.is_finite() && det != 0.0).map(|(_, at)| *at * own.xf.inverse()).filter(Affine::is_finite);
|
||||
let distorted = image.extras().image_quad.is_some();
|
||||
*c = Arc::new(match (first, map) {
|
||||
(Some(first), Some(map)) if cut => {
|
||||
(Some(first), Some(map)) if cut && (back.is_some() || !distorted) => {
|
||||
// A distorted image's corners go back to where they stood at its first warp, as
|
||||
// its placement does: the moves since then are in `map`.
|
||||
if let Some(back) = back
|
||||
&& let Some(q) = image.extras_if_any().and_then(|e| e.image_quad.as_mut())
|
||||
{
|
||||
for p in q.iter_mut() {
|
||||
*p = back * *p;
|
||||
}
|
||||
}
|
||||
let pixelated = image.extras().pixelated;
|
||||
vectorcraft_doc::live::mesh_warp_image(&image, &first, &*map, WARP_IMAGE_CELLS, pixelated, false)
|
||||
}
|
||||
@@ -3787,6 +3816,12 @@ fn copy_placed(n: &mut Node, m: Affine, copies: usize, scaling: vectorcraft_doc:
|
||||
NodeKind::SymbolInstance { xf: at, .. } => *at = xf * *at,
|
||||
_ => {}
|
||||
}
|
||||
// A distorted image's corners move with it.
|
||||
if let Some(q) = one.extras_if_any().and_then(|e| e.image_quad.as_mut()) {
|
||||
for p in q.iter_mut() {
|
||||
*p = xf * *p;
|
||||
}
|
||||
}
|
||||
// The placed gradients of its own fills and strokes move with it, as a path's do.
|
||||
if xf != Affine::IDENTITY && one.appearance.has_positioned_gradient() {
|
||||
one.appearance.transform_gradients(xf);
|
||||
|
||||
@@ -8,7 +8,7 @@ use std::borrow::Cow;
|
||||
use std::sync::Arc;
|
||||
|
||||
use vectorcraft_doc::{Appearance, AppearanceItem, Document, FillLayer, Node, NodeKind};
|
||||
use vectorcraft_geom::{FillRule, PathData, Point, Rect, SubPath};
|
||||
use vectorcraft_geom::{FillRule, PathData, Rect, SubPath};
|
||||
use vectorcraft_pathops as po;
|
||||
|
||||
use super::{MAX_MEMBERS, Scope, geometry, is_container, members, profile, region, reshape_members, solid_paints};
|
||||
@@ -144,18 +144,17 @@ impl Resolver<'_> {
|
||||
}
|
||||
|
||||
/// Does the plain image `c` lie wholly outside what the clips around it show together, each
|
||||
/// clipping path with its own fill rule? Its frame, the pixel rectangle as its transform places
|
||||
/// it, is cut to each clip in turn until nothing is left. An error when a cut fails or the cuts
|
||||
/// pass [`MAX_IMAGE_CUTS`]: the image may show, so it can't be left out.
|
||||
/// clipping path with its own fill rule? Its frame, the quadrilateral of its corners
|
||||
/// ([`Node::image_corners`]: a distorted image's corners, else the pixel rectangle as its
|
||||
/// transform places it), is cut to each clip in turn until nothing is left. An error when a
|
||||
/// cut fails or the cuts pass [`MAX_IMAGE_CUTS`]: the image may show, so it can't be left out.
|
||||
fn hidden(&mut self, c: &Node) -> Result<bool, String> {
|
||||
let Some(shown) = &self.shown else { return Ok(false) };
|
||||
let NodeKind::Image(im) = &c.kind else { return Ok(false) };
|
||||
let Some(corners) = c.image_corners() else { return Ok(false) };
|
||||
let Some(b) = c.visual_bounds() else { return Ok(true) };
|
||||
if b.intersect(shown.bounds).area() <= 0.0 {
|
||||
return Ok(true);
|
||||
}
|
||||
let (w, h) = (f64::from(im.width), f64::from(im.height));
|
||||
let corners = [(0.0, 0.0), (w, 0.0), (w, h), (0.0, h)].map(|(x, y)| im.xf * Point::new(x, y));
|
||||
if corners.iter().any(|p| !p.x.is_finite() || !p.y.is_finite()) {
|
||||
return Err(image_refusal(self.label));
|
||||
}
|
||||
|
||||
@@ -504,6 +504,38 @@ fn warped_images_keep_document_keys_and_hidden_images_apart() {
|
||||
}
|
||||
}
|
||||
|
||||
/// A distorted image that a later effect leaves with no area after its warp is not cut, and its
|
||||
/// corners stay finite.
|
||||
#[test]
|
||||
fn a_distorted_image_left_with_no_area_after_its_warp_keeps_finite_corners() {
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
||||
use vectorcraft_doc::NodeId;
|
||||
let lift: crate::reshape::WarpMap = Rc::new(|p: Point| Point::new(p.x, p.y - p.x * 0.1));
|
||||
let mut image = (*warp_test_image(2)).clone();
|
||||
image.set_image_corners([(10.0, 0.0), (30.0, 0.0), (40.0, 40.0), (0.0, 40.0)].map(|(x, y)| Point::new(x, y))).unwrap();
|
||||
let mut art = Node::group(NodeId(1), vec![Arc::new(image)]);
|
||||
let mut warped = crate::reshape::WarpedImages::new();
|
||||
warped.reserve(&art);
|
||||
crate::reshape::mark_warped_images(&mut art, &lift, &std::collections::HashSet::new(), false, &mut 0, &mut warped);
|
||||
// A later effect squeezes the placement flat.
|
||||
if let Some(c) = art.children_mut()
|
||||
&& let NodeKind::Image(im) = &mut Arc::make_mut(&mut c[0]).kind
|
||||
{
|
||||
im.xf = Affine::scale_non_uniform(1.0, 0.0);
|
||||
}
|
||||
crate::reshape::cut_warped_images_within(&mut art, &warped, usize::MAX);
|
||||
let mut finite = true;
|
||||
art.walk(&mut |c| {
|
||||
if let Some(q) = c.extras().image_quad.as_deref() {
|
||||
finite &= q.iter().all(|p| p.x.is_finite() && p.y.is_finite());
|
||||
}
|
||||
});
|
||||
assert!(finite);
|
||||
assert_eq!(warp_test_images(&art).0, 1, "not cut");
|
||||
}
|
||||
|
||||
/// An image whose frame keeps its shape because the warp would pass the anchor budget keeps its
|
||||
/// pixels as they are; within the budget, both bend.
|
||||
#[test]
|
||||
@@ -2121,3 +2153,27 @@ fn color_halftones_radius_is_in_raster_pixels_not_a_distance() {
|
||||
crate::scale_effect(&mut e, 2.0);
|
||||
assert_eq!((e.params["maxRadius"].as_f64(), e.params["channel1"].as_f64()), (Some(20.0), Some(108.0)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_pathfinder_effects_precision_is_a_distance_that_scales_with_the_object() {
|
||||
for (id, _, _) in PATHFINDER_EFFECTS {
|
||||
assert!(is_length(id, "precision", false), "{id}");
|
||||
assert_eq!(length_range(id, "precision"), Some(PATHFINDER_EFFECT_PRECISION), "{id}");
|
||||
assert!(!is_length(id, "removeRedundantPoints", false) && !is_length(id, "removeUnpainted", false), "{id}");
|
||||
// Scale Strokes & Effects scales the tolerance with the geometry it is refit to.
|
||||
let mut e = crate::new_effect(id, &json!({"precision": 0.5, "removeUnpainted": true})).unwrap();
|
||||
crate::scale_effect(&mut e, 4.0);
|
||||
assert_eq!(e.params["precision"].as_f64(), Some(2.0), "{id}");
|
||||
assert_eq!(e.params["removeUnpainted"], json!(true), "{id}");
|
||||
// An effect saved without the options scales the precision it evaluates with.
|
||||
let mut e = crate::new_effect(id, &json!({})).unwrap();
|
||||
crate::scale_effect(&mut e, 3.0);
|
||||
let scaled = e.params["precision"].as_f64().unwrap_or(f64::NAN);
|
||||
assert!((scaled - PathfinderEffectOptions::default().precision * 3.0).abs() < 1e-12, "{id}: {scaled}");
|
||||
// A scale past the range and its inverse restore the precision, as with other distances.
|
||||
let mut e = crate::new_effect(id, &json!({"precision": 8.0})).unwrap();
|
||||
crate::scale_effect(&mut e, 2.0);
|
||||
crate::scale_effect(&mut e, 0.5);
|
||||
assert_eq!(e.params["precision"].as_f64(), Some(8.0), "{id}");
|
||||
}
|
||||
}
|
||||
@@ -890,6 +890,9 @@ pub use compoundshape::OPEN_PATHS_ADD_NO_AREA;
|
||||
/// Pathfinder Options (`Prefs::pathfinder`).
|
||||
pub use pathops::{PATHFINDER_PRECISION_RANGE, PathfinderOptions};
|
||||
|
||||
/// The Pathfinder Options a new Pathfinder effect takes (`effect.apply`).
|
||||
pub use effectcmd::pathfinder_effect_options;
|
||||
|
||||
/// The Attributes panel's state ([`Session::attributes_info`]) and how many recent URLs it keeps.
|
||||
pub use attributes::RECENT_URLS;
|
||||
pub use overprint::AttributesInfo;
|
||||
|
||||
@@ -109,11 +109,11 @@ impl<'a> Reader<'a> {
|
||||
Ok(union(parts))
|
||||
}
|
||||
}
|
||||
NodeKind::Image(im) => {
|
||||
let (w, h) = (f64::from(im.width), f64::from(im.height));
|
||||
let corners = [Point::new(0.0, 0.0), Point::new(w, 0.0), Point::new(w, h), Point::new(0.0, h)].map(|p| im.xf * p);
|
||||
self.polygon(&corners)
|
||||
}
|
||||
// A distorted image's frame joins its corners.
|
||||
NodeKind::Image(_) => match n.image_corners() {
|
||||
Some(corners) => self.polygon(&corners),
|
||||
None => Ok(None),
|
||||
},
|
||||
// An instance of a symbol the document doesn't have draws nothing.
|
||||
NodeKind::SymbolInstance { .. } => match vectorcraft_render::effects::outline_object(Some(self.doc), n) {
|
||||
Some(art) => self.node(&art, depth + 1),
|
||||
|
||||
@@ -663,6 +663,29 @@ fn an_image_is_measured_by_its_frame_as_turned() {
|
||||
assert!((end - (300.0 - (y - (300.0 - half)))).abs() < 0.01, "{end} at {y}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_distorted_image_is_measured_by_the_frame_through_its_corners() {
|
||||
let mut s = session();
|
||||
let im = vectorcraft_doc::ImageObject {
|
||||
key: "image".into(),
|
||||
width: 100,
|
||||
height: 100,
|
||||
xf: Affine::IDENTITY,
|
||||
link: None,
|
||||
placement: Default::default(),
|
||||
pixels: None,
|
||||
};
|
||||
insert(&mut s, |id| {
|
||||
let mut n = Node::new(id, NodeKind::Image(Box::new(im)));
|
||||
n.set_image_corners([Point::new(40.0, 0.0), Point::new(60.0, 0.0), Point::new(100.0, 100.0), Point::new(0.0, 100.0)]).unwrap();
|
||||
n
|
||||
});
|
||||
let (b, end) = diamond_weeding(&mut s);
|
||||
assert!((b.x0 + 10.0).abs() < 1e-3 && (b.y1 - 110.0).abs() < 1e-3, "{b:?}");
|
||||
// A quarter of the box down (y = 20), the line meets the side from (40, 0) to (0, 100).
|
||||
assert!((end - 32.0).abs() < 0.01, "{end}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_placed_file_is_measured_by_the_art_it_shows() {
|
||||
let dir = crate::tests_links::Folder::new("weed-placed");
|
||||
|
||||
@@ -177,6 +177,7 @@ pub const BUILTIN: &[BuiltinBrushLibrary] = &[
|
||||
BuiltinBrushLibrary { id: "bristle-brushes", name: "Bristle Brushes", make: bristle_brushes },
|
||||
BuiltinBrushLibrary { id: "paint", name: "Paint", make: paint },
|
||||
BuiltinBrushLibrary { id: "pattern-borders", name: "Pattern Borders", make: pattern_borders },
|
||||
BuiltinBrushLibrary { id: "decorative", name: "Decorative", make: decorative },
|
||||
BuiltinBrushLibrary { id: "scatter-shapes", name: "Scatter Shapes", make: scatter_shapes },
|
||||
BuiltinBrushLibrary { id: "stipple", name: "Stipple", make: stipple },
|
||||
BuiltinBrushLibrary { id: "game-trails", name: "Game Trails", make: game_trails },
|
||||
@@ -690,6 +691,47 @@ fn pattern_borders() -> BrushLibrary {
|
||||
built("Pattern Borders", Document::new(100.0, 100.0), brushes)
|
||||
}
|
||||
|
||||
/// Decorative: repeating plant, flower and hanging ornaments drawn as original vector tiles.
|
||||
/// Every tile joins the next at x = 0 and 48 so open and closed paths stay continuous.
|
||||
fn decorative() -> BrushLibrary {
|
||||
let stem = || black(shapes::rectangle(Rect::new(0.0, -0.65, 48.0, 0.65)));
|
||||
let vine = group(vec![
|
||||
stem(),
|
||||
black(polygon(&[(8.0, -0.2), (12.0, -5.0), (24.0, -8.0), (20.0, -1.0)])),
|
||||
black(polygon(&[(28.0, 0.2), (32.0, 5.0), (44.0, 8.0), (40.0, 1.0)])),
|
||||
]);
|
||||
let mut blossoms = vec![stem()];
|
||||
for x in [12.0, 36.0] {
|
||||
for (dx, dy) in [(0.0, -4.0), (4.0, 0.0), (0.0, 4.0), (-4.0, 0.0)] {
|
||||
blossoms.push(black(shapes::ellipse(Rect::new(x + dx - 2.5, dy - 2.5, x + dx + 2.5, dy + 2.5))));
|
||||
}
|
||||
blossoms.push(black(shapes::ellipse(Rect::new(x - 1.3, -1.3, x + 1.3, 1.3))));
|
||||
}
|
||||
let flowers = group(blossoms);
|
||||
let pennants = group(vec![
|
||||
black(shapes::rectangle(Rect::new(0.0, -5.2, 48.0, -4.2))),
|
||||
black(polygon(&[(4.0, -4.2), (20.0, -4.2), (12.0, 10.0)])),
|
||||
black(polygon(&[(28.0, -4.2), (44.0, -4.2), (36.0, 10.0)])),
|
||||
]);
|
||||
let lanterns = group(vec![
|
||||
black(shapes::rectangle(Rect::new(0.0, -5.0, 48.0, -4.0))),
|
||||
black(shapes::rectangle(Rect::new(11.4, -4.0, 12.6, -1.0))),
|
||||
black(shapes::ellipse(Rect::new(7.0, -1.0, 17.0, 9.0))),
|
||||
black(shapes::rectangle(Rect::new(35.4, -4.0, 36.6, -1.0))),
|
||||
black(shapes::ellipse(Rect::new(31.0, -1.0, 41.0, 9.0))),
|
||||
]);
|
||||
built(
|
||||
"Decorative",
|
||||
Document::new(100.0, 100.0),
|
||||
vec![
|
||||
border("Leaf Vine", vine, None, PatternFit::Stretch),
|
||||
border("Blossom Chain", flowers, None, PatternFit::Stretch),
|
||||
border("Pennant Garland", pennants, None, PatternFit::Stretch),
|
||||
border("Lantern String", lanterns, None, PatternFit::Stretch),
|
||||
],
|
||||
)
|
||||
}
|
||||
|
||||
fn scatter(name: &str, art: Node, s: Scatter) -> Brush {
|
||||
Brush { name: name.into(), kind: BrushKind::Scatter(Scatter { art, ..s }) }
|
||||
}
|
||||
|
||||
@@ -58,9 +58,10 @@ fn view_param(cmd: &str, p: &Value) -> Result<Option<TraceView>> {
|
||||
v.as_str().and_then(TraceView::from_id).map(Some).ok_or_else(|| bad(cmd, format!("view must be one of {}", ids())))
|
||||
}
|
||||
|
||||
/// The `split` param (the Split view's divider, 0 to 1), if given.
|
||||
/// The `split` param (the Split view's divider, 0 to 1), if given. A null divider is an error, as
|
||||
/// any other value that is not such a number is; only an omitted one keeps the divider.
|
||||
fn split_param(cmd: &str, p: &Value) -> Result<Option<f64>> {
|
||||
let Some(v) = p.get("split").filter(|v| !v.is_null()) else { return Ok(None) };
|
||||
let Some(v) = p.get("split") else { return Ok(None) };
|
||||
v.as_f64().filter(|f| (0.0..=1.0).contains(f)).map(Some).ok_or_else(|| bad(cmd, "split must be a number from 0 to 1"))
|
||||
}
|
||||
|
||||
@@ -649,7 +650,16 @@ fn prepare(s: &Session, c: &str, p: &Value) -> Result<Prepared> {
|
||||
None if is(tr::preset(named)) || is(tr::enhanced_preset(named)) => named.to_string(),
|
||||
None => "Custom".to_string(),
|
||||
};
|
||||
// The image (inside a trace group, or selected directly).
|
||||
let (target, image) = target_image(s, c, p)?;
|
||||
// The traced shapes are placed by the image's transform, which a distortion overrides: the
|
||||
// command stops before any pixels are read.
|
||||
let distorted = s.doc()?.doc.node(target).is_some_and(|n| {
|
||||
n.is_distorted_image() || (is_trace_group(n) && n.children().and_then(|c| c.first()).is_some_and(|i| i.is_distorted_image()))
|
||||
});
|
||||
if distorted {
|
||||
return Err(crate::cmd::xform::distorted_image_error(c, target));
|
||||
}
|
||||
if by_color && s.doc()?.doc.node(target).is_some_and(vectorcraft_render::effects::has_pathfinder) {
|
||||
return Err(bad(c, LIVE_PATHFINDER_BY_COLOR));
|
||||
}
|
||||
|
||||
@@ -442,6 +442,17 @@ fn check_revolve_count(n: &Node, cmd: &str) -> Result<()> {
|
||||
|
||||
pub(crate) const ONE_3D: &str = "An object takes one 3D effect. Edit the existing effect's options, or remove it first.";
|
||||
|
||||
/// The Pathfinder Options that `effect.apply` gives a Pathfinder effect for the keys its `params`
|
||||
/// leave out: the preferences' Pathfinder Options in force.
|
||||
pub fn pathfinder_effect_options(s: &Session) -> effects::PathfinderEffectOptions {
|
||||
let current = super::pathops::current_pf_options(s);
|
||||
effects::PathfinderEffectOptions {
|
||||
precision: current.precision,
|
||||
remove_redundant_points: current.remove_redundant_points,
|
||||
remove_unpainted: current.remove_unpainted,
|
||||
}
|
||||
}
|
||||
|
||||
/// `effect.apply`: adds effect `effect` (or `id`) with `params`, its defaults filled in, to the
|
||||
/// targets' active item as one undo step. A 3D effect must fit each target, which takes only one;
|
||||
/// a Pathfinder effect on loose objects groups them first. → `{ids, index, item}`.
|
||||
@@ -465,10 +476,23 @@ pub(crate) fn apply(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
super::params::check_effect_color(C, id, ¶ms)?;
|
||||
super::params::check_effect_channel(C, id, ¶ms)?;
|
||||
super::params::check_effect_center(C, id, ¶ms)?;
|
||||
super::params::check_effect_pathfinder(C, id, ¶ms)?;
|
||||
// Crop Marks take their style from the preferences when applied.
|
||||
if id == effects::CROP_MARKS && params.get("style").is_none() {
|
||||
params["style"] = json!(s.crop_mark_style().id());
|
||||
}
|
||||
// A Pathfinder effect keeps the Pathfinder Options in force when it is applied, those `params`
|
||||
// give aside. They join the journal entry, so replaying it gives the same effect.
|
||||
if effects::takes_pathfinder_options(id) {
|
||||
if let Value::Object(filled) = pathfinder_effect_options(s).to_params() {
|
||||
for (key, v) in filled {
|
||||
if params.get(&key).is_none() {
|
||||
params[key.as_str()] = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
s.note_journal("params", params.clone());
|
||||
}
|
||||
if texture_load_effect(id) {
|
||||
load_texture(&mut params, C)?;
|
||||
}
|
||||
@@ -789,6 +813,7 @@ pub(crate) fn set_params(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
super::params::check_effect_color(C, effect, ¶ms)?;
|
||||
super::params::check_effect_channel(C, effect, ¶ms)?;
|
||||
super::params::check_effect_center(C, effect, ¶ms)?;
|
||||
super::params::check_effect_pathfinder(C, effect, ¶ms)?;
|
||||
}
|
||||
if edited.iter().any(|e| texture_load_effect(e)) {
|
||||
load_texture(&mut params, C)?;
|
||||
@@ -808,6 +833,15 @@ pub(crate) fn set_params(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
return Ok(json!({ "ids": [] }));
|
||||
}
|
||||
}
|
||||
// Pathfinder effects given the values they already evaluate with, and nothing else to change,
|
||||
// are no edit and record no undo step.
|
||||
if kind.is_none() && warp_id.is_none() && visible.is_none() {
|
||||
let d = &s.doc()?.doc;
|
||||
let fx: Vec<&Effect> = targets.iter().filter_map(|&(id, at, index)| d.node(id)?.appearance.effects_at(at)?.get(index)).collect();
|
||||
if !fx.is_empty() && fx.iter().all(|e| pathfinder_edit_changes_nothing(e, ¶ms)) {
|
||||
return Ok(json!({ "ids": [] }));
|
||||
}
|
||||
}
|
||||
// An SVG filter is named by its id: another filter renames the effect.
|
||||
if edited.iter().any(|e| e == effects::SVG_FILTER)
|
||||
&& let Some(xml) = params.get("xml").and_then(Value::as_str)
|
||||
@@ -876,6 +910,30 @@ pub(crate) fn set_params(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
Ok(json!({ "ids": ids_json(&ids) }))
|
||||
}
|
||||
|
||||
/// Does merging `params` into Pathfinder effect `e` leave it drawing as it does: the same Pathfinder
|
||||
/// Options ([`effects::PathfinderEffectOptions`], so an effect saved without them and given their
|
||||
/// defaults is unchanged), each option given equal to the one it stores (a precision that Scale
|
||||
/// Strokes & Effects took past its range evaluates at the bound but is still edited), and every
|
||||
/// other value given equal to the one it has?
|
||||
fn pathfinder_edit_changes_nothing(e: &Effect, params: &Value) -> bool {
|
||||
if !effects::takes_pathfinder_options(&e.id) {
|
||||
return false;
|
||||
}
|
||||
let Some(given) = params.as_object().filter(|m| !m.is_empty()) else { return true };
|
||||
let current = effects::merged_params(&e.id, &e.params);
|
||||
let mut after = current.clone();
|
||||
if let Value::Object(m) = &mut after {
|
||||
m.extend(given.clone());
|
||||
}
|
||||
let others_same = given.iter().filter(|(k, _)| !effects::PATHFINDER_OPTION_KEYS.contains(&k.as_str())).all(|(k, v)| current.get(k) == Some(v));
|
||||
let same_value = |a: &Value, b: &Value| a == b || a.as_f64().is_some_and(|x| b.as_f64() == Some(x));
|
||||
let stored_same = given
|
||||
.iter()
|
||||
.filter(|(k, _)| effects::PATHFINDER_OPTION_KEYS.contains(&k.as_str()))
|
||||
.all(|(k, v)| e.params.get(k).is_none_or(|stored| same_value(stored, v)));
|
||||
others_same && stored_same && effects::PathfinderEffectOptions::from_params(¤t) == effects::PathfinderEffectOptions::from_params(&after)
|
||||
}
|
||||
|
||||
// ---------- Load Texture ----------
|
||||
|
||||
/// Effect › Distort › Glass.
|
||||
|
||||
@@ -141,7 +141,11 @@ impl Builder {
|
||||
if fills.is_empty() { Body::Complex } else { Body::Fills { shape: self.shape(path, rule, Kind::Vector)?, fills } }
|
||||
}
|
||||
NodeKind::Image(im) => {
|
||||
let frame = shapes::rectangle(Rect::new(0.0, 0.0, im.width as f64, im.height as f64)).transformed(im.xf);
|
||||
// A distorted image's frame joins its corners.
|
||||
let frame = match n.image_frame().filter(|_| n.is_distorted_image()) {
|
||||
Some(bp) => PathData::from_bezpath(&bp),
|
||||
None => shapes::rectangle(Rect::new(0.0, 0.0, im.width as f64, im.height as f64)).transformed(im.xf),
|
||||
};
|
||||
self.shape(frame, FillRule::NonZero, Kind::Other)?;
|
||||
Body::Complex
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ fn select_stop(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
// No document is needed for the default paint's gradient, so this does not use `refuse_symbol_part`.
|
||||
// While the Live Paint Bucket is active the proxies show the default paint, whose stops can be
|
||||
// selected with a part picked.
|
||||
if s.tool_id() != super::paint::LIVE_PAINT_BUCKET && s.active().is_some_and(|st| st.selection.symbol_part.is_some()) {
|
||||
if !s.bucket_paints() && s.active().is_some_and(|st| st.selection.symbol_part.is_some()) {
|
||||
return Err(super::brushsym::part_only());
|
||||
}
|
||||
let index = match p.get("index") {
|
||||
@@ -111,7 +111,7 @@ impl StopOwner {
|
||||
part: st.is_some_and(|d| d.selection.symbol_part.is_some()),
|
||||
fill: s.fill_active,
|
||||
item: s.appearance_item(),
|
||||
bucket: s.tool_id() == super::paint::LIVE_PAINT_BUCKET,
|
||||
bucket: s.bucket_paints(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1211,6 +1211,16 @@ pub(crate) fn set_image_from_path(d: &mut Document, id: NodeId, path: &str, doc_
|
||||
install(d, &[id], read, Some(Preserve::Bounds), None)
|
||||
}
|
||||
|
||||
/// Distorted image `im` shows the file read for `link` (`img`) and keeps its corners and its
|
||||
/// clipping: the new pixels fill them. Its transform is scaled to the new pixel size, so a reader
|
||||
/// that places it by the transform still gives it its old size.
|
||||
fn refill_distorted(im: &mut ImageObject, link: &LinkInfo, img: &RasterImage) {
|
||||
if (img.width, img.height) != (im.width, im.height) && img.width > 0 && img.height > 0 {
|
||||
im.xf *= Affine::scale_non_uniform(f64::from(im.width) / f64::from(img.width), f64::from(im.height) / f64::from(img.height));
|
||||
}
|
||||
(im.key, im.width, im.height, im.link) = (img.key.clone(), img.width, img.height, Some(link.clone()));
|
||||
}
|
||||
|
||||
/// Image objects `ids` (in the layers or outside them) show the file read for `link` (`img`), each
|
||||
/// placed as its Placement Options say (`force`: as that Preserve choice says, whatever they say);
|
||||
/// with `also` (a file's path and the content shown), so do the images outside the layer tree that
|
||||
@@ -1235,7 +1245,12 @@ fn install(d: &mut Document, ids: &[NodeId], (link, img): FileRead, force: Optio
|
||||
let mut make = |n: &Node, held: Option<(&PathData, FillRule)>| {
|
||||
let mut n = n.clone();
|
||||
let mut clip = ClipTo::Keep;
|
||||
let distorted = n.is_distorted_image();
|
||||
if let NodeKind::Image(im) = &mut n.kind {
|
||||
if distorted {
|
||||
refill_distorted(im, &link, &img);
|
||||
return (n, clip);
|
||||
}
|
||||
let o = PlacementOptions { preserve: force.unwrap_or(im.placement.preserve), ..im.placement };
|
||||
let size = |w: u32, h: u32| (w as f64, h as f64);
|
||||
let (old_pt, old_clip) = match old.get(&im.key) {
|
||||
@@ -1251,6 +1266,14 @@ fn install(d: &mut Document, ids: &[NodeId], (link, img): FileRead, force: Optio
|
||||
Nested { pick: &pick, make: &mut make, next: 0 }.run(d);
|
||||
}
|
||||
for id in ids {
|
||||
if d.node(*id).is_some_and(Node::is_distorted_image) {
|
||||
if let Some(n) = d.node_mut(*id)
|
||||
&& let NodeKind::Image(im) = &mut n.kind
|
||||
{
|
||||
refill_distorted(im, &link, &img);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
let Some(NodeKind::Image(im)) = d.node(*id).map(|n| &n.kind) else { continue };
|
||||
let o = PlacementOptions { preserve: force.unwrap_or(im.placement.preserve), ..im.placement };
|
||||
let size = |w: u32, h: u32| (w as f64, h as f64);
|
||||
@@ -2068,6 +2091,9 @@ fn relink(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
_ => None,
|
||||
})
|
||||
};
|
||||
// Whether the images were found as the missing links (nothing selected, a folder given) rather
|
||||
// than named or selected.
|
||||
let mut found_missing = false;
|
||||
let mut ids: Vec<NodeId> = match (&each, ids_param(p, "ids", C)?) {
|
||||
(Some(each), _) => each.iter().flat_map(|(ids, _)| ids.iter().copied()).collect(),
|
||||
(None, Some(ids)) => ids,
|
||||
@@ -2075,6 +2101,7 @@ fn relink(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let selected: Vec<NodeId> = st.selection.objects.iter().copied().filter(|id| image(id).is_some()).collect();
|
||||
match folder_param {
|
||||
Some(_) if selected.is_empty() => {
|
||||
found_missing = true;
|
||||
groups(&st.doc, None).into_iter().filter(|g| probe(g, LinkBase::of(st)).0 == Status::Missing).flat_map(|g| g.ids).collect()
|
||||
}
|
||||
_ => selected,
|
||||
@@ -2087,6 +2114,11 @@ fn relink(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
if ids.is_empty() {
|
||||
return Err(bad(C, "select the images to relink, or pass ids"));
|
||||
}
|
||||
// A named or selected distorted image is refused before a folder is searched, whether or not
|
||||
// its file is found there.
|
||||
if !found_missing && let Some(id) = ids.iter().find(|id| stored(&doc, **id).is_some_and(Node::is_distorted_image)) {
|
||||
return Err(super::xform::distorted_image_error(C, *id));
|
||||
}
|
||||
// All Instances: the other stored objects linked to the same files, each once.
|
||||
if scope == Scope::All {
|
||||
let paths: BTreeSet<&str> = ids.iter().filter_map(|id| image(id).flatten()).map(|l| l.path.as_str()).collect();
|
||||
@@ -2131,6 +2163,11 @@ fn relink(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
}
|
||||
(None, None, None) => return Err(bad(C, "give path (a file) or folder")),
|
||||
}
|
||||
// A new file's placement options place a plain image: a distorted one is left as it is.
|
||||
let distorted = files.iter().flat_map(|(ids, _)| ids).find(|id| stored(&doc, **id).is_some_and(Node::is_distorted_image));
|
||||
if let Some(id) = distorted {
|
||||
return Err(super::xform::distorted_image_error(C, *id));
|
||||
}
|
||||
// Every file is read and checked before any is copied.
|
||||
let mut checked = vec![];
|
||||
for (ids, path) in files {
|
||||
@@ -2593,6 +2630,9 @@ fn embed(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
if ids.is_empty() {
|
||||
return Err(bad(C, "select the linked images or placed documents, or pass ids"));
|
||||
}
|
||||
if let Some(id) = ids.iter().find(|id| stored(&doc, **id).is_some_and(Node::is_distorted_image)) {
|
||||
return Err(super::xform::distorted_image_error(C, *id));
|
||||
}
|
||||
// A DCS file's plates print from its file.
|
||||
let separated = |id: &NodeId| match kind(id) {
|
||||
Some(NodeKind::Image(im)) => st.doc.images.get(&im.key).is_some_and(ImageBlob::is_separated),
|
||||
@@ -2721,6 +2761,9 @@ fn unembed(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
if im.link.is_some() {
|
||||
return Err(bad(C, format!("image {} is linked already", id.0)));
|
||||
}
|
||||
if n.is_distorted_image() {
|
||||
return Err(super::xform::distorted_image_error(C, id));
|
||||
}
|
||||
let blob = st.doc.images.get(&im.key).filter(|b| !b.is_proxy()).ok_or_else(|| bad(C, "the image's pixels aren't in the document"))?;
|
||||
// As stored (PNG, JPEG, GIF, WebP), unless the path names another format.
|
||||
let stored = stored_extension(blob);
|
||||
@@ -2772,6 +2815,9 @@ fn unembed_to_folder(s: &mut Session, p: &Value, ids: Option<Vec<NodeId>>) -> Re
|
||||
skipped.push(id);
|
||||
continue;
|
||||
}
|
||||
if n.is_distorted_image() {
|
||||
return Err(super::xform::distorted_image_error(C, id));
|
||||
}
|
||||
let blob = st.doc.images.get(&im.key).filter(|b| !b.is_proxy()).ok_or_else(|| bad(C, "the image's pixels aren't in the document"))?;
|
||||
embedded.push((id, n.display_name(), blob));
|
||||
}
|
||||
@@ -2984,7 +3030,9 @@ fn info(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let (px, py) = file_pt(&st.doc, &im.key);
|
||||
out["effectivePpi"] = out["ppi"].take();
|
||||
out["ppi"] = json!([72.0 / px, 72.0 / py]);
|
||||
(out["scale"], out["rotation"]) = scale_rotation(im.xf, (px, py));
|
||||
// A distorted image is measured at its middle, as its effective resolution is.
|
||||
let xf = stored(&doc, id).and_then(vectorcraft_doc::image_quad::nearest_affine).unwrap_or(im.xf);
|
||||
(out["scale"], out["rotation"]) = scale_rotation(xf, (px, py));
|
||||
out["format"] = json!(format_label(&st.doc, im));
|
||||
out["placement"] = placement_json(im.placement);
|
||||
out["status"] = json!("embedded");
|
||||
|
||||
@@ -25,14 +25,23 @@ pub(super) fn mesh_create(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
};
|
||||
let (rows, cols) = if at.is_some() { (1, 1) } else { (rows, cols) };
|
||||
let roots = roots_param(s, p)?;
|
||||
// The distorted images left as they are, each with why.
|
||||
let mut distorted = vec![];
|
||||
let (ids, index) = s.edit("Create Gradient Mesh", |d, sel| {
|
||||
let mut out = vec![];
|
||||
let mut index = None;
|
||||
let mut refused = None;
|
||||
let model = d.color_mode.model();
|
||||
distorted.clear();
|
||||
for id in &roots {
|
||||
let Some(n) = d.node(*id).cloned() else { continue };
|
||||
let m = if let NodeKind::Image(im) = &n.kind {
|
||||
if n.is_distorted_image() {
|
||||
let e = super::super::xform::distorted_image_error(C, *id);
|
||||
distorted.push(json!({"id": id.0, "reason": e.to_string()}));
|
||||
refused.get_or_insert(e);
|
||||
continue;
|
||||
}
|
||||
// An embedded image: the points take the picture's colours there.
|
||||
match image_mesh(d, im, rows, cols) {
|
||||
Ok(mut m) => {
|
||||
@@ -40,7 +49,7 @@ pub(super) fn mesh_create(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
Some(m)
|
||||
}
|
||||
Err(why) => {
|
||||
refused.get_or_insert(why);
|
||||
refused.get_or_insert_with(|| bad(C, why));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -60,7 +69,7 @@ pub(super) fn mesh_create(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
match m.add_lines_at(q, tol) {
|
||||
Some(i) => index = Some(i),
|
||||
None => {
|
||||
refused.get_or_insert("point is outside the object");
|
||||
refused.get_or_insert_with(|| bad(C, "point is outside the object"));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -75,7 +84,7 @@ pub(super) fn mesh_create(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
out.push(*id);
|
||||
}
|
||||
if out.is_empty() {
|
||||
return Err(bad(C, refused.unwrap_or("select a path, a compound path or an embedded image")));
|
||||
return Err(refused.unwrap_or_else(|| bad(C, "select a path, a compound path or an embedded image")));
|
||||
}
|
||||
sel.set(out.iter().copied());
|
||||
Ok((out, index))
|
||||
@@ -84,6 +93,9 @@ pub(super) fn mesh_create(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
if let Some(i) = index {
|
||||
r["index"] = json!(i);
|
||||
}
|
||||
if !distorted.is_empty() {
|
||||
r["skipped"] = json!(distorted);
|
||||
}
|
||||
Ok(r)
|
||||
}
|
||||
|
||||
|
||||
@@ -998,6 +998,9 @@ fn mosaic_plan(s: &Session, p: &Value) -> Result<MosaicPlan> {
|
||||
.ok_or_else(|| bad(C, "select an image"))?;
|
||||
let node = st.doc.node(id).ok_or(EngineError::NoNode(id))?;
|
||||
let NodeKind::Image(im) = &node.kind else { return Err(bad(C, "select an image")) };
|
||||
if node.is_distorted_image() {
|
||||
return Err(super::xform::distorted_image_error(C, id));
|
||||
}
|
||||
if !st.doc.images.get(&im.key).is_some_and(|b| !b.bytes.is_empty()) {
|
||||
return Err(bad(C, "the image has no embedded pixels"));
|
||||
}
|
||||
@@ -1285,6 +1288,9 @@ fn crop_image(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
.ok_or_else(|| bad(C, "select an image"))?;
|
||||
let node = st.doc.node(id).cloned().ok_or(EngineError::NoNode(id))?;
|
||||
let NodeKind::Image(im) = &node.kind else { return Err(bad(C, "select an image")) };
|
||||
if node.is_distorted_image() {
|
||||
return Err(super::xform::distorted_image_error(C, id));
|
||||
}
|
||||
if switch_or(p, "trim", false, C)? {
|
||||
if p.get("ppi").is_some_and(|v| !v.is_null()) {
|
||||
return Err(bad(C, "trim keeps the image's pixels as they are: leave out ppi"));
|
||||
@@ -1495,11 +1501,16 @@ fn mask_image(s: &mut Session, _: &Value) -> Result<Value> {
|
||||
.selection
|
||||
.objects
|
||||
.iter()
|
||||
.find_map(|id| match st.doc.node(*id).map(|n| &n.kind) {
|
||||
Some(NodeKind::Image(im)) => {
|
||||
Some((*id, vectorcraft_geom::shapes::rectangle(Rect::new(0.0, 0.0, im.width as f64, im.height as f64)).transformed(im.xf)))
|
||||
.find_map(|id| {
|
||||
let n = st.doc.node(*id)?;
|
||||
match &n.kind {
|
||||
// A distorted image's outline joins its corners.
|
||||
NodeKind::Image(_) if n.is_distorted_image() => Some((*id, PathData::from_bezpath(&n.image_frame()?))),
|
||||
NodeKind::Image(im) => {
|
||||
Some((*id, vectorcraft_geom::shapes::rectangle(Rect::new(0.0, 0.0, im.width as f64, im.height as f64)).transformed(im.xf)))
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
_ => None,
|
||||
})
|
||||
.ok_or_else(|| bad("object.maskImage", "select an image"))?;
|
||||
let (gid, pid) = s.edit("Mask", |d, sel| {
|
||||
|
||||
@@ -209,7 +209,7 @@ impl Session {
|
||||
/// the first selected object (so the last selection's once nothing is selected). Not while the
|
||||
/// Live Paint Bucket is the active tool: the fill and stroke are the colors it paints with.
|
||||
pub(crate) fn inherit_new_art(&mut self) {
|
||||
if self.prefs.new_art_basic || self.tool_id() == super::paint::LIVE_PAINT_BUCKET {
|
||||
if self.prefs.new_art_basic || self.bucket_paints() {
|
||||
return;
|
||||
}
|
||||
let Some(st) = self.active() else { return };
|
||||
|
||||
@@ -203,10 +203,11 @@ impl Session {
|
||||
/// The object whose fill (or stroke) the proxy shows, with the Appearance panel's active item
|
||||
/// when it stands for it (see [`Session::proxy_paints`]); None: the defaults for new art. With
|
||||
/// an object of a dynamic symbol instance selected ([`DocState::selected_symbol_part`]), that
|
||||
/// object as the instance draws it. None while the Live Paint Bucket is the active tool: the
|
||||
/// proxies show the colors it paints with.
|
||||
/// object as the instance draws it. None while the Live Paint Bucket is the active tool (or
|
||||
/// another tool works for it, [`Session::bucket_paints`]): the proxies show the colors it
|
||||
/// paints with.
|
||||
pub(crate) fn proxy_source(&self, stroke: bool) -> Option<(Cow<'_, Node>, Option<usize>)> {
|
||||
if self.tool_id() == LIVE_PAINT_BUCKET {
|
||||
if self.bucket_paints() {
|
||||
return None;
|
||||
}
|
||||
let st = self.active()?;
|
||||
@@ -378,11 +379,28 @@ impl DocState {
|
||||
}
|
||||
|
||||
impl Session {
|
||||
/// Do the fill and stroke proxies, and the paint commands that name no objects, stand for the
|
||||
/// colors the Live Paint Bucket paints with? They do while the bucket is the active tool, while
|
||||
/// a Cmd+click with the bucket uses the Selection tool, and while the Eyedropper samples into a
|
||||
/// stop of the bucket's gradient for the Gradient panel's eyedropper, up to and including the
|
||||
/// sample its click takes before it switches back to the bucket.
|
||||
pub fn bucket_paints(&self) -> bool {
|
||||
let for_bucket = |t: &dyn vectorcraft_tools::Tool| t.id() == LIVE_PAINT_BUCKET || t.returns_to() == Some(LIVE_PAINT_BUCKET);
|
||||
// A Cmd+click lends the Selection tool to the bucket, or to the Eyedropper armed for it.
|
||||
self.back_to_bucket || for_bucket(self.tool.as_ref()) || self.lender.as_deref().is_some_and(for_bucket)
|
||||
}
|
||||
|
||||
/// The tool the active tool's armed one-shot pick switches back to after its click
|
||||
/// ([`vectorcraft_tools::Tool::returns_to`]).
|
||||
pub fn tool_returns_to(&self) -> Option<String> {
|
||||
self.tool.returns_to().map(str::to_string)
|
||||
}
|
||||
|
||||
/// [`DocState::proxy_mixed`] of the active document for the Appearance panel's active item.
|
||||
/// A gradient mesh with points picked ([`Session::fill_mesh_points`]) counts with their colors.
|
||||
/// Neither is mixed while the Live Paint Bucket is the active tool ([`Session::proxy_source`]).
|
||||
pub fn proxy_mixed(&self) -> (bool, bool) {
|
||||
if self.tool_id() == LIVE_PAINT_BUCKET {
|
||||
if self.bucket_paints() {
|
||||
return (false, false);
|
||||
}
|
||||
self.active().map_or((false, false), |st| st.proxy_mixed_with(self.appearance_item(), &self.fill_mesh_points()))
|
||||
@@ -737,12 +755,13 @@ pub(crate) fn apply_paint(s: &mut Session, p: &Value, paint: Paint, fill: bool)
|
||||
Ok(json!({"objects": ids.iter().collect::<std::collections::BTreeSet<_>>().len()}))
|
||||
}
|
||||
|
||||
/// Is the Live Paint Bucket the active tool while `p` names no `ids`, `id` or `item`? A fill,
|
||||
/// Is the Live Paint Bucket the active tool ([`Session::bucket_paints`]) while `p` names no `ids`,
|
||||
/// `id` or `item`? A fill,
|
||||
/// stroke or stroke weight chosen then is what the bucket paints with, so it goes to the defaults
|
||||
/// and the selection keeps its paint.
|
||||
pub(crate) fn for_bucket(s: &Session, p: &Value) -> bool {
|
||||
// A null `ids` or `id` is no target, as `given_nodes` reads it; `item: null` names the top row.
|
||||
s.tool_id() == LIVE_PAINT_BUCKET && ["ids", "id"].iter().all(|k| p.get(k).is_none_or(Value::is_null)) && p.get("item").is_none()
|
||||
s.bucket_paints() && ["ids", "id"].iter().all(|k| p.get(k).is_none_or(Value::is_null)) && p.get("item").is_none()
|
||||
}
|
||||
|
||||
/// `p` with `ids: []` when [`for_bucket`]: the paint goes to the defaults only. None otherwise.
|
||||
|
||||
@@ -516,7 +516,30 @@ pub fn check_effect_params(id: &str, effect: &str, params: &Value) -> Result<()>
|
||||
}
|
||||
check_effect_color(id, effect, params)?;
|
||||
check_effect_channel(id, effect, params)?;
|
||||
check_effect_center(id, effect, params)
|
||||
check_effect_center(id, effect, params)?;
|
||||
check_effect_pathfinder(id, effect, params)
|
||||
}
|
||||
|
||||
/// The Pathfinder Options in `params` of a Pathfinder effect (`effect`), as command `id` was given
|
||||
/// them: `precision` a number of points from 0.001 to 10, and `removeRedundantPoints` and
|
||||
/// `removeUnpainted` true or false. `effect.apply` and `effect.setParams` run this themselves
|
||||
/// before they edit, as they run [`check_effect_color`].
|
||||
pub(crate) fn check_effect_pathfinder(id: &str, effect: &str, params: &Value) -> Result<()> {
|
||||
use vectorcraft_render::effects;
|
||||
if !effects::takes_pathfinder_options(effect) {
|
||||
return Ok(());
|
||||
}
|
||||
if let Some(v) = params.get("precision")
|
||||
&& !v.as_f64().is_some_and(|p| effects::PATHFINDER_EFFECT_PRECISION.contains(&p))
|
||||
{
|
||||
return Err(bad(id, "precision must be from 0.001 to 10 pt"));
|
||||
}
|
||||
for key in ["removeRedundantPoints", "removeUnpainted"] {
|
||||
if params.get(key).is_some_and(|v| !v.is_boolean()) {
|
||||
return Err(bad(id, format!("`{key}` must be true or false")));
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// The type of the values in `params` of effect `effect`, as command `id` was given them: a key
|
||||
@@ -557,9 +580,10 @@ fn check_effect_types(id: &str, effect: &str, params: &Value) -> Result<()> {
|
||||
/// A value of the type effect `effect` reads for `key`, a parameter its params description names
|
||||
/// without a dialog default: the earlier 3D Perspective and light (`perspective`, `lightAzimuth`,
|
||||
/// `lightElevation`) and Scribble `variation` are numbers, an Outline Stroke's `width` is a number
|
||||
/// and a Gaussian Blur's `linear` is true or false. A Glass, Texturizer or Rough Pastels
|
||||
/// `textureImage`, an SVG filter's `name` and `xml`, a Warp's `version` and the `style` of Crop
|
||||
/// Marks have checks of their own; they aren't listed.
|
||||
/// and a Gaussian Blur's `linear` is true or false. A Pathfinder effect's `precision` is a number and
|
||||
/// its `removeRedundantPoints` and `removeUnpainted` are true or false. A Glass, Texturizer or Rough
|
||||
/// Pastels `textureImage`, an SVG filter's `name` and `xml`, a Warp's `version` and the `style` of
|
||||
/// Crop Marks have checks of their own; they aren't listed.
|
||||
pub(crate) fn undefaulted_type(effect: &str, key: &str) -> Option<Value> {
|
||||
use vectorcraft_render::effects;
|
||||
let number = || Some(Value::from(0.0));
|
||||
@@ -568,6 +592,8 @@ pub(crate) fn undefaulted_type(effect: &str, key: &str) -> Option<Value> {
|
||||
"variation" if effect == "stylize.scribble" => number(),
|
||||
"width" if effect == "path.outlineStroke" => number(),
|
||||
"linear" if effect == "blur.gaussian" => Some(Value::Bool(false)),
|
||||
"precision" if effects::takes_pathfinder_options(effect) => number(),
|
||||
"removeRedundantPoints" | "removeUnpainted" if effects::takes_pathfinder_options(effect) => Some(Value::Bool(false)),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -685,14 +685,21 @@ fn pf_label(op: PathfinderOp) -> &'static str {
|
||||
}
|
||||
}
|
||||
|
||||
/// The Pathfinder Options an operation uses: those `p` gives, else the preferences'. They join the
|
||||
/// command's journal entry, so replaying it gives the same result whatever the preferences are then.
|
||||
fn pf_options(s: &mut Session, p: &Value, id: &str) -> Result<PathfinderOptions> {
|
||||
/// The Pathfinder Options in the preferences, as the panel's operations and a new Pathfinder effect
|
||||
/// take them.
|
||||
pub(crate) fn current_pf_options(s: &Session) -> PathfinderOptions {
|
||||
let mut stored = s.prefs.pathfinder;
|
||||
if !PATHFINDER_PRECISION_RANGE.contains(&stored.precision) {
|
||||
// A preferences file edited by hand: the default, rather than refitting everything away.
|
||||
stored.precision = po::DEFAULT_PRECISION;
|
||||
}
|
||||
stored
|
||||
}
|
||||
|
||||
/// The Pathfinder Options an operation uses: those `p` gives, else the preferences'. They join the
|
||||
/// command's journal entry, so replaying it gives the same result whatever the preferences are then.
|
||||
fn pf_options(s: &mut Session, p: &Value, id: &str) -> Result<PathfinderOptions> {
|
||||
let stored = current_pf_options(s);
|
||||
let keys = ["precision", "removeRedundantPoints", "removeUnpainted"];
|
||||
let given: serde_json::Map<String, Value> =
|
||||
p.as_object().into_iter().flatten().filter(|(k, _)| keys.contains(&k.as_str())).map(|(k, v)| (k.clone(), v.clone())).collect();
|
||||
|
||||
@@ -630,19 +630,7 @@ fn at_param(p: &Value) -> Result<Option<Point>> {
|
||||
/// `image_xf`), also for an image alone in a clip group when the new art is an image, clipped by
|
||||
/// its file's clipping path or not (`new_image`); other objects keep their centre.
|
||||
fn replace_xf(d: &Document, old: &Node, natural: Rect, image_xf: bool, new_image: bool) -> Affine {
|
||||
// An image alone in a clip group (as a PSD or PSB file's clipping path places it,
|
||||
// [`fileio::file_clipped`]) is measured as the image when the new art is an image; a DCS
|
||||
// file's plates are not.
|
||||
let image = match &old.kind {
|
||||
NodeKind::Group { children, clip: true } if new_image => match &children[..] {
|
||||
[path, image] if matches!(path.kind, NodeKind::Path { clipping: true, .. }) => match &image.kind {
|
||||
NodeKind::Image(im) if d.images.get(&im.key).is_none_or(|b| b.separated().is_none()) => image,
|
||||
_ => old,
|
||||
},
|
||||
_ => old,
|
||||
},
|
||||
_ => old,
|
||||
};
|
||||
let image = replace_measured(d, old, new_image);
|
||||
if image_xf && let NodeKind::Image(im) = &image.kind {
|
||||
let (sx, sy) = pt_per_px(d.images.get(&im.key).and_then(|b| fileio::ppi::resolution(&b.bytes)));
|
||||
let full = Affine::scale_non_uniform(sx, sy);
|
||||
@@ -655,6 +643,22 @@ fn replace_xf(d: &Document, old: &Node, natural: Rect, image_xf: bool, new_image
|
||||
Affine::translate(c - natural.center())
|
||||
}
|
||||
|
||||
/// The object [`replace_xf`] measures when Replace swaps `old`: an image alone in a clip group (as
|
||||
/// a PSD or PSB file's clipping path places it, [`fileio::file_clipped`]) when the new art is an
|
||||
/// image (`new_image`), except a DCS file's plates; else `old` itself.
|
||||
fn replace_measured<'a>(d: &Document, old: &'a Node, new_image: bool) -> &'a Node {
|
||||
match &old.kind {
|
||||
NodeKind::Group { children, clip: true } if new_image => match &children[..] {
|
||||
[path, image] if matches!(path.kind, NodeKind::Path { clipping: true, .. }) => match &image.kind {
|
||||
NodeKind::Image(im) if d.images.get(&im.key).is_none_or(|b| b.separated().is_none()) => image,
|
||||
_ => old,
|
||||
},
|
||||
_ => old,
|
||||
},
|
||||
_ => old,
|
||||
}
|
||||
}
|
||||
|
||||
/// `rect` fitted with `natural`'s aspect, centred.
|
||||
fn fit(natural: Rect, r: Rect) -> Affine {
|
||||
let ratio = |a: f64, b: f64| (b > 1e-9).then(|| a / b);
|
||||
@@ -814,6 +818,17 @@ fn apply(s: &mut Session, read: PlaceRead) -> Result<Value> {
|
||||
loaded.natural = Rect::from_origin_size(Point::ORIGIN, size);
|
||||
}
|
||||
let natural = loaded.natural;
|
||||
// Replace keeps the transform of the image it measures (`replace_measured`), which a
|
||||
// distortion's corners do not follow. Type, and any other object it measures, is placed by the
|
||||
// bounds of what it replaces, so a distorted image there is not refused.
|
||||
if let Some(o) = old_node
|
||||
&& !is_text
|
||||
{
|
||||
let image = replace_measured(&st.doc, o, matches!(loaded.art, Art::Image(..)));
|
||||
if image.is_distorted_image() {
|
||||
return Err(super::xform::distorted_image_error(PLACE, image.id));
|
||||
}
|
||||
}
|
||||
let m = match (old_node, rect) {
|
||||
(Some(o), _) => replace_xf(&st.doc, o, natural, !is_text, matches!(loaded.art, Art::Image(..))),
|
||||
(None, Some(r)) => fit(natural, r),
|
||||
@@ -1173,6 +1188,8 @@ pub(crate) fn image_info(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let doc = super::links::with_brush_art(&st.doc);
|
||||
let n = doc.stored_node(id).map(|(n, _)| &**n).ok_or(EngineError::NoNode(id))?;
|
||||
let NodeKind::Image(im) = &n.kind else { return Err(bad(C, format!("object {} is not an image", id.0))) };
|
||||
// Effective resolution, taken at the middle of a distorted image.
|
||||
let ppi = effective_ppi(vectorcraft_doc::image_quad::nearest_affine(n).unwrap_or(im.xf));
|
||||
let size = n.geometric_bounds().unwrap_or_default();
|
||||
// A linked file outside the read roots of the caller asking now is left unnamed, as in Link Info.
|
||||
let doc_path = super::links::LinkBase::of(st).doc;
|
||||
@@ -1184,7 +1201,7 @@ pub(crate) fn image_info(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
"colorMode": st.doc.images.get(&im.key).map_or("RGB", |b| color_mode(&b.bytes)),
|
||||
"pixelWidth": im.width,
|
||||
"pixelHeight": im.height,
|
||||
"ppi": effective_ppi(im.xf),
|
||||
"ppi": ppi,
|
||||
"width": size.width(),
|
||||
"height": size.height(),
|
||||
}))
|
||||
|
||||
@@ -404,6 +404,7 @@ pub const PREF_SPECS: &[PrefSpec] = &[
|
||||
"Update Links",
|
||||
choice(&[("automatically", "Automatically"), ("manually", "Manually"), ("askWhenModified", "Ask When Modified")])
|
||||
),
|
||||
p!("pdfTextAs", "File Handling", "Files", "PDF Text", choice(&[("text", "Editable"), ("outlines", "Outlines")])),
|
||||
// Clipboard Handling
|
||||
p!("copyAsSvg", "Clipboard Handling", "On Copy", "Include SVG Code", bool),
|
||||
p!("copyAsPdf", "Clipboard Handling", "On Copy", "PDF", bool),
|
||||
|
||||
@@ -455,6 +455,10 @@ fn places(map: Affine) -> bool {
|
||||
/// member).
|
||||
pub(crate) fn replace_with_image(mut v: Node, image: Node) -> Node {
|
||||
if !v.is_layer() {
|
||||
// The new pixels already show a distorted image's distortion.
|
||||
if let Some(e) = v.extras_if_any() {
|
||||
e.image_quad = None;
|
||||
}
|
||||
return Node { kind: image.kind, appearance: Default::default(), ..v };
|
||||
}
|
||||
v.appearance = Default::default();
|
||||
|
||||
@@ -130,7 +130,8 @@ type Region = (vectorcraft_geom::BezPath, vectorcraft_geom::FillRule);
|
||||
#[derive(Clone)]
|
||||
struct ImageRead<'a> {
|
||||
blob: &'a vectorcraft_doc::ImageBlob,
|
||||
xf: vectorcraft_geom::Affine,
|
||||
/// Pixel space to the page: the image's transform, or a distorted image's projective map.
|
||||
map: vectorcraft_geom::Homography,
|
||||
size: (f64, f64),
|
||||
area: Option<Rect>,
|
||||
clip: Option<Vec<Region>>,
|
||||
@@ -261,9 +262,9 @@ impl<'a> Theme<'a> {
|
||||
let keeps: Vec<Box<dyn Fn(f64, f64) -> bool + '_>> = group
|
||||
.iter()
|
||||
.map(|r| {
|
||||
let (xf, (w, h), area, clip, cost, tested) = (r.xf, r.size, r.area, &r.clip, elements(r), &tested);
|
||||
let (map, (w, h), area, clip, cost, tested) = (r.map, r.size, r.area, &r.clip, elements(r), &tested);
|
||||
Box::new(move |u: f64, v: f64| {
|
||||
let p = xf * Point::new(u * w, v * h);
|
||||
let Some(p) = map.apply(Point::new(u * w, v * h)) else { return false };
|
||||
area.is_none_or(|a| a.contains(p))
|
||||
&& clip.as_ref().is_none_or(|rs| {
|
||||
tested.set(tested.get().saturating_add(cost));
|
||||
@@ -278,7 +279,7 @@ impl<'a> Theme<'a> {
|
||||
.map(|(r, keep)| {
|
||||
use vectorcraft_geom::kurbo::Shape;
|
||||
let (w, h) = r.size;
|
||||
let inv = r.xf.inverse();
|
||||
let inv = r.map.inverse();
|
||||
// The box sampled: the marquee, cut to the clipping paths' bounds, so a small
|
||||
// region a clip shows of a large image is still sampled densely.
|
||||
let clip_box = r.clip.as_ref().map(|rs| rs.iter().map(|(bp, _)| bp.bounding_box()).reduce(|a, b| a.union(b)).unwrap_or_default());
|
||||
@@ -286,12 +287,16 @@ impl<'a> Theme<'a> {
|
||||
(Some(a), Some(c)) => Some(a.intersect(c)),
|
||||
(a, c) => a.or(c),
|
||||
};
|
||||
let box_uv = region.map(|a| {
|
||||
let uv: Vec<Point> =
|
||||
[(a.x0, a.y0), (a.x1, a.y0), (a.x0, a.y1), (a.x1, a.y1)].into_iter().map(|(x, y)| inv * Point::new(x, y)).collect();
|
||||
// A region that crosses a distorted image's horizon has no box: the whole
|
||||
// image is sampled, and `keep` tests each pixel.
|
||||
let box_uv = region.zip(inv).and_then(|(a, inv)| {
|
||||
let uv: Vec<Point> = [(a.x0, a.y0), (a.x1, a.y0), (a.x0, a.y1), (a.x1, a.y1)]
|
||||
.into_iter()
|
||||
.map(|(x, y)| inv.apply(Point::new(x, y)))
|
||||
.collect::<Option<_>>()?;
|
||||
let low = |f: fn(&Point) -> f64| uv.iter().map(f).fold(f64::INFINITY, f64::min);
|
||||
let high = |f: fn(&Point) -> f64| uv.iter().map(f).fold(f64::NEG_INFINITY, f64::max);
|
||||
[low(|p| p.x) / w, low(|p| p.y) / h, high(|p| p.x) / w, high(|p| p.y) / h]
|
||||
Some([low(|p| p.x) / w, low(|p| p.y) / h, high(|p| p.x) / w, high(|p| p.y) / h])
|
||||
});
|
||||
(box_uv, if r.clip.is_some() { clipped } else { budget }, keep.as_ref())
|
||||
})
|
||||
@@ -401,7 +406,9 @@ impl<'a> Theme<'a> {
|
||||
None
|
||||
};
|
||||
let size = (f64::from(im.width.max(1)), f64::from(im.height.max(1)));
|
||||
self.queue_image(ImageRead { blob, xf: im.xf, size, area, clip: self.clip.clone(), colorize });
|
||||
// A distorted image's pixels are where its projective map puts them.
|
||||
let map = n.image_map().unwrap_or_else(|| vectorcraft_geom::Homography::from_affine(im.xf));
|
||||
self.queue_image(ImageRead { blob, map, size, area, clip: self.clip.clone(), colorize });
|
||||
return;
|
||||
}
|
||||
NodeKind::SymbolInstance { symbol, xf } => {
|
||||
@@ -2051,7 +2058,14 @@ mod tests {
|
||||
bp.line_to((size, size));
|
||||
bp.line_to((0.0, size));
|
||||
bp.close_path();
|
||||
ImageRead { blob, xf: Affine::IDENTITY, size: (size, size), area: None, clip: Some(vec![(bp, FillRule::NonZero)]), colorize: None }
|
||||
ImageRead {
|
||||
blob,
|
||||
map: vectorcraft_geom::Homography::from_affine(Affine::IDENTITY),
|
||||
size: (size, size),
|
||||
area: None,
|
||||
clip: Some(vec![(bp, FillRule::NonZero)]),
|
||||
colorize: None,
|
||||
}
|
||||
}
|
||||
|
||||
/// The reads of one image inside clip groups share the work limit: three reads of a 64 px
|
||||
|
||||
@@ -445,7 +445,7 @@ impl Session {
|
||||
/// selection's stroke.
|
||||
pub fn shown_stroke(&self) -> Option<StrokeLayer> {
|
||||
let st = self.active()?;
|
||||
if self.tool_id() == super::paint::LIVE_PAINT_BUCKET {
|
||||
if self.bucket_paints() {
|
||||
return Some(self.new_art_stroke());
|
||||
}
|
||||
if let Some(part) = st.selected_symbol_part() {
|
||||
|
||||
@@ -21,7 +21,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
"Free Distort",
|
||||
[],
|
||||
None,
|
||||
"{corners: [[x,y]×4] (TL, TR, BR, BL), from?: [x0,y0,x1,y1] (default: selection bounds), angle?: degrees (counter-clockwise; `from`, or the selection bounds, is then a box in the frame turned by it, as a rotated bounding box is; default 0), ids?} projective warp of anchors and handles; a linked opacity mask's art is warped with its object, an unlinked one stays; each warped object's bounding box (the objects inside groups and the art of linked masks too) turns as the warp turns the art at its center (object.resetBoundingBox squares it again); corners where the box already stands change nothing and add no undo step",
|
||||
"{corners: [[x,y]×4] (TL, TR, BR, BL), from?: [x0,y0,x1,y1] (default: selection bounds), angle?: degrees (counter-clockwise; `from`, or the selection bounds, is then a box in the frame turned by it, as a rotated bounding box is; default 0), ids?} projective warp of anchors and handles; an image's four corners go exactly where the warp takes them and its pixels are drawn in perspective between them (an error, and nothing changes, when an image's corners would fold over, fall on one line, cross the warp's horizon or lie too close together for a perspective map); a linked opacity mask's art is warped with its object, an unlinked one stays; each warped object's bounding box (the objects inside groups and the art of linked masks too) turns as the warp turns the art at its center (object.resetBoundingBox squares it again); corners where the box already stands change nothing and add no undo step",
|
||||
has_doc,
|
||||
distort
|
||||
),
|
||||
@@ -86,6 +86,15 @@ impl Projective {
|
||||
Self { m: [a, b, p0.x, d, e, p0.y, g, h], src, pre: bx.to_doc().inverse() }
|
||||
}
|
||||
|
||||
/// Whether `p` maps in front of the warp's horizon, on the side the box's own corners are.
|
||||
fn in_front(&self, p: Point) -> bool {
|
||||
let [.., g, h] = self.m;
|
||||
let p = self.pre * p;
|
||||
let u = if self.src.width().abs() > 1e-12 { (p.x - self.src.x0) / self.src.width() } else { 0.0 };
|
||||
let v = if self.src.height().abs() > 1e-12 { (p.y - self.src.y0) / self.src.height() } else { 0.0 };
|
||||
g * u + h * v + 1.0 > 1e-9
|
||||
}
|
||||
|
||||
pub fn apply(&self, p: Point) -> Point {
|
||||
let [a, b, c, d, e, f, g, h] = self.m;
|
||||
let p = self.pre * p;
|
||||
@@ -138,6 +147,15 @@ fn warp_node(n: &mut Node, pr: &Projective) -> Option<Rect> {
|
||||
// A clip group is bounded by its clip path.
|
||||
NodeKind::Group { children, clip: true } => warp_children(children, pr, |i| i == 0),
|
||||
NodeKind::Group { children, .. } | NodeKind::Compound { children, .. } => warp_children(children, pr, |i| i >= skip),
|
||||
// An image's corners follow the warp exactly ([`Node::set_image_corners`]); [`distort`]
|
||||
// has checked that they stay convex.
|
||||
NodeKind::Image(_) => {
|
||||
let b = n.geometric_bounds();
|
||||
if let Some(q) = n.image_corners() {
|
||||
let _ = n.set_image_corners(q.map(|p| pr.apply(p)));
|
||||
}
|
||||
b
|
||||
}
|
||||
_ => {
|
||||
// No editable points: the affine approximation (which maps the gradients too).
|
||||
let b = n.geometric_bounds();
|
||||
@@ -157,6 +175,21 @@ fn warp_node(n: &mut Node, pr: &Projective) -> Option<Rect> {
|
||||
before
|
||||
}
|
||||
|
||||
/// Whether the warp from `src` to `q` ([`Projective::from_box`]) takes the corners of `src` to `q`,
|
||||
/// within a millionth of `q`'s shortest side plus the rounding error of coordinates as far from `q`'s
|
||||
/// first corner as the others. The warp is solved and measured with `src` and `q` moved to the
|
||||
/// origin, so coordinates far from it do not widen the allowance.
|
||||
fn reaches_corners(src: OrientedBox, q: [Point; 4]) -> bool {
|
||||
let origin = q[0].to_vec2();
|
||||
let q = q.map(|p| p - origin);
|
||||
let src = OrientedBox { rect: src.rect - src.rect.origin().to_vec2(), ..src };
|
||||
let pr = Projective::from_box(src, q);
|
||||
let side = (0..4).map(|i| q[i].distance(q[(i + 1) % 4])).fold(f64::INFINITY, f64::min);
|
||||
let far = q.iter().map(|p| p.x.abs().max(p.y.abs())).fold(0.0, f64::max);
|
||||
let tol = side * 1e-6 + far * 1e-12;
|
||||
side.is_finite() && side > 0.0 && src.corners().iter().zip(q).all(|(c, want)| pr.apply(*c).distance(want) <= tol)
|
||||
}
|
||||
|
||||
/// Warps each of `children` and returns the union of the pre-warp bounds of those `counts` picks
|
||||
/// by index.
|
||||
fn warp_children(children: &mut [Arc<Node>], pr: &Projective, counts: impl Fn(usize) -> bool) -> Option<Rect> {
|
||||
@@ -166,6 +199,76 @@ fn warp_children(children: &mut [Arc<Node>], pr: &Projective, counts: impl Fn(us
|
||||
})
|
||||
}
|
||||
|
||||
/// The first image in `n` (its children and the art of linked opacity masks, as [`warp_node`]
|
||||
/// reaches them) whose corners `pr` would fold, collapse or carry past the warp's horizon, with
|
||||
/// why.
|
||||
fn unwarpable_image(n: &Node, pr: &Projective) -> Option<(vectorcraft_doc::NodeId, Unwarpable)> {
|
||||
if let (Some(q), NodeKind::Image(im)) = (n.image_corners(), &n.kind) {
|
||||
if !q.iter().all(|p| pr.in_front(*p)) {
|
||||
return Some((n.id, Unwarpable::Horizon));
|
||||
}
|
||||
if let Err(e) = vectorcraft_doc::image_quad::check_for(im, &q.map(|p| pr.apply(p))) {
|
||||
return Some((
|
||||
n.id,
|
||||
match e {
|
||||
vectorcraft_doc::image_quad::QuadError::NotFinite | vectorcraft_doc::image_quad::QuadError::NotConvex => Unwarpable::NotConvex,
|
||||
vectorcraft_doc::image_quad::QuadError::TooNarrow => Unwarpable::TooNarrow,
|
||||
},
|
||||
));
|
||||
}
|
||||
}
|
||||
warped_parts(n).into_iter().find_map(|c| unwarpable_image(c, pr))
|
||||
}
|
||||
|
||||
/// The first image in `n` that [`warp_node`] reaches (its children and the art of linked opacity
|
||||
/// masks).
|
||||
fn first_image(n: &Node) -> Option<vectorcraft_doc::NodeId> {
|
||||
if matches!(n.kind, NodeKind::Image(_)) {
|
||||
return Some(n.id);
|
||||
}
|
||||
warped_parts(n).into_iter().find_map(first_image)
|
||||
}
|
||||
|
||||
/// The objects inside `n` that [`warp_node`] warps point by point: the children of layers, groups
|
||||
/// and compound paths, and the art of a linked opacity mask on those, paths and images. Other
|
||||
/// objects (blends, envelopes, repeats and the rest) take the warp's affine approximation whole.
|
||||
fn warped_parts(n: &Node) -> Vec<&Node> {
|
||||
let inside = matches!(n.kind, NodeKind::Layer { .. } | NodeKind::Group { .. } | NodeKind::Compound { .. });
|
||||
let mask_too = inside || matches!(n.kind, NodeKind::Path { .. } | NodeKind::Image(_));
|
||||
let children = n.children().filter(|_| inside).into_iter().flatten().map(|c| &**c);
|
||||
let mask = n.extras().mask.as_deref().filter(|m| mask_too && m.linked).map(|m| &*m.art);
|
||||
children.chain(mask).collect()
|
||||
}
|
||||
|
||||
/// The error of `command` on image `id`, which is distorted (Perspective Distort or Free Distort)
|
||||
/// in a way the command cannot keep.
|
||||
pub(crate) fn distorted_image_error(command: &str, id: vectorcraft_doc::NodeId) -> EngineError {
|
||||
bad(command, format!("object {} is an image changed by Perspective Distort or Free Distort, which this command does not work on", id.0))
|
||||
}
|
||||
|
||||
/// Why an image cannot follow the corners of a distort.
|
||||
#[derive(Clone, Copy)]
|
||||
enum Unwarpable {
|
||||
/// Its corners would fold over, meet or fall on one line.
|
||||
NotConvex,
|
||||
/// A corner would cross the warp's horizon.
|
||||
Horizon,
|
||||
/// Its corners would be too close together for a perspective map to place them.
|
||||
TooNarrow,
|
||||
}
|
||||
|
||||
/// The error of `object.distort` when image `id` cannot follow its corners.
|
||||
fn unwarpable_error(id: vectorcraft_doc::NodeId, why: Unwarpable) -> EngineError {
|
||||
const C: &str = "object.distort";
|
||||
match why {
|
||||
Unwarpable::NotConvex => bad(C, format!("image {} cannot be distorted this way: its corners would not make a convex shape", id.0)),
|
||||
Unwarpable::Horizon => bad(C, format!("image {} cannot be distorted this way: its corners would cross the warp's horizon", id.0)),
|
||||
Unwarpable::TooNarrow => {
|
||||
bad(C, format!("image {} cannot be distorted this way: its corners would be too close together for a perspective map", id.0))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn distort(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
const C: &str = "object.distort";
|
||||
// All four corners or nothing, each exactly [x, y]: nothing malformed is left out.
|
||||
@@ -208,6 +311,26 @@ fn distort(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
return Ok(ids_json);
|
||||
}
|
||||
let pr = Projective::from_box(src, [tl, tr, br, bl]);
|
||||
// An image's corners follow the handles exactly, so they must stay a convex shape: nothing
|
||||
// changes when one would not.
|
||||
let doc = &s.doc()?.doc;
|
||||
// Corners that do not make a convex shape give no perspective map (the warp falls back to an
|
||||
// affine one), so an image cannot follow them.
|
||||
if vectorcraft_doc::image_quad::check(&[tl, tr, br, bl]).is_err()
|
||||
&& let Some(id) = ids.iter().filter_map(|id| doc.node(*id)).find_map(first_image)
|
||||
{
|
||||
return Err(unwarpable_error(id, Unwarpable::NotConvex));
|
||||
}
|
||||
// Corners so close together that the map falls back to an affine one: the box's corners do
|
||||
// not reach the handles, so an image cannot follow them either.
|
||||
if !reaches_corners(src, [tl, tr, br, bl])
|
||||
&& let Some(id) = ids.iter().filter_map(|id| doc.node(*id)).find_map(first_image)
|
||||
{
|
||||
return Err(unwarpable_error(id, Unwarpable::TooNarrow));
|
||||
}
|
||||
if let Some((id, why)) = ids.iter().filter_map(|id| doc.node(*id)).find_map(|n| unwarpable_image(n, &pr)) {
|
||||
return Err(unwarpable_error(id, why));
|
||||
}
|
||||
s.edit("Free Distort", |d, _| {
|
||||
for id in &ids {
|
||||
if let Some(n) = d.node_mut(*id) {
|
||||
|
||||
@@ -74,6 +74,10 @@ pub struct Session {
|
||||
/// While Cmd lends `tool` (a selection tool) for a drag: the tool it was lent to, which comes
|
||||
/// back as it was at the release ([`Session::pointer`]).
|
||||
pub(crate) lender: Option<Box<dyn Tool>>,
|
||||
/// Set while tool actions that end by switching back to the Live Paint Bucket are applied (the
|
||||
/// Eyedropper's sample into a stop of the bucket's gradient): their paint commands change the
|
||||
/// colors the bucket paints with ([`Session::bucket_paints`]).
|
||||
pub(crate) back_to_bucket: bool,
|
||||
/// Pointer and key input that came while the tool computed an edit on another thread, each with
|
||||
/// its number and view, made in order once the edit is applied.
|
||||
held_input: std::collections::VecDeque<(u64, tooling::HeldInput, ViewInfo)>,
|
||||
|
||||
@@ -283,6 +283,11 @@ pub struct Prefs {
|
||||
pub low_res_proxy_eps: bool,
|
||||
pub anti_aliased_bitmaps: bool,
|
||||
pub update_links: String,
|
||||
/// PDF Text: what the text of a PDF, `.ai` or `.ait` file opened or placed from the app
|
||||
/// becomes when the open or place does not say (`text`: editable type in the file's fonts;
|
||||
/// `outlines`: the glyph outlines the file draws). The Import PDF dialog starts from it and
|
||||
/// keeps the choice it confirms.
|
||||
pub pdf_text_as: String,
|
||||
// Clipboard Handling
|
||||
pub copy_as_svg: bool,
|
||||
pub copy_as_pdf: bool,
|
||||
@@ -589,6 +594,7 @@ impl Default for Prefs {
|
||||
low_res_proxy_eps: false,
|
||||
anti_aliased_bitmaps: false,
|
||||
update_links: s("askWhenModified"),
|
||||
pdf_text_as: s("text"),
|
||||
copy_as_svg: true,
|
||||
copy_as_pdf: false,
|
||||
copy_aicb: false,
|
||||
|
||||
@@ -55,6 +55,7 @@ impl Session {
|
||||
histories_seen: None,
|
||||
tool: vectorcraft_tools::create("selection"),
|
||||
lender: None,
|
||||
back_to_bucket: false,
|
||||
held_input: Default::default(),
|
||||
input_count: 0,
|
||||
edit_started_by: None,
|
||||
|
||||
@@ -323,7 +323,7 @@ impl Session {
|
||||
}
|
||||
// While the Live Paint Bucket is active, paint previews change only the bucket's colors, so
|
||||
// each preview starts from the colors the interaction began with.
|
||||
let bucket = self.tool_id() == cmd::LIVE_PAINT_BUCKET;
|
||||
let bucket = self.bucket_paints();
|
||||
let (paint, restore_paint) = {
|
||||
let menu = self.menu.clone();
|
||||
let st = self.doc_mut()?;
|
||||
@@ -485,7 +485,7 @@ impl Session {
|
||||
self.pending_paint = None;
|
||||
// While the Live Paint Bucket is active, a previewed color is the bucket's color, which the
|
||||
// cancel puts back as well.
|
||||
let bucket = self.tool_id() == cmd::LIVE_PAINT_BUCKET;
|
||||
let bucket = self.bucket_paints();
|
||||
if let Some(paint) = self
|
||||
.active()
|
||||
.and_then(|st| st.interaction.as_ref())
|
||||
|
||||
@@ -114,6 +114,7 @@ fn the_builtin_libraries_are_original_brushes_generated_in_code() {
|
||||
"bristle-brushes",
|
||||
"paint",
|
||||
"pattern-borders",
|
||||
"decorative",
|
||||
"scatter-shapes",
|
||||
"stipple",
|
||||
"game-trails",
|
||||
@@ -127,6 +128,20 @@ fn the_builtin_libraries_are_original_brushes_generated_in_code() {
|
||||
]
|
||||
);
|
||||
assert!(libs.iter().all(|l| l["category"] == "builtIn"));
|
||||
// None of them is a default brush.
|
||||
let defaults: Vec<&str> = vectorcraft_brush::defaults().iter().map(|b| b.name.as_str()).collect();
|
||||
for id in ids {
|
||||
let (_, lib) = cmd::brushlib::library(&s, id).unwrap();
|
||||
assert!(lib.brushes.iter().all(|b| !defaults.contains(&b.name.as_str())), "{id}");
|
||||
}
|
||||
assert!(s.execute("brush.library", &json!({"library": "nope"})).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_builtin_libraries_list_their_brush_names_and_counts() {
|
||||
let mut s = Session::new();
|
||||
let list = run(&mut s, "brush.libraries", json!({}));
|
||||
let libs = list["libraries"].as_array().unwrap();
|
||||
// Looked up by id, so a library added to the list does not shift these checks.
|
||||
let entry = |id: &str| libs.iter().find(|l| l["id"] == id).unwrap();
|
||||
let lib = run(&mut s, "brush.library", json!({"library": "art ribbons"}));
|
||||
@@ -135,6 +150,7 @@ fn the_builtin_libraries_are_original_brushes_generated_in_code() {
|
||||
["Notched Ribbon", "Double Line", "Wave", "Teardrop", "Striped Ribbon"]
|
||||
);
|
||||
assert_eq!(entry("art-ribbons")["count"].as_u64(), Some(5));
|
||||
assert_eq!((entry("decorative")["name"].as_str(), entry("decorative")["count"].as_u64()), (Some("Decorative"), Some(4)));
|
||||
let trails = run(&mut s, "brush.library", json!({"library": "game-trails"}));
|
||||
assert_eq!(
|
||||
trails["brushes"].as_array().unwrap().iter().map(|b| b["name"].as_str().unwrap()).collect::<Vec<_>>(),
|
||||
@@ -164,6 +180,11 @@ fn the_builtin_libraries_are_original_brushes_generated_in_code() {
|
||||
let id = run(&mut s, "shape.rectangle", json!({"x": 10, "y": 20, "width": 40, "height": 8}))["id"].as_u64().unwrap();
|
||||
let added = run(&mut s, "brush.addFromLibrary", json!({"library": "energy-beams", "name": "Laser Bolt", "apply": true, "ids": [id]}));
|
||||
assert_eq!(strs(&added["added"]), ["Laser Bolt"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_builtin_library_brush_has_its_kind_and_draws() {
|
||||
let s = Session::new();
|
||||
// One kind of brush per library (Ink and Wash: art brushes and a calligraphic one), every
|
||||
// brush drawing something.
|
||||
for (id, kind) in [
|
||||
@@ -174,6 +195,7 @@ fn the_builtin_libraries_are_original_brushes_generated_in_code() {
|
||||
("bristle-brushes", "bristle"),
|
||||
("paint", "art"),
|
||||
("pattern-borders", "pattern"),
|
||||
("decorative", "pattern"),
|
||||
("scatter-shapes", "scatter"),
|
||||
("stipple", "scatter"),
|
||||
("game-trails", "art"),
|
||||
@@ -195,6 +217,11 @@ fn the_builtin_libraries_are_original_brushes_generated_in_code() {
|
||||
assert!(!vectorcraft_brush::stroke_pieces(&lib.doc, b, &line, &stroke).is_empty(), "{} draws nothing", b.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn builtin_library_brushes_bring_the_resources_their_art_uses() {
|
||||
let s = Session::new();
|
||||
// The resources their art uses come with them: Striped Ribbon's pattern, Sparkles' symbol.
|
||||
let (_, ribbons) = cmd::brushlib::library(&s, "art-ribbons").unwrap();
|
||||
assert_eq!(art_patterns(ribbons.brush("Striped Ribbon").unwrap()), ["Pinstripes"]);
|
||||
@@ -203,13 +230,6 @@ fn the_builtin_libraries_are_original_brushes_generated_in_code() {
|
||||
let BrushKind::Scatter(sparkles) = &shapes.brush("Sparkles").unwrap().kind else { panic!("not a scatter brush") };
|
||||
assert!(matches!(&sparkles.art.kind, NodeKind::SymbolInstance { symbol, .. } if symbol == "Sparkle"));
|
||||
assert!(shapes.doc.symbols.iter().any(|x| x.name == "Sparkle"));
|
||||
// None of them is a default brush.
|
||||
let defaults: Vec<&str> = vectorcraft_brush::defaults().iter().map(|b| b.name.as_str()).collect();
|
||||
for id in ids {
|
||||
let (_, lib) = cmd::brushlib::library(&s, id).unwrap();
|
||||
assert!(lib.brushes.iter().all(|b| !defaults.contains(&b.name.as_str())), "{id}");
|
||||
}
|
||||
assert!(s.execute("brush.library", &json!({"library": "nope"})).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -562,6 +582,41 @@ fn the_tech_circuit_library_constructs_adds_and_applies_each_brush() {
|
||||
assert_eq!(vectorcraft_brush::library(&reopened), lib.brushes);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn decorative_brushes_repeat_distinct_art_and_survive_a_saved_library() {
|
||||
let mut s = session();
|
||||
let (_, lib) = cmd::brushlib::library(&s, "Decorative").unwrap();
|
||||
let names = ["Leaf Vine", "Blossom Chain", "Pennant Garland", "Lantern String"];
|
||||
assert_eq!(lib.brushes.iter().map(|b| b.name.as_str()).collect::<Vec<_>>(), names);
|
||||
let path = run(&mut s, "shape.line", json!({"x1": 10, "y1": 40, "x2": 190, "y2": 40}))["id"].as_u64().unwrap();
|
||||
let mut signatures = std::collections::HashSet::new();
|
||||
for b in &lib.brushes {
|
||||
let BrushKind::Pattern(pattern) = &b.kind else { panic!("{} is not a pattern brush", b.name) };
|
||||
assert_eq!(pattern.colorization, vectorcraft_brush::Colorization::Tints);
|
||||
let points = |len: f64| anchors(&vectorcraft_brush::stroke_pieces(&lib.doc, b, &line_to(len), &black_stroke()).iter().collect::<Vec<_>>());
|
||||
let (one, four) = (points(48.0), points(192.0));
|
||||
assert!(!one.is_empty() && four.iter().all(|p| p.x.is_finite() && p.y.is_finite()), "{}", b.name);
|
||||
// A path four tiles long places the motif four times, each copy one tile further along.
|
||||
assert_eq!(four.len(), 4 * one.len(), "{} repeats its motif", b.name);
|
||||
for (i, p) in four.iter().enumerate() {
|
||||
let q = one[i % one.len()];
|
||||
let shift = 48.0 * (i / one.len()) as f64;
|
||||
assert!((p.x - q.x - shift).abs() < 1e-3 && (p.y - q.y).abs() < 1e-3, "{} copy {} at {p:?}, not {q:?}", b.name, i / one.len());
|
||||
}
|
||||
signatures.insert(one.iter().map(|p| ((p.x * 100.0).round() as i64, (p.y * 100.0).round() as i64)).collect::<Vec<_>>());
|
||||
let before = undo_len(&s);
|
||||
let applied = run(&mut s, "brush.addFromLibrary", json!({"library": "decorative", "name": b.name, "apply": true, "ids": [path]}));
|
||||
assert_eq!((strs(&applied["added"]), &applied["applied"]), (vec![b.name.as_str()], &json!([path])));
|
||||
assert_eq!(undo_len(&s), before + 1);
|
||||
assert_eq!(doc(&s).node(NodeId(path)).unwrap().appearance.stroke().unwrap().brush.as_deref(), Some(b.name.as_str()));
|
||||
}
|
||||
assert_eq!(signatures.len(), names.len(), "each design produces a different repeating shape");
|
||||
let saved = run(&mut s, "brush.saveLibrary", json!({"names": names}));
|
||||
let bytes = vectorcraft_format::base64_decode(saved["dataBase64"].as_str().unwrap()).unwrap();
|
||||
let reopened = vectorcraft_format::load(&bytes).unwrap();
|
||||
assert_eq!(vectorcraft_brush::library(&reopened), lib.brushes);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pressure_sensitive_brushes_widen_with_pen_pressure_and_survive_a_saved_library() {
|
||||
let mut s = session();
|
||||
|
||||
@@ -3434,6 +3434,65 @@ fn live_paint_bucket_gradient_preset_and_sampled_stop_follow_the_active_proxy()
|
||||
assert_eq!(node(&s, rect), art, "the selection keeps its paint");
|
||||
}
|
||||
|
||||
/// The Gradient panel's eyedropper, used on a stop of the Live Paint Bucket's gradient, samples the
|
||||
/// color clicked into that stop of the bucket's fill, and the selection keeps its paint. A Cmd-click
|
||||
/// with the bucket, or with the Eyedropper armed for it, which the selection tool takes, leaves the
|
||||
/// bucket's colors as they were.
|
||||
#[test]
|
||||
fn live_paint_bucket_keeps_its_colors_through_the_stop_eyedropper_and_a_cmd_click() {
|
||||
let v = ViewInfo::default();
|
||||
let click = |s: &mut Session, mods: Mods| {
|
||||
for kind in [PointerKind::Down, PointerKind::Up] {
|
||||
s.pointer(&PointerEvent::new(kind, 320.0, 320.0).with_mods(mods), v).unwrap();
|
||||
}
|
||||
};
|
||||
let mut s = session();
|
||||
live(&mut s);
|
||||
let rect = rect(&mut s, 300.0, 300.0, 40.0, 40.0);
|
||||
s.execute("paint.setFill", &json!({"color": "#00ff00", "ids": [rect.0]})).unwrap();
|
||||
s.execute("appearance.setNewArtBasic", &json!({"on": false})).unwrap();
|
||||
s.execute("select.set", &json!({"ids": [rect.0]})).unwrap();
|
||||
s.select_tool("livePaintBucket", v).unwrap();
|
||||
s.execute("paint.editGradient", &json!({"stroke": false, "kind": "linear"})).unwrap();
|
||||
s.execute("gradient.selectStop", &json!({"index": 1})).unwrap();
|
||||
let art = node(&s, rect);
|
||||
// The panel's eyedropper (`stop_eyedropper`): the Eyedropper, set to switch back to the bucket.
|
||||
s.select_tool("eyedropper", v).unwrap();
|
||||
s.set_tool_option("stop", &json!("livePaintBucket"));
|
||||
assert_eq!(s.selected_stop(), Some(1), "the bucket's stop stays selected for the pick");
|
||||
// A Cmd-click while the pick is armed selects the rectangle and leaves the bucket's gradient.
|
||||
let fill = s.paint.fill.clone();
|
||||
s.execute("select.set", &json!({"ids": []})).unwrap();
|
||||
click(&mut s, Mods { cmd: true, ..Mods::default() });
|
||||
assert_eq!(s.doc().unwrap().selection.objects, vec![rect], "the selection tool took the click");
|
||||
assert_eq!((s.paint.fill.clone(), s.selected_stop()), (fill, Some(1)), "the bucket's fill and stop stay");
|
||||
click(&mut s, Mods::default());
|
||||
let Paint::Gradient(g) = &s.paint.fill else { panic!("the bucket's fill is not a gradient") };
|
||||
assert_eq!(g.gradient.stops[1].color, Color::from_hex("#00ff00").unwrap(), "the sampled stop");
|
||||
assert_eq!(node(&s, rect), art, "the selection keeps its paint");
|
||||
// A Cmd-click selects the rectangle; the bucket keeps its gradient.
|
||||
s.select_tool("livePaintBucket", v).unwrap();
|
||||
let fill = s.paint.fill.clone();
|
||||
s.execute("select.set", &json!({"ids": []})).unwrap();
|
||||
click(&mut s, Mods { cmd: true, ..Mods::default() });
|
||||
assert_eq!(s.doc().unwrap().selection.objects, vec![rect], "the selection tool took the click");
|
||||
assert_eq!(s.paint.fill, fill, "the bucket's fill stays");
|
||||
// Armed again, a Cmd-click on another object deselects the stop; the next click (a Shift-click,
|
||||
// which would sample a color) ends the pick and leaves the bucket's gradient.
|
||||
let other = self::rect(&mut s, 400.0, 400.0, 40.0, 40.0);
|
||||
s.execute("select.set", &json!({"ids": [rect.0]})).unwrap();
|
||||
s.execute("gradient.selectStop", &json!({"index": 1})).unwrap();
|
||||
s.select_tool("eyedropper", v).unwrap();
|
||||
s.set_tool_option("stop", &json!("livePaintBucket"));
|
||||
for mods in [Mods { cmd: true, ..Mods::default() }, Mods { shift: true, ..Mods::default() }] {
|
||||
for kind in [PointerKind::Down, PointerKind::Up] {
|
||||
s.pointer(&PointerEvent::new(kind, 420.0, 420.0).with_mods(mods), v).unwrap();
|
||||
}
|
||||
}
|
||||
assert_eq!(s.doc().unwrap().selection.objects, vec![other], "the Cmd-click selected the other object");
|
||||
assert_eq!((s.paint.fill.clone(), s.tool_returns_to()), (fill, None), "the pick ended without a sample");
|
||||
}
|
||||
|
||||
/// A gradient stop selected on the selection's gradient is not selected once the Live Paint
|
||||
/// Bucket is active (its proxies show the default paint), and one selected on the bucket's
|
||||
/// gradient is not selected once another tool is chosen.
|
||||
@@ -9491,9 +9550,12 @@ fn image_trace_split_view_keeps_and_validates_its_divider() {
|
||||
assert_eq!((back.node(g).unwrap().trace_view(), back.node(g).unwrap().trace_split()), (vectorcraft_doc::TraceView::Split, 0.25));
|
||||
// Bad dividers are refused and change nothing.
|
||||
let steps = s.doc().unwrap().history.undo.len();
|
||||
for bad in [json!(-0.1), json!(1.01), json!("0.5"), json!(true), json!([0.5])] {
|
||||
for bad in [json!(-0.1), json!(1.01), json!("0.5"), json!(true), json!([0.5]), json!(null)] {
|
||||
assert!(s.execute("imageTrace.setView", &json!({"view": "split", "split": bad})).is_err(), "{bad}");
|
||||
}
|
||||
// A null divider with another view is refused too, and the view stays.
|
||||
assert!(s.execute("imageTrace.setView", &json!({"view": "outlines", "split": null})).is_err());
|
||||
assert_eq!(node(&s, g).trace_view(), vectorcraft_doc::TraceView::Split);
|
||||
assert_eq!((s.doc().unwrap().history.undo.len(), node(&s, g).trace_split()), (steps, 0.25));
|
||||
for edge in [0.0, 1.0] {
|
||||
s.execute("imageTrace.setView", &json!({"view": "split", "split": edge})).unwrap();
|
||||
|
||||
@@ -1002,6 +1002,27 @@ fn dcs_transparency_counts_a_transparent_dcs_image_over_another() {
|
||||
assert!(marked(b), "the opaque image it overlaps");
|
||||
}
|
||||
|
||||
/// Replace measures a DCS file's clipping group by its bounds, not by its plates' image, so a
|
||||
/// distorted plate image does not stop an image replacing the group.
|
||||
#[test]
|
||||
fn replace_is_not_refused_for_a_dcs_group_whose_image_is_distorted() {
|
||||
let dir = temp_dir("replace-distorted");
|
||||
let path = write(&dir, "pic.eps", &two_plates());
|
||||
let mut s = session();
|
||||
let r = s.execute("file.place", &json!({ "path": path, "at": [100, 100] })).unwrap();
|
||||
let group = r["ids"][0].clone();
|
||||
let image = image_of(&s, &group).id;
|
||||
let b = s.doc().unwrap().doc.node(image).unwrap().geometric_bounds().unwrap();
|
||||
let (x0, y0, x1, y1) = (b.x0, b.y0, b.x1, b.y1);
|
||||
let corners = json!([[x0 + 4.0, y0], [x1 - 4.0, y0], [x1, y1], [x0, y1]]);
|
||||
s.execute("object.distort", &json!({ "ids": [image.0], "corners": corners })).unwrap();
|
||||
assert!(s.doc().unwrap().doc.node(image).unwrap().is_distorted_image());
|
||||
s.execute("select.set", &json!({ "ids": [group] })).unwrap();
|
||||
let png = crate::tests_links::png(2, 2, [0, 0, 255]);
|
||||
let out = s.execute("file.place", &json!({"replace": true, "name": "b.png", "dataBase64": vectorcraft_format::base64_encode(&png)}));
|
||||
assert!(out.is_ok(), "{out:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dcs_transparency_counts_characters_with_a_transparent_gradient() {
|
||||
use vectorcraft_color::{Gradient, GradientKind, GradientPaint, GradientStop};
|
||||
|
||||
@@ -588,6 +588,81 @@ fn a_symbols_link_without_a_relative_path_follows_the_moved_file() {
|
||||
assert_eq!(paths, [moved.clone(), moved], "the layers' link, then the symbol's");
|
||||
}
|
||||
|
||||
/// Update Links gives a distorted image its file's new pixels between the same corners: its
|
||||
/// Placement Options' fill and clip do not move or clip it. Its transform takes the new pixel size,
|
||||
/// and Link Info measures its scale at its middle.
|
||||
#[test]
|
||||
fn update_links_keeps_a_distorted_images_corners() {
|
||||
let dir = Folder::new("distorted-update");
|
||||
let photo = dir.file("photo.png");
|
||||
write(&photo, &png(20, 10, RED));
|
||||
let mut s = session();
|
||||
let id = place(&mut s, &photo);
|
||||
s.execute("links.placementOptions", &json!({"ids": [id.0], "preserve": "fill", "clip": true})).unwrap();
|
||||
s.execute("select.set", &json!({"ids": [id.0]})).unwrap();
|
||||
s.execute("object.distort", &json!({"corners": [[240, 300], [260, 300], [300, 400], [200, 400]]})).unwrap();
|
||||
let corners = |s: &Session| s.doc().unwrap().doc.node(id).unwrap().image_corners().unwrap();
|
||||
let before = corners(&s);
|
||||
assert!(s.doc().unwrap().doc.node(id).unwrap().is_distorted_image());
|
||||
// The far corner of the pixels as the transform alone places them.
|
||||
let far = |s: &Session| {
|
||||
let NodeKind::Image(im) = &s.doc().unwrap().doc.node(id).unwrap().kind else { panic!("an image") };
|
||||
im.xf * vectorcraft_geom::Point::new(f64::from(im.width), f64::from(im.height))
|
||||
};
|
||||
let far_before = far(&s);
|
||||
// Link Info measures the scale where the effective resolution is measured: at the middle.
|
||||
let scale_matches_ppi = |s: &mut Session| {
|
||||
let info = s.execute("links.info", &json!({"id": id.0})).unwrap();
|
||||
for i in 0..2 {
|
||||
let (scale, ppi, eff) = (info["scale"][i].as_f64().unwrap(), info["ppi"][i].as_f64().unwrap(), info["effectivePpi"][i].as_f64().unwrap());
|
||||
assert!((scale - ppi / eff * 100.0).abs() < 1e-6, "{info}");
|
||||
}
|
||||
};
|
||||
scale_matches_ppi(&mut s);
|
||||
// A copy in a symbol, distorted the same way, shows the same file.
|
||||
let copy = place(&mut s, &photo);
|
||||
s.execute("links.placementOptions", &json!({"ids": [copy.0], "preserve": "fill", "clip": true})).unwrap();
|
||||
s.execute("select.set", &json!({"ids": [copy.0]})).unwrap();
|
||||
s.execute("object.distort", &json!({"corners": [[240, 300], [260, 300], [300, 400], [200, 400]]})).unwrap();
|
||||
s.execute("symbol.new", &json!({"name": "Mark", "ids": [copy.0]})).unwrap();
|
||||
let in_symbol = |s: &Session| {
|
||||
let mut out = vec![];
|
||||
s.doc().unwrap().doc.symbols[0].art.walk(&mut |n| {
|
||||
if let NodeKind::Image(im) = &n.kind {
|
||||
out.push((n.is_distorted_image(), (im.width, im.height)));
|
||||
}
|
||||
});
|
||||
out
|
||||
};
|
||||
let symbol_corners = |s: &Session| {
|
||||
let mut out = vec![];
|
||||
s.doc().unwrap().doc.symbols[0].art.walk(&mut |n| out.extend(n.image_corners()));
|
||||
out
|
||||
};
|
||||
assert_eq!(in_symbol(&s), [(true, (20, 10))]);
|
||||
let symbol_before = symbol_corners(&s);
|
||||
assert_eq!(symbol_before.len(), 1);
|
||||
write(&photo, &png(60, 20, BLUE));
|
||||
let u = s.execute("links.update", &json!({})).unwrap();
|
||||
assert_eq!(u["updated"].as_array().unwrap().len(), 2, "{u}");
|
||||
let d = &s.doc().unwrap().doc;
|
||||
let n = d.node(id).unwrap();
|
||||
assert!(n.is_distorted_image());
|
||||
assert_eq!(corners(&s), before);
|
||||
let NodeKind::Image(im) = &n.kind else { panic!("an image") };
|
||||
assert_eq!((im.width, im.height), (60, 20));
|
||||
// The transform takes the new pixel size, so a placement by the transform keeps the old size.
|
||||
assert!(far(&s).distance(far_before) < 1e-9, "{:?} vs {far_before:?}", far(&s));
|
||||
let d = &s.doc().unwrap().doc;
|
||||
assert!(!matches!(d.parent_of(id).and_then(|p| d.node(p)).map(|p| &p.kind), Some(NodeKind::Group { clip: true, .. })), "not clipped");
|
||||
let mut clipped = false;
|
||||
d.symbols[0].art.walk(&mut |n| clipped |= matches!(n.kind, NodeKind::Group { clip: true, .. }));
|
||||
assert!(!clipped, "the symbol's image is not clipped");
|
||||
assert_eq!(in_symbol(&s), [(true, (60, 20))]);
|
||||
assert_eq!(symbol_corners(&s), symbol_before, "the symbol's image keeps its corners");
|
||||
scale_matches_ppi(&mut s);
|
||||
}
|
||||
|
||||
/// Update Links reads a changed file again for the images inside symbols, patterns and opacity
|
||||
/// masks too: those showing the same content as an image in the layers, and those no object in the
|
||||
/// layers shows. Each takes the file's place as its own Placement Options say, in one undo step,
|
||||
|
||||
@@ -1907,6 +1907,166 @@ fn pathfinder_journal_entries_replay_with_the_options_they_used() {
|
||||
assert!(s.execute("object.pathfinder.divide", &json!({"precision": 20})).is_err());
|
||||
}
|
||||
|
||||
/// The leaf objects of `n`, in paint order.
|
||||
fn leaves_of(n: &vectorcraft_doc::Node, out: &mut Vec<vectorcraft_doc::Node>) {
|
||||
match n.children() {
|
||||
Some(children) => children.iter().for_each(|c| leaves_of(c, out)),
|
||||
None => out.push(n.clone()),
|
||||
}
|
||||
}
|
||||
|
||||
/// Apply the live Pathfinder effect `effect` with `params` to the selection, then expand its
|
||||
/// appearance: the objects it draws.
|
||||
fn live_pieces(s: &mut Session, effect: &str, params: Value) -> Vec<vectorcraft_doc::Node> {
|
||||
let g = ids(&s.execute("effect.apply", &json!({"effect": effect, "params": params})).unwrap())[0];
|
||||
s.execute("effect.expandAppearance", &json!({"ids": [g.0]})).unwrap();
|
||||
let mut out = vec![];
|
||||
leaves_of(&node(s, g), &mut out);
|
||||
out
|
||||
}
|
||||
|
||||
/// The parameters of the first effect of the selected object.
|
||||
fn first_effect_params(s: &Session) -> Value {
|
||||
let st = s.doc().unwrap();
|
||||
st.doc.node(st.selection.objects[0]).unwrap().appearance.effects[0].params.clone()
|
||||
}
|
||||
|
||||
/// A Pathfinder effect keeps the Pathfinder Options in force when it is applied, those its params
|
||||
/// give aside, and its journal entry carries them.
|
||||
#[test]
|
||||
fn a_pathfinder_effect_keeps_the_options_in_force_when_applied() {
|
||||
let mut s = session();
|
||||
let (a, b) = (rect(&mut s, 0.0, 0.0, 100.0, 100.0), rect(&mut s, 50.0, 50.0, 100.0, 100.0));
|
||||
s.execute("object.pathfinder.options", &json!({"precision": 1, "removeRedundantPoints": true, "removeUnpainted": true})).unwrap();
|
||||
s.execute("select.set", &json!({"ids": [a.0, b.0]})).unwrap();
|
||||
s.execute("effect.apply", &json!({"effect": "pathfinder.divide"})).unwrap();
|
||||
let all = json!({"precision": 1.0, "removeRedundantPoints": true, "removeUnpainted": true});
|
||||
assert_eq!(first_effect_params(&s), all);
|
||||
assert_eq!(s.journal.last().unwrap().1["params"], all, "the journal entry gives the options it used");
|
||||
s.execute("effect.apply", &json!({"effect": "pathfinder.softMix", "params": {"precision": 0.5}})).unwrap();
|
||||
let st = s.doc().unwrap();
|
||||
let mix = &st.doc.node(st.selection.objects[0]).unwrap().appearance.effects[1].params;
|
||||
assert_eq!(mix, &json!({"mixingRate": 50.0, "precision": 0.5, "removeRedundantPoints": true, "removeUnpainted": true}));
|
||||
}
|
||||
|
||||
/// A live Pathfinder effect evaluates with its own options as the panel's operations do with
|
||||
/// Pathfinder Options: a precision of 1 pt drops a 0.5 pt overlap, Divide leaves out an unfilled
|
||||
/// object's pieces, and Remove Redundant Points drops an anchor that shapes nothing.
|
||||
#[test]
|
||||
fn a_pathfinder_effect_evaluates_with_its_own_options() {
|
||||
for (precision, faces) in [(0.01, 3), (1.0, 2)] {
|
||||
let mut s = session();
|
||||
let a = rect(&mut s, 0.0, 0.0, 100.0, 100.0);
|
||||
let b = rect(&mut s, 0.0, 99.5, 100.0, 100.0);
|
||||
s.execute("select.set", &json!({"ids": [a.0, b.0]})).unwrap();
|
||||
assert_eq!(live_pieces(&mut s, "pathfinder.divide", json!({"precision": precision})).len(), faces, "precision {precision}");
|
||||
}
|
||||
for on in [false, true] {
|
||||
let mut s = session();
|
||||
filled_and_unfilled(&mut s);
|
||||
let divided = live_pieces(&mut s, "pathfinder.divide", json!({"removeUnpainted": on}));
|
||||
let unfilled = divided.iter().filter(|n| n.appearance.fill_paint().is_none()).count();
|
||||
assert_eq!((unfilled, divided.len() - unfilled), (if on { 0 } else { 2 }, 1), "removeUnpainted {on}");
|
||||
}
|
||||
for on in [false, true] {
|
||||
let mut s = session();
|
||||
let pts = [(0.0, 0.0), (50.0, 0.0), (100.0, 0.0), (100.0, 100.0), (0.0, 100.0)];
|
||||
let anchors: Vec<Value> = pts.iter().map(|(x, y)| json!({"x": x, "y": y})).collect();
|
||||
let a = NodeId(s.execute("path.create", &json!({"anchors": anchors, "closed": true})).unwrap()["id"].as_u64().unwrap());
|
||||
let b = rect(&mut s, 20.0, 20.0, 60.0, 60.0);
|
||||
s.execute("select.set", &json!({"ids": [a.0, b.0]})).unwrap();
|
||||
let united = live_pieces(&mut s, "pathfinder.add", json!({"removeRedundantPoints": on}));
|
||||
let count = united[0].path_data().unwrap().anchor_count();
|
||||
assert!(if on { count == 4 } else { count > 4 }, "removeRedundantPoints {on}: {count} anchors");
|
||||
}
|
||||
}
|
||||
|
||||
/// An effect saved before Pathfinder effects kept their own options draws as one given their
|
||||
/// defaults, so older documents look as they did.
|
||||
#[test]
|
||||
fn a_pathfinder_effect_saved_without_options_draws_as_before() {
|
||||
let draw = |params: Value| {
|
||||
let mut s = session();
|
||||
filled_and_unfilled(&mut s);
|
||||
let g = ids(&s.execute("effect.apply", &json!({"effect": "pathfinder.divide"})).unwrap())[0];
|
||||
s.edit("t", |d, _| {
|
||||
d.node_mut(g).unwrap().appearance.effects[0].params = params;
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
s.execute("effect.expandAppearance", &json!({"ids": [g.0]})).unwrap();
|
||||
serde_json::to_value(node(&s, g)).unwrap()
|
||||
};
|
||||
assert_eq!(draw(json!({})), draw(json!({"precision": 0.01, "removeRedundantPoints": false, "removeUnpainted": false})));
|
||||
}
|
||||
|
||||
/// `effect.setParams` edits a Pathfinder effect's options as one undo step, records none for the
|
||||
/// values it already evaluates with, and refuses values out of range or of the wrong type.
|
||||
#[test]
|
||||
fn pathfinder_effect_options_edit_as_one_step_and_refuse_bad_values() {
|
||||
let mut s = session();
|
||||
let (a, b) = (rect(&mut s, 0.0, 0.0, 100.0, 100.0), rect(&mut s, 50.0, 50.0, 100.0, 100.0));
|
||||
s.execute("select.set", &json!({"ids": [a.0, b.0]})).unwrap();
|
||||
s.execute("effect.apply", &json!({"effect": "pathfinder.add"})).unwrap();
|
||||
let steps = |s: &Session| s.doc().unwrap().history.undo.len();
|
||||
let doc = |s: &Session| serde_json::to_value(&*s.doc().unwrap().doc).unwrap();
|
||||
let before = steps(&s);
|
||||
let same = s.execute("effect.setParams", &json!({"index": 0, "params": {"precision": 0.01, "removeUnpainted": false}})).unwrap();
|
||||
assert_eq!((same, steps(&s)), (json!({"ids": []}), before), "the values it has: no step");
|
||||
// An effect saved without options evaluates with the defaults: given them, it is unchanged.
|
||||
let g = s.doc().unwrap().selection.objects[0];
|
||||
s.edit("t", |d, _| {
|
||||
d.node_mut(g).unwrap().appearance.effects[0].params = json!({});
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
let before = steps(&s);
|
||||
let defaults = json!({"index": 0, "params": {"precision": 0.01, "removeRedundantPoints": false, "removeUnpainted": false}});
|
||||
assert_eq!(s.execute("effect.setParams", &defaults).unwrap(), json!({"ids": []}));
|
||||
assert_eq!(steps(&s), before);
|
||||
s.execute("effect.setParams", &json!({"index": 0, "params": {"precision": 2, "removeRedundantPoints": true}})).unwrap();
|
||||
assert_eq!(steps(&s), before + 1, "one step");
|
||||
assert_eq!(first_effect_params(&s), json!({"precision": 2, "removeRedundantPoints": true}));
|
||||
let kept = doc(&s);
|
||||
for bad in [
|
||||
json!({"precision": 0}),
|
||||
json!({"precision": 11}),
|
||||
json!({"precision": "1 pt"}),
|
||||
json!({"precision": null}),
|
||||
json!({"removeRedundantPoints": "yes"}),
|
||||
json!({"removeUnpainted": 1}),
|
||||
] {
|
||||
assert!(s.execute("effect.setParams", &json!({"index": 0, "params": bad})).is_err(), "setParams {bad}");
|
||||
assert!(s.execute("effect.apply", &json!({"effect": "pathfinder.trim", "params": bad})).is_err(), "apply {bad}");
|
||||
assert_eq!(doc(&s), kept, "{bad} changes nothing");
|
||||
}
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
assert_eq!(first_effect_params(&s), json!({}), "undo restores the options");
|
||||
}
|
||||
|
||||
/// A precision that Scale Strokes & Effects took past the range evaluates at its bound, and setting
|
||||
/// the bound is still an edit: a later scale then starts from the value set.
|
||||
#[test]
|
||||
fn a_precision_set_after_a_scale_past_its_range_is_kept() {
|
||||
let mut s = session();
|
||||
let (a, b) = (rect(&mut s, 0.0, 0.0, 100.0, 100.0), rect(&mut s, 50.0, 50.0, 100.0, 100.0));
|
||||
s.execute("select.set", &json!({"ids": [a.0, b.0]})).unwrap();
|
||||
s.execute("effect.apply", &json!({"effect": "pathfinder.add", "params": {"precision": 8}})).unwrap();
|
||||
let precision = |s: &Session| first_effect_params(s)["precision"].as_f64();
|
||||
s.execute("object.scale", &json!({"sx": 200, "strokes": true})).unwrap();
|
||||
assert_eq!(precision(&s), Some(16.0));
|
||||
let steps = s.doc().unwrap().history.undo.len();
|
||||
let out = s.execute("effect.setParams", &json!({"index": 0, "params": {"precision": 10}})).unwrap();
|
||||
assert_ne!(out, json!({"ids": []}), "an edit");
|
||||
assert_eq!((precision(&s), s.doc().unwrap().history.undo.len()), (Some(10.0), steps + 1));
|
||||
s.execute("object.scale", &json!({"sx": 50, "strokes": true})).unwrap();
|
||||
assert_eq!(precision(&s), Some(5.0));
|
||||
// The value it stores is still no edit.
|
||||
let steps = s.doc().unwrap().history.undo.len();
|
||||
assert_eq!(s.execute("effect.setParams", &json!({"index": 0, "params": {"precision": 5}})).unwrap(), json!({"ids": []}));
|
||||
assert_eq!(s.doc().unwrap().history.undo.len(), steps);
|
||||
}
|
||||
|
||||
/// A single group containing multiple overlapping paths is accepted by Crop.
|
||||
#[test]
|
||||
fn crop_operates_on_a_single_selected_group_of_paths() {
|
||||
|
||||
@@ -1422,6 +1422,26 @@ fn theme_picker_marquee_takes_the_area_and_picks_add_up() {
|
||||
assert_eq!(got, ["rgb 0 255 0", "rgb 255 255 0"]);
|
||||
}
|
||||
|
||||
/// A distorted image is read where its pixels are drawn, between its corners.
|
||||
#[test]
|
||||
fn theme_picker_reads_a_distorted_image_where_it_is_drawn() {
|
||||
let mut s = session();
|
||||
let (id, b) = halves_image(&mut s, 64, 32, [255, 0, 0, 255], [0, 0, 255, 255]);
|
||||
let (x, y0, y1) = (b.x1 + 20.0, b.y0, b.y1);
|
||||
run(&mut s, "select.set", json!({"ids": [id.0]}));
|
||||
run(&mut s, "object.distort", json!({"corners": [[x + 40.0, y0], [x + 60.0, y0], [x + 100.0, y1], [x, y1]]}));
|
||||
// The lower left of the trapezoid, outside the rectangle the image was placed in: red.
|
||||
assert_eq!(pick_theme(&mut s, json!({"picks": [{"rect": [x + 2.0, y1 - 4.0, x + 20.0, y1 - 1.0]}]})), ["rgb 255 0 0"]);
|
||||
// Where the image was: nothing.
|
||||
assert!(pick_theme(&mut s, json!({"picks": [{"rect": [b.x0 + 1.0, b.y0 + 1.0, b.x1 - 1.0, b.y1 - 1.0]}]})).is_empty());
|
||||
// A marquee reaching past the horizon its sides meet at (a quarter of its height above its
|
||||
// top) still reads every pixel it covers.
|
||||
let h = y1 - y0;
|
||||
let mut both = pick_theme(&mut s, json!({"picks": [{"rect": [x - 10.0, y0 - h, x + 110.0, y1 + 1.0]}]}));
|
||||
both.sort();
|
||||
assert_eq!(both, ["rgb 0 0 255", "rgb 255 0 0"]);
|
||||
}
|
||||
|
||||
/// Pixels less than half opaque are left out, and so is an image whose pixels can't be read.
|
||||
#[test]
|
||||
fn theme_picker_leaves_out_clear_pixels_and_unreadable_images() {
|
||||
|
||||
@@ -754,6 +754,406 @@ fn distort_perspective_midpoint_is_projective() {
|
||||
assert!((c.y - 100.0 / 6.0).abs() < 1e-3, "{c:?}");
|
||||
}
|
||||
|
||||
/// A 2 × 2 px image placed at (0, 0)–(100, 100), selected.
|
||||
fn placed_image(s: &mut Session) -> NodeId {
|
||||
s.edit("Place", |d, sel| {
|
||||
d.images.insert("pic".into(), vectorcraft_doc::ImageBlob::png(vec![]));
|
||||
let id = d.alloc_id();
|
||||
let im = vectorcraft_doc::ImageObject {
|
||||
key: "pic".into(),
|
||||
width: 2,
|
||||
height: 2,
|
||||
xf: vectorcraft_geom::Affine::scale(50.0),
|
||||
link: None,
|
||||
placement: Default::default(),
|
||||
pixels: None,
|
||||
};
|
||||
d.insert(d.default_layer(), 0, Node::new(id, vectorcraft_doc::NodeKind::Image(Box::new(im))))?;
|
||||
sel.set([id]);
|
||||
Ok(id)
|
||||
})
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn corners(s: &Session, id: NodeId) -> [Point; 4] {
|
||||
s.doc().unwrap().doc.node(id).unwrap().image_corners().unwrap()
|
||||
}
|
||||
|
||||
fn assert_corners(got: [Point; 4], want: [(f64, f64); 4]) {
|
||||
for (g, (x, y)) in got.iter().zip(want) {
|
||||
assert!(g.distance(Point::new(x, y)) < 1e-9, "{got:?} against {want:?}");
|
||||
}
|
||||
}
|
||||
|
||||
/// Perspective Distort and Free Distort put an image's corners exactly on the handles, in one
|
||||
/// undo step; the image is bounded and clicked by its corners, and a move takes them along.
|
||||
#[test]
|
||||
fn distort_puts_an_images_corners_on_the_handles() {
|
||||
for want in [[(40.0, 0.0), (60.0, 0.0), (100.0, 100.0), (0.0, 100.0)], [(10.0, 5.0), (90.0, 0.0), (120.0, 110.0), (0.0, 100.0)]] {
|
||||
let mut s = session();
|
||||
let img = placed_image(&mut s);
|
||||
let undo = undo_len(&s);
|
||||
let corners_json: Vec<[f64; 2]> = want.iter().map(|(x, y)| [*x, *y]).collect();
|
||||
s.execute("object.distort", &json!({ "corners": corners_json })).unwrap();
|
||||
assert_eq!(undo_len(&s), undo + 1);
|
||||
assert_corners(corners(&s, img), want);
|
||||
assert!(s.doc().unwrap().doc.node(img).unwrap().is_distorted_image());
|
||||
let b = bounds(&s, img);
|
||||
let xs = want.map(|c| c.0);
|
||||
let ys = want.map(|c| c.1);
|
||||
let near = |a: f64, b: f64| (a - b).abs() < 1e-9;
|
||||
assert!(near(b.x0, xs.iter().copied().fold(f64::MAX, f64::min)) && near(b.x1, xs.iter().copied().fold(f64::MIN, f64::max)), "{b:?}");
|
||||
assert!(near(b.y0, ys.iter().copied().fold(f64::MAX, f64::min)) && near(b.y1, ys.iter().copied().fold(f64::MIN, f64::max)), "{b:?}");
|
||||
s.execute("object.move", &json!({"dx": 10, "dy": 20})).unwrap();
|
||||
assert_corners(corners(&s, img), want.map(|(x, y)| (x + 10.0, y + 20.0)));
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
assert_corners(corners(&s, img), [(0.0, 0.0), (100.0, 0.0), (100.0, 100.0), (0.0, 100.0)]);
|
||||
assert!(!s.doc().unwrap().doc.node(img).unwrap().is_distorted_image());
|
||||
}
|
||||
// Clicks: inside the trapezoid hits the image; inside its old square but outside the
|
||||
// trapezoid does not.
|
||||
let mut s = session();
|
||||
let img = placed_image(&mut s);
|
||||
s.execute("object.distort", &json!({ "corners": [[40, 0], [60, 0], [100, 100], [0, 100]] })).unwrap();
|
||||
let doc = &s.doc().unwrap().doc;
|
||||
let opt = vectorcraft_doc::hit::HitOptions::default();
|
||||
assert_eq!(vectorcraft_doc::hit::hit_test(doc, Point::new(50.0, 50.0), opt).map(|h| h.leaf), Some(img));
|
||||
assert_eq!(vectorcraft_doc::hit::hit_test(doc, Point::new(5.0, 10.0), opt).map(|h| h.leaf), None);
|
||||
}
|
||||
|
||||
/// Distorted together with a path, the image's corners and the path's anchors follow one warp.
|
||||
#[test]
|
||||
fn distort_moves_an_image_and_a_path_as_one() {
|
||||
let mut s = session();
|
||||
let img = placed_image(&mut s);
|
||||
let path = rect(&mut s, 100.0, 0.0, 100.0, 100.0);
|
||||
s.execute("select.set", &json!({"ids": [img.0, path.0]})).unwrap();
|
||||
s.execute("object.distort", &json!({"corners": [[0, 0], [200, 0], [200, 100], [50, 100]]})).unwrap();
|
||||
let d = &s.doc().unwrap().doc;
|
||||
let anchors: Vec<Point> = d.node(path).unwrap().path_data().unwrap().anchors().map(|(_, _, a)| a.p).collect();
|
||||
let q = corners(&s, img);
|
||||
// The image's right edge and the path's left edge were one line, and stay one where the warp
|
||||
// moves it.
|
||||
assert!(q[2].distance(Point::new(100.0, 100.0)) > 1.0, "{q:?}");
|
||||
for p in [q[1], q[2]] {
|
||||
assert!(anchors.iter().any(|a| a.distance(p) < 1e-9), "{p:?} not in {anchors:?}");
|
||||
}
|
||||
}
|
||||
|
||||
/// Corners that would fold an image over are refused: nothing changes and no undo step is kept.
|
||||
/// A distorted image keeps its distortion where commands that cannot keep it are asked to work.
|
||||
#[test]
|
||||
fn distort_refuses_a_folded_image_and_crop_and_trace_refuse_a_distorted_one() {
|
||||
let mut s = session();
|
||||
let img = placed_image(&mut s);
|
||||
let (before, undo) = (s.doc().unwrap().doc.clone(), undo_len(&s));
|
||||
let e = s.execute("object.distort", &json!({"corners": [[0, 0], [100, 0], [0, 100], [100, 100]]})).unwrap_err().to_string();
|
||||
assert!(e.contains("convex"), "{e}");
|
||||
assert_eq!(undo_len(&s), undo);
|
||||
assert_eq!(s.doc().unwrap().doc, before);
|
||||
// Three corners on one line give no perspective map at all.
|
||||
let e = s.execute("object.distort", &json!({"corners": [[0, 0], [200, 0], [100, 50], [0, 100]]})).unwrap_err().to_string();
|
||||
assert!(e.contains("convex"), "{e}");
|
||||
assert_eq!(s.doc().unwrap().doc, before);
|
||||
// A convex shape too small for a perspective map: the corners could not reach the handles.
|
||||
let e = s.execute("object.distort", &json!({"corners": [[0, 0], [1e-7, 0], [8e-8, 1e-7], [0, 1e-7]]})).unwrap_err().to_string();
|
||||
assert!(e.contains("too close together"), "{e}");
|
||||
// The same shape far from the origin: its distance from it does not hide the missed corner.
|
||||
let x = 1_000_000.0;
|
||||
let e = s.execute("object.distort", &json!({"corners": [[x, 0], [x + 1e-7, 0], [x + 8e-8, 1e-7], [x, 1e-7]]})).unwrap_err().to_string();
|
||||
assert!(e.contains("too close together"), "{e}");
|
||||
// A long, thin shape with one side all but gone.
|
||||
let e = s.execute("object.distort", &json!({"corners": [[0, 0], [1_000_000, 0], [1_000_000, 1e-19], [0, 1]]})).unwrap_err().to_string();
|
||||
assert!(e.contains("too close together"), "{e}");
|
||||
assert_eq!(s.doc().unwrap().doc, before);
|
||||
assert_eq!(undo_len(&s), undo);
|
||||
// A small shape near the edge of the canvas is still distorted.
|
||||
let o = vectorcraft_doc::MAX_COORD - 2.0;
|
||||
let far = [[o, o], [o + 1.0, o], [o + 0.2130712, o + 1.0], [o, o + 1.0]];
|
||||
s.execute("object.distort", &json!({ "from": [0, 0, 100, 100], "corners": far })).unwrap();
|
||||
assert!(s.doc().unwrap().doc.node(img).unwrap().is_distorted_image());
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
assert_eq!(undo_len(&s), undo);
|
||||
s.execute("object.distort", &json!({ "corners": [[40, 0], [60, 0], [100, 100], [0, 100]] })).unwrap();
|
||||
for (cmd, params) in [
|
||||
("object.cropImage", json!({})),
|
||||
("imageTrace.make", json!({})),
|
||||
("links.relink", json!({"path": "/nowhere/pic.png"})),
|
||||
// Refused before the folder is searched, so a file missing there does not hide it.
|
||||
("links.relink", json!({"folder": "/nowhere"})),
|
||||
("links.embed", json!({"ids": [img.0]})),
|
||||
("links.unembed", json!({})),
|
||||
// Refused before any file is written.
|
||||
("links.unembed", json!({"folder": "/nowhere"})),
|
||||
("object.createObjectMosaic", json!({})),
|
||||
("object.mesh.create", json!({})),
|
||||
(
|
||||
"file.place",
|
||||
json!({"replace": true, "name": "b.png", "dataBase64": vectorcraft_format::base64_encode(&crate::tests_links::png(2, 2, [0, 0, 255]))}),
|
||||
),
|
||||
] {
|
||||
let e = s.execute(cmd, ¶ms).unwrap_err().to_string();
|
||||
// Every command gives the one shared refusal, which the complete-message catalogs translate.
|
||||
assert!(e.contains("is an image changed by Perspective Distort or Free Distort, which this command does not work on"), "{cmd}: {e}");
|
||||
}
|
||||
assert!(s.doc().unwrap().doc.node(img).unwrap().is_distorted_image());
|
||||
assert_eq!(undo_len(&s), undo + 1);
|
||||
// Type replaces a distorted image by its bounds, which the corners give: not refused.
|
||||
let text = json!({"replace": true, "name": "note.txt", "dataBase64": vectorcraft_format::base64_encode(b"Hello")});
|
||||
let out = s.execute("file.place", &text).unwrap();
|
||||
let id = NodeId(out["ids"][0].as_u64().unwrap());
|
||||
assert!(matches!(s.doc().unwrap().doc.node(id).unwrap().kind, vectorcraft_doc::NodeKind::Text(_)));
|
||||
}
|
||||
|
||||
/// Create Gradient Mesh on a path and a distorted image converts the path and names the image it
|
||||
/// left as it is, with the shared refusal.
|
||||
#[test]
|
||||
fn mesh_create_reports_the_distorted_image_it_skips() {
|
||||
let mut s = session();
|
||||
let img = placed_image(&mut s);
|
||||
s.execute("object.distort", &json!({ "corners": [[40, 0], [60, 0], [100, 100], [0, 100]] })).unwrap();
|
||||
let path = rect(&mut s, 200.0, 0.0, 100.0, 100.0);
|
||||
s.execute("select.set", &json!({"ids": [img.0, path.0]})).unwrap();
|
||||
let out = s.execute("object.mesh.create", &json!({"rows": 1, "cols": 1})).unwrap();
|
||||
assert_eq!(out["ids"].as_array().map(Vec::len), Some(1), "{out}");
|
||||
let skipped = out["skipped"].as_array().expect("the skipped image");
|
||||
assert_eq!(skipped.len(), 1, "{out}");
|
||||
assert_eq!(skipped[0]["id"], json!(img.0));
|
||||
assert!(skipped[0]["reason"].as_str().unwrap().contains("Perspective Distort or Free Distort"), "{out}");
|
||||
assert!(s.doc().unwrap().doc.node(img).unwrap().is_distorted_image());
|
||||
// Without a distorted image, no `skipped`.
|
||||
let other = rect(&mut s, 400.0, 0.0, 100.0, 100.0);
|
||||
let out = s.execute("object.mesh.create", &json!({"ids": [other.0], "rows": 1, "cols": 1})).unwrap();
|
||||
assert!(out.get("skipped").is_none(), "{out}");
|
||||
}
|
||||
|
||||
/// A blend takes the warp's affine approximation whole, so an image inside it does not stop a
|
||||
/// distort whose corners an image could not follow.
|
||||
#[test]
|
||||
fn distort_of_a_blend_holding_an_image_is_not_refused() {
|
||||
let mut s = session();
|
||||
let img = placed_image(&mut s);
|
||||
let r = rect(&mut s, 200.0, 0.0, 100.0, 100.0);
|
||||
let out = s.execute("object.blend.make", &json!({"ids": [img.0, r.0]})).unwrap();
|
||||
let blend = NodeId(out["id"].as_u64().unwrap());
|
||||
let undo = undo_len(&s);
|
||||
s.execute("object.distort", &json!({"ids": [blend.0], "corners": [[0, 0], [300, 0], [100, 50], [0, 100]]})).unwrap();
|
||||
assert_eq!(undo_len(&s), undo + 1);
|
||||
assert!(!s.doc().unwrap().doc.node(img).unwrap().is_distorted_image());
|
||||
}
|
||||
|
||||
/// The Control bar's Mask clips a distorted image to the shape between its corners.
|
||||
#[test]
|
||||
fn mask_on_a_distorted_image_follows_its_corners() {
|
||||
let mut s = session();
|
||||
let img = placed_image(&mut s);
|
||||
let want = [(40.0, 0.0), (60.0, 0.0), (100.0, 100.0), (0.0, 100.0)];
|
||||
s.execute("object.distort", &json!({ "corners": [[40, 0], [60, 0], [100, 100], [0, 100]] })).unwrap();
|
||||
let out = s.execute("object.maskImage", &json!({})).unwrap();
|
||||
let path = NodeId(out["path"].as_u64().unwrap());
|
||||
let d = &s.doc().unwrap().doc;
|
||||
let anchors: Vec<Point> = d.node(path).unwrap().path_data().unwrap().anchors().map(|(_, _, a)| a.p).collect();
|
||||
assert_eq!(anchors.len(), 4, "{anchors:?}");
|
||||
for (x, y) in want {
|
||||
assert!(anchors.iter().any(|a| a.distance(Point::new(x, y)) < 1e-9), "{x},{y} not in {anchors:?}");
|
||||
}
|
||||
assert!(d.node(img).unwrap().is_distorted_image());
|
||||
}
|
||||
|
||||
/// A Transform effect moves a distorted image's corners with it: expanded, the image stands
|
||||
/// where the effect drew it.
|
||||
#[test]
|
||||
fn a_transform_effect_moves_a_distorted_images_corners() {
|
||||
let mut s = session();
|
||||
let img = placed_image(&mut s);
|
||||
s.execute("object.distort", &json!({ "corners": [[40, 0], [60, 0], [100, 100], [0, 100]] })).unwrap();
|
||||
s.execute("effect.apply", &json!({"ids": [img.0], "effect": "distort.transform", "params": {"moveH": 200}})).unwrap();
|
||||
s.execute("select.set", &json!({"ids": [img.0]})).unwrap();
|
||||
s.execute("effect.expandAppearance", &json!({})).unwrap();
|
||||
let mut found = vec![];
|
||||
for layer in &s.doc().unwrap().doc.layers {
|
||||
layer.walk(&mut |n| {
|
||||
if let Some(q) = n.image_corners() {
|
||||
found.push(q);
|
||||
}
|
||||
});
|
||||
}
|
||||
let want = [(240.0, 0.0), (260.0, 0.0), (300.0, 100.0), (200.0, 100.0)];
|
||||
assert!(found.iter().any(|q| q.iter().zip(want).all(|(p, (x, y))| p.distance(Point::new(x, y)) < 1e-6)), "{found:?}");
|
||||
}
|
||||
|
||||
/// A Transform effect after a Warp effect moves a distorted image's warped pixels once: the art
|
||||
/// stands where the Warp alone draws it, moved by the Transform.
|
||||
#[test]
|
||||
fn a_transform_after_a_warp_moves_a_distorted_image_once() {
|
||||
let expanded_bounds = |transform: bool| {
|
||||
let mut s = session();
|
||||
let img = placed_image(&mut s);
|
||||
s.execute("object.distort", &json!({ "corners": [[40, 0], [60, 0], [100, 100], [0, 100]] })).unwrap();
|
||||
s.execute("effect.apply", &json!({"ids": [img.0], "effect": "warp.bulge", "params": {"bend": 50}})).unwrap();
|
||||
if transform {
|
||||
s.execute("effect.apply", &json!({"ids": [img.0], "effect": "distort.transform", "params": {"moveH": 200}})).unwrap();
|
||||
}
|
||||
s.execute("select.set", &json!({"ids": [img.0]})).unwrap();
|
||||
s.execute("effect.expandAppearance", &json!({})).unwrap();
|
||||
let mut images = None;
|
||||
for layer in &s.doc().unwrap().doc.layers {
|
||||
layer.walk(&mut |n| {
|
||||
if let vectorcraft_doc::NodeKind::Image(im) = &n.kind {
|
||||
let r = im.xf.transform_rect_bbox(vectorcraft_geom::Rect::new(0.0, 0.0, f64::from(im.width), f64::from(im.height)));
|
||||
images = Some(images.map_or(r, |b: vectorcraft_geom::Rect| b.union(r)));
|
||||
}
|
||||
});
|
||||
}
|
||||
images.expect("the warped pieces")
|
||||
};
|
||||
let (alone, moved) = (expanded_bounds(false), expanded_bounds(true));
|
||||
assert!((moved.x0 - alone.x0 - 200.0).abs() < 1e-6 && (moved.x1 - alone.x1 - 200.0).abs() < 1e-6, "{alone:?} {moved:?}");
|
||||
assert!((moved.y0 - alone.y0).abs() < 1e-6 && (moved.y1 - alone.y1).abs() < 1e-6, "{alone:?} {moved:?}");
|
||||
}
|
||||
|
||||
/// A raster effect's baked pixels already show the distortion: the image that replaces a
|
||||
/// distorted one is placed by its own transform.
|
||||
#[test]
|
||||
fn baked_raster_effect_pixels_replace_a_distortion() {
|
||||
let mut s = session();
|
||||
let img = placed_image(&mut s);
|
||||
s.execute("object.distort", &json!({ "corners": [[40, 0], [60, 0], [100, 100], [0, 100]] })).unwrap();
|
||||
let v = s.doc().unwrap().doc.node(img).unwrap().clone();
|
||||
let baked = Node::new(NodeId(99), v.kind.clone());
|
||||
let out = crate::cmd::rasterfx::replace_with_image(v, baked);
|
||||
assert!(!out.is_distorted_image());
|
||||
assert!(out.extras().image_quad.is_none());
|
||||
}
|
||||
|
||||
/// A distorted image is saved with its corners and reads back the same.
|
||||
#[test]
|
||||
fn a_distorted_image_saves_and_reads_back() {
|
||||
let mut s = session();
|
||||
let img = placed_image(&mut s);
|
||||
s.execute("object.distort", &json!({ "corners": [[40, 0], [60, 0], [100, 100], [0, 100]] })).unwrap();
|
||||
let doc = &s.doc().unwrap().doc;
|
||||
let bytes = vectorcraft_format::save(doc, false);
|
||||
let back = vectorcraft_format::load(&bytes).unwrap();
|
||||
assert_eq!(back.node(img).unwrap().image_corners(), doc.node(img).unwrap().image_corners());
|
||||
assert!(back.node(img).unwrap().is_distorted_image());
|
||||
assert!(String::from_utf8_lossy(&bytes).contains("image_quad"));
|
||||
// An image without a distortion is saved without the field, and opens as it was.
|
||||
let mut plain = session();
|
||||
let img = placed_image(&mut plain);
|
||||
let doc = &plain.doc().unwrap().doc;
|
||||
let bytes = vectorcraft_format::save(doc, false);
|
||||
assert!(!String::from_utf8_lossy(&bytes).contains("image_quad"));
|
||||
let back = vectorcraft_format::load(&bytes).unwrap();
|
||||
assert_eq!(back.node(img), doc.node(img));
|
||||
// Corners in a file that fold the image over leave it placed by its transform.
|
||||
let mut bad = (**doc).clone();
|
||||
bad.node_mut(img).unwrap().extras_mut().image_quad =
|
||||
Some(Box::new([(0.0, 0.0), (100.0, 0.0), (0.0, 100.0), (100.0, 100.0)].map(|(x, y)| Point::new(x, y))));
|
||||
let back = vectorcraft_format::load(&vectorcraft_format::save(&bad, false)).unwrap();
|
||||
assert!(!back.node(img).unwrap().is_distorted_image());
|
||||
assert_corners(back.node(img).unwrap().image_corners().unwrap(), [(0.0, 0.0), (100.0, 0.0), (100.0, 100.0), (0.0, 100.0)]);
|
||||
}
|
||||
|
||||
/// A distort whose corners cross the warp's horizon at the image is refused with that reason, and
|
||||
/// a distort that leaves a distorted image where it is records nothing.
|
||||
#[test]
|
||||
fn distort_names_the_horizon_and_an_unchanged_distort_of_a_distorted_image_records_nothing() {
|
||||
let mut s = session();
|
||||
let img = placed_image(&mut s);
|
||||
let (before, undo) = (s.doc().unwrap().doc.clone(), undo_len(&s));
|
||||
// The box (0, 0)-(10, 10) widens toward its bottom so fast that the warp's horizon lies at
|
||||
// y = 15, inside the image.
|
||||
let e = s.execute("object.distort", &json!({"from": [0, 0, 10, 10], "corners": [[0, 0], [10, 0], [20, 10], [-10, 10]]})).unwrap_err().to_string();
|
||||
assert!(e.contains("horizon"), "{e}");
|
||||
assert_eq!(s.doc().unwrap().doc, before);
|
||||
assert_eq!(undo_len(&s), undo);
|
||||
s.execute("object.distort", &json!({ "corners": [[40, 0], [60, 0], [100, 100], [0, 100]] })).unwrap();
|
||||
let (before, undo) = (s.doc().unwrap().doc.clone(), undo_len(&s));
|
||||
let b = bounds(&s, img);
|
||||
let at = [[b.x0, b.y0], [b.x1, b.y0], [b.x1, b.y1], [b.x0, b.y1]];
|
||||
s.execute("object.distort", &json!({ "from": [b.x0, b.y0, b.x1, b.y1], "corners": at })).unwrap();
|
||||
assert_eq!(s.doc().unwrap().doc, before);
|
||||
assert_eq!(undo_len(&s), undo);
|
||||
}
|
||||
|
||||
/// Image info gives a distorted image's resolution at its middle, not the resolution it had
|
||||
/// before the distort.
|
||||
#[test]
|
||||
fn image_info_measures_a_distorted_image_at_its_middle() {
|
||||
let mut s = session();
|
||||
placed_image(&mut s);
|
||||
// 2 pixels across 100 pt: 1.44 ppi.
|
||||
let ppi = |s: &mut Session| {
|
||||
let out = s.execute("image.info", &json!({})).unwrap();
|
||||
[out["ppi"][0].as_f64().unwrap(), out["ppi"][1].as_f64().unwrap()]
|
||||
};
|
||||
assert!((ppi(&mut s)[0] - 1.44).abs() < 1e-9);
|
||||
// The top squeezed to half the width: the middle of the pixels spans less than 100 pt across,
|
||||
// so the resolution across there is higher.
|
||||
s.execute("object.distort", &json!({ "corners": [[25, 0], [75, 0], [100, 100], [0, 100]] })).unwrap();
|
||||
let [x, _] = ppi(&mut s);
|
||||
assert!(x > 1.44 * 1.1, "{x}");
|
||||
}
|
||||
|
||||
/// Rasterize draws a distorted image's pixels between its corners, and the image it makes is a
|
||||
/// plain one.
|
||||
#[test]
|
||||
fn rasterize_draws_a_distorted_image_between_its_corners() {
|
||||
let mut s = session();
|
||||
let img = placed_image(&mut s);
|
||||
let mut png = std::io::Cursor::new(vec![]);
|
||||
image::RgbaImage::from_pixel(2, 2, image::Rgba([255, 0, 0, 255])).write_to(&mut png, image::ImageFormat::Png).unwrap();
|
||||
s.edit("Pixels", |d, _| {
|
||||
d.images.insert("pic".into(), vectorcraft_doc::ImageBlob::png(png.into_inner()));
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
s.execute("object.distort", &json!({ "corners": [[40, 0], [60, 0], [100, 100], [0, 100]] })).unwrap();
|
||||
s.execute("select.set", &json!({ "ids": [img.0] })).unwrap();
|
||||
let out = s.execute("object.rasterize", &json!({ "ppi": 72, "background": "transparent", "addAround": 0 })).unwrap();
|
||||
let d = &s.doc().unwrap().doc;
|
||||
let id = NodeId(out["id"].as_u64().unwrap());
|
||||
let n = d.node(id).unwrap();
|
||||
assert!(!n.is_distorted_image());
|
||||
let vectorcraft_doc::NodeKind::Image(im) = &n.kind else { panic!("an image") };
|
||||
// The raster covers the corners' bounds.
|
||||
let b = n.geometric_bounds().unwrap();
|
||||
assert!([b.x0, b.y0, b.x1 - 100.0, b.y1 - 100.0].iter().all(|v| v.abs() <= 1.0), "{b:?}");
|
||||
let px = craft_image_codecs::decode(&d.images[&im.key].bytes).unwrap();
|
||||
let (w, h) = px.dimensions();
|
||||
let rgba = px.to_rgba8();
|
||||
let alpha = |x: f64, y: f64| {
|
||||
let p = im.xf.inverse() * Point::new(x, y);
|
||||
assert!(p.x >= 0.0 && p.y >= 0.0 && p.x < f64::from(w) && p.y < f64::from(h), "({x}, {y}) is outside the raster: {p:?}");
|
||||
let (i, j) = (p.x as u32, p.y as u32);
|
||||
rgba[((j * w + i) * 4 + 3) as usize]
|
||||
};
|
||||
assert_eq!(alpha(50.0, 90.0), 255, "inside the corners");
|
||||
assert_eq!(alpha(10.0, 10.0), 0, "inside the old rectangle, outside the corners");
|
||||
}
|
||||
|
||||
/// A Free Transform drag in Free Distort mode on an image puts the dragged corner where the drag
|
||||
/// ends, in one undo step, also when a position on the way would have folded the image.
|
||||
#[test]
|
||||
fn free_transform_distort_drag_on_an_image_is_one_undo_step() {
|
||||
let mut s = session();
|
||||
let img = placed_image(&mut s);
|
||||
let undo = undo_len(&s);
|
||||
let v = ViewInfo::default();
|
||||
s.select_tool("freeTransform", v).unwrap();
|
||||
s.set_tool_option("mode", &json!("distort"));
|
||||
s.pointer(&PointerEvent::new(PointerKind::Down, 100.0, 100.0), v).unwrap();
|
||||
// Past the top left corner: the image would fold over.
|
||||
s.pointer(&PointerEvent::new(PointerKind::Drag, -50.0, -50.0), v).unwrap();
|
||||
s.pointer(&PointerEvent::new(PointerKind::Drag, 130.0, 120.0), v).unwrap();
|
||||
s.pointer(&PointerEvent::new(PointerKind::Up, 130.0, 120.0), v).unwrap();
|
||||
assert_corners(corners(&s, img), [(0.0, 0.0), (100.0, 0.0), (130.0, 120.0), (0.0, 100.0)]);
|
||||
assert!(s.doc().unwrap().doc.node(img).unwrap().is_distorted_image());
|
||||
assert_eq!(undo_len(&s), undo + 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn free_transform_distort_mode_via_pointer() {
|
||||
let mut s = session();
|
||||
|
||||
@@ -1578,6 +1578,10 @@ impl Session {
|
||||
/// Apply tool actions. Errors from previews are reported but keep the interaction alive.
|
||||
pub fn apply_actions(&mut self, acts: Vec<Action>) -> Result<Vec<UiRequest>> {
|
||||
let outer = std::mem::replace(&mut self.in_tool_actions, true);
|
||||
let outer_bucket = self.back_to_bucket;
|
||||
// The Eyedropper's sample into a stop of the Live Paint Bucket's gradient, which switches back to the bucket.
|
||||
self.back_to_bucket |=
|
||||
self.tool.id() == "eyedropper" && acts.iter().any(|a| matches!(a, Action::SwitchTool(t) if t == crate::cmd::LIVE_PAINT_BUCKET));
|
||||
// A preview that settling applied (typing kept as its own step before a drag begins) shows
|
||||
// its warning in the status bar, as the tool's own commit shows its preview's.
|
||||
let r = if !outer && self.depth == 0 {
|
||||
@@ -1587,6 +1591,7 @@ impl Session {
|
||||
self.apply_tool_actions(acts)
|
||||
};
|
||||
self.in_tool_actions = outer;
|
||||
self.back_to_bucket = outer_bucket;
|
||||
if !outer && self.depth == 0 {
|
||||
self.trim_histories();
|
||||
}
|
||||
|
||||
@@ -2432,6 +2432,26 @@ fn an_unpainted_paths_transparency_after_a_compound_path_is_its_own() {
|
||||
assert_eq!((art[0].opacity, art[0].blend, art[1].opacity, art[1].blend), (1.0, BlendMode::Normal, 0.5, BlendMode::Multiply));
|
||||
}
|
||||
|
||||
/// A distorted image as deep as the writer goes, in the art of 8 nested opacity masks, is written
|
||||
/// as one image at the placement nearest its corners, with a warning, not left out.
|
||||
#[test]
|
||||
fn a_distorted_image_nested_as_deep_as_the_limit_is_written_as_its_nearest_placement() {
|
||||
let mut doc = Document::new(200.0, 100.0);
|
||||
let layer = doc.layers[0].id;
|
||||
let mut n = image_node(&mut doc, ImageBlob::png(rgb_png()), (3, 2), Affine::translate((10.0, 10.0)) * Affine::scale(10.0), None);
|
||||
n.set_image_corners([(14.0, 10.0), (36.0, 10.0), (40.0, 30.0), (10.0, 30.0)].map(|(x, y)| vectorcraft_geom::Point::new(x, y))).unwrap();
|
||||
for _ in 0..8 {
|
||||
let mut owner = square(&mut doc, Rect::new(10.0, 10.0, 40.0, 30.0), Color::gray(0.5));
|
||||
owner.extras_mut().mask = Some(Box::new(OpacityMask::new(n, true)));
|
||||
n = owner;
|
||||
}
|
||||
doc.insert(Some(layer), usize::MAX, n).unwrap();
|
||||
let out = export_ai_editing(&doc, &opts()).unwrap();
|
||||
assert!(out.warnings.iter().any(|w| w == writer::DEEP_DISTORTED), "{:?}", out.warnings);
|
||||
// The samples are binary: count the `XI` lines in the bytes.
|
||||
assert_eq!(out.program.windows(4).filter(|w| w == b"XI\r\n").count(), 1, "the one image");
|
||||
}
|
||||
|
||||
/// Opacity masks in mask art nested past the limit are left out, not written empty.
|
||||
#[test]
|
||||
fn opacity_masks_nested_too_deep_are_left_out() {
|
||||
|
||||
@@ -67,7 +67,9 @@ pub(super) const PATTERN_TILES: &str = "pattern fills with more tiles than a fil
|
||||
pub(super) const CLIPPING: &str = "clipping groups and clipping layers whose clipping object isn't a path, and the clipping groups inside them, are written as their art cut to that object in the editing data for other apps";
|
||||
pub(super) const CLIP_PAINT: &str = "the fills and strokes of clipping paths that a plain fill and line can't draw are written as paths of their own inside the clipping (fills under the clipped art, strokes over it) in the editing data for other apps";
|
||||
pub(super) const CLIP_PAINT_MASKS: &str = "the opacity masks of clipping paths whose fills and strokes are written as paths of their own stay on the clipping path, not on those paths, in the editing data for other apps";
|
||||
pub(super) const LIVE: &str = "repeats, placed documents and intertwines are written as their art in the editing data for other apps";
|
||||
pub(super) const LIVE: &str =
|
||||
"repeats, placed documents, intertwines and distorted images are written as their art in the editing data for other apps";
|
||||
pub(super) const DEEP_DISTORTED: &str = "images changed by Perspective Distort or Free Distort more than 8 deep in opacity masks, symbols, live objects and pattern tiles are written as the nearest parallelogram in the editing data for other apps";
|
||||
pub(super) const GRAPHS: &str = "graphs are written as their art, without their data or settings, in the editing data for other apps";
|
||||
pub(super) const STROKES: &str = "strokes a plain line can't draw (inside or outside the path, variable width, dots, dashes fitted to corners, gradients, patterns, arrowheads) are written as filled outlines, and brushed strokes as their brush's art, in the editing data for other apps";
|
||||
pub(super) const ITEM_TRANSPARENCY: &str =
|
||||
@@ -802,6 +804,7 @@ impl<'a> Writer<'a> {
|
||||
}
|
||||
NodeKind::Compound { rule, .. } => self.shape(n, &compound_path(n), *rule, xy),
|
||||
NodeKind::Text(_) => self.text(n, xy),
|
||||
NodeKind::Image(im) if n.is_distorted_image() => self.distorted_image(n, im, xy),
|
||||
NodeKind::Image(im) => {
|
||||
// An opacity mask that clips shows the image within what its art paints only (its
|
||||
// effects and its symbol instances' art included, as the renderer measures it).
|
||||
@@ -947,6 +950,18 @@ impl<'a> Writer<'a> {
|
||||
self.warn(GRAPHS);
|
||||
}
|
||||
|
||||
/// Distorted image `n` (`im`), of transparency `xy`: the mesh of its pieces while the art may
|
||||
/// nest further, else one image at the placement nearest its corners, with a warning.
|
||||
fn distorted_image(&mut self, n: &Node, im: &vectorcraft_doc::ImageObject, xy: Xy) {
|
||||
if self.nest < MAX_NEST {
|
||||
return self.drawn_art(n, xy, Some(LIVE), true);
|
||||
}
|
||||
let Some(near) = vectorcraft_doc::image_quad::nearest_affine(n) else { return };
|
||||
self.warn(DEEP_DISTORTED);
|
||||
self.windowed = None;
|
||||
self.image(&vectorcraft_doc::ImageObject { xf: near, ..self.doc.shown_image(n, im).into_owned() }, xy);
|
||||
}
|
||||
|
||||
/// Live object `n`, of transparency `xy`, as a group of its art, with `warning` when it is given.
|
||||
/// With `bounds`, `n`'s text wrap options go on the rectangle of its bounds, the group's first
|
||||
/// member ([`Self::wrap_on_bounds`]); without it, in the group's dictionary.
|
||||
|
||||
@@ -128,7 +128,9 @@ const CONIC_WEDGES: usize = 360;
|
||||
const STROKES: &str =
|
||||
"strokes a plain line can't draw (inside or outside the path, variable width, gradients, brushes, arrowheads) are written as filled outlines";
|
||||
const IMAGE_ALPHA: &str = "transparent image pixels are written over white";
|
||||
const LIVE: &str = "symbols, blends, envelopes, meshes, repeats, placed documents and intertwines are written as their art";
|
||||
const LIVE: &str = "symbols, blends, envelopes, meshes, repeats, placed documents, intertwines and distorted images are written as their art";
|
||||
const DEEP_DISTORTED: &str =
|
||||
"images changed by Perspective Distort or Free Distort more than 8 deep in symbols and live objects are written as the nearest parallelogram";
|
||||
const GRAPHS: &str = "graphs are written as their art, without their data or settings";
|
||||
/// The warning for an image left out because it can't be decoded: the note raster exports give
|
||||
/// (`vectorcraft-engine`'s `rasterfx::undecoded_warning`).
|
||||
|
||||
@@ -703,6 +703,25 @@ fn picture(doc: &mut Document, r: Rect) -> Node {
|
||||
)
|
||||
}
|
||||
|
||||
/// A distorted image as deep as the writer goes, the art of the innermost of 8 nested symbols, is
|
||||
/// written as one image at the placement nearest its corners, with a warning, not left out.
|
||||
#[test]
|
||||
fn a_distorted_image_nested_as_deep_as_the_limit_is_written_as_its_nearest_placement() {
|
||||
let mut doc = Document::new(200.0, 100.0);
|
||||
let mut art = picture(&mut doc, Rect::new(10.0, 10.0, 90.0, 90.0));
|
||||
art.set_image_corners([(40.0, 10.0), (60.0, 10.0), (90.0, 90.0), (10.0, 90.0)].map(|(x, y)| vectorcraft_geom::Point::new(x, y))).unwrap();
|
||||
for i in 0..8 {
|
||||
let name = format!("S{i}");
|
||||
doc.symbols.push(vectorcraft_doc::Symbol { dynamic: false, name: name.clone(), art: Arc::new(art) });
|
||||
art = Node::new(doc.alloc_id(), NodeKind::SymbolInstance { symbol: name, xf: Affine::IDENTITY });
|
||||
}
|
||||
doc.insert(doc.default_layer(), usize::MAX, art).unwrap();
|
||||
let out = write(&doc);
|
||||
assert!(out.warnings.iter().any(|w| w == DEEP_DISTORTED), "{:?}", out.warnings);
|
||||
let text = String::from_utf8(out.bytes).unwrap();
|
||||
assert_eq!(text.lines().filter(|l| l.ends_with(" XI")).count(), 1, "the one image");
|
||||
}
|
||||
|
||||
/// A layer `Below` holding a clipping group (a circle clipping an image, as in #2692), a group
|
||||
/// holding an image and an image; a layer `Above` holding an orange square. Without `images`,
|
||||
/// `Below` is empty.
|
||||
|
||||
@@ -9,7 +9,7 @@ use super::{
|
||||
ROTATED_TYPE, Rect, STROKES, SUBLAYERS, Shape, StrokeLayer, SubPath, TITLE_AND_COLOR_NAMES, TRANSPARENCY, TYPE, TYPE_ATTRIBUTES, TextKind,
|
||||
TextObject, UNDECODED, Vec2, Write, ai_ops, latin, ps, stroke,
|
||||
};
|
||||
use super::{CONIC, CONIC_WEDGES, DIAMOND, GRAPHS, HUE_STOPS, PERCEPTUAL_STOPS, SPREAD, SPREAD_CAPPED};
|
||||
use super::{CONIC, CONIC_WEDGES, DEEP_DISTORTED, DIAMOND, GRAPHS, HUE_STOPS, PERCEPTUAL_STOPS, SPREAD, SPREAD_CAPPED};
|
||||
|
||||
#[cfg(test)]
|
||||
thread_local! {
|
||||
@@ -322,14 +322,23 @@ impl<'a> Writer<'a> {
|
||||
self.lock(locked);
|
||||
self.text(t);
|
||||
}
|
||||
NodeKind::Image(im) => {
|
||||
// A distorted image too deep for its pieces is written at the placement nearest its
|
||||
// corners.
|
||||
NodeKind::Image(im) if !n.is_distorted_image() || self.nest >= MAX_NEST => {
|
||||
self.lock(locked);
|
||||
let shown = self.doc.shown_image(n, im);
|
||||
let blob = self.doc.image_blob(&shown);
|
||||
// A colorize color the renderer draws the image in.
|
||||
let colorize =
|
||||
n.extras().colorize.as_deref().filter(|p| matches!(p, Paint::Solid { .. }) && blob.is_some_and(ImageBlob::takes_colorize));
|
||||
self.image(blob, im.width, im.height, im.xf, colorize);
|
||||
let xf = match vectorcraft_doc::image_quad::nearest_affine(n) {
|
||||
Some(near) => {
|
||||
self.warn(DEEP_DISTORTED);
|
||||
near
|
||||
}
|
||||
None => im.xf,
|
||||
};
|
||||
self.image(blob, im.width, im.height, xf, colorize);
|
||||
}
|
||||
NodeKind::SymbolInstance { symbol, xf } => {
|
||||
self.warn(LIVE);
|
||||
@@ -348,7 +357,8 @@ impl<'a> Writer<'a> {
|
||||
| NodeKind::Mesh(_)
|
||||
| NodeKind::Repeat(_)
|
||||
| NodeKind::PlacedDocument(_)
|
||||
| NodeKind::Intertwine { .. } => {
|
||||
| NodeKind::Intertwine { .. }
|
||||
| NodeKind::Image(_) => {
|
||||
self.warn(LIVE);
|
||||
if self.nest < MAX_NEST {
|
||||
let g = vectorcraft_effects::expand_live_deep(Some(self.doc), n);
|
||||
|
||||
@@ -585,7 +585,7 @@ impl<'a> Scene<'a> {
|
||||
self.shape(n, &bp, *rule);
|
||||
}
|
||||
NodeKind::Text(t) => self.text(n, t),
|
||||
NodeKind::Image(im) => {
|
||||
NodeKind::Image(im) if !n.is_distorted_image() => {
|
||||
let shown = self.doc.shown_image(n, im);
|
||||
let im = &*shown;
|
||||
let blob = self.doc.image_blob(im);
|
||||
@@ -606,13 +606,15 @@ impl<'a> Scene<'a> {
|
||||
self.nest -= 1;
|
||||
}
|
||||
}
|
||||
// Live blends, envelopes, meshes and repeats are written as their evaluated art.
|
||||
// Live blends, envelopes, meshes and repeats (and distorted images) are written as
|
||||
// their evaluated art.
|
||||
NodeKind::Blend { .. }
|
||||
| NodeKind::Envelope { .. }
|
||||
| NodeKind::Mesh(_)
|
||||
| NodeKind::Repeat(_)
|
||||
| NodeKind::PlacedDocument(_)
|
||||
| NodeKind::Intertwine { .. } => {
|
||||
| NodeKind::Intertwine { .. }
|
||||
| NodeKind::Image(_) => {
|
||||
let g = vectorcraft_effects::expand_live_deep(Some(self.doc), n);
|
||||
for c in g.children().into_iter().flatten() {
|
||||
self.node(c, false);
|
||||
|
||||
@@ -1255,6 +1255,50 @@ fn an_envelopes_image_pieces_draw_one_copy_of_its_samples() {
|
||||
}
|
||||
}
|
||||
|
||||
/// An image changed by Perspective Distort is written as the pieces of its mesh, placed so that
|
||||
/// its pixel rectangle's corners land on its corners: read back, each corner of the quad is a
|
||||
/// corner of one of the pieces' images.
|
||||
#[test]
|
||||
fn a_distorted_image_is_written_with_its_corners_on_its_quad() {
|
||||
let mut d = png_doc();
|
||||
let id = d.layers[0].children().unwrap()[0].id;
|
||||
let q = [(40.0, 10.0), (60.0, 10.0), (90.0, 90.0), (10.0, 90.0)].map(|(x, y)| Point::new(x, y));
|
||||
d.node_mut(id).unwrap().set_image_corners(q).unwrap();
|
||||
for level in Level::ALL {
|
||||
let out = export(&d, &EpsOptions { level, ..opts(&d) }, None, None).unwrap();
|
||||
let back = import::import(&out.bytes).unwrap().document;
|
||||
let (mut seen, mut pieces) = ([false; 4], 0);
|
||||
back.walk(|n| {
|
||||
if let NodeKind::Image(im) = &n.kind {
|
||||
pieces += 1;
|
||||
let (w, h) = (f64::from(im.width), f64::from(im.height));
|
||||
for p in [(0.0, 0.0), (w, 0.0), (w, h), (0.0, h)] {
|
||||
let at = im.xf * Point::new(p.0, p.1);
|
||||
for (i, c) in q.iter().enumerate() {
|
||||
seen[i] |= at.distance(*c) < 0.01;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
assert!(pieces > 2, "{level:?}: {pieces}");
|
||||
assert_eq!(seen, [true; 4], "{level:?}");
|
||||
// The pieces are clipped by the quad: a clipping path with its bounds and its area.
|
||||
let mut quad_clips = 0;
|
||||
back.walk(|n| {
|
||||
if let NodeKind::Group { children, clip: true } = &n.kind
|
||||
&& let Some(p) = children.first().and_then(|c| c.path_data())
|
||||
&& let Some(b) = p.bounds()
|
||||
{
|
||||
let area: f64 = p.subpaths.iter().map(|s| s.area()).sum::<f64>().abs();
|
||||
if [b.x0 - 10.0, b.y0 - 10.0, b.x1 - 90.0, b.y1 - 90.0].iter().all(|v| v.abs() < 0.01) && (area - 4000.0).abs() < 1.0 {
|
||||
quad_clips += 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
assert!(quad_clips >= 1, "{level:?}: no clipping path on the quad");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn each_ink_of_a_colorized_image_placed_twice_is_written_once() {
|
||||
let first = Paint::Solid { color: Color::rgb8(255, 0, 0), swatch: Some("Ink".into()), tint: 1.0 };
|
||||
|
||||
@@ -31,6 +31,7 @@ const BLENDING: &str = "blending modes are left out";
|
||||
const MASKS: &str = "opacity masks are left out";
|
||||
const RASTER_FX: &str = "raster effects (shadows, glows, blurs, feathering) are left out";
|
||||
const CLIPPING: &str = "clipping masks are not applied: the art they clip is written whole";
|
||||
const DISTORTED_IMAGES: &str = "images changed by Perspective Distort or Free Distort are written as the nearest parallelogram";
|
||||
const FLAT_GRADIENTS: &str = "gradients are written as one colour, the average of their stops";
|
||||
const FLAT_PATTERNS: &str = "pattern fills are written as one colour";
|
||||
const TOO_MANY_TILES: &str = "pattern fills past 250,000 tiles in all are written as one colour";
|
||||
@@ -134,6 +135,9 @@ pub(crate) struct Scene<'a> {
|
||||
/// Pattern tiles being written that may be merged: their parts aren't left out off the page,
|
||||
/// so each tile draws the same parts (the fill's clip still trims them).
|
||||
whole_tiles: bool,
|
||||
/// While the pieces of a distorted image are written: the box of the clips around the current
|
||||
/// object (`Some(None)` before the first), to which each piece's image is cropped.
|
||||
crop: Option<Option<Rect>>,
|
||||
}
|
||||
|
||||
impl<'a> Scene<'a> {
|
||||
@@ -151,6 +155,7 @@ impl<'a> Scene<'a> {
|
||||
nest: 0,
|
||||
tiles_left: MAX_TILES,
|
||||
whole_tiles: false,
|
||||
crop: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,7 +218,24 @@ impl<'a> Scene<'a> {
|
||||
self.node(&o, true);
|
||||
}
|
||||
}
|
||||
NodeKind::Image(im) => self.image(&self.doc.shown_image(n, im)),
|
||||
NodeKind::Image(im) => match vectorcraft_doc::image_quad::nearest_affine(n) {
|
||||
// A format that clips writes a distorted image as the pieces of its mesh; one that
|
||||
// doesn't, at the affine placement nearest its corners.
|
||||
// Each piece stores only the pixels inside its clips.
|
||||
Some(_) if self.clips => {
|
||||
let g = vectorcraft_effects::expand_live_deep(Some(self.doc), n);
|
||||
let outer = self.crop.replace(None);
|
||||
for c in g.children().into_iter().flatten() {
|
||||
self.node(c, false);
|
||||
}
|
||||
self.crop = outer;
|
||||
}
|
||||
Some(xf) => {
|
||||
self.warn(DISTORTED_IMAGES);
|
||||
self.image(&ImageObject { xf, ..self.doc.shown_image(n, im).into_owned() });
|
||||
}
|
||||
None => self.image(&self.doc.shown_image(n, im)),
|
||||
},
|
||||
NodeKind::SymbolInstance { symbol, xf } => {
|
||||
if let Some(sym) = self.doc.symbols.iter().find(|s| &s.name == symbol)
|
||||
&& self.nest < MAX_NEST
|
||||
@@ -261,13 +283,19 @@ impl<'a> Scene<'a> {
|
||||
None
|
||||
};
|
||||
let clipped = outline.is_some();
|
||||
let outer_crop = self.crop;
|
||||
if let Some((path, rule)) = outline {
|
||||
if let Some(c) = self.crop {
|
||||
let b = path.bounding_box();
|
||||
self.crop = Some(Some(c.map_or(b, |c| c.intersect(b))));
|
||||
}
|
||||
self.ops.push(Op::Clip { path, rule });
|
||||
}
|
||||
if let Some(f) = &paint.fill {
|
||||
self.node(f, false);
|
||||
}
|
||||
rest.iter().for_each(|c| self.node(c, false));
|
||||
self.crop = outer_crop;
|
||||
if clipped {
|
||||
self.ops.push(Op::Unclip);
|
||||
}
|
||||
@@ -478,6 +506,13 @@ impl<'a> Scene<'a> {
|
||||
let Some(img) = self.decoded(im) else { return };
|
||||
let (dw, dh) = (f64::from(img.width), f64::from(img.height));
|
||||
let xf = im.xf * Affine::scale_non_uniform(f64::from(im.width.max(1)) / dw, f64::from(im.height.max(1)) / dh);
|
||||
let (img, xf) = match self.crop.flatten() {
|
||||
Some(c) => match cropped(&img, xf, c) {
|
||||
Some((part, x0, y0)) => (Arc::new(part), xf * Affine::translate((f64::from(x0), f64::from(y0)))),
|
||||
None => return,
|
||||
},
|
||||
None => (img, xf),
|
||||
};
|
||||
self.ops.push(Op::Image { image: img, xf, opacity: self.opacity.clamp(0.0, 1.0) });
|
||||
}
|
||||
|
||||
@@ -503,6 +538,37 @@ impl<'a> Scene<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
/// The pixels of `img`, drawn by `xf`, that `clip` (a box in the document) shows, with one pixel
|
||||
/// more on each side: the part and its top left pixel. The whole image when `xf` cannot be
|
||||
/// inverted; `None` when `clip` shows none of it.
|
||||
fn cropped(img: &Rgba, xf: Affine, clip: Rect) -> Option<(Rgba, u32, u32)> {
|
||||
if xf.determinant().abs() < 1e-12 || !xf.determinant().is_finite() {
|
||||
return Some((img.clone(), 0, 0));
|
||||
}
|
||||
let inv = xf.inverse();
|
||||
let corners =
|
||||
[Point::new(clip.x0, clip.y0), Point::new(clip.x1, clip.y0), Point::new(clip.x1, clip.y1), Point::new(clip.x0, clip.y1)].map(|p| inv * p);
|
||||
let (w, h) = (f64::from(img.width), f64::from(img.height));
|
||||
let lo = |f: fn(&Point) -> f64| corners.iter().map(f).fold(f64::INFINITY, f64::min);
|
||||
let hi = |f: fn(&Point) -> f64| corners.iter().map(f).fold(f64::NEG_INFINITY, f64::max);
|
||||
let (x0, y0) = ((lo(|p| p.x).floor() - 1.0).max(0.0), (lo(|p| p.y).floor() - 1.0).max(0.0));
|
||||
let (x1, y1) = ((hi(|p| p.x).ceil() + 1.0).min(w), (hi(|p| p.y).ceil() + 1.0).min(h));
|
||||
if !(x0 < x1 && y0 < y1) {
|
||||
return None;
|
||||
}
|
||||
let (x0, y0, x1, y1) = (x0 as u32, y0 as u32, x1 as u32, y1 as u32);
|
||||
if (x0, y0, x1, y1) == (0, 0, img.width, img.height) {
|
||||
return Some((img.clone(), 0, 0));
|
||||
}
|
||||
let row = img.width as usize * 4;
|
||||
let mut pixels = Vec::with_capacity((x1 - x0) as usize * (y1 - y0) as usize * 4);
|
||||
for y in y0..y1 {
|
||||
let start = y as usize * row + x0 as usize * 4;
|
||||
pixels.extend_from_slice(img.pixels.get(start..start + (x1 - x0) as usize * 4)?);
|
||||
}
|
||||
Some((Rgba { width: x1 - x0, height: y1 - y0, pixels }, x0, y0))
|
||||
}
|
||||
|
||||
/// Do the instances of `def` stay apart? A grid or brick tiling places its tiles side by side, so
|
||||
/// art that stays in its tile never overlaps another instance's; hex tilings overlap their tiles.
|
||||
fn tiles_apart(def: &vectorcraft_doc::PatternDef) -> bool {
|
||||
|
||||
@@ -288,6 +288,82 @@ fn emf_clips_gradients_and_images() {
|
||||
assert_eq!((count(&k, 35), count(&k, 36)), (3, 3));
|
||||
}
|
||||
|
||||
/// An image changed by Perspective Distort is written as the clipped pieces of its mesh where
|
||||
/// the format clips (EMF), and as one image at the placement nearest its corners, with a warning,
|
||||
/// where it does not (WMF).
|
||||
#[test]
|
||||
fn a_distorted_image_is_its_mesh_with_clips_and_its_nearest_parallelogram_without() {
|
||||
let mut d = doc_with(100.0, 100.0, vec![]);
|
||||
let img = image_node(&mut d, png(4, 4, [10, 20, 30, 255]), 4, 4, Affine::scale(10.0));
|
||||
add(&mut d, img);
|
||||
let id = d.layers[0].children().unwrap()[0].id;
|
||||
let q = [(16.0, 0.0), (24.0, 0.0), (40.0, 40.0), (0.0, 40.0)].map(|(x, y)| Point::new(x, y));
|
||||
d.node_mut(id).unwrap().set_image_corners(q).unwrap();
|
||||
let images = |ops: &[crate::scene::Op]| ops.iter().filter(|o| matches!(o, crate::scene::Op::Image { .. })).count();
|
||||
let warned = |w: &[String]| w.iter().any(|w| w.contains("Perspective Distort or Free Distort"));
|
||||
let (ops, warnings) = crate::scene::Scene::new(&d, d.artboards[0].rect, true).run();
|
||||
assert!(images(&ops) > 2 && !warned(&warnings), "{} images, {warnings:?}", images(&ops));
|
||||
let (ops, warnings) = crate::scene::Scene::new(&d, d.artboards[0].rect, false).run();
|
||||
assert!(images(&ops) == 1 && warned(&warnings), "{} images, {warnings:?}", images(&ops));
|
||||
// Without clips, the image is placed by the affine map nearest its corners.
|
||||
let near = vectorcraft_doc::image_quad::nearest_affine(d.node(id).unwrap()).unwrap();
|
||||
let placed = ops.iter().find_map(|o| match o {
|
||||
crate::scene::Op::Image { xf, .. } => Some(*xf),
|
||||
_ => None,
|
||||
});
|
||||
assert!(placed.unwrap().as_coeffs().iter().zip(near.as_coeffs()).all(|(a, b)| (a - b).abs() < 1e-9), "{placed:?} against {near:?}");
|
||||
}
|
||||
|
||||
/// Each piece of a distorted image's mesh in EMF stores the pixels inside its clips, not the
|
||||
/// whole image, placed where the uncropped piece puts them.
|
||||
#[test]
|
||||
fn the_pieces_of_a_distorted_image_store_only_the_pixels_they_show() {
|
||||
let mut pixels = vec![];
|
||||
for y in 0..64u8 {
|
||||
for x in 0..64u8 {
|
||||
pixels.extend_from_slice(&[x * 4, y * 4, 0, 255]);
|
||||
}
|
||||
}
|
||||
let img =
|
||||
craft_image_codecs::Image::from_raw(64, 64, craft_image_codecs::ChannelLayout::Rgba, craft_image_codecs::SampleType::U8, pixels).unwrap();
|
||||
let bytes = craft_image_codecs::encode(&img, craft_image_codecs::Format::Png, &craft_image_codecs::EncodeOptions::default()).unwrap();
|
||||
let mut d = doc_with(100.0, 100.0, vec![]);
|
||||
let n = image_node(&mut d, bytes, 64, 64, Affine::scale(1.5));
|
||||
add(&mut d, n);
|
||||
let id = d.layers[0].children().unwrap()[0].id;
|
||||
let q = [(30.0, 0.0), (66.0, 0.0), (96.0, 96.0), (0.0, 96.0)].map(|(x, y)| Point::new(x, y));
|
||||
d.node_mut(id).unwrap().set_image_corners(q).unwrap();
|
||||
let art = vectorcraft_doc::image_quad::distorted_art(d.node(id).unwrap()).unwrap();
|
||||
let whole: Vec<Affine> = vectorcraft_doc::image_quad::distorted_pieces(&art)
|
||||
.iter()
|
||||
.filter_map(|p| match &p.children()?.get(1)?.kind {
|
||||
NodeKind::Image(im) => Some(im.xf),
|
||||
_ => None,
|
||||
})
|
||||
.collect();
|
||||
let (ops, _) = crate::scene::Scene::new(&d, d.artboards[0].rect, true).run();
|
||||
let parts: Vec<(&crate::dib::Rgba, Affine)> = ops
|
||||
.iter()
|
||||
.filter_map(|o| match o {
|
||||
crate::scene::Op::Image { image, xf, .. } => Some((&**image, *xf)),
|
||||
_ => None,
|
||||
})
|
||||
.collect();
|
||||
assert_eq!(parts.len(), whole.len());
|
||||
assert!(parts.len() > 8, "{}", parts.len());
|
||||
let stored: u64 = parts.iter().map(|(i, _)| u64::from(i.width) * u64::from(i.height)).sum();
|
||||
assert!(stored * 4 < 64 * 64 * parts.len() as u64, "{stored} pixels in {} pieces", parts.len());
|
||||
for ((part, xf), full) in parts.iter().zip(&whole) {
|
||||
// The part's first pixel names where it starts in the image.
|
||||
let (x0, y0) = (f64::from(part.pixels[0] / 4), f64::from(part.pixels[1] / 4));
|
||||
let want = *full * Affine::translate((x0, y0));
|
||||
assert!(xf.as_coeffs().iter().zip(want.as_coeffs()).all(|(a, b)| (a - b).abs() < 1e-6), "{xf:?} against {want:?}");
|
||||
// Each row runs on from that pixel.
|
||||
let last = (part.width as usize - 1) * 4;
|
||||
assert_eq!(f64::from(part.pixels[last] / 4), x0 + f64::from(part.width - 1));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn type_is_written_as_outlines() {
|
||||
let t = TextObject::point(Point::new(10.0, 50.0), "Hi", CharStyle { fill: red(), ..CharStyle::default() });
|
||||
|
||||
@@ -28,7 +28,9 @@ pub use edit::{
|
||||
};
|
||||
pub use fit::{fit_cubics, fit_cubics_through};
|
||||
pub use offset::{Cap, Join, MAX_OFFSET_SEGMENT_PAIRS, offset_path, outline_stroke, stroke_region, try_offset_path};
|
||||
pub use pathfinder::{FaceMerger, PathfinderOp, Region, Shape, merge_regions, pathfinder, pathfinder_with, region_at, regions, regions_within};
|
||||
pub use pathfinder::{
|
||||
FaceMerger, PathfinderOp, Region, Shape, merge_regions, pathfinder, pathfinder_with, region_at, regions, regions_with, regions_within,
|
||||
};
|
||||
pub use planar::{
|
||||
Adjacency, BuilderArrangement, MapEdge, MapFace, MapOutline, SHAPE_BUILDER_MAX_GAP, SHAPE_BUILDER_MAX_SEGMENTS, adjacency, cut_out,
|
||||
encloses_area, find_gaps, has_open_path, interior_point, live_paint, live_paint_with_gaps, run_around, shape_builder, shape_builder_with_gap,
|
||||
|
||||
@@ -557,7 +557,7 @@ pub fn regions(shapes: &[Shape]) -> Vec<Region> {
|
||||
}
|
||||
|
||||
/// [`regions`] refit to `precision`.
|
||||
pub(crate) fn regions_with(shapes: &[Shape], precision: f64) -> Vec<Region> {
|
||||
pub fn regions_with(shapes: &[Shape], precision: f64) -> Vec<Region> {
|
||||
arrangement(shapes, precision).map(|a| regions_of(&a)).unwrap_or_default()
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,9 @@ pub(crate) struct Exporter<'a> {
|
||||
images: HashMap<String, Option<Image>>,
|
||||
/// `Some` while opacity mask art is written: whether an image in it was left out.
|
||||
image_left_out: Option<bool>,
|
||||
/// While the pieces of a distorted image whose opacity mask is its own pixel grid are written:
|
||||
/// its image key and the image written with the mask as its alpha, which each piece draws.
|
||||
piece_image: Option<(String, Image)>,
|
||||
/// While the pieces of a mesh-warped image are written: the size its pixels are resampled for
|
||||
/// ([`Exporter::warp_image_size`]).
|
||||
warp_size: Option<images::SharedSize>,
|
||||
|
||||
@@ -35,6 +35,7 @@ impl<'a> Exporter<'a> {
|
||||
warnings: vec![],
|
||||
images: HashMap::new(),
|
||||
image_left_out: None,
|
||||
piece_image: None,
|
||||
warp_size: None,
|
||||
brushes: None,
|
||||
knockout: doc.page_knockout,
|
||||
|
||||
@@ -374,7 +374,8 @@ impl Exporter<'_> {
|
||||
let (mut pushes, isolated_children) = transparency(s, n, page, container, knockout);
|
||||
let mask = n.extras().mask.as_deref().filter(|m| !m.disabled);
|
||||
let alpha = match (&n.kind, mask) {
|
||||
(NodeKind::Image(im), Some(m)) => self.masked_image(im, m, !n.extras().pixelated),
|
||||
// The mask's image shares the pixel grid only when it has the same corners (or none).
|
||||
(NodeKind::Image(im), Some(m)) if n.image_quad() == m.art.image_quad() => self.masked_image(im, m, !n.extras().pixelated),
|
||||
_ => None,
|
||||
};
|
||||
if let Some(m) = mask
|
||||
@@ -427,7 +428,7 @@ impl Exporter<'_> {
|
||||
self.shape(s, n, &bp, *rule, page);
|
||||
}
|
||||
NodeKind::Text(t) => self.text(s, n, t, page),
|
||||
NodeKind::Image(im) => match (n.extras().colorize.as_deref(), self.doc.shown_image(n, im)) {
|
||||
NodeKind::Image(im) if !n.is_distorted_image() => match (n.extras().colorize.as_deref(), self.doc.shown_image(n, im)) {
|
||||
(Some(p @ Paint::Solid { .. }), im) if self.doc.image_blob(&im).is_none_or(vectorcraft_doc::ImageBlob::takes_colorize) => {
|
||||
let im = &*im;
|
||||
if writable(s, im.xf, Rect::new(0.0, 0.0, im.width.max(1).into(), im.height.max(1).into())) {
|
||||
@@ -442,7 +443,11 @@ impl Exporter<'_> {
|
||||
self.warn(super::exporter::UNWRITABLE_IMAGE);
|
||||
}
|
||||
}
|
||||
(_, im) => self.image(s, &im, alpha, n.extras().pixelated),
|
||||
(_, im) => {
|
||||
// A piece of a distorted image draws the image its mask was written into.
|
||||
let alpha = alpha.or_else(|| self.piece_image.as_ref().filter(|(key, _)| *key == im.key).map(|(_, i)| i.clone()));
|
||||
self.image(s, &im, alpha, n.extras().pixelated)
|
||||
}
|
||||
},
|
||||
NodeKind::SymbolInstance { symbol, xf } => {
|
||||
// Within the objects a frame may draw of symbol instances, as on screen: nested
|
||||
@@ -488,17 +493,28 @@ impl Exporter<'_> {
|
||||
}
|
||||
// A gradient mesh is a smooth patch shading where it can be written as one.
|
||||
NodeKind::Mesh(m) if self.mesh(s, m) => {}
|
||||
// Live blends/envelopes/meshes export their evaluated (expanded) form.
|
||||
// Live blends/envelopes/meshes (and distorted images) export their evaluated
|
||||
// (expanded) form.
|
||||
NodeKind::Blend { .. }
|
||||
| NodeKind::Envelope { .. }
|
||||
| NodeKind::Mesh(_)
|
||||
| NodeKind::Repeat(_)
|
||||
| NodeKind::PlacedDocument(_)
|
||||
| NodeKind::Intertwine { .. } => {
|
||||
| NodeKind::Intertwine { .. }
|
||||
| NodeKind::Image(_) => {
|
||||
let g = vectorcraft_effects::expand_live_deep(Some(self.doc), n);
|
||||
// The pieces draw the image as it is shown, under its color mask's key.
|
||||
let piece = match (&n.kind, &alpha) {
|
||||
(NodeKind::Image(im), Some(img)) => Some((self.doc.shown_image(n, im).key.clone(), img.clone())),
|
||||
_ => None,
|
||||
};
|
||||
let outer = piece.map(|p| self.piece_image.replace(p));
|
||||
for c in g.children().into_iter().flatten() {
|
||||
self.node(s, c, page, false);
|
||||
}
|
||||
if let Some(outer) = outer {
|
||||
self.piece_image = outer;
|
||||
}
|
||||
}
|
||||
// Ruler guides draw on screen only.
|
||||
NodeKind::RulerGuide { .. } => {}
|
||||
|
||||
@@ -1173,6 +1173,43 @@ fn a_cmyk_image_masked_by_a_grey_image_of_its_grid_writes_it_as_its_smask() {
|
||||
assert!(String::from_utf8_lossy(&bytes).contains("/S/Luminosity"), "a luminosity soft mask");
|
||||
}
|
||||
|
||||
/// A distorted CMYK image whose mask is a gray image distorted to the same corners keeps the
|
||||
/// mask on its pixel grid: every piece of its mesh draws the image with the mask as its `/SMask`,
|
||||
/// with a color mask on the image too.
|
||||
#[test]
|
||||
fn a_distorted_cmyk_image_and_its_grid_mask_with_the_same_corners_write_it_as_its_smask() {
|
||||
for color_masked in [false, true] {
|
||||
let mut d = masked_doc(png(image::GrayImage::from_raw(2, 2, vec![255, 128, 0, 64]).unwrap()), true, false);
|
||||
let q = [(16.0, 0.0), (24.0, 0.0), (40.0, 40.0), (0.0, 40.0)].map(|(x, y)| Point::new(x, y));
|
||||
let id = d.layers[0].children().unwrap()[0].id;
|
||||
let mut mask = d.node(id).unwrap().extras().mask.clone().unwrap();
|
||||
Arc::make_mut(&mut mask.art).set_image_corners(q).unwrap();
|
||||
if color_masked {
|
||||
d.images.insert("shown".into(), ImageBlob::new("image/png", png(image::RgbaImage::from_pixel(2, 2, image::Rgba([0, 90, 200, 255])))));
|
||||
}
|
||||
let n = d.node_mut(id).unwrap();
|
||||
n.extras_mut().mask = Some(mask);
|
||||
if color_masked {
|
||||
n.extras_mut().color_mask = Some(Box::new(vectorcraft_doc::color_mask::ColorMask {
|
||||
key: "shown".into(),
|
||||
from: "img".into(),
|
||||
background: vectorcraft_doc::color_mask::MaskBackground::Colors,
|
||||
colors: vec![[255, 255, 255]],
|
||||
contiguous: false,
|
||||
measure: vectorcraft_doc::color_mask::MaskMatch::Distance,
|
||||
tolerance: 0.0,
|
||||
softness: 0.0,
|
||||
}));
|
||||
}
|
||||
n.set_image_corners(q).unwrap();
|
||||
let (bytes, smasks) = export_smasks(&d);
|
||||
// The shown pixels of a color mask have alpha, so its pieces take their triangles as
|
||||
// luminosity masks; the mask's alpha still goes to the image's own `/SMask`.
|
||||
assert!(color_masked || !String::from_utf8_lossy(&bytes).contains("/S/Luminosity"), "no luminosity soft mask");
|
||||
assert!(!smasks.is_empty() && smasks.iter().all(|m| m.as_deref() == Some(&[255, 128, 0, 64][..])), "{color_masked}: {smasks:?}");
|
||||
}
|
||||
}
|
||||
|
||||
/// A grey mask image with a color mask masks the CMYK image with the pixels it shows: its hidden
|
||||
/// pixels are clear in the image's `/SMask`.
|
||||
#[test]
|
||||
|
||||
@@ -154,6 +154,48 @@ fn a_warped_image_is_written_once_for_all_its_pieces() {
|
||||
}
|
||||
}
|
||||
|
||||
/// An image changed by Perspective Distort is written as the pieces of its mesh, placed so that
|
||||
/// its pixel rectangle's corners land on its corners: read back, each corner of the quad is a
|
||||
/// corner of one of the pieces' images.
|
||||
#[test]
|
||||
fn a_distorted_image_is_written_with_its_corners_on_its_quad() {
|
||||
let mut d = doc(encoded(colour(), ImageFormat::Png), "image/png");
|
||||
let id = d.layers[0].children().unwrap()[0].id;
|
||||
let q = [(40.0, 10.0), (60.0, 10.0), (90.0, 90.0), (10.0, 90.0)].map(|(x, y)| Point::new(x, y));
|
||||
d.node_mut(id).unwrap().set_image_corners(q).unwrap();
|
||||
let bytes = export_with_report(&d, &PdfOptions::default()).unwrap().bytes;
|
||||
let back = crate::import(&bytes).unwrap();
|
||||
let (mut seen, mut pieces) = ([false; 4], 0);
|
||||
back.walk(|n| {
|
||||
if let NodeKind::Image(im) = &n.kind {
|
||||
pieces += 1;
|
||||
let (w, h) = (f64::from(im.width), f64::from(im.height));
|
||||
for p in [(0.0, 0.0), (w, 0.0), (w, h), (0.0, h)] {
|
||||
let at = im.xf * Point::new(p.0, p.1);
|
||||
for (i, c) in q.iter().enumerate() {
|
||||
seen[i] |= at.distance(*c) < 0.01;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
assert!(pieces > 2, "{pieces}");
|
||||
assert_eq!(seen, [true; 4]);
|
||||
// The pieces are clipped by the quad: a clipping path with its bounds and its area.
|
||||
let mut quad_clips = 0;
|
||||
back.walk(|n| {
|
||||
if let NodeKind::Group { children, clip: true } = &n.kind
|
||||
&& let Some(p) = children.first().and_then(|c| c.path_data())
|
||||
&& let Some(b) = p.bounds()
|
||||
{
|
||||
let area: f64 = p.subpaths.iter().map(|s| s.area()).sum::<f64>().abs();
|
||||
if [b.x0 - 10.0, b.y0 - 10.0, b.x1 - 90.0, b.y1 - 90.0].iter().all(|v| v.abs() < 0.01) && (area - 4000.0).abs() < 1.0 {
|
||||
quad_clips += 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
assert!(quad_clips >= 1, "no clipping path on the quad");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn jpeg_zip_and_automatic_compression() {
|
||||
let png = doc(encoded(colour(), ImageFormat::Png), "image/png");
|
||||
|
||||
@@ -325,7 +325,11 @@ fn encode_read_only_within(doc: &Document, n: &Node, symbols: &SymbolBoxes, left
|
||||
o["truncated"] = json!(false);
|
||||
}
|
||||
NodeKind::Image(im) => {
|
||||
o["transform"] = affine_json(im.xf);
|
||||
// A distorted image: its corners, and the affine placement nearest them at its middle.
|
||||
o["transform"] = affine_json(vectorcraft_doc::image_quad::nearest_affine(n).unwrap_or(im.xf));
|
||||
if let Some(q) = n.image_quad() {
|
||||
o["corners"] = json!(q.map(|p| [p.x, p.y]));
|
||||
}
|
||||
o["pixelSize"] = json!([im.width, im.height]);
|
||||
o["colorMode"] = json!(doc.image_blob(im).map_or("unknown", color_mode));
|
||||
o["linked"] = json!(im.link.is_some());
|
||||
|
||||
@@ -608,6 +608,24 @@ fn declared_embedded_and_linked_images_have_distinct_metadata_and_pixel_omission
|
||||
}
|
||||
}
|
||||
|
||||
/// A distorted image comes with its corners, and with the transform that matches it at its middle
|
||||
/// rather than the one it had before the distort.
|
||||
#[test]
|
||||
fn a_distorted_image_comes_with_its_corners() {
|
||||
let (mut d, _, _, [_, embedded, linked, ..]) = mixed();
|
||||
let q = [(40.0, 60.0), (42.0, 60.0), (44.0, 62.0), (40.0, 62.0)].map(|(x, y)| Point::new(x, y));
|
||||
d.node_mut(embedded).unwrap().set_image_corners(q).unwrap();
|
||||
let e = encode_read_only(&d, d.node(embedded).unwrap()).unwrap();
|
||||
assert_eq!(e["corners"], json!([[40.0, 60.0], [42.0, 60.0], [44.0, 62.0], [40.0, 62.0]]));
|
||||
assert_ne!(e["transform"], json!([2.0, 0.0, 0.0, 2.0, 40.0, 60.0]));
|
||||
// The transform is the affine map nearest the corners, the one that matches them at the middle.
|
||||
let near = vectorcraft_doc::image_quad::nearest_affine(d.node(embedded).unwrap()).unwrap().as_coeffs();
|
||||
let got: Vec<f64> = e["transform"].as_array().unwrap().iter().map(|v| v.as_f64().unwrap()).collect();
|
||||
assert!(got.len() == 6 && got.iter().zip(near).all(|(a, b)| (a - b).abs() < 1e-9), "{got:?} against {near:?}");
|
||||
let plain = encode_read_only(&d, d.node(linked).unwrap()).unwrap();
|
||||
assert!(plain.get("corners").is_none());
|
||||
}
|
||||
|
||||
/// A CMYK image's pixels are its inks as the working CMYK profile shows them on the canvas: black
|
||||
/// ink alone is the profile's black, not RGB black.
|
||||
#[test]
|
||||
|
||||
@@ -51,6 +51,8 @@ pub(crate) struct LiveCache {
|
||||
expanded: FrameCache<usize, (Arc<Node>, Expanded, Found)>,
|
||||
meshes: FrameCache<(usize, usize), MeshEntry>,
|
||||
walks: FrameCache<usize, Walk>,
|
||||
/// A distorted image's art by node and scale step ([`Renderer::distorted_art`]).
|
||||
distorted: FrameCache<(usize, usize), (Arc<Node>, Arc<Node>)>,
|
||||
/// How many live objects [`Renderer::live_expanded`] evaluated and how many meshes
|
||||
/// [`Renderer::mesh_quads`] tessellated.
|
||||
#[cfg(test)]
|
||||
@@ -66,6 +68,7 @@ impl Default for LiveCache {
|
||||
expanded: FrameCache::new(lru::LIVE_BUDGET, 256),
|
||||
meshes: FrameCache::new(lru::MESH_BUDGET, 256),
|
||||
walks: FrameCache::new(lru::WALK_BUDGET, 256),
|
||||
distorted: FrameCache::new(lru::LIVE_BUDGET, 256),
|
||||
#[cfg(test)]
|
||||
evaluated: 0,
|
||||
#[cfg(test)]
|
||||
@@ -80,6 +83,7 @@ impl LiveCache {
|
||||
self.expanded.sweep(stamp);
|
||||
self.meshes.sweep(stamp);
|
||||
self.walks.sweep(stamp);
|
||||
self.distorted.sweep(stamp);
|
||||
}
|
||||
|
||||
/// A cache whose evaluations take at most `budget` bytes.
|
||||
@@ -522,6 +526,28 @@ impl Renderer {
|
||||
v
|
||||
}
|
||||
|
||||
/// Distorted image `a`'s art for drawing through `view`
|
||||
/// ([`vectorcraft_doc::image_quad::distorted_art_at`] at the view's largest stretch, rounded to
|
||||
/// a quarter of an octave), kept with `cache` while the node stays the same. `None` when `a` is
|
||||
/// not a distorted image.
|
||||
pub(crate) fn distorted_art(&mut self, a: &Arc<Node>, view: Affine, cache: bool) -> Option<Arc<Node>> {
|
||||
let scale = vectorcraft_doc::image_quad::max_stretch(view);
|
||||
let step = if scale.is_finite() && scale > 0.0 { (scale.log2() * 4.0).round().clamp(-256.0, 256.0) } else { 0.0 };
|
||||
let key = (Arc::as_ptr(a) as usize, (step + 256.0) as usize);
|
||||
if cache
|
||||
&& let Some(e) = self.live.distorted.get(&key, self.stamp)
|
||||
&& Arc::ptr_eq(&e.0, a)
|
||||
{
|
||||
return Some(e.1.clone());
|
||||
}
|
||||
let density = vectorcraft_doc::image_quad::Density::at_scale((step / 4.0).exp2());
|
||||
let art = Arc::new(vectorcraft_doc::image_quad::distorted_art_at(a, density)?);
|
||||
if cache {
|
||||
self.live.distorted.insert(key, (a.clone(), art.clone()), lru::node_bytes(&art), self.stamp);
|
||||
}
|
||||
Some(art)
|
||||
}
|
||||
|
||||
/// The quads of mesh `a` (`m`) at subdivision `level`, kept while the node and the color
|
||||
/// settings that colored them ([`GradientMesh::color_at`]) stay the same.
|
||||
fn mesh_quads(&mut self, doc: &Document, a: &Arc<Node>, m: &GradientMesh, level: usize, cache: bool) -> Arc<Vec<MeshQuad>> {
|
||||
@@ -572,6 +598,15 @@ impl Renderer {
|
||||
match &a.kind {
|
||||
NodeKind::PlacedDocument(p) => self.draw_placed(ctx, f, p),
|
||||
NodeKind::Mesh(m) => self.draw_mesh(ctx, f, a, m, cache),
|
||||
// Outline mode draws a distorted image's frame through its corners, not the pieces it
|
||||
// is drawn with.
|
||||
NodeKind::Image(_) if f.opts.outline => self.draw_distorted_frame(ctx, f, a, cache),
|
||||
// A distorted image's mesh is cut for the view's scale.
|
||||
NodeKind::Image(_) => {
|
||||
if let Some(art) = self.distorted_art(a, f.view, cache) {
|
||||
self.draw_arc(ctx, f, &art);
|
||||
}
|
||||
}
|
||||
NodeKind::Blend { .. }
|
||||
| NodeKind::Envelope { .. }
|
||||
| NodeKind::Repeat(_)
|
||||
|
||||
@@ -2,6 +2,8 @@ use super::{
|
||||
Affine, Arc, BezPath, Document, FillRule, Frame, HashMap, Ink, Node, NodeKind, Pixmap, Rect, RenderContext, Renderer, Shape, blob_key,
|
||||
blob_pixmap, fill_rule, image_mip, ink, lookup, mip_level, peniko, proof, vello_cpu,
|
||||
};
|
||||
use vello_cpu::peniko::{BlendMode, Compose, Mix};
|
||||
|
||||
use crate::images;
|
||||
|
||||
/// The color image node `n` of `doc` is colorized with ([`vectorcraft_doc::NodeExtras::colorize`]),
|
||||
@@ -24,6 +26,47 @@ impl Renderer {
|
||||
self.draw_image_in(ctx, f, im, None, tint, false);
|
||||
}
|
||||
|
||||
/// Distorted image `n` in outline mode: with Document Setup's Show Images in Outline Mode its
|
||||
/// pixels, each piece of its mesh at the view's scale ([`Self::distorted_art`]) painted into
|
||||
/// its triangle inside its corners, then its frame through its corners as a hairline. The
|
||||
/// pieces knock out as the mesh's knockout group does ([`Self::draw_knockout`]): each first
|
||||
/// erases the pieces below it inside its triangle, so a partly transparent image paints once
|
||||
/// where pieces overlap.
|
||||
pub(crate) fn draw_distorted_frame(&mut self, ctx: &mut RenderContext, f: &Frame, n: &Arc<Node>, cache: bool) {
|
||||
let frame = n.image_frame();
|
||||
if f.doc.setup.outline_images
|
||||
&& let Some(edge) = &frame
|
||||
&& let Some(art) = self.distorted_art(n, f.view, cache)
|
||||
{
|
||||
let layer = |ctx: &mut RenderContext, compose: Compose| {
|
||||
ctx.set_transform(Affine::IDENTITY);
|
||||
ctx.push_layer(None, Some(BlendMode::new(Mix::Normal, compose)), None, None, None);
|
||||
};
|
||||
// The pieces along the edges reach past the corners: the corners clip them.
|
||||
ctx.set_transform(f.view);
|
||||
ctx.push_layer(Some(edge), Some(BlendMode::new(Mix::Normal, Compose::SrcOver)), None, None, None);
|
||||
for piece in vectorcraft_doc::image_quad::distorted_pieces(&art) {
|
||||
let Some([clip, image]) = piece.children().map(Vec::as_slice) else { continue };
|
||||
let (NodeKind::Path { path, .. }, NodeKind::Image(im)) = (&clip.kind, &image.kind) else { continue };
|
||||
let region = (path.to_bezpath(), FillRule::NonZero);
|
||||
layer(ctx, Compose::DestOut);
|
||||
ctx.set_transform(f.view);
|
||||
ctx.set_paint(f.ink.fixed([255, 255, 255, 255]));
|
||||
ctx.set_fill_rule(fill_rule(region.1));
|
||||
ctx.fill_path(®ion.0);
|
||||
ctx.pop_layer();
|
||||
layer(ctx, Compose::Plus);
|
||||
let shown = f.doc.shown_image(image.as_ref(), im.as_ref());
|
||||
self.draw_image_in(ctx, f, &shown, Some(®ion), None, image.extras().pixelated);
|
||||
ctx.pop_layer();
|
||||
}
|
||||
ctx.pop_layer();
|
||||
}
|
||||
if let Some(bp) = &frame {
|
||||
self.hairline(ctx, f, bp, [0, 0, 0, 255]);
|
||||
}
|
||||
}
|
||||
|
||||
/// Draw an image, or with `area` (a region in the document inside the image's frame, see
|
||||
/// [`plain_image`]) the image painted into that region; colorized with `tint` when given; with
|
||||
/// `pixelated` ([`vectorcraft_doc::NodeExtras::pixelated`]) without smoothing.
|
||||
@@ -136,7 +179,9 @@ impl Renderer {
|
||||
} else if !pending && !outline {
|
||||
self.image_left_out = self.image_left_out.map(|_| true);
|
||||
}
|
||||
if outline {
|
||||
// An image painted into a region in outline mode is a piece of a distorted image, whose
|
||||
// frame its caller draws ([`Self::draw_distorted_frame`]).
|
||||
if outline && area.is_none() {
|
||||
let mut p = rect.to_path(0.1);
|
||||
p.apply_affine(im.xf);
|
||||
self.hairline(ctx, f, &p, [0, 0, 0, 255]);
|
||||
|
||||
@@ -251,6 +251,7 @@ impl Renderer {
|
||||
&& !f.opts.outline
|
||||
&& !self.is_shape(a)
|
||||
&& let NodeKind::Image(im) = &a.kind
|
||||
&& !a.is_distorted_image()
|
||||
&& white_shape_mask(m)
|
||||
&& let Some(region) = self.clip_of(&m.art)
|
||||
&& shape_masked_image(a, im, ®ion.0)
|
||||
@@ -370,7 +371,7 @@ impl Renderer {
|
||||
self.stats.drawn += 1;
|
||||
return;
|
||||
}
|
||||
if vectorcraft_doc::live::is_live(a) || effects::has_pathfinder(a) {
|
||||
if vectorcraft_doc::live::is_drawn_live(a) || effects::has_pathfinder(a) {
|
||||
// The isolated object itself (a repeat isolated to edit its source, #5054) draws its
|
||||
// art as usual, as an isolated group does in `draw_layer_node`.
|
||||
let settle = f.opts.isolated == Some(a.id) && f.doc.mask_edit.is_none();
|
||||
@@ -525,6 +526,7 @@ impl Renderer {
|
||||
// a clip layer (envelopes cut distorted images into many such pieces).
|
||||
if let ([image], None, None) = (rest, &fill, &stroke)
|
||||
&& let NodeKind::Image(im) = &image.kind
|
||||
&& !image.is_distorted_image()
|
||||
&& plain_image(image, im, ®ion.0)
|
||||
{
|
||||
let im = f.doc.shown_image(image, im);
|
||||
@@ -578,7 +580,7 @@ impl Renderer {
|
||||
}
|
||||
}
|
||||
NodeKind::Text(t) => self.draw_text(ctx, f, n, t),
|
||||
NodeKind::Image(im) => {
|
||||
NodeKind::Image(im) if !n.is_distorted_image() => {
|
||||
self.draw_image_in(ctx, f, &f.doc.shown_image(n, im), None, images::image_tint(f.doc, n, f.ink), n.extras().pixelated)
|
||||
}
|
||||
NodeKind::SymbolInstance { symbol, xf } => {
|
||||
@@ -604,7 +606,8 @@ impl Renderer {
|
||||
| NodeKind::Mesh(_)
|
||||
| NodeKind::Repeat(_)
|
||||
| NodeKind::PlacedDocument(_)
|
||||
| NodeKind::Intertwine { .. } => match self.live_root.clone().filter(|a| std::ptr::eq(&**a, n)) {
|
||||
| NodeKind::Intertwine { .. }
|
||||
| NodeKind::Image(_) => match self.live_root.clone().filter(|a| std::ptr::eq(&**a, n)) {
|
||||
Some(a) => self.draw_live_body(ctx, f, &a, true),
|
||||
None => self.draw_live_node(ctx, f, n),
|
||||
},
|
||||
@@ -629,7 +632,7 @@ impl Renderer {
|
||||
/// same from frame to frame while the art does. When `a` is a live object,
|
||||
/// [`Self::draw_content`] draws its evaluation from the live cache ([`Self::live_root`]).
|
||||
pub(crate) fn draw_kept_node(&mut self, ctx: &mut RenderContext, f: &Frame, a: &Arc<Node>) {
|
||||
let live = vectorcraft_doc::live::is_live(a).then(|| a.clone());
|
||||
let live = vectorcraft_doc::live::is_drawn_live(a).then(|| a.clone());
|
||||
let outer = std::mem::replace(&mut self.live_root, live);
|
||||
self.draw_forced_arc(ctx, f, a);
|
||||
self.live_root = outer;
|
||||
|
||||
@@ -605,6 +605,35 @@ fn outline_mode_no_fill() {
|
||||
assert!(r.pixel(10, 50)[0] < 200);
|
||||
}
|
||||
|
||||
/// Outline view draws a distorted image's frame through its corners: a slanted side, and nothing
|
||||
/// inside or along the rectangle it was placed in.
|
||||
#[test]
|
||||
fn outline_mode_draws_a_distorted_images_frame_through_its_corners() {
|
||||
let mut d = Document::new(100.0, 100.0);
|
||||
let id = d.alloc_id();
|
||||
let im = vectorcraft_doc::ImageObject {
|
||||
key: "k".into(),
|
||||
width: 10,
|
||||
height: 10,
|
||||
xf: Affine::scale(10.0),
|
||||
link: None,
|
||||
placement: Default::default(),
|
||||
pixels: None,
|
||||
};
|
||||
let mut n = Node::new(id, NodeKind::Image(Box::new(im)));
|
||||
let q = [(40.0, 0.0), (60.0, 0.0), (100.0, 100.0), (0.0, 100.0)].map(|(x, y)| vectorcraft_geom::Point::new(x, y));
|
||||
n.set_image_corners(q).unwrap();
|
||||
let l = d.layers[0].id;
|
||||
d.insert(Some(l), 0, n).unwrap();
|
||||
let r =
|
||||
Renderer::new().render(&d, 100, 100, Affine::IDENTITY, &RenderOptions { outline: true, background: Some([255; 4]), ..Default::default() });
|
||||
// On the left side, halfway down: from (40, 0) to (0, 100).
|
||||
assert!(r.pixel(20, 50)[0] < 200, "the slanted side");
|
||||
// The old rectangle's left edge and the inside of the quad stay blank.
|
||||
assert_eq!(r.pixel(1, 30), [255; 4]);
|
||||
assert_eq!(r.pixel(50, 50), [255; 4]);
|
||||
}
|
||||
|
||||
/// A 100 × 100 document with each kind of path Outline view draws, and the ids of its objects by
|
||||
/// name: a stroked square, a compound path with a hole, a path and a compound path with a live
|
||||
/// effect, a guide, a clip group, an Image Trace object showing its outlines, and a path in a layer
|
||||
|
||||
@@ -136,3 +136,64 @@ fn other_clip_groups_in_a_knockout_group_knock_out_by_their_alpha() {
|
||||
let a = r.pixel(120, 80)[3];
|
||||
assert!(a > 160, "{a}");
|
||||
}
|
||||
|
||||
/// Show Images in Outline Mode paints a half transparent distorted image's pixels once, where the
|
||||
/// pieces of its mesh overlap too: inside the image, its alpha is the preview's.
|
||||
#[test]
|
||||
fn outline_mode_paints_a_distorted_images_pixels_once_where_its_pieces_overlap() {
|
||||
let mut d = Document::new(100.0, 100.0);
|
||||
d.images.insert("pic".into(), ImageBlob::png(png(128)));
|
||||
d.setup.outline_images = true;
|
||||
let im = ImageObject {
|
||||
key: "pic".into(),
|
||||
width: 4,
|
||||
height: 4,
|
||||
xf: Affine::translate((10.0, 10.0)) * Affine::scale(20.0),
|
||||
link: None,
|
||||
placement: Default::default(),
|
||||
pixels: None,
|
||||
};
|
||||
let mut n = Node::new(d.alloc_id(), NodeKind::Image(Box::new(im)));
|
||||
n.set_image_corners([(20.0, 10.0), (80.0, 10.0), (90.0, 90.0), (10.0, 90.0)].map(|(x, y)| Point::new(x, y))).unwrap();
|
||||
let pieces = vectorcraft_doc::image_quad::distorted_pieces(&vectorcraft_doc::image_quad::distorted_art(&n).unwrap()).len();
|
||||
assert!(pieces > 2, "{pieces}");
|
||||
d.insert(Some(d.layers[0].id), 0, n).unwrap();
|
||||
let r = Renderer::new().render(&d, 400, 400, Affine::scale(4.0), &RenderOptions { outline: true, background: None, ..Default::default() });
|
||||
let preview = drawn(&d);
|
||||
let a = preview.pixel(200, 200)[3];
|
||||
assert!(a.abs_diff(128) <= 4, "the image's own alpha inside it: {a}");
|
||||
let mut off = vec![];
|
||||
for y in 80..320 {
|
||||
for x in 100..300 {
|
||||
let (a, b) = (r.pixel(x, y)[3], preview.pixel(x, y)[3]);
|
||||
if a.abs_diff(b) > 2 && off.len() < 8 {
|
||||
off.push((x, y, a, b));
|
||||
}
|
||||
}
|
||||
}
|
||||
assert_eq!(off, vec![], "outline alpha against preview alpha");
|
||||
}
|
||||
|
||||
/// The canvas cuts a distorted image's mesh for the view's scale: more pieces zoomed in, fewer
|
||||
/// zoomed out, than the mesh files and print take.
|
||||
#[test]
|
||||
fn the_canvas_cuts_a_distorted_images_mesh_for_the_zoom() {
|
||||
let im =
|
||||
ImageObject { key: "pic".into(), width: 400, height: 400, xf: Affine::IDENTITY, link: None, placement: Default::default(), pixels: None };
|
||||
let mut n = Node::new(vectorcraft_doc::NodeId(1), NodeKind::Image(Box::new(im)));
|
||||
n.set_image_corners([(40.0, 0.0), (360.0, 0.0), (400.0, 400.0), (0.0, 400.0)].map(|(x, y)| Point::new(x, y))).unwrap();
|
||||
let page = vectorcraft_doc::image_quad::distorted_pieces(&vectorcraft_doc::image_quad::distorted_art(&n).unwrap()).len();
|
||||
let n = std::sync::Arc::new(n);
|
||||
let mut r = Renderer::new();
|
||||
let mut pieces = |scale: f64| vectorcraft_doc::image_quad::distorted_pieces(&r.distorted_art(&n, Affine::scale(scale), false).unwrap()).len();
|
||||
let (small, large) = (pieces(1.0 / 25.0), pieces(8.0));
|
||||
assert!(small < page && page < large, "{small} {page} {large}");
|
||||
// A view that stretches one way and squeezes the other as much keeps its area, and still
|
||||
// takes a finer mesh than an unscaled one.
|
||||
let (plain, stretched) = (pieces(1.0), r_pieces(&n, Affine::scale_non_uniform(16.0, 1.0 / 16.0)));
|
||||
assert!(stretched > plain, "{stretched} {plain}");
|
||||
}
|
||||
|
||||
fn r_pieces(n: &std::sync::Arc<Node>, view: Affine) -> usize {
|
||||
vectorcraft_doc::image_quad::distorted_pieces(&Renderer::new().distorted_art(n, view, false).unwrap()).len()
|
||||
}
|
||||
@@ -611,6 +611,65 @@ fn a_shadow_on_an_image_paints_offset_pixels() {
|
||||
assert!(worst <= 4, "max channel difference {worst}");
|
||||
}
|
||||
|
||||
/// A distorted opaque image is drawn opaque between its corners, where the pieces of its mesh
|
||||
/// meet too; its drop shadow is the shape between its corners moved, and nothing paints where its
|
||||
/// rectangle was.
|
||||
#[test]
|
||||
fn a_distorted_image_is_opaque_between_its_corners_and_its_shadow_follows_them() {
|
||||
let mut d = image_doc(vec![fx("stylize.dropShadow", json!({"x": 10, "y": 10, "blur": 0, "opacity": 100, "mode": "normal"}))]);
|
||||
let id = d.layers[0].children().unwrap()[0].id;
|
||||
d.node_mut(id).unwrap().set_image_corners([(35.0, 20.0), (45.0, 20.0), (50.0, 50.0), (20.0, 50.0)].map(|(x, y)| Point::new(x, y))).unwrap();
|
||||
let img = render(&d);
|
||||
let mut faded = vec![];
|
||||
for y in 30..42 {
|
||||
for x in 30..40 {
|
||||
let p = img.pixel(x, y);
|
||||
// A seam shows the white page (green) or the shadow below (darker red) through.
|
||||
if p[0] < 200 || p[1] > 48 {
|
||||
faded.push((x, y, p));
|
||||
}
|
||||
}
|
||||
}
|
||||
assert_eq!(faded, vec![], "the image's red, also where its pieces meet");
|
||||
assert!(lum(img.pixel(40, 55)) < 100, "the shadow below the quad: {:?}", img.pixel(40, 55));
|
||||
assert_eq!(lum(img.pixel(24, 28)), WHITE, "outside the quad, inside the old rectangle");
|
||||
// The rectangle's shadow would reach (58, 36); the quad's shadow ends at x = 56 there.
|
||||
assert_eq!(lum(img.pixel(58, 36)), WHITE, "outside the quad's shadow, inside the rectangle's");
|
||||
}
|
||||
|
||||
/// A distorted opaque image draws opaque inside its corners at any zoom, where the pieces of its
|
||||
/// mesh meet too, and nothing of it draws outside its corners.
|
||||
#[test]
|
||||
fn a_distorted_image_is_opaque_inside_its_corners_at_every_zoom() {
|
||||
let mut d = image_doc(vec![]);
|
||||
let id = d.layers[0].children().unwrap()[0].id;
|
||||
let q = [(35.0, 20.0), (45.0, 20.0), (50.0, 50.0), (20.0, 50.0)].map(|(x, y)| Point::new(x, y));
|
||||
d.node_mut(id).unwrap().set_image_corners(q).unwrap();
|
||||
for scale in [0.5, 1.0, 3.0] {
|
||||
let size = (100.0 * scale) as u32;
|
||||
let opts = RenderOptions { background: Some([255, 255, 255, 255]), ..Default::default() };
|
||||
let img = Renderer::new().render(&d, size, size, Affine::scale(scale), &opts);
|
||||
let at = |x: f64, y: f64| img.pixel((x * scale) as u32, (y * scale) as u32);
|
||||
let mut faded = vec![];
|
||||
// Points at least 2.5 pt inside the corners: the left side runs from (35, 20) to (20, 50)
|
||||
// and the right side from (45, 20) to (50, 50).
|
||||
for y in [24.0, 30.0, 36.0, 42.0, 47.0] {
|
||||
let t = (y - 20.0) / 30.0;
|
||||
let (left, right) = (35.0 - 15.0 * t + 2.5, 45.0 + 5.0 * t - 2.5);
|
||||
let mid = (left + right) / 2.0;
|
||||
for x in [left, (left + mid) / 2.0, mid, (mid + right) / 2.0, right] {
|
||||
let p = at(x, y);
|
||||
if p[1] > 12 || p[2] > 12 {
|
||||
faded.push((x, y, p));
|
||||
}
|
||||
}
|
||||
}
|
||||
assert_eq!(faded, vec![], "the image's red at {scale}x");
|
||||
assert_eq!(lum(at(24.0, 28.0)), WHITE, "outside the corners at {scale}x");
|
||||
assert_eq!(lum(at(36.0, 17.0)), WHITE, "above the top edge at {scale}x");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn blur_on_a_symbol_instance_softens_its_edges() {
|
||||
let plain = render(&symbol_doc(vec![]));
|
||||
|
||||
@@ -90,6 +90,7 @@ impl Reuse {
|
||||
| NodeKind::Repeat(_)
|
||||
| NodeKind::PlacedDocument(_)
|
||||
| NodeKind::Intertwine { .. } => (self.turns, self.scales) = (false, false),
|
||||
NodeKind::Image(_) if n.is_distorted_image() => (self.turns, self.scales) = (false, false),
|
||||
NodeKind::SymbolInstance { symbol, .. } => {
|
||||
// A scale reaching an instance of a symbol with 9-slice guides changes how its
|
||||
// cells are sized.
|
||||
@@ -988,7 +989,7 @@ impl Writer<'_> {
|
||||
self.shape(n, &d.join(" "), None, &paths, *rule, export_shape_bounds(n));
|
||||
}
|
||||
NodeKind::Text(t) => self.text_node(n, t),
|
||||
NodeKind::Image(im) => {
|
||||
NodeKind::Image(im) if !n.is_distorted_image() => {
|
||||
let shown = self.doc.shown_image(n, im);
|
||||
let im = &*shown;
|
||||
if let Some(Paint::Solid { color, .. }) = n.extras().colorize.as_deref()
|
||||
@@ -1090,14 +1091,28 @@ impl Writer<'_> {
|
||||
self.line("</g>");
|
||||
(self.xf, self.instance_xf) = saved;
|
||||
}
|
||||
// Live blends/envelopes/meshes export their evaluated (expanded) form.
|
||||
// Live blends/envelopes/meshes (and distorted images) export their evaluated
|
||||
// (expanded) form.
|
||||
NodeKind::Blend { .. }
|
||||
| NodeKind::Envelope { .. }
|
||||
| NodeKind::Mesh(_)
|
||||
| NodeKind::Repeat(_)
|
||||
| NodeKind::PlacedDocument(_)
|
||||
| NodeKind::Intertwine { .. } => {
|
||||
let g = vectorcraft_effects::expand_live_deep(Some(self.doc), n);
|
||||
| NodeKind::Intertwine { .. }
|
||||
| NodeKind::Image(_) => {
|
||||
let mut g = vectorcraft_effects::expand_live_deep(Some(self.doc), n);
|
||||
// A distorted image inside instances that scale it is cut as finely on the page as
|
||||
// one placed directly.
|
||||
let stretch = vectorcraft_doc::image_quad::max_stretch(self.instance_xf);
|
||||
if n.is_distorted_image()
|
||||
&& (stretch - 1.0).abs() > 1e-9
|
||||
&& let Some(art) = vectorcraft_doc::image_quad::distorted_art_at(n, vectorcraft_doc::image_quad::Density::page_at(stretch))
|
||||
&& let NodeKind::Group { children, .. } = &mut g.kind
|
||||
&& let [only] = &mut children[..]
|
||||
&& only.id == n.id
|
||||
{
|
||||
*only = std::sync::Arc::new(art);
|
||||
}
|
||||
self.share_images(&g);
|
||||
self.node_body(&g);
|
||||
}
|
||||
|
||||
@@ -167,6 +167,80 @@ fn hidden_warp_pieces_share_no_image() {
|
||||
}
|
||||
}
|
||||
|
||||
/// An image whose corners Perspective Distort moved is written with its pixels between those
|
||||
/// corners: opaque just inside each corner of the quad, and clear where its rectangle was but the
|
||||
/// quad is not.
|
||||
#[test]
|
||||
fn a_distorted_image_is_written_between_its_corners() {
|
||||
let q = [(40.0, 10.0), (60.0, 10.0), (90.0, 90.0), (10.0, 90.0)].map(|(x, y)| Point::new(x, y));
|
||||
let mut d = Document::new(100.0, 100.0);
|
||||
let n = distorted_image(&mut d, q, 4);
|
||||
d.insert(d.default_layer(), 0, n).unwrap();
|
||||
let svg = export_full(&d, &ExportOptions::default(), None).svg;
|
||||
let tree = resvg::usvg::Tree::from_str(&svg, &resvg::usvg::Options::default()).unwrap();
|
||||
let mut pixmap = resvg::tiny_skia::Pixmap::new(400, 400).unwrap();
|
||||
resvg::render(&tree, resvg::tiny_skia::Transform::from_scale(4.0, 4.0), &mut pixmap.as_mut());
|
||||
let alpha = |x: f64, y: f64| pixmap.pixel((x * 4.0) as u32, (y * 4.0) as u32).unwrap().alpha();
|
||||
// A point (in points) 2 pt inside each corner, toward the quad's middle.
|
||||
let mid = Point::new(50.0, 50.0);
|
||||
for c in q {
|
||||
let inside = c + (mid - c).normalize() * 2.0;
|
||||
assert!(alpha(inside.x, inside.y) > 200, "{c:?}: {}", alpha(inside.x, inside.y));
|
||||
}
|
||||
// The rectangle's top corners lie outside the quad.
|
||||
assert_eq!(alpha(14.0, 14.0), 0);
|
||||
assert_eq!(alpha(86.0, 14.0), 0);
|
||||
}
|
||||
|
||||
/// A plain opaque red `px` × `px` image over (10, 10)–(90, 90), its corners moved to `q`.
|
||||
fn distorted_image(d: &mut Document, q: [Point; 4], px: u32) -> Node {
|
||||
let img = craft_image_codecs::Image::from_raw(
|
||||
px,
|
||||
px,
|
||||
craft_image_codecs::ChannelLayout::Rgba,
|
||||
craft_image_codecs::SampleType::U8,
|
||||
[255, 0, 0, 255].repeat((px * px) as usize),
|
||||
)
|
||||
.unwrap();
|
||||
let png = craft_image_codecs::encode(&img, craft_image_codecs::Format::Png, &craft_image_codecs::EncodeOptions::default()).unwrap();
|
||||
d.images.insert("pic".into(), ImageBlob::png(png));
|
||||
let im = ImageObject {
|
||||
key: "pic".into(),
|
||||
width: px,
|
||||
height: px,
|
||||
xf: Affine::translate((10.0, 10.0)) * Affine::scale(80.0 / f64::from(px)),
|
||||
link: None,
|
||||
placement: Default::default(),
|
||||
pixels: None,
|
||||
};
|
||||
let mut n = Node::new(d.alloc_id(), NodeKind::Image(Box::new(im)));
|
||||
n.set_image_corners(q).unwrap();
|
||||
n
|
||||
}
|
||||
|
||||
/// A distorted image in a symbol instance that scales it is cut into as many pieces as the same
|
||||
/// image placed directly at that size.
|
||||
#[test]
|
||||
fn a_distorted_image_in_a_scaled_instance_is_cut_as_finely_as_one_placed_directly() {
|
||||
let q = [(40.0, 10.0), (60.0, 10.0), (90.0, 90.0), (10.0, 90.0)].map(|(x, y)| Point::new(x, y));
|
||||
let pieces = |d: &Document| export_full(d, &ExportOptions::default(), None).svg.matches("<clipPath").count();
|
||||
let mut direct = Document::new(400.0, 400.0);
|
||||
let mut n = distorted_image(&mut direct, q, 64);
|
||||
n.transform(Affine::scale(4.0), false);
|
||||
direct.insert(direct.default_layer(), 0, n).unwrap();
|
||||
let in_instance = |scale: f64| {
|
||||
let mut d = Document::new(400.0, 400.0);
|
||||
let n = distorted_image(&mut d, q, 64);
|
||||
d.symbols.push(vectorcraft_doc::Symbol { dynamic: false, name: "Pic".into(), art: std::sync::Arc::new(n) });
|
||||
let inst = Node::new(d.alloc_id(), NodeKind::SymbolInstance { symbol: "Pic".into(), xf: Affine::scale(scale) });
|
||||
d.insert(d.default_layer(), 0, inst).unwrap();
|
||||
d
|
||||
};
|
||||
let (want, unscaled, scaled) = (pieces(&direct), pieces(&in_instance(1.0)), pieces(&in_instance(4.0)));
|
||||
assert!(scaled > unscaled, "{scaled} {unscaled}");
|
||||
assert!(scaled.abs_diff(want) * 10 <= want, "{scaled} against {want}");
|
||||
}
|
||||
|
||||
/// Pieces of an opaque image are drawn one over another without knockout masks; a colorize paint
|
||||
/// draws a gray image's light pixels partly transparent, so its pieces take them.
|
||||
#[test]
|
||||
|
||||
@@ -230,6 +230,11 @@ pub trait Tool: Send {
|
||||
fn wants_text(&self) -> bool {
|
||||
false
|
||||
}
|
||||
/// The tool a gradient stop's one-shot pick switches back to after its click (the Eyedropper
|
||||
/// armed by the Gradient panel's eyedropper); None when no such pick is armed.
|
||||
fn returns_to(&self) -> Option<&str> {
|
||||
None
|
||||
}
|
||||
fn text_input(&mut self, _cx: &ToolContext, _s: &str) -> Vec<Action> {
|
||||
vec![]
|
||||
}
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
//!
|
||||
//! The Gradient panel's eyedropper sets the `stop` option (the tool to return to): the next click
|
||||
//! samples the colour under the cursor into the selected gradient stop (`paint.sampleColor
|
||||
//! {stop}`) and switches back to that tool.
|
||||
//! {stop}`) and switches back to that tool. Armed for the Live Paint Bucket, a click once its stop
|
||||
//! is no longer selected ends the pick without sampling and switches back to the bucket.
|
||||
//!
|
||||
//! Gradient mesh points picked with the Mesh tool, Direct Selection or the Lasso before switching
|
||||
//! to the Eyedropper stay picked (its `meshPoints` option), and go back to one of those tools
|
||||
@@ -479,10 +480,15 @@ fn renumber(doc: &mut Document, n: &mut Node) {
|
||||
/// as that pixel).
|
||||
fn image_color_at(s: &Sampler, n: &Node, p: Point) -> Option<Color> {
|
||||
let NodeKind::Image(im) = &n.kind else { return None };
|
||||
if im.xf.determinant().abs() < 1e-12 {
|
||||
return None;
|
||||
}
|
||||
let px = im.xf.inverse() * p;
|
||||
// A distorted image's pixel under `p` is found through its projective map.
|
||||
let px = if n.is_distorted_image() {
|
||||
n.image_map()?.inverse()?.apply(p)?
|
||||
} else {
|
||||
if im.xf.determinant().abs() < 1e-12 {
|
||||
return None;
|
||||
}
|
||||
im.xf.inverse() * p
|
||||
};
|
||||
let blob = s.doc.images.get(&im.key)?;
|
||||
let object = (im.width, im.height);
|
||||
if let Some(inks) = blob.sample_cmyk_object(px.x, px.y, object, s.raster_sample) {
|
||||
@@ -531,6 +537,15 @@ impl Tool for EyedropperTool {
|
||||
self.stop = None;
|
||||
return vec![Action::Dialog("brushKeyColor".into(), json!({ "color": color_json(&c) })), Action::SwitchTool(back)];
|
||||
}
|
||||
// A pick for a stop of the Live Paint Bucket's gradient (the default paint's) ends without
|
||||
// sampling once that stop is no longer selected (a Cmd-click selected another object) or no
|
||||
// longer there (another paint was chosen): the click switches back.
|
||||
let bucket_paint = if cx.fill_active { &cx.paint.fill } else { &cx.paint.stroke };
|
||||
let bucket_stop = cx.gradient_stop.filter(|i| matches!(bucket_paint, Paint::Gradient(g) if *i < g.gradient.stops.len()));
|
||||
if self.stop.as_deref() == Some("livePaintBucket") && bucket_stop.is_none() {
|
||||
self.stop = None;
|
||||
return vec![Action::SwitchTool("livePaintBucket".into())];
|
||||
}
|
||||
let stop = self.stop.as_ref().zip(cx.gradient_stop);
|
||||
// A plain click on a selected gradient mesh gives the fill color to the point there, else
|
||||
// to the four points of the patch there.
|
||||
@@ -655,6 +670,10 @@ impl Tool for EyedropperTool {
|
||||
vec![]
|
||||
}
|
||||
|
||||
fn returns_to(&self) -> Option<&str> {
|
||||
self.stop.as_deref().filter(|_| !self.brush_key_color && self.image_trace_ignore_color.is_none())
|
||||
}
|
||||
|
||||
/// Escape is the tool's while a pick is armed, so it switches back and ends nothing else.
|
||||
fn claims_key(&self, _cx: &ToolContext, key: ToolKey) -> bool {
|
||||
key == ToolKey::Escape && self.picking()
|
||||
@@ -833,6 +852,27 @@ mod tests {
|
||||
]
|
||||
);
|
||||
assert_eq!(t.options(), json!({"stop": null, "brushKeyColor": false}), "one sample only");
|
||||
// Armed for the Live Paint Bucket with its stop no longer selected, a click ends the pick.
|
||||
cx.gradient_stop = None;
|
||||
t.set_option("stop", &json!("livePaintBucket"));
|
||||
let a = t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 100.0, 150.0));
|
||||
assert_eq!(a, vec![Action::SwitchTool("livePaintBucket".into())]);
|
||||
assert_eq!(t.returns_to(), None);
|
||||
// So does a click once the default paint has no such stop (here, a solid fill).
|
||||
cx.gradient_stop = Some(1);
|
||||
assert!(!matches!(cx.paint.fill, Paint::Gradient(_)));
|
||||
t.set_option("stop", &json!("livePaintBucket"));
|
||||
assert_eq!(t.returns_to(), Some("livePaintBucket"));
|
||||
let a = t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 100.0, 150.0));
|
||||
assert_eq!(a, vec![Action::SwitchTool("livePaintBucket".into())]);
|
||||
// Neither a Key Color pick nor an Image Trace ignored-color pick is a gradient stop's.
|
||||
t.set_option("brushKeyColor", &json!(true));
|
||||
t.set_option("stop", &json!("livePaintBucket"));
|
||||
assert_eq!(t.returns_to(), None);
|
||||
let mut t = EyedropperTool::default();
|
||||
t.set_option("imageTraceIgnoreColor", &json!({"dialog": "imageTrace"}));
|
||||
t.set_option("stop", &json!("livePaintBucket"));
|
||||
assert_eq!(t.returns_to(), None);
|
||||
}
|
||||
|
||||
/// #8024: Escape ends a gradient stop's pick and a Key Color pick without sampling and
|
||||
@@ -1050,6 +1090,12 @@ mod tests {
|
||||
assert_eq!(sampled_hex(&EyedropperTool::default().pointer(&crate::testutil::cx(&d, &s, &p), &click)), "#00ff00");
|
||||
d.node_mut(l).unwrap().visible = false;
|
||||
assert!(EyedropperTool::default().pointer(&crate::testutil::cx(&d, &s, &p), &click).is_empty());
|
||||
// Distorted with its left and right swapped, the blue pixel is drawn at the left.
|
||||
d.node_mut(l).unwrap().visible = true;
|
||||
let q = [(30.0, 0.0), (0.0, 0.0), (0.0, 10.0), (40.0, 10.0)].map(|(x, y)| vectorcraft_geom::Point::new(x, y));
|
||||
d.node_mut(id).unwrap().set_image_corners(q).unwrap();
|
||||
let left = PointerEvent::new(PointerKind::Down, 4.0, 5.0);
|
||||
assert_eq!(sampled_hex(&EyedropperTool::default().pointer(&crate::testutil::cx(&d, &s, &p), &left)), "#0000ff");
|
||||
}
|
||||
|
||||
/// #2276: a CMYK image gives its ink amounts as they are, not the RGB its decoder shows.
|
||||
|
||||
@@ -629,6 +629,8 @@ pub fn accepts_field(d: &Dialog, field: &str) -> bool {
|
||||
/// Import PDF `allPages` set this way to the other pick sets Import PDF pages as links back to its
|
||||
/// default. A Dimension Tool Options `arrowStyle` set this way clears `arrowHead`, and a built-in
|
||||
/// `arrowHead` set this way sets both values of its Arrow Style entry, as that menu does.
|
||||
/// A Pathfinder effect's precision set this way replaces a stored precision out of range, the
|
||||
/// bound included.
|
||||
pub fn set_field(d: &mut Dialog, field: String, value: Value) {
|
||||
if d.kind == brush_options::KIND {
|
||||
brush_art_options::note_set(d, &field);
|
||||
@@ -651,6 +653,11 @@ pub fn set_field(d: &mut Dialog, field: String, value: Value) {
|
||||
if d.kind == new_document::KIND || new_document::popup_open(d) {
|
||||
new_document::note_set(d, &field);
|
||||
}
|
||||
// A Pathfinder effect's precision set this way replaces a stored one out of range, as one
|
||||
// entered in its field does.
|
||||
if d.kind == "effect" && field == "precision" {
|
||||
d.fields.remove(effect::OPENED_PRECISION);
|
||||
}
|
||||
// Create Object Mosaic's Resize Using Percentages shows the new size the other way, as its checkbox does.
|
||||
if d.kind == object_mosaic::KIND && field == "percentages" {
|
||||
object_mosaic::set_percentages(d, &value);
|
||||
|
||||
@@ -18,7 +18,16 @@ use crate::theme::Tokens;
|
||||
use crate::{VectorcraftApp, widgets};
|
||||
|
||||
pub(super) const SPEC: DialogSpec = DialogSpec {
|
||||
heading: |d| if super::warp_effect::is_warp(&d.str("__effect")) { tl!("Warp Options").to_string() } else { heading_label(d) },
|
||||
heading: |d| {
|
||||
let id = d.str("__effect");
|
||||
if super::warp_effect::is_warp(&id) {
|
||||
tl!("Warp Options").to_string()
|
||||
} else if has_only_pathfinder_options(&id) {
|
||||
tl!("Pathfinder Options").to_string()
|
||||
} else {
|
||||
heading_label(d)
|
||||
}
|
||||
},
|
||||
body,
|
||||
confirm,
|
||||
preview: true,
|
||||
@@ -125,6 +134,7 @@ pub fn open(app: &mut VectorcraftApp, p: &Value) -> Result<Value, String> {
|
||||
fields.insert("__editTarget".into(), edit_target);
|
||||
fields.insert("__index".into(), json!(k));
|
||||
fields.extend(params_of(e));
|
||||
fill_pathfinder_options(app, id, &mut fields, false);
|
||||
}
|
||||
None => {
|
||||
if let Some(k) = applied.iter().rposition(|e| e.id == id) {
|
||||
@@ -135,6 +145,7 @@ pub fn open(app: &mut VectorcraftApp, p: &Value) -> Result<Value, String> {
|
||||
return Ok(json!({ "pending": EXISTS }));
|
||||
}
|
||||
fields.extend(info.defaults.as_object().cloned().unwrap_or_default());
|
||||
fill_pathfinder_options(app, id, &mut fields, true);
|
||||
if super::warp_effect::is_warp(id) {
|
||||
super::warp_effect::merge_remembered(&mut fields, app.last_warp.as_ref());
|
||||
}
|
||||
@@ -155,6 +166,55 @@ fn target_effects(app: &VectorcraftApp, p: &Value) -> (Value, Vec<vectorcraft_do
|
||||
app.session.appearance_effect_target(¶ms).map(|(target, effects)| (target, effects.to_vec())).unwrap_or_else(|| (json!({}), vec![]))
|
||||
}
|
||||
|
||||
/// Is `id` a Pathfinder effect whose only options are its Pathfinder Options (every one but Soft
|
||||
/// Mix, which also has a Mixing Rate)?
|
||||
fn has_only_pathfinder_options(id: &str) -> bool {
|
||||
vectorcraft_effects::takes_pathfinder_options(id)
|
||||
&& vectorcraft_effects::default_params(id).is_some_and(|d| d.as_object().is_none_or(Map::is_empty))
|
||||
}
|
||||
|
||||
/// A Pathfinder effect's Pathfinder Options in `fields`, where they are missing: for a new effect
|
||||
/// (`fresh`) the Pathfinder panel's current options, as `effect.apply` takes them; for an applied
|
||||
/// one saved without them, the values it evaluates with. A precision out of range (one that Scale
|
||||
/// Strokes & Effects took past it) or not a number opens at the value it evaluates with, kept in
|
||||
/// `__openedPrecision`: OK leaves that value out unless the user enters a precision, so the stored
|
||||
/// one stays until the user changes it.
|
||||
fn fill_pathfinder_options(app: &VectorcraftApp, id: &str, fields: &mut Map<String, Value>, fresh: bool) {
|
||||
if !vectorcraft_effects::takes_pathfinder_options(id) {
|
||||
return;
|
||||
}
|
||||
let options =
|
||||
if fresh { super::pathfinder_options::options_in_force(app) } else { vectorcraft_effects::PathfinderEffectOptions::default().to_params() };
|
||||
for (key, v) in options.as_object().into_iter().flatten() {
|
||||
fields.entry(key.clone()).or_insert_with(|| v.clone());
|
||||
}
|
||||
if fields.get("precision").is_some_and(|v| !v.as_f64().is_some_and(|p| vectorcraft_effects::PATHFINDER_EFFECT_PRECISION.contains(&p))) {
|
||||
let evaluated = vectorcraft_effects::PathfinderEffectOptions::from_params(&json!({"precision": fields["precision"]})).precision;
|
||||
fields.insert("precision".into(), json!(evaluated));
|
||||
fields.insert(OPENED_PRECISION.into(), json!(evaluated));
|
||||
}
|
||||
}
|
||||
|
||||
/// The precision a Pathfinder effect's dialog opened at in place of a stored one out of range,
|
||||
/// until the user enters a precision.
|
||||
pub(super) const OPENED_PRECISION: &str = "__openedPrecision";
|
||||
|
||||
/// A Pathfinder effect's fields: Soft Mix's Mixing Rate as the other effects show their
|
||||
/// parameters, then the Pathfinder Options. Returns whether the values changed.
|
||||
fn pathfinder_fields(ui: &mut egui::Ui, d: &mut Dialog, id: &str, unit: vectorcraft_doc::Unit) -> bool {
|
||||
let before = d.fields.clone();
|
||||
if !has_only_pathfinder_options(id) {
|
||||
let options: Vec<(String, Value)> =
|
||||
vectorcraft_effects::PATHFINDER_OPTION_KEYS.iter().filter_map(|k| d.fields.remove(*k).map(|v| (k.to_string(), v))).collect();
|
||||
let doc = vectorcraft_effects::effect_info(id).map(|e| e.params).unwrap_or_default();
|
||||
form::param_fields(ui, d, &|_| false, &|k| choices(id, k), &|k| doc_rank(doc, k), unit);
|
||||
d.fields.extend(options);
|
||||
ui.add_space(6.0);
|
||||
}
|
||||
super::pathfinder_options::fields(ui, d);
|
||||
before != d.fields
|
||||
}
|
||||
|
||||
/// An applied effect's values over its defaults.
|
||||
fn params_of(e: &vectorcraft_doc::Effect) -> Map<String, Value> {
|
||||
match vectorcraft_effects::merged_params(&e.id, &e.params) {
|
||||
@@ -174,6 +234,7 @@ fn confirm_exists(app: &mut VectorcraftApp, d: &Dialog) -> Result<Value, String>
|
||||
let id = d.str("__effect");
|
||||
let defaults = vectorcraft_effects::default_params(&id);
|
||||
fields.extend(defaults.and_then(|v| v.as_object().cloned()).unwrap_or_default());
|
||||
fill_pathfinder_options(app, &id, &mut fields, true);
|
||||
if super::warp_effect::is_warp(id.as_str()) {
|
||||
super::warp_effect::merge_remembered(&mut fields, app.last_warp.as_ref());
|
||||
}
|
||||
@@ -183,6 +244,7 @@ fn confirm_exists(app: &mut VectorcraftApp, d: &Dialog) -> Result<Value, String>
|
||||
let applied = app.session.appearance_effect_target(&edit_target).map(|(_, effects)| effects.to_vec()).unwrap_or_default();
|
||||
let params = applied.get(k).map(params_of).unwrap_or_default();
|
||||
fields.extend(params);
|
||||
fill_pathfinder_options(app, &d.str("__effect"), &mut fields, false);
|
||||
fields.insert("__item".into(), target);
|
||||
}
|
||||
fields.insert("preview".into(), json!(true));
|
||||
@@ -237,6 +299,7 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool {
|
||||
super::raster_effects::effect_fields(app, ui, d);
|
||||
values_changed(d)
|
||||
}
|
||||
None if vectorcraft_effects::takes_pathfinder_options(&id) => pathfinder_fields(ui, d, &id, app.session.general_unit()),
|
||||
None => {
|
||||
let doc = vectorcraft_effects::effect_info(&id).map(|e| e.params).unwrap_or_default();
|
||||
let unit = app.session.general_unit();
|
||||
@@ -1035,6 +1098,12 @@ fn command(d: &Dialog) -> (&'static str, Value) {
|
||||
p["index"] = index.clone();
|
||||
p["item"] = item.unwrap_or(Value::Null);
|
||||
p["params"] = params;
|
||||
// A precision the dialog opened at in place of a stored one out of range keeps the stored one.
|
||||
if let (Some(opened), Some(Value::Object(m))) = (d.fields.get(OPENED_PRECISION).and_then(Value::as_f64), p.get_mut("params"))
|
||||
&& m.get("precision").and_then(Value::as_f64) == Some(opened)
|
||||
{
|
||||
m.remove("precision");
|
||||
}
|
||||
let id = d.str("__effect");
|
||||
// Each target keeps the map its own Warp draws with: the dialog's `version` is the first
|
||||
// target's.
|
||||
@@ -1517,6 +1586,101 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
/// An applied Pathfinder effect opens Pathfinder Options with its own values (the defaults for
|
||||
/// one saved without them); OK keeps a change as one undo step, and OK with nothing changed
|
||||
/// records none. Soft Mix's dialog has Mixing Rate too, and a new one takes the panel's options.
|
||||
#[test]
|
||||
fn a_pathfinder_effect_opens_pathfinder_options_with_its_own_values() {
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
|
||||
app.run("file.new", json!({"width": 200, "height": 200})).unwrap();
|
||||
app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap();
|
||||
app.run("shape.rectangle", json!({"x": 40, "y": 40, "width": 50, "height": 50})).unwrap();
|
||||
app.run("select.all", json!({})).unwrap();
|
||||
app.run("effect.apply", json!({"effect": "pathfinder.add", "params": {"precision": 0.5}})).unwrap();
|
||||
let g = app.session.doc().unwrap().selection.objects[0];
|
||||
let steps = |app: &VectorcraftApp| app.session.doc().unwrap().history.undo.len();
|
||||
let paint = |app: &mut VectorcraftApp| crate::tests_labels::painted_text(app, |app, ui| super::super::show(app, ui.ctx()));
|
||||
app.run("effect.dialog", json!({"effect": "pathfinder.add", "index": 0, "item": null})).unwrap();
|
||||
let text = paint(&mut app);
|
||||
for s in ["Pathfinder Options", "Precision:", "Remove Redundant Points", "Divide and Outline Will Remove Unpainted Artwork"] {
|
||||
assert!(text.lines().any(|l| l == s), "{s} in {text}");
|
||||
}
|
||||
assert_eq!(app.ui.dialog.as_ref().unwrap().fields["precision"], json!(0.5));
|
||||
let before = steps(&app);
|
||||
super::super::confirm(&mut app).unwrap();
|
||||
assert_eq!(steps(&app), before, "OK with nothing changed records no step");
|
||||
app.run("effect.dialog", json!({"effect": "pathfinder.add", "index": 0, "item": null})).unwrap();
|
||||
paint(&mut app);
|
||||
app.ui.dialog.as_mut().unwrap().fields.insert("removeRedundantPoints".into(), json!(true));
|
||||
paint(&mut app);
|
||||
super::super::confirm(&mut app).unwrap();
|
||||
assert_eq!(steps(&app), before + 1, "one step");
|
||||
let params = |app: &VectorcraftApp| app.session.doc().unwrap().doc.node(g).unwrap().appearance.effects[0].params.clone();
|
||||
assert_eq!(params(&app)["removeRedundantPoints"], json!(true));
|
||||
// Saved without options, it opens with the values it evaluates with.
|
||||
app.session
|
||||
.edit("t", |d, _| {
|
||||
d.node_mut(g).unwrap().appearance.effects[0].params = json!({});
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
app.run("effect.dialog", json!({"effect": "pathfinder.add", "index": 0, "item": null})).unwrap();
|
||||
let fields = &app.ui.dialog.as_ref().unwrap().fields;
|
||||
assert_eq!(
|
||||
(&fields["precision"], &fields["removeRedundantPoints"], &fields["removeUnpainted"]),
|
||||
(&json!(0.01), &json!(false), &json!(false))
|
||||
);
|
||||
app.ui.dialog = None;
|
||||
let _ = app.session.cancel_interaction();
|
||||
// A new Soft Mix takes the panel's options and shows Mixing Rate beside them.
|
||||
app.run("object.pathfinder.options", json!({"removeUnpainted": true})).unwrap();
|
||||
app.run("effect.dialog", json!({"effect": "pathfinder.softMix"})).unwrap();
|
||||
let text = paint(&mut app);
|
||||
assert!(text.contains("Mixing Rate") && text.lines().any(|l| l == "Remove Redundant Points"), "{text}");
|
||||
assert_eq!(app.ui.dialog.as_ref().unwrap().fields["removeUnpainted"], json!(true));
|
||||
}
|
||||
|
||||
/// A Pathfinder effect whose precision Scale Strokes & Effects took past the range opens at the
|
||||
/// bound it evaluates at. OK with nothing changed records no step, OK with another option
|
||||
/// changed keeps the stored precision, and a precision the user sets replaces it.
|
||||
#[test]
|
||||
fn a_pathfinder_precision_scaled_past_its_range_opens_at_the_bound_and_ok_keeps_it() {
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
|
||||
app.run("file.new", json!({"width": 200, "height": 200})).unwrap();
|
||||
app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap();
|
||||
app.run("shape.rectangle", json!({"x": 40, "y": 40, "width": 50, "height": 50})).unwrap();
|
||||
app.run("select.all", json!({})).unwrap();
|
||||
app.run("effect.apply", json!({"effect": "pathfinder.add", "params": {"precision": 8}})).unwrap();
|
||||
let g = app.session.doc().unwrap().selection.objects[0];
|
||||
app.run("object.scale", json!({"sx": 200, "strokes": true})).unwrap();
|
||||
let params = |app: &VectorcraftApp| app.session.doc().unwrap().doc.node(g).unwrap().appearance.effects[0].params.clone();
|
||||
assert_eq!(params(&app)["precision"].as_f64(), Some(16.0));
|
||||
let steps = |app: &VectorcraftApp| app.session.doc().unwrap().history.undo.len();
|
||||
let open = |app: &mut VectorcraftApp| {
|
||||
app.run("effect.dialog", json!({"effect": "pathfinder.add", "index": 0, "item": null})).unwrap();
|
||||
assert_eq!(app.ui.dialog.as_ref().unwrap().fields["precision"].as_f64(), Some(10.0));
|
||||
};
|
||||
open(&mut app);
|
||||
let before = steps(&app);
|
||||
super::super::confirm(&mut app).unwrap();
|
||||
assert_eq!((steps(&app), params(&app)["precision"].as_f64()), (before, Some(16.0)), "OK with nothing changed");
|
||||
open(&mut app);
|
||||
app.ui.dialog.as_mut().unwrap().fields.insert("removeRedundantPoints".into(), json!(true));
|
||||
super::super::confirm(&mut app).unwrap();
|
||||
assert_eq!((params(&app)["precision"].as_f64(), ¶ms(&app)["removeRedundantPoints"]), (Some(16.0), &json!(true)));
|
||||
open(&mut app);
|
||||
app.ui.dialog.as_mut().unwrap().fields.insert("precision".into(), json!(2.5));
|
||||
super::super::confirm(&mut app).unwrap();
|
||||
assert_eq!(params(&app)["precision"].as_f64(), Some(2.5));
|
||||
// Setting the bound itself (`ui.dialog.set`, or the Precision field) replaces a stored value past it.
|
||||
app.run("object.scale", json!({"sx": 800, "strokes": true})).unwrap();
|
||||
assert_eq!(params(&app)["precision"].as_f64(), Some(20.0));
|
||||
open(&mut app);
|
||||
super::super::set_field(app.ui.dialog.as_mut().unwrap(), "precision".into(), json!(10.0));
|
||||
super::super::confirm(&mut app).unwrap();
|
||||
assert_eq!(params(&app)["precision"].as_f64(), Some(10.0));
|
||||
}
|
||||
|
||||
/// A Radial Blur whose saved Blur Center lies outside the object's bounds (a document written
|
||||
/// by hand or by another build) opens with the center at the nearest edge, and OK stores that
|
||||
/// edge instead of sending the saved value, which `effect.setParams` refuses.
|
||||
|
||||
@@ -6,7 +6,11 @@
|
||||
//! a file read from a path and opened without a password; `null` until it is checked or cleared,
|
||||
//! when it follows the pages picked: on for All, off for a range; picking the other of All and
|
||||
//! Range sets it back to `null`; `__linkable` is false for a file `linkPages` does not take, such as
|
||||
//! one over its size limit), `cropTo` and `password`. `__locked` is set
|
||||
//! one over its size limit), `cropTo`, `textAs` (`text` | `outlines`; it starts from the `pdfTextAs`
|
||||
//! preference for a PDF (`__pdf`; Editable for a `.ai` or `.ait` file), or from the `textAs` a place
|
||||
//! gives (`__textAsGiven`), and OK keeps a PDF's choice there; a
|
||||
//! linked place shows the file's own text, so placing linked leaves it as it is, and Outlines clears
|
||||
//! Import PDF Pages as Links) and `password`. `__locked` is set
|
||||
//! until the password is accepted: OK then unlocks the file, and with `__passwordOnly` (Place with
|
||||
//! Show Import Options off) places its first page at once. `__place` keeps the other `file.place`
|
||||
//! params (Link, Template, `at`…). The file's bytes stay out of the fields, in
|
||||
@@ -17,7 +21,7 @@ use std::sync::atomic::{AtomicU64, Ordering};
|
||||
|
||||
use serde_json::{Value, json};
|
||||
use vectorcraft_engine::cmd::fileio;
|
||||
use vectorcraft_pdf::{Choice, CropTo, PdfError};
|
||||
use vectorcraft_pdf::{Choice, CropTo, PdfError, TextAs};
|
||||
|
||||
use super::DialogSpec;
|
||||
use crate::state::Dialog;
|
||||
@@ -149,6 +153,10 @@ pub fn offer(app: &mut VectorcraftApp, name: &str, bytes: &[u8], path: Option<St
|
||||
"range": "",
|
||||
"linkPages": null,
|
||||
"cropTo": CropTo::default().id(),
|
||||
// The PDF Text preference is for PDFs: a `.ai` or `.ait` file starts from Editable, as it
|
||||
// opens or is placed without the dialog.
|
||||
"textAs": if format == "pdf" { preferred_text_as(app) } else { TextAs::Text }.id(),
|
||||
"__pdf": format == "pdf",
|
||||
"password": "",
|
||||
"__locked": locked,
|
||||
"__linkable": fileio::pages_can_link(name, bytes),
|
||||
@@ -157,7 +165,15 @@ pub fn offer(app: &mut VectorcraftApp, name: &str, bytes: &[u8], path: Option<St
|
||||
fields["path"] = json!(p);
|
||||
}
|
||||
if let Some(p) = place {
|
||||
fields["__place"] = other_place_params(p, &["page", "crop", "password"]);
|
||||
// A `textAs` the place gives starts the Text choice; one that isn't a choice stays with
|
||||
// the other params, for `file.place` to refuse.
|
||||
let given = p.get("textAs").and_then(Value::as_str).filter(|id| TextAs::IDS.iter().any(|i| i.eq_ignore_ascii_case(id)));
|
||||
if let Some(id) = given {
|
||||
fields["textAs"] = json!(text_as_of(id).id());
|
||||
fields["__textAsGiven"] = json!(true);
|
||||
}
|
||||
let taken: &[&str] = if given.is_some() { &["page", "crop", "password", "textAs"] } else { &["page", "crop", "password"] };
|
||||
fields["__place"] = other_place_params(p, taken);
|
||||
}
|
||||
app.ui.dialog = Some(Dialog::new(KIND, fields));
|
||||
true
|
||||
@@ -217,13 +233,92 @@ fn password(d: &Dialog) -> Option<String> {
|
||||
Some(d.str("password")).filter(|p| !p.is_empty())
|
||||
}
|
||||
|
||||
/// Can the pages open linked: the file was read from a path (a linked page is read from its
|
||||
/// The labels of the Text choices, in the order of [`TextAs::ALL`].
|
||||
const TEXT_AS_LABELS: [&str; 2] = ["Editable", "Outlines"];
|
||||
|
||||
/// The `textAs` choice `id` (any case); anything else is editable text.
|
||||
fn text_as_of(id: &str) -> TextAs {
|
||||
TextAs::ALL.iter().zip(TextAs::IDS).find(|(_, i)| i.eq_ignore_ascii_case(id)).map(|(t, _)| *t).unwrap_or_default()
|
||||
}
|
||||
|
||||
/// What a PDF's text becomes when an open or place from the app does not say: the `pdfTextAs`
|
||||
/// preference.
|
||||
pub(crate) fn preferred_text_as(app: &VectorcraftApp) -> TextAs {
|
||||
text_as_of(&app.session.prefs.pdf_text_as)
|
||||
}
|
||||
|
||||
/// The `document.open` options `p` for the file `name` holding `bytes`, with the `pdfTextAs`
|
||||
/// preference as its `textAs` when it is a PDF opened as Outlines and `p` has no `textAs`. A `.ai`
|
||||
/// or `.ait` file opens as it says: Outlines would open it from its PDF content, without its
|
||||
/// editing data. So does an open with `linkPages`, which refuses Outlines: a linked page shows the
|
||||
/// file's own text.
|
||||
pub(crate) fn with_preferred_text_as(app: &VectorcraftApp, name: &str, bytes: &[u8], p: &Value) -> Value {
|
||||
let given = p.get("textAs").is_some_and(|v| !v.is_null());
|
||||
let linked = p.get("linkPages").and_then(Value::as_bool) == Some(true);
|
||||
let options = p.is_object() || p.is_null();
|
||||
if given || linked || !options || preferred_text_as(app) == TextAs::Text || fileio::detect(name, bytes).map(|f| f.id) != Some("pdf") {
|
||||
return p.clone();
|
||||
}
|
||||
let mut p = if p.is_object() { p.clone() } else { json!({}) };
|
||||
p["textAs"] = json!(TextAs::Outlines.id());
|
||||
p
|
||||
}
|
||||
|
||||
/// The `file.place` params `p` of a PDF the user places embedded (Link off, from bytes or with a
|
||||
/// password) get the `pdfTextAs` preference as their `textAs` when it is Outlines and they have no
|
||||
/// `textAs`. A linked page shows the file's own text, and a `.ai` or `.ait` file is placed as it
|
||||
/// says.
|
||||
pub(crate) fn place_with_preferred_text_as(app: &VectorcraftApp, p: &mut Value) {
|
||||
let given = |k: &str| p.get(k).is_some_and(|v| !v.is_null());
|
||||
let path = p.get("path").and_then(Value::as_str);
|
||||
let name = path.or_else(|| p.get("name").and_then(Value::as_str)).unwrap_or_default();
|
||||
let linked = path.is_some() && p.get("link").and_then(Value::as_bool) != Some(false) && !given("password");
|
||||
if given("textAs") || linked || preferred_text_as(app) == TextAs::Text || fileio::extension(name) != "pdf" {
|
||||
return;
|
||||
}
|
||||
if let Some(o) = p.as_object_mut() {
|
||||
o.insert("textAs".into(), json!(TextAs::Outlines.id()));
|
||||
}
|
||||
}
|
||||
|
||||
fn text_as(d: &Dialog) -> TextAs {
|
||||
text_as_of(&d.str("textAs"))
|
||||
}
|
||||
|
||||
/// A place that links the page: from a path, with Link on, without a password (`file.place`
|
||||
/// embeds a page read with a password) and without a `textAs` given with the place (`__textAsGiven`:
|
||||
/// the Text choice then decides, and Outlines embeds the page). A linked page shows the file's own
|
||||
/// text, so the Text choice does not apply to it.
|
||||
fn places_linked(d: &Dialog) -> bool {
|
||||
d.str("mode") == "place"
|
||||
&& d.fields.get("path").and_then(Value::as_str).is_some()
|
||||
&& d.fields.get("__place").and_then(|p| p.get("link")).and_then(Value::as_bool) != Some(false)
|
||||
&& password(d).is_none()
|
||||
&& !d.bool("__textAsGiven")
|
||||
}
|
||||
|
||||
/// Can the file's pages open linked: it was read from a path (a linked page is read from its
|
||||
/// file again), `document.open`'s `linkPages` takes its size, and it opens without a password
|
||||
/// (`linkPages` refuses one).
|
||||
fn can_link(d: &Dialog) -> bool {
|
||||
fn file_can_link(d: &Dialog) -> bool {
|
||||
d.fields.get("path").and_then(Value::as_str).is_some() && d.bool("__linkable") && password(d).is_none()
|
||||
}
|
||||
|
||||
/// Can the pages open linked: [`file_can_link`], with the text kept editable (`linkPages`
|
||||
/// refuses `textAs: outlines`).
|
||||
fn can_link(d: &Dialog) -> bool {
|
||||
file_can_link(d) && text_as(d) == TextAs::Text
|
||||
}
|
||||
|
||||
/// Keeps the Text choice OK confirmed in the `pdfTextAs` preference.
|
||||
fn keep_text_as(app: &mut VectorcraftApp, text_as: TextAs) {
|
||||
if preferred_text_as(app) != text_as {
|
||||
// The open or place has already happened; a preference that can't be written only means
|
||||
// the next dialog starts from the old choice.
|
||||
let _ = app.run("prefs.set", json!({"key": "pdfTextAs", "value": text_as.id()}));
|
||||
}
|
||||
}
|
||||
|
||||
/// Import PDF Pages as Links as checked or cleared, or, when it is `null`, as the pages picked
|
||||
/// default it: on for All, off for a range.
|
||||
fn link_pages(d: &Dialog) -> bool {
|
||||
@@ -283,9 +378,13 @@ fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result<Value, String> {
|
||||
if let Some(pw) = password(&d) {
|
||||
p["password"] = json!(pw);
|
||||
}
|
||||
// A `textAs` left with the other params is one `file.place` refuses; null leaves it out.
|
||||
if !places_linked(&d) && p.get("textAs").is_none_or(Value::is_null) {
|
||||
p["textAs"] = json!(text_as(&d).id());
|
||||
}
|
||||
crate::place::run_for_user(app, &p).map(|_| ())
|
||||
} else {
|
||||
let mut p = json!({"cropTo": crop(&d).id(), "password": password(&d)});
|
||||
let mut p = json!({"cropTo": crop(&d).id(), "password": password(&d), "textAs": text_as(&d).id()});
|
||||
let range = d.str("range");
|
||||
if !d.bool("allPages") && !range.trim().is_empty() {
|
||||
p["pages"] = json!(range);
|
||||
@@ -297,6 +396,11 @@ fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result<Value, String> {
|
||||
};
|
||||
match r {
|
||||
Ok(()) => {
|
||||
// Asked only for the password, the dialog showed no Text choice to keep; the choice
|
||||
// for a `.ai` or `.ait` file is not kept for PDFs.
|
||||
if !places_linked(&d) && !d.bool("__passwordOnly") && d.bool("__pdf") {
|
||||
keep_text_as(app, text_as(&d));
|
||||
}
|
||||
// Opening may have asked something else (the profile of the document); only this
|
||||
// dialog closes.
|
||||
if app.ui.dialog.as_ref().is_some_and(|x| x.kind == KIND) {
|
||||
@@ -359,6 +463,18 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool {
|
||||
d.fields.insert("cropTo".into(), json!(id));
|
||||
}
|
||||
});
|
||||
ui.add_space(4.0);
|
||||
let linked = places_linked(d);
|
||||
widgets::label_row(ui, tl!("Text"), LABEL_WIDTH, |ui| {
|
||||
let current = TextAs::ALL.iter().position(|t| *t == text_as(d)).and_then(|i| TEXT_AS_LABELS.get(i)).copied().unwrap_or_default();
|
||||
let picked = ui.add_enabled_ui(!linked, |ui| widgets::dropdown(ui, "pdf-text-as", current, &TEXT_AS_LABELS, 130.0)).inner;
|
||||
if let Some(t) = picked.and_then(|i| TextAs::ALL.get(i)) {
|
||||
d.fields.insert("textAs".into(), json!(t.id()));
|
||||
}
|
||||
});
|
||||
if linked {
|
||||
widgets::dim_label(ui, tl!("Linked pages show the file's own text."));
|
||||
}
|
||||
if d.str("mode") != "place" {
|
||||
ui.add_space(10.0);
|
||||
ui.label(egui::RichText::new(tl!("Pages")).color(t.text));
|
||||
@@ -379,6 +495,10 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool {
|
||||
if widgets::check(ui, tl!("Import PDF pages as links"), links_on(d), can_link(d)) {
|
||||
d.fields.insert("linkPages".into(), json!(!link_pages(d)));
|
||||
}
|
||||
// Outlines alone dims the box.
|
||||
if text_as(d) == TextAs::Outlines && file_can_link(d) {
|
||||
widgets::dim_label(ui, tl!("Linked pages show the file's own text."));
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -399,12 +519,14 @@ fn password_row(ui: &mut egui::Ui, d: &mut Dialog) {
|
||||
});
|
||||
}
|
||||
|
||||
/// Page `page` (1-based) cropped as the dialog says, rendered once per file, page and box.
|
||||
/// Page `page` (1-based) cropped and with its text as the dialog says (a linked place: as
|
||||
/// editable text, as before the choice), rendered once per file, page, box and text choice.
|
||||
fn preview(app: &mut VectorcraftApp, ctx: &egui::Context, d: &Dialog, page: usize) -> Option<egui::TextureHandle> {
|
||||
let file = app.ui.dialog_file.clone()?;
|
||||
let crop = crop(d);
|
||||
let key = egui::Id::unique(("pdf-preview", file.token, page, crop.id()));
|
||||
let opts = fileio::LoadOptions { crop, password: password(d), ..Default::default() };
|
||||
let text_as = if places_linked(d) { TextAs::Text } else { text_as(d) };
|
||||
let key = egui::Id::unique(("pdf-preview", file.token, page, crop.id(), text_as.id()));
|
||||
let opts = fileio::LoadOptions { crop, password: password(d), text_as, ..Default::default() };
|
||||
// A page that can't be read shows an empty preview (and isn't read again).
|
||||
preview_texture(app, ctx, key, &format!("pdf-preview-{page}"), PREVIEW, || {
|
||||
fileio::page_document(&file.bytes, page - 1, &opts).ok().map(|(doc, _)| doc)
|
||||
|
||||
@@ -21,6 +21,31 @@ pub fn open(app: &mut VectorcraftApp) {
|
||||
app.ui.dialog = Some(Dialog::new(KIND, json!(app.session.prefs.pathfinder)));
|
||||
}
|
||||
|
||||
/// The Pathfinder Options that `effect.apply` gives a new Pathfinder effect, as its params.
|
||||
pub fn options_in_force(app: &VectorcraftApp) -> Value {
|
||||
vectorcraft_engine::cmd::pathfinder_effect_options(&app.session).to_params()
|
||||
}
|
||||
|
||||
/// The params that an Effect › Pathfinder menu item with params `p` (`effect.apply`) runs with: its
|
||||
/// `params` with the Pathfinder Options in force ([`options_in_force`]) added where they are
|
||||
/// missing, as `effect.apply` journals them. Insert Menu Item stores the same params as the item's
|
||||
/// step. Params of any other effect are returned unchanged.
|
||||
pub fn menu_effect_params(app: &VectorcraftApp, mut p: Value) -> Value {
|
||||
if !p.get("effect").and_then(Value::as_str).is_some_and(vectorcraft_effects::takes_pathfinder_options) {
|
||||
return p;
|
||||
}
|
||||
let options = options_in_force(app);
|
||||
if let Some(o) = p.as_object_mut() {
|
||||
let params = o.entry("params").or_insert_with(|| json!({}));
|
||||
if let (Some(params), Some(options)) = (params.as_object_mut(), options.as_object()) {
|
||||
for (key, v) in options {
|
||||
params.entry(key.clone()).or_insert_with(|| v.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
p
|
||||
}
|
||||
|
||||
fn check(ui: &mut egui::Ui, d: &mut Dialog, key: &str, text: &str) {
|
||||
let v = d.bool(key);
|
||||
if widgets::check(ui, text, v, true) {
|
||||
@@ -29,19 +54,28 @@ fn check(ui: &mut egui::Ui, d: &mut Dialog, key: &str, text: &str) {
|
||||
}
|
||||
|
||||
fn body(_: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool {
|
||||
fields(ui, d);
|
||||
false
|
||||
}
|
||||
|
||||
/// Precision, Remove Redundant Points and Divide and Outline Will Remove Unpainted Artwork, editing
|
||||
/// `precision`, `removeRedundantPoints` and `removeUnpainted` in `d` (this dialog's, and a
|
||||
/// Pathfinder effect's in the effect dialog).
|
||||
pub(super) fn fields(ui: &mut egui::Ui, d: &mut Dialog) {
|
||||
let range = vectorcraft_engine::cmd::PATHFINDER_PRECISION_RANGE;
|
||||
grid(ui, |ui| {
|
||||
label(ui, tl!("Precision:"));
|
||||
let v = d.f64("precision", vectorcraft_engine::PathfinderOptions::default().precision);
|
||||
if let Some(v) = widgets::range_field(ui, "pathfinder-precision", v, range, " pt", 3, 80.0) {
|
||||
d.fields.insert("precision".into(), json!(v));
|
||||
// An entered precision replaces a stored one out of range, the bound included.
|
||||
d.fields.remove(super::effect::OPENED_PRECISION);
|
||||
}
|
||||
ui.end_row();
|
||||
});
|
||||
ui.add_space(8.0);
|
||||
check(ui, d, "removeRedundantPoints", tl!("Remove Redundant Points"));
|
||||
check(ui, d, "removeUnpainted", tl!("Divide and Outline Will Remove Unpainted Artwork"));
|
||||
false
|
||||
}
|
||||
|
||||
fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result<Value, String> {
|
||||
|
||||
@@ -350,3 +350,144 @@ fn the_import_dialog_stays_where_there_is_something_to_ask() {
|
||||
assert!(import_pdf::offer(&mut app, "two.ai", &two_pages(true, None), None, Some(&json!({}))));
|
||||
assert_eq!(app.ui.dialog.as_ref().unwrap().str("mode"), "place");
|
||||
}
|
||||
|
||||
/// `pages` pages, each showing "AB" in a font the file names without embedding it.
|
||||
fn text_pages(pages: usize) -> Vec<u8> {
|
||||
let font = format!("/Font << /F1 {} 0 R >>", first_extra(pages));
|
||||
let page = PdfPage { resources: font, ..PdfPage::new(100.0, 100.0, "BT /F1 20 Tf 1 0 0 1 10 40 Tm (AB) Tj ET") };
|
||||
pdf_with(&vec![page; pages], &["<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>"], None)
|
||||
}
|
||||
|
||||
/// The type objects of the active document.
|
||||
fn type_objects(app: &VectorcraftApp) -> usize {
|
||||
let mut n = 0;
|
||||
app.session.active().unwrap().doc.walk(|node| n += usize::from(matches!(node.kind, NodeKind::Text(_))));
|
||||
n
|
||||
}
|
||||
|
||||
fn set_pdf_text(app: &mut VectorcraftApp, value: &str) {
|
||||
app.run("prefs.set", json!({"key": "pdfTextAs", "value": value})).unwrap();
|
||||
}
|
||||
|
||||
/// The Import PDF dialog is closed; the Missing Fonts dialog an editable open asks with is
|
||||
/// dismissed.
|
||||
fn opened(app: &mut VectorcraftApp) {
|
||||
assert!(!app.ui.dialog.as_ref().is_some_and(|d| d.kind == import_pdf::KIND), "the Import PDF dialog closed");
|
||||
app.ui.dialog = None;
|
||||
app.ui.pending_fonts.clear();
|
||||
}
|
||||
|
||||
/// The Text choice starts from the PDF Text preference (Editable by default), Outlines opens the
|
||||
/// pages' text as outlines, and OK keeps the choice for the next PDF. Outlines clears and dims
|
||||
/// Import PDF pages as links (`linkPages` refuses it).
|
||||
#[test]
|
||||
fn the_text_choice_opens_text_as_outlines_and_is_kept() {
|
||||
let mut app = app();
|
||||
assert_eq!(app.session.prefs.pdf_text_as, "text");
|
||||
io::open_bytes(&mut app, "two.pdf", &text_pages(2), None).unwrap();
|
||||
assert_eq!(field(&app, "textAs"), "text", "Editable by default");
|
||||
frame(&mut app);
|
||||
confirm(&mut app).unwrap();
|
||||
opened(&mut app);
|
||||
assert_eq!(type_objects(&app), 2, "one type object per page");
|
||||
assert_eq!(app.session.prefs.pdf_text_as, "text");
|
||||
|
||||
io::open_bytes(&mut app, "two.pdf", &text_pages(2), None).unwrap();
|
||||
set(&mut app, "textAs", json!("outlines"));
|
||||
frame(&mut app);
|
||||
confirm(&mut app).unwrap();
|
||||
opened(&mut app);
|
||||
assert_eq!(type_objects(&app), 0, "the text is outlines");
|
||||
assert_eq!(app.session.prefs.pdf_text_as, "outlines", "OK keeps the choice");
|
||||
|
||||
// The next PDF starts from Outlines; a file it could link opens unlinked while Outlines is picked.
|
||||
io::open_bytes(&mut app, "/tmp/two.pdf", &text_pages(2), Some("/tmp/two.pdf".into())).unwrap();
|
||||
assert_eq!(field(&app, "textAs"), "outlines");
|
||||
assert!(!import_pdf::links_on(app.ui.dialog.as_ref().unwrap()), "Outlines: not linked");
|
||||
frame(&mut app);
|
||||
set(&mut app, "textAs", json!("text"));
|
||||
assert!(import_pdf::links_on(app.ui.dialog.as_ref().unwrap()), "Editable: All links the pages again");
|
||||
}
|
||||
|
||||
/// A PDF that opens without the dialog (one page) takes the PDF Text preference, unless the open
|
||||
/// gives `textAs`; a `.ai` file opens as it says.
|
||||
#[test]
|
||||
fn a_pdf_opened_without_the_dialog_takes_the_pdf_text_preference() {
|
||||
let mut app = app();
|
||||
let one = text_pages(1);
|
||||
io::open_bytes(&mut app, "one.pdf", &one, None).unwrap();
|
||||
opened(&mut app);
|
||||
assert_eq!(type_objects(&app), 1, "Editable by default");
|
||||
set_pdf_text(&mut app, "outlines");
|
||||
io::open_bytes(&mut app, "one.pdf", &one, None).unwrap();
|
||||
opened(&mut app);
|
||||
assert_eq!(type_objects(&app), 0, "Outlines");
|
||||
io::open_document(&mut app, "one.pdf", &one, None, &json!({"textAs": "text"})).unwrap();
|
||||
opened(&mut app);
|
||||
assert_eq!(type_objects(&app), 1, "an open that gives textAs keeps it");
|
||||
let p = import_pdf::with_preferred_text_as(&app, "one.ai", &one, &serde_json::Value::Null);
|
||||
assert!(p.is_null(), "a .ai file opens as it says: {p}");
|
||||
// In the dialog too, a .ai file starts from Editable, and its choice is not kept for PDFs.
|
||||
assert!(import_pdf::offer(&mut app, "two.ai", &two_pages(false, None), None, None));
|
||||
assert_eq!(field(&app, "textAs"), "text", "a .ai file starts from Editable");
|
||||
frame(&mut app);
|
||||
confirm(&mut app).unwrap();
|
||||
opened(&mut app);
|
||||
assert_eq!(app.session.prefs.pdf_text_as, "outlines", "the preference stays");
|
||||
// An open with linkPages keeps the file's own text, which linked pages show.
|
||||
let dir = vectorcraft_testkit::TempDir::new("import-pdf-text-link-pages");
|
||||
let path = dir.join("one.pdf").to_string_lossy().into_owned();
|
||||
std::fs::write(&path, &one).unwrap();
|
||||
io::open_document(&mut app, &path, &one, Some(path.clone()), &json!({"linkPages": true})).unwrap();
|
||||
opened(&mut app);
|
||||
assert_eq!(placed_pages(&app), [true], "opened linked");
|
||||
}
|
||||
|
||||
/// Placing a page embedded takes the Text choice (and the preference when no dialog asks); a
|
||||
/// linked place shows the file's own text, so the choice is dimmed and not sent.
|
||||
#[test]
|
||||
fn the_text_choice_applies_to_embedded_places_only() {
|
||||
let mut app = app();
|
||||
// `textAs: null` leaves the param out: the dialog's choice is sent.
|
||||
place(&mut app, &text_pages(2), json!({"link": false, "textAs": null})).unwrap();
|
||||
assert_eq!(field(&app, "textAs"), "text");
|
||||
set(&mut app, "textAs", json!("outlines"));
|
||||
frame(&mut app);
|
||||
confirm(&mut app).unwrap();
|
||||
opened(&mut app);
|
||||
assert_eq!(type_objects(&app), 0, "placed as outlines");
|
||||
assert_eq!(app.session.prefs.pdf_text_as, "outlines");
|
||||
// One page asks nothing: placed by the user, it takes the preference.
|
||||
let one = json!({"name": "one.pdf", "dataBase64": vectorcraft_format::base64_encode(&text_pages(1))});
|
||||
crate::place::run_for_user(&mut app, &one).unwrap();
|
||||
assert_eq!(type_objects(&app), 0, "the preference");
|
||||
set_pdf_text(&mut app, "text");
|
||||
crate::place::run_for_user(&mut app, &one).unwrap();
|
||||
assert_eq!(type_objects(&app), 1);
|
||||
|
||||
// Linked: the choice is not sent, and OK leaves the preference as it is.
|
||||
set_pdf_text(&mut app, "outlines");
|
||||
let dir = vectorcraft_testkit::TempDir::new("import-pdf-text-linked");
|
||||
let path = dir.join("two.pdf").to_string_lossy().into_owned();
|
||||
std::fs::write(&path, text_pages(2)).unwrap();
|
||||
assert!(import_pdf::offer(&mut app, &path, &text_pages(2), Some(path.clone()), Some(&json!({"link": true}))));
|
||||
frame(&mut app);
|
||||
confirm(&mut app).unwrap();
|
||||
let st = app.session.active().unwrap();
|
||||
let placed = st.doc.node(st.selection.objects[0]).unwrap();
|
||||
assert!(matches!(placed.kind, NodeKind::PlacedDocument(_)), "linked: {:?}", placed.kind);
|
||||
assert_eq!(app.session.prefs.pdf_text_as, "outlines");
|
||||
|
||||
// A place that gives `textAs: "outlines"` with Link on is embedded as outlines, as without the dialog.
|
||||
set_pdf_text(&mut app, "text");
|
||||
assert!(import_pdf::offer(&mut app, &path, &text_pages(2), Some(path.clone()), Some(&json!({"link": true, "textAs": "outlines"}))));
|
||||
assert_eq!(field(&app, "textAs"), "outlines");
|
||||
frame(&mut app);
|
||||
let before = type_objects(&app);
|
||||
confirm(&mut app).unwrap();
|
||||
opened(&mut app);
|
||||
let st = app.session.active().unwrap();
|
||||
let placed = st.doc.node(st.selection.objects[0]).unwrap();
|
||||
assert!(!matches!(placed.kind, NodeKind::PlacedDocument(_)), "embedded: {:?}", placed.kind);
|
||||
assert_eq!(type_objects(&app), before, "placed as outlines");
|
||||
}
|
||||
@@ -3279,6 +3279,10 @@ digits Malayalam Малаялам
|
||||
Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Показва номера на всяка отрязана част в каре в горния ѝ ляв ъгъл върху платното; когато е изключено, контурите на отрязаните части остават видими.
|
||||
The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. Цветът на контурите на потребителските и обектните отрязани части и на каретата с номерата им; автоматичните отрязани части използват по-блед нюанс на този цвят.
|
||||
New type takes this language while Document Setup's language is English: USA and [Normal Character Style] sets none; type already in a document keeps its own language. Новият текст получава този език, докато езикът в Настройка на документ е Английски: САЩ и [Нормален стил на знак] не задава език; текстът, който вече е в документа, запазва своя език.
|
||||
In paragraphs with Hyphenate on, a listed word is hyphenated only at the hyphens typed in it, or never when it has none, whatever its language or case. В абзаците с включено Пренасяне на думи изброената дума получава пренос само при въведените в нея тирета или никога, ако няма такива, независимо от езика и регистъра ѝ.
|
||||
On the desktop, this folder's .wasm plug-ins load at startup and when OK sets a new folder, except in Safe Mode; one that asks for permissions loads only after you grant them. The web version loads none. В настолната версия .wasm приставките от тази папка се зареждат при стартиране и когато ОК зададе нова папка, освен в Безопасен режим; приставка, която иска разрешения, се зарежда едва след като ги дадете. Уеб версията не зарежда нито една.
|
||||
Large gives each filter or command plug-in run at least 250 million instructions, with the same time limit; Normal keeps the plug-in's own budget. Live effects, exporters and importers keep theirs. Голям дава на всяко изпълнение на приставка за филтър или команда поне 250 милиона инструкции при същия лимит на време; Нормално запазва собствения бюджет на приставката. Живите ефекти, експортерите и импортерите запазват своя.
|
||||
New type takes this language while Document Setup's language is English: USA; type already in a document keeps its own language. Новият текст получава този език, докато езикът в Настройка на документ е Английски: САЩ; текстът, който вече е в документа, запазва своя език.
|
||||
In paragraphs with Hyphenate on, a listed word breaks only at the hyphens typed in it, or nowhere when it has none, whatever its language or case. В абзаците с включено Пренасяне на думи изброената дума се пренася само при въведените в нея тирета или никъде, ако няма такива, независимо от езика и регистъра ѝ.
|
||||
On the desktop, the .wasm plug-ins in this folder load at startup and when you click OK with a new folder here, except in Safe Mode; the web version does not load them. В настолната версия .wasm приставките в тази папка се зареждат при стартиране и когато щракнете върху ОК с нова папка тук, освен в Безопасен режим; уеб версията не ги зарежда.
|
||||
Normal keeps each plug-in's own limits; with Large, a plug-in filter or command may run at least 250 million instructions besides those for its input. The time limit stays the same. „Нормално“ запазва собствените ограничения на всеки плъгин; с „Голям“ филтър или команда на плъгин може да изпълни поне 250 милиона инструкции освен тези за входните си данни. Ограничението по време остава същото.
|
||||
@@ -3293,8 +3297,8 @@ digits Malayalam Малаялам
|
||||
Shows each tool group's name above its tools in the toolbar; off, the groups follow one another with nothing between them. Показва името на всяка група инструменти над инструментите ѝ в лентата с инструменти; изключено, групите следват една след друга без нищо между тях.
|
||||
From now on, documents you open or create open as tabs; off, each opens in a floating window. Documents already open stay where they are. Отсега нататък документите, които отваряте или създавате, се отварят като подпрозорци; изключено, всеки се отваря в плаващ прозорец. Вече отворените документи остават на мястото си.
|
||||
Makes the document tabs taller and their names larger. Прави подпрозорците на документите по-високи, а имената им по-големи.
|
||||
From the next start, the system draws the window's title bar where VectorCraft would otherwise draw its own. От следващото стартиране системата изчертава заглавната лента на прозореца там, където иначе VectorCraft би изчертал своя.
|
||||
From the next start, VectorCraft draws the window's title bar even where the desktop would draw it, unless System Title Bar is on. От следващото стартиране VectorCraft изчертава заглавната лента на прозореца дори там, където работният плот би я изчертал, освен ако Заглавна лента на системата е включена.
|
||||
From the next start, the system draws the window's title bar where VectorCraft would otherwise draw its own; on Linux and the BSDs, the VECTORCRAFT_TITLEBAR variable takes precedence. От следващото стартиране системата изчертава заглавната лента на прозореца там, където иначе VectorCraft би изчертал своя; в Linux и BSD системите променливата VECTORCRAFT_TITLEBAR има предимство.
|
||||
From the next start, VectorCraft draws the window's title bar even where the desktop would draw it, unless System Title Bar is on or the VECTORCRAFT_TITLEBAR variable chooses it. От следващото стартиране VectorCraft изчертава заглавната лента на прозореца дори там, където работният плот би я изчертал, освен ако Заглавна лента на системата е включена или променливата VECTORCRAFT_TITLEBAR я избира.
|
||||
Makes the interface larger or smaller; art on the canvas keeps its size at the same zoom. Уголемява или смалява интерфейса; рисунката в платното запазва размера си при същия мащаб.
|
||||
The tool pointers VectorCraft draws grow and shrink with UI Scaling; off, they keep their size. Показалците на инструментите, които VectorCraft изчертава, растат и се смаляват с Мащабиране на потребителския интерфейс; изключено, запазват размера си.
|
||||
The language of the interface; Auto uses the system's language. The dialog switches language as soon as you choose one. Езикът на интерфейса; Автоматично използва езика на системата. Диалоговият прозорец сменя езика веднага щом изберете някой.
|
||||
@@ -3320,6 +3324,9 @@ digits Malayalam Малаялам
|
||||
Open Recent Files and the Home screen list at most this many recent files; 0 lists none, and VectorCraft still remembers up to 30. „Скорошни файлове“ и екранът „Начало“ показват най-много толкова скорошни файла; 0 не показва нито един, а VectorCraft пак помни до 30.
|
||||
When a document opens, a linked EPS image that shows its saved preview keeps it instead of reading the EPS file again; changed files still follow Update Links. При отваряне на документ свързано EPS изображение, което показва запазения си преглед, го запазва, вместо да чете EPS файла отново; променените файлове пак следват „Актуализиране на връзките“.
|
||||
In Pixel Preview, images are drawn smoothed; off, their pixels show with hard edges. Outside Pixel Preview, images are always smoothed. В „Пикселен преглед“ изображенията се рисуват изгладени; изключено, пикселите им имат остри ръбове. Извън „Пикселен преглед“ изображенията винаги се изглаждат.
|
||||
PDF Text Текст на PDF
|
||||
The text of a PDF you open or embed comes in as editable type, or as outlines that look the same on a computer without its fonts. Текстът на PDF, който отваряте или вграждате, идва като редактируем текст или като контури, които изглеждат същите на компютър без шрифтовете му.
|
||||
Linked pages show the file's own text. Свързаните страници показват собствения текст на файла.
|
||||
When a linked file changes, Automatically reads it again, Ask When Modified asks you first, and Manually leaves it and shows a note in the status bar. Когато свързан файл се промени, „Автоматично“ го прочита отново, „Питане при промяна“ първо ви пита, а „Ръчно“ го оставя както е и показва бележка в лентата на състоянието.
|
||||
On the desktop, the folder New from Template… and Save as Template… start in; leave it blank for VectorCraft Templates in your documents folder. В настолната версия папката, в която започват „Нов от шаблон…“ и „Запази като шаблон…“; оставете я празна за VectorCraft Templates в папката ви с документи.
|
||||
Edit Original opens a linked file in the system's default app for its type; off, a linked raster image opens in PhotoCraft where it is installed. „Редактиране на оригинал“ отваря свързан файл в стандартното приложение на системата за неговия тип; изключено, свързано растерно изображение се отваря в PhotoCraft, ако е инсталиран.
|
||||
@@ -7897,6 +7904,10 @@ breakText Glyphs Глифи
|
||||
@msg A joint does not close by {gap} pt. Една връзка не се затваря с {gap} pt.
|
||||
@msg Two panels pass through each other. Два панела минават един през друг.
|
||||
@msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer трябва да е "singleLine", "everyLine", "standardSingleLine" или "standardEveryLine"
|
||||
Leaf Vine Листна лоза
|
||||
Blossom Chain Цветна верига
|
||||
Pennant Garland Гирлянд от знаменца
|
||||
Lantern String Низ от фенери
|
||||
Orbit Lines Орбитални линии
|
||||
Petal Garland Гирлянд от венчелистчета
|
||||
Lattice Braid Решетъчна плетка
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -4768,6 +4768,10 @@ font-technology Variable Varijabilni
|
||||
Edit type set in fonts that aren't available? Urediti tekst u fontovima koji nisu dostupni?
|
||||
Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Prikazuje broj svakog isječka u okviru u njegovom gornjem lijevom uglu na platnu; kada je isključeno, obrisi isječaka i dalje se prikazuju.
|
||||
The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. Boja obrisa korisničkih i objektnih isječaka i okvira s njihovim brojevima; automatski isječci koriste blijeđu nijansu te boje.
|
||||
In paragraphs with Hyphenate on, a listed word is hyphenated only at the hyphens typed in it, or never when it has none, whatever its language or case. U pasusima s uključenom opcijom Rastavljaj riječi navedena riječ dobija crticu za rastavljanje samo na crticama upisanim u nju, ili nikad ako ih nema, bez obzira na jezik i velika ili mala slova.
|
||||
On the desktop, this folder's .wasm plug-ins load at startup and when OK sets a new folder, except in Safe Mode; one that asks for permissions loads only after you grant them. The web version loads none. U desktop verziji .wasm dodaci iz ove mape učitavaju se pri pokretanju i kada U redu postavi novu mapu, osim u sigurnom načinu rada; dodatak koji traži dozvole učitava se tek kada ih odobrite. Web verzija ne učitava nijedan.
|
||||
Large gives each filter or command plug-in run at least 250 million instructions, with the same time limit; Normal keeps the plug-in's own budget. Live effects, exporters and importers keep theirs. Veliko daje svakom pokretanju dodatka za filter ili naredbu najmanje 250 miliona instrukcija uz isto vremensko ograničenje; Normalno zadržava vlastiti budžet dodatka. Živi efekti, izvoznici i uvoznici zadržavaju svoj.
|
||||
New type takes this language while Document Setup's language is English: USA; type already in a document keeps its own language. Novi tekst dobija ovaj jezik dok je jezik u Postavkama dokumenta Engleski: SAD; tekst koji je već u dokumentu zadržava svoj jezik.
|
||||
In paragraphs with Hyphenate on, a listed word breaks only at the hyphens typed in it, or nowhere when it has none, whatever its language or case. U pasusima s uključenom opcijom Rastavljaj riječi navedena riječ se rastavlja samo na crticama upisanim u nju, ili nigdje ako ih nema, bez obzira na jezik i velika ili mala slova.
|
||||
On the desktop, the .wasm plug-ins in this folder load at startup and when you click OK with a new folder here, except in Safe Mode; the web version does not load them. U desktop verziji .wasm dodaci iz ove mape učitavaju se pri pokretanju i kada kliknete U redu s novom mapom ovdje, osim u sigurnom načinu rada; web verzija ih ne učitava.
|
||||
Normal keeps each plug-in's own limits; with Large, a plug-in filter or command may run at least 250 million instructions besides those for its input. The time limit stays the same. Normalno zadržava vlastita ograničenja svakog dodatka; uz Veliko filter ili naredba dodatka može izvršiti najmanje 250 miliona instrukcija pored onih za svoj ulaz. Vremensko ograničenje ostaje isto.
|
||||
@@ -4782,8 +4786,8 @@ font-technology Variable Varijabilni
|
||||
Shows each tool group's name above its tools in the toolbar; off, the groups follow one another with nothing between them. Prikazuje naziv svake grupe alata iznad njenih alata na traci s alatima; isključeno, grupe slijede jedna za drugom bez ičega između njih.
|
||||
From now on, documents you open or create open as tabs; off, each opens in a floating window. Documents already open stay where they are. Od sada se dokumenti koje otvorite ili kreirate otvaraju kao kartice; isključeno, svaki se otvara u plutajućem prozoru. Već otvoreni dokumenti ostaju gdje jesu.
|
||||
Makes the document tabs taller and their names larger. Kartice dokumenata čini višim, a njihove nazive većim.
|
||||
From the next start, the system draws the window's title bar where VectorCraft would otherwise draw its own. Od sljedećeg pokretanja sistem iscrtava naslovnu traku prozora tamo gdje bi VectorCraft inače iscrtao svoju.
|
||||
From the next start, VectorCraft draws the window's title bar even where the desktop would draw it, unless System Title Bar is on. Od sljedećeg pokretanja VectorCraft iscrtava naslovnu traku prozora čak i tamo gdje bi je iscrtala radna površina, osim ako je Sistemska naslovna traka uključena.
|
||||
From the next start, the system draws the window's title bar where VectorCraft would otherwise draw its own; on Linux and the BSDs, the VECTORCRAFT_TITLEBAR variable takes precedence. Od sljedećeg pokretanja sistem iscrtava naslovnu traku prozora tamo gdje bi VectorCraft inače iscrtao svoju; na Linuxu i BSD sistemima prednost ima varijabla VECTORCRAFT_TITLEBAR.
|
||||
From the next start, VectorCraft draws the window's title bar even where the desktop would draw it, unless System Title Bar is on or the VECTORCRAFT_TITLEBAR variable chooses it. Od sljedećeg pokretanja VectorCraft iscrtava naslovnu traku prozora čak i tamo gdje bi je iscrtala radna površina, osim ako je Sistemska naslovna traka uključena ili je bira varijabla VECTORCRAFT_TITLEBAR.
|
||||
Makes the interface larger or smaller; art on the canvas keeps its size at the same zoom. Povećava ili smanjuje interfejs; crtež na platnu zadržava veličinu pri istom zumu.
|
||||
The tool pointers VectorCraft draws grow and shrink with UI Scaling; off, they keep their size. Pokazivači alata koje VectorCraft iscrtava rastu i smanjuju se sa Skaliranjem interfejsa; isključeno, zadržavaju svoju veličinu.
|
||||
The language of the interface; Auto uses the system's language. The dialog switches language as soon as you choose one. Jezik interfejsa; Automatski koristi jezik sistema. Dijalog mijenja jezik čim ga odaberete.
|
||||
@@ -4809,6 +4813,9 @@ font-technology Variable Varijabilni
|
||||
Open Recent Files and the Home screen list at most this many recent files; 0 lists none, and VectorCraft still remembers up to 30. Otvori nedavne datoteke i ekran Početna prikazuju najviše ovoliko nedavnih datoteka; 0 ne prikazuje nijednu, a VectorCraft i dalje pamti do 30.
|
||||
When a document opens, a linked EPS image that shows its saved preview keeps it instead of reading the EPS file again; changed files still follow Update Links. Pri otvaranju dokumenta povezana EPS slika koja prikazuje svoj sačuvani pregled zadržava ga umjesto ponovnog čitanja EPS datoteke; izmijenjene datoteke i dalje slijede Ažuriraj veze.
|
||||
In Pixel Preview, images are drawn smoothed; off, their pixels show with hard edges. Outside Pixel Preview, images are always smoothed. U Pregledu piksela slike se crtaju zaglađene; isključeno, njihovi pikseli imaju oštre ivice. Izvan Pregleda piksela slike su uvijek zaglađene.
|
||||
PDF Text Tekst PDF-a
|
||||
The text of a PDF you open or embed comes in as editable type, or as outlines that look the same on a computer without its fonts. Tekst PDF-a koji otvorite ili ugradite dolazi kao tekst koji se može uređivati ili kao obrisi koji izgledaju isto na računaru bez njegovih fontova.
|
||||
Linked pages show the file's own text. Povezane stranice prikazuju vlastiti tekst datoteke.
|
||||
When a linked file changes, Automatically reads it again, Ask When Modified asks you first, and Manually leaves it and shows a note in the status bar. Kada se povezana datoteka promijeni, Automatski je ponovo čita, Pitaj kad je izmijenjeno vas prvo pita, a Ručno je ostavlja kakva jeste i prikazuje napomenu na statusnoj traci.
|
||||
On the desktop, the folder New from Template… and Save as Template… start in; leave it blank for VectorCraft Templates in your documents folder. U desktop verziji folder u kojem počinju Novo iz predloška… i Sačuvaj kao predložak…; ostavite prazno za VectorCraft Templates u vašem folderu dokumenata.
|
||||
Edit Original opens a linked file in the system's default app for its type; off, a linked raster image opens in PhotoCraft where it is installed. Uredi original otvara povezanu datoteku u zadanoj aplikaciji sistema za njen tip; isključeno, povezana rasterska slika otvara se u PhotoCraftu ako je instaliran.
|
||||
@@ -7952,6 +7959,10 @@ shape Open Otvoren
|
||||
@msg A joint does not close by {gap} pt. Spoj se ne zatvara za {gap} pt.
|
||||
@msg Two panels pass through each other. Dva panela prolaze jedan kroz drugi.
|
||||
@msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer mora biti "singleLine", "everyLine", "standardSingleLine" ili "standardEveryLine"
|
||||
Leaf Vine Lisnata loza
|
||||
Blossom Chain Cvjetni lanac
|
||||
Pennant Garland Girlanda zastavica
|
||||
Lantern String Niz lampiona
|
||||
Orbit Lines Orbitalne linije
|
||||
Petal Garland Vijenac od latica
|
||||
Lattice Braid Rešetkasti preplet
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -4137,6 +4137,10 @@ digits Malayalam Malaiàlam
|
||||
Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Mostra al llenç el número de cada tall en un requadre a la seva cantonada superior esquerra; si està desactivat, els contorns dels talls continuen visibles.
|
||||
The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. El color dels contorns dels talls d’usuari i d’objecte i dels requadres amb el seu número; els talls automàtics fan servir un to més apagat d’aquest color.
|
||||
New type takes this language while Document Setup's language is English: USA and [Normal Character Style] sets none; type already in a document keeps its own language. El text nou pren aquest idioma mentre l’idioma de Configuració del document sigui Anglès: EUA i [Estil de caràcter normal] no en defineixi cap; el text que ja és en un document conserva el seu idioma.
|
||||
In paragraphs with Hyphenate on, a listed word is hyphenated only at the hyphens typed in it, or never when it has none, whatever its language or case. En els paràgrafs amb Particiona activat, una paraula de la llista només rep guionet de partició als guionets que s’hi han escrit, o mai si no en té, sigui quin sigui el seu idioma o l’ús de majúscules.
|
||||
On the desktop, this folder's .wasm plug-ins load at startup and when OK sets a new folder, except in Safe Mode; one that asks for permissions loads only after you grant them. The web version loads none. A la versió d’escriptori, els complements .wasm d’aquesta carpeta es carreguen en iniciar i quan D’acord estableix una carpeta nova, excepte en Mode segur; un que demana permisos només es carrega després que els concediu. La versió web no en carrega cap.
|
||||
Large gives each filter or command plug-in run at least 250 million instructions, with the same time limit; Normal keeps the plug-in's own budget. Live effects, exporters and importers keep theirs. Gran dona a cada execució d’un complement de filtre o d’ordre almenys 250 milions d’instruccions, amb el mateix límit de temps; Normal manté el pressupost propi del complement. Els efectes en viu, els exportadors i els importadors mantenen el seu.
|
||||
New type takes this language while Document Setup's language is English: USA; type already in a document keeps its own language. El text nou pren aquest idioma mentre l’idioma de Configuració del document sigui Anglès: EUA; el text que ja és en un document conserva el seu idioma.
|
||||
In paragraphs with Hyphenate on, a listed word breaks only at the hyphens typed in it, or nowhere when it has none, whatever its language or case. En els paràgrafs amb Particiona activat, una paraula de la llista es parteix només als guionets que s’hi han escrit, o enlloc si no en té, sigui quin sigui el seu idioma o l’ús de majúscules.
|
||||
On the desktop, the .wasm plug-ins in this folder load at startup and when you click OK with a new folder here, except in Safe Mode; the web version does not load them. A la versió d’escriptori, els complements .wasm d’aquesta carpeta es carreguen en iniciar i quan feu clic a D’acord amb una carpeta nova aquí, excepte en Mode segur; la versió web no els carrega.
|
||||
Normal keeps each plug-in's own limits; with Large, a plug-in filter or command may run at least 250 million instructions besides those for its input. The time limit stays the same. Normal manté els límits propis de cada complement; amb Gran, un filtre o una ordre d’un complement pot executar com a mínim 250 milions d’instruccions a més de les de la seva entrada. El límit de temps no canvia.
|
||||
@@ -4151,8 +4155,8 @@ digits Malayalam Malaiàlam
|
||||
Shows each tool group's name above its tools in the toolbar; off, the groups follow one another with nothing between them. Mostra el nom de cada grup d’eines damunt de les seves eines a la barra d’eines; desactivat, els grups se succeeixen sense res entre ells.
|
||||
From now on, documents you open or create open as tabs; off, each opens in a floating window. Documents already open stay where they are. A partir d’ara, els documents que obriu o creeu s’obren com a pestanyes; desactivat, cadascun s’obre en una finestra flotant. Els documents ja oberts es queden on són.
|
||||
Makes the document tabs taller and their names larger. Fa les pestanyes dels documents més altes i els seus noms més grans.
|
||||
From the next start, the system draws the window's title bar where VectorCraft would otherwise draw its own. A partir del pròxim inici, el sistema dibuixa la barra de títol de la finestra on VectorCraft, si no, dibuixaria la seva.
|
||||
From the next start, VectorCraft draws the window's title bar even where the desktop would draw it, unless System Title Bar is on. A partir del pròxim inici, VectorCraft dibuixa la barra de títol de la finestra fins i tot on l’escriptori la dibuixaria, tret que Barra de títol del sistema estigui activada.
|
||||
From the next start, the system draws the window's title bar where VectorCraft would otherwise draw its own; on Linux and the BSDs, the VECTORCRAFT_TITLEBAR variable takes precedence. A partir del pròxim inici, el sistema dibuixa la barra de títol de la finestra on VectorCraft, si no, dibuixaria la seva; a Linux i als BSD, la variable VECTORCRAFT_TITLEBAR té prioritat.
|
||||
From the next start, VectorCraft draws the window's title bar even where the desktop would draw it, unless System Title Bar is on or the VECTORCRAFT_TITLEBAR variable chooses it. A partir del pròxim inici, VectorCraft dibuixa la barra de títol de la finestra fins i tot on l’escriptori la dibuixaria, tret que Barra de títol del sistema estigui activada o la variable VECTORCRAFT_TITLEBAR la triï.
|
||||
Makes the interface larger or smaller; art on the canvas keeps its size at the same zoom. Fa la interfície més gran o més petita; l’art del llenç conserva la mida amb el mateix zoom.
|
||||
The tool pointers VectorCraft draws grow and shrink with UI Scaling; off, they keep their size. Els punters d’eina que dibuixa VectorCraft creixen i s’encongeixen amb l’Escalat de la interfície; desactivat, conserven la mida.
|
||||
The language of the interface; Auto uses the system's language. The dialog switches language as soon as you choose one. La llengua de la interfície; Automàtic fa servir la llengua del sistema. El diàleg canvia de llengua tan bon punt en trieu una.
|
||||
@@ -4178,6 +4182,9 @@ digits Malayalam Malaiàlam
|
||||
Open Recent Files and the Home screen list at most this many recent files; 0 lists none, and VectorCraft still remembers up to 30. Obre fitxers recents i la pantalla d’Inici mostren com a màxim aquest nombre de fitxers recents; 0 no en mostra cap, i VectorCraft continua recordant-ne fins a 30.
|
||||
When a document opens, a linked EPS image that shows its saved preview keeps it instead of reading the EPS file again; changed files still follow Update Links. En obrir un document, una imatge EPS enllaçada que mostra la seva previsualització desada la conserva en lloc de tornar a llegir el fitxer EPS; els fitxers modificats segueixen Actualitza els enllaços.
|
||||
In Pixel Preview, images are drawn smoothed; off, their pixels show with hard edges. Outside Pixel Preview, images are always smoothed. A Previsualització de píxels, les imatges es dibuixen suavitzades; desactivat, els seus píxels mostren vores dures. Fora de Previsualització de píxels, les imatges sempre se suavitzen.
|
||||
PDF Text Text del PDF
|
||||
The text of a PDF you open or embed comes in as editable type, or as outlines that look the same on a computer without its fonts. El text d’un PDF que obriu o incrusteu entra com a text editable o com a contorns que es veuen igual en un ordinador sense les seves fonts.
|
||||
Linked pages show the file's own text. Les pàgines enllaçades mostren el text propi del fitxer.
|
||||
When a linked file changes, Automatically reads it again, Ask When Modified asks you first, and Manually leaves it and shows a note in the status bar. Quan un fitxer enllaçat canvia, Automàticament el torna a llegir, Pregunta quan es modifiqui us ho pregunta abans, i Manualment el deixa com està i mostra un avís a la barra d’estat.
|
||||
On the desktop, the folder New from Template… and Save as Template… start in; leave it blank for VectorCraft Templates in your documents folder. A la versió d’escriptori, la carpeta on comencen Nou a partir d’una plantilla… i Desa com a plantilla…; deixeu-la buida per a VectorCraft Templates a la vostra carpeta de documents.
|
||||
Edit Original opens a linked file in the system's default app for its type; off, a linked raster image opens in PhotoCraft where it is installed. Edita l’original obre un fitxer enllaçat amb l’aplicació per defecte del sistema per al seu tipus; desactivat, una imatge ràster enllaçada s’obre a PhotoCraft si està instal·lat.
|
||||
@@ -7144,6 +7151,10 @@ liquify-list-end {0}, {1} {0} i {1}
|
||||
@msg exit isolation mode first surt primer del mode d’aïllament
|
||||
@msg select an envelope selecciona un embolcall
|
||||
@msg select an image selecciona una imatge
|
||||
@msg object {_1} is an image changed by Perspective Distort or Free Distort, which this command does not work on l'objecte {_1} és una imatge modificada amb Distorsió de perspectiva o Distorsió lliure, amb la qual aquesta ordre no funciona
|
||||
@msg image {_1} cannot be distorted this way: its corners would not make a convex shape la imatge {_1} no es pot distorsionar així: les seves cantonades no formarien una forma convexa
|
||||
@msg image {_1} cannot be distorted this way: its corners would cross the warp's horizon la imatge {_1} no es pot distorsionar així: les seves cantonades creuarien l'horitzó de la distorsió
|
||||
@msg image {_1} cannot be distorted this way: its corners would be too close together for a perspective map la imatge {_1} no es pot distorsionar així: les seves cantonades estarien massa juntes per a una projecció en perspectiva
|
||||
@msg `background` must be edges, corners or colors `background` ha de ser edges, corners o colors
|
||||
@msg `match` must be distance or channels `match` ha de ser distance o channels
|
||||
@msg `{key}` must be from 0 to 100 `{key}` ha d’estar entre 0 i 100
|
||||
@@ -8933,6 +8944,10 @@ breakText Glyphs Glifs
|
||||
@msg A joint does not close by {gap} pt. Una unió no es tanca per {gap} pt.
|
||||
@msg Two panels pass through each other. Dos panells es travessen l’un a l’altre.
|
||||
@msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer ha de ser "singleLine", "everyLine", "standardSingleLine" o "standardEveryLine"
|
||||
Leaf Vine Enfiladissa de fulles
|
||||
Blossom Chain Cadena de flors
|
||||
Pennant Garland Garlanda de banderins
|
||||
Lantern String Filera de fanalets
|
||||
Orbit Lines Línies orbitals
|
||||
Petal Garland Garlanda de pètals
|
||||
Lattice Braid Trena reticular
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -4877,6 +4877,10 @@ font-technology Variable Variabilní
|
||||
Edit type set in fonts that aren't available? Upravit text v písmech, která nejsou k dispozici?
|
||||
Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Zobrazí na plátně číslo každého řezu v rámečku v jeho levém horním rohu; když je vypnuto, obrysy řezů zůstanou zobrazené.
|
||||
The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. Barva obrysů uživatelských a objektových řezů a rámečků s jejich čísly; automatické řezy používají tlumenější odstín této barvy.
|
||||
In paragraphs with Hyphenate on, a listed word is hyphenated only at the hyphens typed in it, or never when it has none, whatever its language or case. V odstavcích se zapnutou volbou Dělit slova dostane uvedené slovo dělicí spojovník jen u spojovníků, které v něm napíšete, nebo nikdy, pokud žádné nemá, bez ohledu na jazyk a velikost písmen.
|
||||
On the desktop, this folder's .wasm plug-ins load at startup and when OK sets a new folder, except in Safe Mode; one that asks for permissions loads only after you grant them. The web version loads none. V desktopové verzi se zásuvné moduly .wasm z této složky načtou při spuštění a když OK nastaví novou složku, kromě nouzového režimu; modul, který žádá o oprávnění, se načte až po jejich udělení. Webová verze nenačte žádný.
|
||||
Large gives each filter or command plug-in run at least 250 million instructions, with the same time limit; Normal keeps the plug-in's own budget. Live effects, exporters and importers keep theirs. Velké dá každému běhu zásuvného modulu filtru nebo příkazu nejméně 250 milionů instrukcí se stejným časovým limitem; Normální ponechá vlastní rozpočet modulu. Živé efekty, exportéry a importéry si ponechají svůj.
|
||||
New type takes this language while Document Setup's language is English: USA; type already in a document keeps its own language. Nový text dostane tento jazyk, dokud je jazyk v Nastavení dokumentu Angličtina: USA; text, který už v dokumentu je, si ponechá svůj jazyk.
|
||||
In paragraphs with Hyphenate on, a listed word breaks only at the hyphens typed in it, or nowhere when it has none, whatever its language or case. V odstavcích se zapnutou volbou Dělit slova se uvedené slovo dělí jen u spojovníků, které v něm napíšete, nebo nikde, pokud žádné nemá, bez ohledu na jazyk a velikost písmen.
|
||||
On the desktop, the .wasm plug-ins in this folder load at startup and when you click OK with a new folder here, except in Safe Mode; the web version does not load them. V desktopové verzi se zásuvné moduly .wasm z této složky načtou při spuštění a po klepnutí na OK s novou složkou zde, kromě nouzového režimu; webová verze je nenačítá.
|
||||
Normal keeps each plug-in's own limits; with Large, a plug-in filter or command may run at least 250 million instructions besides those for its input. The time limit stays the same. Normální zachová vlastní limity každého zásuvného modulu; s volbou Velké může filtr nebo příkaz zásuvného modulu provést nejméně 250 milionů instrukcí navíc k těm pro svůj vstup. Časový limit zůstává stejný.
|
||||
@@ -4891,8 +4895,8 @@ font-technology Variable Variabilní
|
||||
Shows each tool group's name above its tools in the toolbar; off, the groups follow one another with nothing between them. Zobrazuje název každé skupiny nástrojů nad jejími nástroji v panelu nástrojů; při vypnutí skupiny následují jedna za druhou bez ničeho mezi nimi.
|
||||
From now on, documents you open or create open as tabs; off, each opens in a floating window. Documents already open stay where they are. Dokumenty, které od teď otevřete nebo vytvoříte, se otevírají jako karty; při vypnutí se každý otevře v plovoucím okně. Už otevřené dokumenty zůstanou, kde jsou.
|
||||
Makes the document tabs taller and their names larger. Karty dokumentů budou vyšší a jejich názvy větší.
|
||||
From the next start, the system draws the window's title bar where VectorCraft would otherwise draw its own. Od příštího spuštění kreslí záhlaví okna systém tam, kde by jinak VectorCraft kreslil své vlastní.
|
||||
From the next start, VectorCraft draws the window's title bar even where the desktop would draw it, unless System Title Bar is on. Od příštího spuštění kreslí VectorCraft záhlaví okna i tam, kde by ho kreslilo pracovní prostředí, pokud není zapnuté Systémové záhlaví okna.
|
||||
From the next start, the system draws the window's title bar where VectorCraft would otherwise draw its own; on Linux and the BSDs, the VECTORCRAFT_TITLEBAR variable takes precedence. Od příštího spuštění kreslí záhlaví okna systém tam, kde by jinak VectorCraft kreslil své vlastní; v Linuxu a systémech BSD má přednost proměnná VECTORCRAFT_TITLEBAR.
|
||||
From the next start, VectorCraft draws the window's title bar even where the desktop would draw it, unless System Title Bar is on or the VECTORCRAFT_TITLEBAR variable chooses it. Od příštího spuštění kreslí VectorCraft záhlaví okna i tam, kde by ho kreslilo pracovní prostředí, pokud není zapnuté Systémové záhlaví okna nebo ho nevolí proměnná VECTORCRAFT_TITLEBAR.
|
||||
Makes the interface larger or smaller; art on the canvas keeps its size at the same zoom. Zvětší nebo zmenší rozhraní; kresba na plátně si při stejném zvětšení zachová velikost.
|
||||
The tool pointers VectorCraft draws grow and shrink with UI Scaling; off, they keep their size. Ukazatele nástrojů, které kreslí VectorCraft, se zvětšují a zmenšují s Měřítkem rozhraní; při vypnutí si zachovají velikost.
|
||||
The language of the interface; Auto uses the system's language. The dialog switches language as soon as you choose one. Jazyk rozhraní; Automaticky použije jazyk systému. Dialog přepne jazyk, jakmile nějaký zvolíte.
|
||||
@@ -4918,6 +4922,9 @@ font-technology Variable Variabilní
|
||||
Open Recent Files and the Home screen list at most this many recent files; 0 lists none, and VectorCraft still remembers up to 30. Otevřít nedávné soubory a obrazovka Domů uvádějí nejvýše tolik nedávných souborů; 0 neuvádí žádný a VectorCraft si i tak pamatuje až 30.
|
||||
When a document opens, a linked EPS image that shows its saved preview keeps it instead of reading the EPS file again; changed files still follow Update Links. Při otevření dokumentu si propojený obraz EPS, který ukazuje svůj uložený náhled, tento náhled ponechá a soubor EPS znovu nečte; změněné soubory se dál řídí volbou Aktualizovat propojení.
|
||||
In Pixel Preview, images are drawn smoothed; off, their pixels show with hard edges. Outside Pixel Preview, images are always smoothed. V Náhledu obrazových bodů se obrazy kreslí vyhlazené; při vypnutí mají jejich obrazové body ostré hrany. Mimo Náhled obrazových bodů se obrazy vyhlazují vždy.
|
||||
PDF Text Text PDF
|
||||
The text of a PDF you open or embed comes in as editable type, or as outlines that look the same on a computer without its fonts. Text PDF, který otevřete nebo vložíte, se načte jako upravitelný text nebo jako obrysy, které vypadají stejně i na počítači bez jeho písem.
|
||||
Linked pages show the file's own text. Propojené stránky zobrazují vlastní text souboru.
|
||||
When a linked file changes, Automatically reads it again, Ask When Modified asks you first, and Manually leaves it and shows a note in the status bar. Když se propojený soubor změní, Automaticky ho načte znovu, Při změně se zeptat se vás nejdřív zeptá a Ručně ho nechá být a zobrazí upozornění ve stavovém řádku.
|
||||
On the desktop, the folder New from Template… and Save as Template… start in; leave it blank for VectorCraft Templates in your documents folder. V desktopové verzi složka, ve které začínají Nový ze šablony… a Uložit jako šablonu…; nechte ji prázdnou pro VectorCraft Templates ve vaší složce dokumentů.
|
||||
Edit Original opens a linked file in the system's default app for its type; off, a linked raster image opens in PhotoCraft where it is installed. Upravit originál otevře propojený soubor ve výchozí aplikaci systému pro jeho typ; při vypnutí se propojený rastrový obraz otevře v PhotoCraftu, pokud je nainstalován.
|
||||
@@ -5916,6 +5923,10 @@ liquify-list-end {0}, {1} {0} a {1}
|
||||
@msg this trace would make more than {max} anchor points, more than the document can show smoothly: raise Noise, lower Paths or Colors, or pick a lower-fidelity preset tato vektorizace by vytvořila více než {max} kotevních bodů, víc, než dokument plynule zobrazí: zvyšte Šum, snižte Cesty nebo Barvy, nebo zvolte přednastavení s nižší věrností
|
||||
@msg select an envelope vyberte obálku
|
||||
@msg select an image vyberte obraz
|
||||
@msg object {_1} is an image changed by Perspective Distort or Free Distort, which this command does not work on objekt {_1} je obraz změněný příkazem Perspektivní deformace nebo Volná deformace, se kterým tento příkaz nepracuje
|
||||
@msg image {_1} cannot be distorted this way: its corners would not make a convex shape obraz {_1} nelze takto deformovat: jeho rohy by netvořily konvexní tvar
|
||||
@msg image {_1} cannot be distorted this way: its corners would cross the warp's horizon obraz {_1} nelze takto deformovat: jeho rohy by překročily horizont deformace
|
||||
@msg image {_1} cannot be distorted this way: its corners would be too close together for a perspective map obraz {_1} nelze takto deformovat: jeho rohy by byly příliš blízko sebe pro perspektivní zobrazení
|
||||
@msg `background` must be edges, corners or colors `background` musí být edges, corners nebo colors
|
||||
@msg `match` must be distance or channels `match` musí být distance nebo channels
|
||||
@msg `{key}` must be from 0 to 100 `{key}` musí být od 0 do 100
|
||||
@@ -10757,6 +10768,10 @@ breakText Glyphs Glyfy
|
||||
@msg A panel is not joined to the rest by a crease. Panel není se zbytkem spojen žádnou linií bigu.
|
||||
@msg A fold line is on a non-printing layer. Linie skladu je na netisknutelné vrstvě.
|
||||
@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Panely: {panels}, panty: {hinges}, chyby: {errors}, upozornění: {warnings}
|
||||
Leaf Vine Listová liána
|
||||
Blossom Chain Květinový řetěz
|
||||
Pennant Garland Girlanda praporků
|
||||
Lantern String Řetěz luceren
|
||||
Orbit Lines Orbitální čáry
|
||||
Petal Garland Okvětní girlanda
|
||||
Lattice Braid Mřížkový cop
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -7320,6 +7320,10 @@ font-technology Variable Variable
|
||||
Edit type set in fonts that aren't available? Rediger tekst i skrifttyper, der ikke er tilgængelige?
|
||||
Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Viser hvert udsnits nummer i en boks i dets øverste venstre hjørne på lærredet; når den er slået fra, vises udsnittenes konturer stadig.
|
||||
The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. Farven på konturerne af bruger- og objektudsnit og på boksene med deres numre; automatiske udsnit bruger en svagere nuance af den.
|
||||
In paragraphs with Hyphenate on, a listed word is hyphenated only at the hyphens typed in it, or never when it has none, whatever its language or case. I afsnit med Orddeling slået til får et ord på listen kun orddelingsbindestreg ved de bindestreger, der er skrevet i det, eller aldrig uden nogen, uanset sprog og store eller små bogstaver.
|
||||
On the desktop, this folder's .wasm plug-ins load at startup and when OK sets a new folder, except in Safe Mode; one that asks for permissions loads only after you grant them. The web version loads none. I desktopversionen indlæses denne mappes .wasm-plug-ins ved start, og når OK angiver en ny mappe, undtagen i sikker tilstand; et plug-in, der beder om tilladelser, indlæses først, når du har givet dem. Webversionen indlæser ingen.
|
||||
Large gives each filter or command plug-in run at least 250 million instructions, with the same time limit; Normal keeps the plug-in's own budget. Live effects, exporters and importers keep theirs. Stor giver hver kørsel af et filter- eller kommando-plug-in mindst 250 millioner instruktioner med samme tidsgrænse; Normal beholder plug-in'ets eget budget. Live-effekter, eksportører og importører beholder deres.
|
||||
New type takes this language while Document Setup's language is English: USA; type already in a document keeps its own language. Ny tekst får dette sprog, så længe sproget i Dokumentopsætning er Engelsk: USA; tekst, der allerede er i et dokument, beholder sit eget sprog.
|
||||
In paragraphs with Hyphenate on, a listed word breaks only at the hyphens typed in it, or nowhere when it has none, whatever its language or case. I afsnit med Orddeling slået til deles et ord på listen kun ved de bindestreger, der er skrevet i det, eller slet ikke uden nogen, uanset sprog og store eller små bogstaver.
|
||||
On the desktop, the .wasm plug-ins in this folder load at startup and when you click OK with a new folder here, except in Safe Mode; the web version does not load them. I desktopversionen indlæses .wasm-plug-ins i denne mappe ved start, og når du klikker på OK med en ny mappe her, undtagen i sikker tilstand; webversionen indlæser dem ikke.
|
||||
Normal keeps each plug-in's own limits; with Large, a plug-in filter or command may run at least 250 million instructions besides those for its input. The time limit stays the same. Normal beholder hvert plug-ins egne grænser; med Stor kan et plug-in-filter eller en plug-in-kommando køre mindst 250 millioner instruktioner ud over dem til sit input. Tidsgrænsen forbliver den samme.
|
||||
@@ -7334,8 +7338,8 @@ font-technology Variable Variable
|
||||
Shows each tool group's name above its tools in the toolbar; off, the groups follow one another with nothing between them. Viser hver værktøjsgruppes navn over dens værktøjer i værktøjslinjen; slået fra følger grupperne efter hinanden uden noget imellem.
|
||||
From now on, documents you open or create open as tabs; off, each opens in a floating window. Documents already open stay where they are. Fremover åbner dokumenter, du åbner eller opretter, som faner; slået fra åbner hvert i et flydende vindue. Dokumenter, der allerede er åbne, bliver, hvor de er.
|
||||
Makes the document tabs taller and their names larger. Gør dokumentfanerne højere og deres navne større.
|
||||
From the next start, the system draws the window's title bar where VectorCraft would otherwise draw its own. Fra næste start tegner systemet vinduets titellinje, hvor VectorCraft ellers ville tegne sin egen.
|
||||
From the next start, VectorCraft draws the window's title bar even where the desktop would draw it, unless System Title Bar is on. Fra næste start tegner VectorCraft vinduets titellinje, også hvor skrivebordsmiljøet ville tegne den, medmindre Systemtitellinje er slået til.
|
||||
From the next start, the system draws the window's title bar where VectorCraft would otherwise draw its own; on Linux and the BSDs, the VECTORCRAFT_TITLEBAR variable takes precedence. Fra næste start tegner systemet vinduets titellinje, hvor VectorCraft ellers ville tegne sin egen; på Linux og BSD-systemerne har variablen VECTORCRAFT_TITLEBAR forrang.
|
||||
From the next start, VectorCraft draws the window's title bar even where the desktop would draw it, unless System Title Bar is on or the VECTORCRAFT_TITLEBAR variable chooses it. Fra næste start tegner VectorCraft vinduets titellinje, også hvor skrivebordsmiljøet ville tegne den, medmindre Systemtitellinje er slået til eller variablen VECTORCRAFT_TITLEBAR vælger den.
|
||||
Makes the interface larger or smaller; art on the canvas keeps its size at the same zoom. Gør brugergrænsefladen større eller mindre; grafik på lærredet beholder sin størrelse ved samme zoom.
|
||||
The tool pointers VectorCraft draws grow and shrink with UI Scaling; off, they keep their size. De værktøjsmarkører, VectorCraft tegner, vokser og krymper med UI-skalering; slået fra beholder de deres størrelse.
|
||||
The language of the interface; Auto uses the system's language. The dialog switches language as soon as you choose one. Brugergrænsefladens sprog; Auto bruger systemets sprog. Dialogen skifter sprog, så snart du vælger et.
|
||||
@@ -7361,6 +7365,9 @@ font-technology Variable Variable
|
||||
Open Recent Files and the Home screen list at most this many recent files; 0 lists none, and VectorCraft still remembers up to 30. Åbn seneste filer og Home-skærmen viser højst så mange seneste filer; 0 viser ingen, og VectorCraft husker stadig op til 30.
|
||||
When a document opens, a linked EPS image that shows its saved preview keeps it instead of reading the EPS file again; changed files still follow Update Links. Når et dokument åbnes, beholder et linket EPS-billede, der viser sin gemte forhåndsvisning, den i stedet for at læse EPS-filen igen; ændrede filer følger stadig Opdatér links.
|
||||
In Pixel Preview, images are drawn smoothed; off, their pixels show with hard edges. Outside Pixel Preview, images are always smoothed. I Pixel-forhåndsvisning tegnes billeder udglattet; slået fra viser deres pixels skarpe kanter. Uden for Pixel-forhåndsvisning udglattes billeder altid.
|
||||
PDF Text PDF-tekst
|
||||
The text of a PDF you open or embed comes in as editable type, or as outlines that look the same on a computer without its fonts. Teksten i en PDF, du åbner eller indlejrer, kommer ind som redigerbar tekst eller som omrids, der ser ens ud på en computer uden dens skrifttyper.
|
||||
Linked pages show the file's own text. Linkede sider viser filens egen tekst.
|
||||
When a linked file changes, Automatically reads it again, Ask When Modified asks you first, and Manually leaves it and shows a note in the status bar. Når en linket fil ændres, læser Automatisk den igen, Spørg ved ændringer spørger dig først, og Manuelt lader den være og viser en besked i statuslinjen.
|
||||
On the desktop, the folder New from Template… and Save as Template… start in; leave it blank for VectorCraft Templates in your documents folder. I desktopversionen den mappe, Ny fra skabelon… og Gem som skabelon… starter i; lad den stå tom for VectorCraft Templates i din dokumentmappe.
|
||||
Edit Original opens a linked file in the system's default app for its type; off, a linked raster image opens in PhotoCraft where it is installed. Redigér original åbner en linket fil i systemets standardapp for dens type; slået fra åbnes et linket rasterbillede i PhotoCraft, hvis det er installeret.
|
||||
@@ -8086,6 +8093,10 @@ imageTrace Outline Kontur
|
||||
@msg this trace would make more than {max} anchor points, more than the document can show smoothly: raise Noise, lower Paths or Colors, or pick a lower-fidelity preset denne sporing ville skabe flere end {max} ankerpunkter, hvilket er flere, end dokumentet kan vise flydende: hæv Støj, sænk Stier eller Farver, eller vælg en forudindstilling med lavere kvalitet
|
||||
@msg select an envelope markér en konvolut
|
||||
@msg select an image markér et billede
|
||||
@msg object {_1} is an image changed by Perspective Distort or Free Distort, which this command does not work on objektet {_1} er et billede, der er ændret med Perspektivforvrængning eller Fri forvrængning, og denne kommando virker ikke på det
|
||||
@msg image {_1} cannot be distorted this way: its corners would not make a convex shape billedet {_1} kan ikke forvrænges sådan: dets hjørner ville ikke danne en konveks form
|
||||
@msg image {_1} cannot be distorted this way: its corners would cross the warp's horizon billedet {_1} kan ikke forvrænges sådan: dets hjørner ville krydse forvrængningens horisont
|
||||
@msg image {_1} cannot be distorted this way: its corners would be too close together for a perspective map billedet {_1} kan ikke forvrænges sådan: dets hjørner ville ligge for tæt på hinanden til en perspektivisk afbildning
|
||||
@msg select an object in perspective markér et objekt i perspektiv
|
||||
@msg select artwork (or a colour group) to recolor markér grafik (eller en farvegruppe) for at skifte farver
|
||||
@msg select at least two objects markér mindst to objekter
|
||||
@@ -10819,6 +10830,10 @@ breakText Glyphs Glyffer
|
||||
@msg A joint does not close by {gap} pt. En samling lukker ikke med {gap} pt.
|
||||
@msg Two panels pass through each other. To paneler går gennem hinanden.
|
||||
@msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer skal være "singleLine", "everyLine", "standardSingleLine" eller "standardEveryLine"
|
||||
Leaf Vine Bladranke
|
||||
Blossom Chain Blomsterkæde
|
||||
Pennant Garland Vimpelguirlande
|
||||
Lantern String Lygtekæde
|
||||
Orbit Lines Banekurver
|
||||
Petal Garland Kronbladsguirlande
|
||||
Lattice Braid Gitterfletning
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -3347,6 +3347,10 @@ digits Malayalam Malayalam
|
||||
Edit type set in fonts that aren't available? Text in Schriften bearbeiten, die nicht verfügbar sind?
|
||||
Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Zeigt auf der Arbeitsfläche die Nummer jedes Slices in einem Kästchen oben links im Slice; ist die Option aus, werden die Slice-Umrisse weiterhin angezeigt.
|
||||
The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. Die Farbe der Umrisse von Benutzer- und Objekt-Slices und ihrer Nummernkästchen; automatische Slices verwenden einen blasseren Ton davon.
|
||||
In paragraphs with Hyphenate on, a listed word is hyphenated only at the hyphens typed in it, or never when it has none, whatever its language or case. In Absätzen mit eingeschalteter Silbentrennung erhält ein aufgeführtes Wort nur an den darin eingegebenen Bindestrichen einen Trennstrich oder nie, wenn es keine hat, unabhängig von Sprache und Groß- und Kleinschreibung.
|
||||
On the desktop, this folder's .wasm plug-ins load at startup and when OK sets a new folder, except in Safe Mode; one that asks for permissions loads only after you grant them. The web version loads none. In der Desktop-Version werden die .wasm-Plug-ins dieses Ordners beim Start geladen und wenn OK einen neuen Ordner festlegt, außer im abgesicherten Modus; eines, das Berechtigungen anfordert, erst nachdem Sie sie erteilt haben. Die Webversion lädt keine.
|
||||
Large gives each filter or command plug-in run at least 250 million instructions, with the same time limit; Normal keeps the plug-in's own budget. Live effects, exporters and importers keep theirs. „Groß“ gibt jedem Lauf eines Filter- oder Befehls-Plug-ins mindestens 250 Millionen Anweisungen bei gleichem Zeitlimit; „Normal“ behält das eigene Budget des Plug-ins. Live-Effekte, Exporter und Importer behalten ihres.
|
||||
New type takes this language while Document Setup's language is English: USA; type already in a document keeps its own language. Neuer Text erhält diese Sprache, solange die Sprache unter „Dokument einrichten“ Englisch: USA ist; Text, der bereits in einem Dokument steht, behält seine Sprache.
|
||||
New type takes this language while Document Setup's language is English: USA and [Normal Character Style] sets none; type already in a document keeps its own language. Neuer Text erhält diese Sprache, solange die Sprache unter „Dokument einrichten“ Englisch: USA ist und [Normales Zeichenformat] keine Sprache festlegt; Text, der bereits in einem Dokument steht, behält seine Sprache.
|
||||
In paragraphs with Hyphenate on, a listed word breaks only at the hyphens typed in it, or nowhere when it has none, whatever its language or case. In Absätzen mit eingeschalteter Silbentrennung wird ein aufgeführtes Wort nur an den darin eingegebenen Bindestrichen getrennt oder gar nicht, wenn es keine hat, unabhängig von Sprache und Groß- und Kleinschreibung.
|
||||
On the desktop, the .wasm plug-ins in this folder load at startup and when you click OK with a new folder here, except in Safe Mode; the web version does not load them. In der Desktop-Version werden die .wasm-Plug-ins in diesem Ordner beim Start geladen und wenn Sie hier mit einem neuen Ordner auf OK klicken, außer im abgesicherten Modus; die Webversion lädt sie nicht.
|
||||
@@ -3362,8 +3366,8 @@ digits Malayalam Malayalam
|
||||
Shows each tool group's name above its tools in the toolbar; off, the groups follow one another with nothing between them. Zeigt den Namen jeder Werkzeuggruppe über ihren Werkzeugen in der Werkzeugleiste; ausgeschaltet folgen die Gruppen ohne etwas dazwischen aufeinander.
|
||||
From now on, documents you open or create open as tabs; off, each opens in a floating window. Documents already open stay where they are. Ab jetzt öffnen sich Dokumente, die Sie öffnen oder erstellen, als Registerkarten; ausgeschaltet öffnet sich jedes in einem schwebenden Fenster. Bereits geöffnete Dokumente bleiben, wo sie sind.
|
||||
Makes the document tabs taller and their names larger. Macht die Registerkarten der Dokumente höher und ihre Namen größer.
|
||||
From the next start, the system draws the window's title bar where VectorCraft would otherwise draw its own. Ab dem nächsten Start zeichnet das System die Titelleiste des Fensters dort, wo VectorCraft sonst seine eigene zeichnen würde.
|
||||
From the next start, VectorCraft draws the window's title bar even where the desktop would draw it, unless System Title Bar is on. Ab dem nächsten Start zeichnet VectorCraft die Titelleiste des Fensters auch dort, wo der Desktop sie zeichnen würde, außer „Systemtitelleiste“ ist eingeschaltet.
|
||||
From the next start, the system draws the window's title bar where VectorCraft would otherwise draw its own; on Linux and the BSDs, the VECTORCRAFT_TITLEBAR variable takes precedence. Ab dem nächsten Start zeichnet das System die Titelleiste des Fensters dort, wo VectorCraft sonst seine eigene zeichnen würde; unter Linux und den BSDs hat die Variable VECTORCRAFT_TITLEBAR Vorrang.
|
||||
From the next start, VectorCraft draws the window's title bar even where the desktop would draw it, unless System Title Bar is on or the VECTORCRAFT_TITLEBAR variable chooses it. Ab dem nächsten Start zeichnet VectorCraft die Titelleiste des Fensters auch dort, wo der Desktop sie zeichnen würde, außer „Systemtitelleiste“ ist eingeschaltet oder die Variable VECTORCRAFT_TITLEBAR legt sie fest.
|
||||
Makes the interface larger or smaller; art on the canvas keeps its size at the same zoom. Macht die Benutzeroberfläche größer oder kleiner; Bildmaterial auf der Arbeitsfläche behält bei gleichem Zoom seine Größe.
|
||||
The tool pointers VectorCraft draws grow and shrink with UI Scaling; off, they keep their size. Die Werkzeugzeiger, die VectorCraft zeichnet, wachsen und schrumpfen mit der „Skalierung der Benutzeroberfläche“; ausgeschaltet behalten sie ihre Größe.
|
||||
The language of the interface; Auto uses the system's language. The dialog switches language as soon as you choose one. Die Sprache der Benutzeroberfläche; „Auto“ verwendet die Sprache des Systems. Der Dialog wechselt die Sprache, sobald Sie eine wählen.
|
||||
@@ -3389,6 +3393,9 @@ digits Malayalam Malayalam
|
||||
Open Recent Files and the Home screen list at most this many recent files; 0 lists none, and VectorCraft still remembers up to 30. „Zuletzt geöffnete Dateien“ und der Startbildschirm listen höchstens so viele zuletzt verwendete Dateien; 0 listet keine, und VectorCraft merkt sich weiterhin bis zu 30.
|
||||
When a document opens, a linked EPS image that shows its saved preview keeps it instead of reading the EPS file again; changed files still follow Update Links. Beim Öffnen eines Dokuments behält ein verknüpftes EPS-Bild, das seine gespeicherte Vorschau zeigt, diese, statt die EPS-Datei neu zu lesen; geänderte Dateien folgen weiterhin „Verknüpfungen aktualisieren“.
|
||||
In Pixel Preview, images are drawn smoothed; off, their pixels show with hard edges. Outside Pixel Preview, images are always smoothed. In der Pixelvorschau werden Bilder geglättet gezeichnet; ausgeschaltet zeigen ihre Pixel harte Kanten. Außerhalb der Pixelvorschau werden Bilder immer geglättet.
|
||||
PDF Text PDF-Text
|
||||
The text of a PDF you open or embed comes in as editable type, or as outlines that look the same on a computer without its fonts. Der Text einer PDF, die Sie öffnen oder einbetten, kommt als bearbeitbarer Text oder als Pfade, die auf einem Computer ohne ihre Schriften gleich aussehen.
|
||||
Linked pages show the file's own text. Verknüpfte Seiten zeigen den Text der Datei selbst.
|
||||
When a linked file changes, Automatically reads it again, Ask When Modified asks you first, and Manually leaves it and shows a note in the status bar. Ändert sich eine verknüpfte Datei, liest „Automatisch“ sie neu, „Bei Änderung fragen“ fragt Sie zuerst, und „Manuell“ lässt sie unverändert und zeigt einen Hinweis in der Statusleiste.
|
||||
On the desktop, the folder New from Template… and Save as Template… start in; leave it blank for VectorCraft Templates in your documents folder. In der Desktop-Version der Ordner, in dem „Neu aus Vorlage…“ und „Als Vorlage speichern…“ beginnen; leer lassen für VectorCraft Templates in Ihrem Dokumentordner.
|
||||
Edit Original opens a linked file in the system's default app for its type; off, a linked raster image opens in PhotoCraft where it is installed. „Original bearbeiten“ öffnet eine verknüpfte Datei im Standardprogramm des Systems für ihren Typ; ausgeschaltet öffnet sich ein verknüpftes Rasterbild in PhotoCraft, sofern es installiert ist.
|
||||
@@ -5494,6 +5501,10 @@ liquify-list-end {0}, {1} {0} und {1}
|
||||
@msg this trace would make more than {max} anchor points, more than the document can show smoothly: raise Noise, lower Paths or Colors, or pick a lower-fidelity preset diese Nachzeichnung würde mehr als {max} Ankerpunkte erzeugen, mehr als das Dokument flüssig darstellen kann: Erhöhen Sie „Rauschen“, verringern Sie „Pfade“ oder „Farben“ oder wählen Sie eine Vorgabe mit geringerer Genauigkeit
|
||||
@msg select an envelope wählen Sie eine Hülle aus
|
||||
@msg select an image wählen Sie ein Bild aus
|
||||
@msg object {_1} is an image changed by Perspective Distort or Free Distort, which this command does not work on Objekt {_1} ist ein Bild, das mit Perspektivisch verzerren oder Frei verzerren verändert wurde; dieser Befehl funktioniert damit nicht
|
||||
@msg image {_1} cannot be distorted this way: its corners would not make a convex shape Bild {_1} kann so nicht verzerrt werden: seine Ecken würden keine konvexe Form bilden
|
||||
@msg image {_1} cannot be distorted this way: its corners would cross the warp's horizon Bild {_1} kann so nicht verzerrt werden: seine Ecken würden den Horizont der Verzerrung überschreiten
|
||||
@msg image {_1} cannot be distorted this way: its corners would be too close together for a perspective map Bild {_1} kann so nicht verzerrt werden: seine Ecken lägen für eine perspektivische Abbildung zu nah beieinander
|
||||
@msg `background` must be edges, corners or colors `background` muss edges, corners oder colors sein
|
||||
@msg `match` must be distance or channels `match` muss distance oder channels sein
|
||||
@msg `{key}` must be from 0 to 100 `{key}` muss von 0 bis 100 sein
|
||||
@@ -10398,6 +10409,10 @@ breakText Glyphs Glyphen
|
||||
@msg A panel is not joined to the rest by a crease. Ein Feld ist durch keine Rilllinie mit den übrigen verbunden.
|
||||
@msg A fold line is on a non-printing layer. Eine Faltlinie liegt auf einer nicht druckbaren Ebene.
|
||||
@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Felder: {panels}, Scharniere: {hinges}, Fehler: {errors}, Warnungen: {warnings}
|
||||
Leaf Vine Blätterranke
|
||||
Blossom Chain Blütenkette
|
||||
Pennant Garland Wimpelgirlande
|
||||
Lantern String Laternenkette
|
||||
Orbit Lines Orbitlinien
|
||||
Petal Garland Blütengirlande
|
||||
Lattice Braid Gittergeflecht
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -4201,6 +4201,10 @@ digits Malayalam Μαλαγιάλαμ
|
||||
Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Εμφανίζει στον καμβά τον αριθμό κάθε τομής σε ένα πλαίσιο πάνω αριστερά της· όταν είναι απενεργοποιημένο, τα περιγράμματα των τομών εξακολουθούν να εμφανίζονται.
|
||||
The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. Το χρώμα των περιγραμμάτων των τομών χρήστη και αντικειμένου και των πλαισίων με τους αριθμούς τους· οι αυτόματες τομές χρησιμοποιούν μια πιο αχνή απόχρωσή του.
|
||||
New type takes this language while Document Setup's language is English: USA and [Normal Character Style] sets none; type already in a document keeps its own language. Το νέο κείμενο παίρνει αυτήν τη γλώσσα όσο η γλώσσα στη Ρύθμιση εγγράφου είναι Αγγλικά: ΗΠΑ και το [Κανονικό στυλ χαρακτήρων] δεν ορίζει γλώσσα· το κείμενο που υπάρχει ήδη σε ένα έγγραφο κρατά τη δική του γλώσσα.
|
||||
In paragraphs with Hyphenate on, a listed word is hyphenated only at the hyphens typed in it, or never when it has none, whatever its language or case. Σε παραγράφους με ενεργό τον Συλλαβισμό, μια λέξη της λίστας συλλαβίζεται μόνο στα ενωτικά που έχουν πληκτρολογηθεί σε αυτήν ή ποτέ αν δεν έχει, ανεξάρτητα από τη γλώσσα ή τα πεζά-κεφαλαία της.
|
||||
On the desktop, this folder's .wasm plug-ins load at startup and when OK sets a new folder, except in Safe Mode; one that asks for permissions loads only after you grant them. The web version loads none. Στην έκδοση για υπολογιστή, τα πρόσθετα .wasm του φακέλου φορτώνονται στην εκκίνηση και όταν το Εντάξει ορίζει νέο φάκελο, εκτός από την Ασφαλή λειτουργία· ένα που ζητά άδειες φορτώνεται μόνο αφού τις δώσετε. Η έκδοση web δεν φορτώνει κανένα.
|
||||
Large gives each filter or command plug-in run at least 250 million instructions, with the same time limit; Normal keeps the plug-in's own budget. Live effects, exporters and importers keep theirs. Το Μεγάλο δίνει σε κάθε εκτέλεση προσθέτου φίλτρου ή εντολής τουλάχιστον 250 εκατομμύρια εντολές με το ίδιο χρονικό όριο· η Κανονική κρατά τον προϋπολογισμό του ίδιου του προσθέτου. Τα ζωντανά εφέ, οι εξαγωγείς και οι εισαγωγείς κρατούν τον δικό τους.
|
||||
New type takes this language while Document Setup's language is English: USA; type already in a document keeps its own language. Το νέο κείμενο παίρνει αυτήν τη γλώσσα όσο η γλώσσα στη Ρύθμιση εγγράφου είναι Αγγλικά: ΗΠΑ· το κείμενο που υπάρχει ήδη σε ένα έγγραφο κρατά τη δική του γλώσσα.
|
||||
In paragraphs with Hyphenate on, a listed word breaks only at the hyphens typed in it, or nowhere when it has none, whatever its language or case. Σε παραγράφους με ενεργό τον Συλλαβισμό, μια λέξη της λίστας χωρίζεται μόνο στα ενωτικά που έχουν πληκτρολογηθεί σε αυτήν ή πουθενά αν δεν έχει, ανεξάρτητα από τη γλώσσα ή τα πεζά-κεφαλαία της.
|
||||
On the desktop, the .wasm plug-ins in this folder load at startup and when you click OK with a new folder here, except in Safe Mode; the web version does not load them. Στην έκδοση για υπολογιστή, τα πρόσθετα .wasm αυτού του φακέλου φορτώνονται κατά την εκκίνηση και όταν κάνετε κλικ στο Εντάξει με νέο φάκελο εδώ, εκτός από την Ασφαλή λειτουργία· η έκδοση web δεν τα φορτώνει.
|
||||
Normal keeps each plug-in's own limits; with Large, a plug-in filter or command may run at least 250 million instructions besides those for its input. The time limit stays the same. Το Κανονική διατηρεί τα δικά όρια κάθε επέκτασης· με το Μεγάλο, ένα φίλτρο ή μια εντολή επέκτασης μπορεί να εκτελέσει τουλάχιστον 250 εκατομμύρια εντολές επιπλέον εκείνων για την είσοδό του. Το χρονικό όριο μένει το ίδιο.
|
||||
@@ -4215,8 +4219,8 @@ digits Malayalam Μαλαγιάλαμ
|
||||
Shows each tool group's name above its tools in the toolbar; off, the groups follow one another with nothing between them. Εμφανίζει το όνομα κάθε ομάδας εργαλείων πάνω από τα εργαλεία της στη γραμμή εργαλείων· όταν είναι ανενεργό, οι ομάδες ακολουθούν η μία την άλλη χωρίς τίποτα ανάμεσα.
|
||||
From now on, documents you open or create open as tabs; off, each opens in a floating window. Documents already open stay where they are. Από εδώ και πέρα, τα έγγραφα που ανοίγετε ή δημιουργείτε ανοίγουν σε καρτέλες· όταν είναι ανενεργό, το καθένα ανοίγει σε αιωρούμενο παράθυρο. Τα ήδη ανοιχτά έγγραφα μένουν εκεί που είναι.
|
||||
Makes the document tabs taller and their names larger. Κάνει τις καρτέλες των εγγράφων ψηλότερες και τα ονόματά τους μεγαλύτερα.
|
||||
From the next start, the system draws the window's title bar where VectorCraft would otherwise draw its own. Από την επόμενη εκκίνηση, το σύστημα σχεδιάζει τη γραμμή τίτλου του παραθύρου εκεί όπου αλλιώς το VectorCraft θα σχεδίαζε τη δική του.
|
||||
From the next start, VectorCraft draws the window's title bar even where the desktop would draw it, unless System Title Bar is on. Από την επόμενη εκκίνηση, το VectorCraft σχεδιάζει τη γραμμή τίτλου του παραθύρου ακόμη κι εκεί όπου θα τη σχεδίαζε η επιφάνεια εργασίας, εκτός αν είναι ενεργή η Γραμμή τίτλου συστήματος.
|
||||
From the next start, the system draws the window's title bar where VectorCraft would otherwise draw its own; on Linux and the BSDs, the VECTORCRAFT_TITLEBAR variable takes precedence. Από την επόμενη εκκίνηση, το σύστημα σχεδιάζει τη γραμμή τίτλου του παραθύρου εκεί όπου αλλιώς το VectorCraft θα σχεδίαζε τη δική του· σε Linux και BSD προηγείται η μεταβλητή VECTORCRAFT_TITLEBAR.
|
||||
From the next start, VectorCraft draws the window's title bar even where the desktop would draw it, unless System Title Bar is on or the VECTORCRAFT_TITLEBAR variable chooses it. Από την επόμενη εκκίνηση, το VectorCraft σχεδιάζει τη γραμμή τίτλου ακόμη κι εκεί όπου θα τη σχεδίαζε η επιφάνεια εργασίας, εκτός αν είναι ενεργή η Γραμμή τίτλου συστήματος ή την επιλέγει η μεταβλητή VECTORCRAFT_TITLEBAR.
|
||||
Makes the interface larger or smaller; art on the canvas keeps its size at the same zoom. Μεγαλώνει ή μικραίνει το περιβάλλον χρήστη· το έργο στον καμβά κρατά το μέγεθός του στο ίδιο ζουμ.
|
||||
The tool pointers VectorCraft draws grow and shrink with UI Scaling; off, they keep their size. Οι δείκτες εργαλείων που σχεδιάζει το VectorCraft μεγαλώνουν και μικραίνουν με την Κλιμάκωση περιβάλλοντος χρήστη· όταν είναι ανενεργό, κρατούν το μέγεθός τους.
|
||||
The language of the interface; Auto uses the system's language. The dialog switches language as soon as you choose one. Η γλώσσα του περιβάλλοντος χρήστη· το Αυτόματα χρησιμοποιεί τη γλώσσα του συστήματος. Ο διάλογος αλλάζει γλώσσα μόλις επιλέξετε μία.
|
||||
@@ -4242,6 +4246,9 @@ digits Malayalam Μαλαγιάλαμ
|
||||
Open Recent Files and the Home screen list at most this many recent files; 0 lists none, and VectorCraft still remembers up to 30. Το Άνοιγμα πρόσφατων αρχείων και η Αρχική οθόνη δείχνουν το πολύ τόσα πρόσφατα αρχεία· το 0 δεν δείχνει κανένα, και το VectorCraft θυμάται ακόμη έως 30.
|
||||
When a document opens, a linked EPS image that shows its saved preview keeps it instead of reading the EPS file again; changed files still follow Update Links. Όταν ανοίγει ένα έγγραφο, μια συνδεδεμένη εικόνα EPS που δείχνει την αποθηκευμένη προεπισκόπησή της την κρατά αντί να διαβάσει ξανά το αρχείο EPS· τα αλλαγμένα αρχεία ακολουθούν πάντα την Ενημέρωση συνδέσμων.
|
||||
In Pixel Preview, images are drawn smoothed; off, their pixels show with hard edges. Outside Pixel Preview, images are always smoothed. Στην Προεπισκόπηση εικονοστοιχείων οι εικόνες σχεδιάζονται εξομαλυμένες· όταν είναι ανενεργό, τα εικονοστοιχεία τους έχουν αιχμηρές άκρες. Εκτός Προεπισκόπησης εικονοστοιχείων οι εικόνες εξομαλύνονται πάντα.
|
||||
PDF Text Κείμενο PDF
|
||||
The text of a PDF you open or embed comes in as editable type, or as outlines that look the same on a computer without its fonts. Το κείμενο ενός PDF που ανοίγετε ή ενσωματώνετε εισάγεται ως επεξεργάσιμο κείμενο ή ως περιγράμματα που φαίνονται ίδια σε υπολογιστή χωρίς τις γραμματοσειρές του.
|
||||
Linked pages show the file's own text. Οι συνδεδεμένες σελίδες δείχνουν το κείμενο του ίδιου του αρχείου.
|
||||
When a linked file changes, Automatically reads it again, Ask When Modified asks you first, and Manually leaves it and shows a note in the status bar. Όταν αλλάζει ένα συνδεδεμένο αρχείο, το Αυτόματα το διαβάζει ξανά, το Ερώτηση όταν τροποποιηθεί σας ρωτά πρώτα και το Χειροκίνητα το αφήνει ως έχει και δείχνει μια σημείωση στη γραμμή κατάστασης.
|
||||
On the desktop, the folder New from Template… and Save as Template… start in; leave it blank for VectorCraft Templates in your documents folder. Στην έκδοση για υπολογιστή, ο φάκελος όπου ξεκινούν το Νέο από πρότυπο… και η Αποθήκευση ως πρότυπο…· αφήστε τον κενό για το VectorCraft Templates στον φάκελο εγγράφων σας.
|
||||
Edit Original opens a linked file in the system's default app for its type; off, a linked raster image opens in PhotoCraft where it is installed. Η Επεξεργασία πρωτοτύπου ανοίγει ένα συνδεδεμένο αρχείο στην προεπιλεγμένη εφαρμογή του συστήματος για τον τύπο του· όταν είναι ανενεργό, μια συνδεδεμένη εικόνα raster ανοίγει στο PhotoCraft, αν είναι εγκατεστημένο.
|
||||
@@ -5549,6 +5556,10 @@ digits Malayalam Μαλαγιάλαμ
|
||||
@msg this trace would make more than {max} anchor points, more than the document can show smoothly: raise Noise, lower Paths or Colors, or pick a lower-fidelity preset αυτή η διανυσματοποίηση θα δημιουργούσε πάνω από {max} σημεία αγκύρωσης, περισσότερα από όσα μπορεί να εμφανίσει ομαλά το έγγραφο: αυξήστε τον Θόρυβο, μειώστε τις Διαδρομές ή τα Χρώματα ή επιλέξτε προεπιλογή χαμηλότερης πιστότητας
|
||||
@msg select an envelope επιλέξτε περίβλημα
|
||||
@msg select an image επιλέξτε εικόνα
|
||||
@msg object {_1} is an image changed by Perspective Distort or Free Distort, which this command does not work on το αντικείμενο {_1} είναι εικόνα που άλλαξε με Παραμόρφωση προοπτικής ή Ελεύθερη παραμόρφωση, στην οποία δεν λειτουργεί αυτή η εντολή
|
||||
@msg image {_1} cannot be distorted this way: its corners would not make a convex shape η εικόνα {_1} δεν μπορεί να παραμορφωθεί έτσι: οι γωνίες της δεν θα σχημάτιζαν κυρτό σχήμα
|
||||
@msg image {_1} cannot be distorted this way: its corners would cross the warp's horizon η εικόνα {_1} δεν μπορεί να παραμορφωθεί έτσι: οι γωνίες της θα περνούσαν τον ορίζοντα της παραμόρφωσης
|
||||
@msg image {_1} cannot be distorted this way: its corners would be too close together for a perspective map η εικόνα {_1} δεν μπορεί να παραμορφωθεί έτσι: οι γωνίες της θα ήταν πολύ κοντά μεταξύ τους για προοπτική απεικόνιση
|
||||
@msg `background` must be edges, corners or colors το `background` πρέπει να είναι edges, corners ή colors
|
||||
@msg `match` must be distance or channels το `match` πρέπει να είναι distance ή channels
|
||||
@msg `{key}` must be from 0 to 100 το `{key}` πρέπει να είναι από 0 έως 100
|
||||
@@ -8906,6 +8917,10 @@ breakText Glyphs Γλύφοι
|
||||
@msg A joint does not close by {gap} pt. Μια ένωση δεν κλείνει κατά {gap} pt.
|
||||
@msg Two panels pass through each other. Δύο πάνελ διαπερνούν το ένα το άλλο.
|
||||
@msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" το composer πρέπει να είναι "singleLine", "everyLine", "standardSingleLine" ή "standardEveryLine"
|
||||
Leaf Vine Κληματίδα φύλλων
|
||||
Blossom Chain Αλυσίδα λουλουδιών
|
||||
Pennant Garland Γιρλάντα σημαιών
|
||||
Lantern String Σειρά φαναριών
|
||||
Orbit Lines Τροχιακές γραμμές
|
||||
Petal Garland Γιρλάντα πετάλων
|
||||
Lattice Braid Πλεξούδα πλέγματος
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -3385,6 +3385,10 @@ digits Malayalam Malayálam
|
||||
Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Muestra en el lienzo el número de cada sector en un recuadro en su esquina superior izquierda; si está desactivado, los contornos de los sectores siguen visibles.
|
||||
The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. El color de los contornos de los sectores de usuario y de objeto y de los recuadros con su número; los sectores automáticos usan un tono más apagado de ese color.
|
||||
New type takes this language while Document Setup's language is English: USA and [Normal Character Style] sets none; type already in a document keeps its own language. El texto nuevo toma este idioma mientras el idioma de Ajustar documento sea Inglés: Estados Unidos y [Estilo de carácter normal] no defina ninguno; el texto que ya está en un documento conserva su idioma.
|
||||
In paragraphs with Hyphenate on, a listed word is hyphenated only at the hyphens typed in it, or never when it has none, whatever its language or case. En los párrafos con Separar con guiones activado, una palabra de la lista solo recibe guion de separación en los guiones escritos en ella, o nunca si no tiene, sea cual sea su idioma o uso de mayúsculas.
|
||||
On the desktop, this folder's .wasm plug-ins load at startup and when OK sets a new folder, except in Safe Mode; one that asks for permissions loads only after you grant them. The web version loads none. En la versión de escritorio, los plugins .wasm de esta carpeta se cargan al iniciar y cuando Aceptar fija una carpeta nueva, salvo en Modo seguro; uno que pide permisos solo se carga después de que los concedas. La versión web no carga ninguno.
|
||||
Large gives each filter or command plug-in run at least 250 million instructions, with the same time limit; Normal keeps the plug-in's own budget. Live effects, exporters and importers keep theirs. Grande da a cada ejecución de un plugin de filtro o de comando al menos 250 millones de instrucciones, con el mismo límite de tiempo; Normal mantiene el presupuesto propio del plugin. Los efectos en vivo, exportadores e importadores mantienen el suyo.
|
||||
New type takes this language while Document Setup's language is English: USA; type already in a document keeps its own language. El texto nuevo toma este idioma mientras el idioma de Ajustar documento sea Inglés: Estados Unidos; el texto que ya está en un documento conserva su idioma.
|
||||
In paragraphs with Hyphenate on, a listed word breaks only at the hyphens typed in it, or nowhere when it has none, whatever its language or case. En los párrafos con Separar con guiones activado, una palabra de la lista se divide solo en los guiones escritos en ella, o en ningún punto si no tiene, sea cual sea su idioma o uso de mayúsculas.
|
||||
On the desktop, the .wasm plug-ins in this folder load at startup and when you click OK with a new folder here, except in Safe Mode; the web version does not load them. En la versión de escritorio, los plugins .wasm de esta carpeta se cargan al iniciar y al hacer clic en Aceptar con una carpeta nueva aquí, salvo en Modo seguro; la versión web no los carga.
|
||||
Normal keeps each plug-in's own limits; with Large, a plug-in filter or command may run at least 250 million instructions besides those for its input. The time limit stays the same. Normal mantiene los límites propios de cada plugin; con Grande, un filtro o un comando de un plugin puede ejecutar al menos 250 millones de instrucciones además de las de su entrada. El límite de tiempo no cambia.
|
||||
@@ -3399,8 +3403,8 @@ digits Malayalam Malayálam
|
||||
Shows each tool group's name above its tools in the toolbar; off, the groups follow one another with nothing between them. Muestra el nombre de cada grupo de herramientas encima de sus herramientas en la barra de herramientas; desactivado, los grupos se suceden sin nada entre ellos.
|
||||
From now on, documents you open or create open as tabs; off, each opens in a floating window. Documents already open stay where they are. A partir de ahora, los documentos que abra o cree se abren como pestañas; desactivado, cada uno se abre en una ventana flotante. Los documentos ya abiertos se quedan donde están.
|
||||
Makes the document tabs taller and their names larger. Hace más altas las pestañas de los documentos y más grandes sus nombres.
|
||||
From the next start, the system draws the window's title bar where VectorCraft would otherwise draw its own. A partir del próximo inicio, el sistema dibuja la barra de título de la ventana donde, si no, VectorCraft dibujaría la suya.
|
||||
From the next start, VectorCraft draws the window's title bar even where the desktop would draw it, unless System Title Bar is on. A partir del próximo inicio, VectorCraft dibuja la barra de título de la ventana incluso donde la dibujaría el escritorio, salvo que Barra de título del sistema esté activada.
|
||||
From the next start, the system draws the window's title bar where VectorCraft would otherwise draw its own; on Linux and the BSDs, the VECTORCRAFT_TITLEBAR variable takes precedence. A partir del próximo inicio, el sistema dibuja la barra de título de la ventana donde, si no, VectorCraft dibujaría la suya; en Linux y los BSD, la variable VECTORCRAFT_TITLEBAR tiene prioridad.
|
||||
From the next start, VectorCraft draws the window's title bar even where the desktop would draw it, unless System Title Bar is on or the VECTORCRAFT_TITLEBAR variable chooses it. A partir del próximo inicio, VectorCraft dibuja la barra de título de la ventana incluso donde la dibujaría el escritorio, salvo que Barra de título del sistema esté activada o la variable VECTORCRAFT_TITLEBAR la elija.
|
||||
Makes the interface larger or smaller; art on the canvas keeps its size at the same zoom. Agranda o reduce la interfaz; el arte del lienzo conserva su tamaño con el mismo zoom.
|
||||
The tool pointers VectorCraft draws grow and shrink with UI Scaling; off, they keep their size. Los punteros de herramienta que dibuja VectorCraft crecen y se reducen con la Escala de la interfaz; desactivado, conservan su tamaño.
|
||||
The language of the interface; Auto uses the system's language. The dialog switches language as soon as you choose one. El idioma de la interfaz; Auto usa el idioma del sistema. El cuadro de diálogo cambia de idioma en cuanto elige uno.
|
||||
@@ -3426,6 +3430,9 @@ digits Malayalam Malayálam
|
||||
Open Recent Files and the Home screen list at most this many recent files; 0 lists none, and VectorCraft still remembers up to 30. Abrir archivos recientes y la pantalla de Inicio muestran como máximo este número de archivos recientes; 0 no muestra ninguno, y VectorCraft sigue recordando hasta 30.
|
||||
When a document opens, a linked EPS image that shows its saved preview keeps it instead of reading the EPS file again; changed files still follow Update Links. Al abrir un documento, una imagen EPS vinculada que muestra su vista previa guardada la conserva en lugar de volver a leer el archivo EPS; los archivos modificados siguen Actualizar vínculos.
|
||||
In Pixel Preview, images are drawn smoothed; off, their pixels show with hard edges. Outside Pixel Preview, images are always smoothed. En Vista previa de píxeles, las imágenes se dibujan suavizadas; desactivado, sus píxeles muestran bordes duros. Fuera de Vista previa de píxeles, las imágenes siempre se suavizan.
|
||||
PDF Text Texto de PDF
|
||||
The text of a PDF you open or embed comes in as editable type, or as outlines that look the same on a computer without its fonts. El texto de un PDF que abre o incrusta entra como texto editable o como contornos que se ven igual en un equipo sin sus fuentes.
|
||||
Linked pages show the file's own text. Las páginas vinculadas muestran el texto propio del archivo.
|
||||
When a linked file changes, Automatically reads it again, Ask When Modified asks you first, and Manually leaves it and shows a note in the status bar. Cuando un archivo vinculado cambia, Automáticamente lo vuelve a leer, Preguntar al modificar le pregunta primero, y Manualmente lo deja como está y muestra un aviso en la barra de estado.
|
||||
On the desktop, the folder New from Template… and Save as Template… start in; leave it blank for VectorCraft Templates in your documents folder. En la versión de escritorio, la carpeta en la que empiezan Nuevo a partir de plantilla… y Guardar como plantilla…; déjela vacía para VectorCraft Templates en su carpeta de documentos.
|
||||
Edit Original opens a linked file in the system's default app for its type; off, a linked raster image opens in PhotoCraft where it is installed. Editar original abre un archivo vinculado en la aplicación predeterminada del sistema para su tipo; desactivado, una imagen rasterizada vinculada se abre en PhotoCraft si está instalado.
|
||||
@@ -5609,6 +5616,10 @@ liquify-list-end {0}, {1} {0}, {1}
|
||||
@msg this trace would make more than {max} anchor points, more than the document can show smoothly: raise Noise, lower Paths or Colors, or pick a lower-fidelity preset este calco crearía más de {max} puntos de ancla, más de los que el documento puede mostrar con fluidez: sube Ruido, baja Trazados o Colores, o elige un preajuste de menor fidelidad
|
||||
@msg select an envelope selecciona una envolvente
|
||||
@msg select an image selecciona una imagen
|
||||
@msg object {_1} is an image changed by Perspective Distort or Free Distort, which this command does not work on el objeto {_1} es una imagen modificada con Distorsión de perspectiva o Distorsión libre, con la que este comando no funciona
|
||||
@msg image {_1} cannot be distorted this way: its corners would not make a convex shape la imagen {_1} no se puede distorsionar así: sus esquinas no formarían una forma convexa
|
||||
@msg image {_1} cannot be distorted this way: its corners would cross the warp's horizon la imagen {_1} no se puede distorsionar así: sus esquinas cruzarían el horizonte de la distorsión
|
||||
@msg image {_1} cannot be distorted this way: its corners would be too close together for a perspective map la imagen {_1} no se puede distorsionar así: sus esquinas estarían demasiado juntas para una proyección en perspectiva
|
||||
@msg `background` must be edges, corners or colors `background` debe ser edges, corners o colors
|
||||
@msg `match` must be distance or channels `match` debe ser distance o channels
|
||||
@msg `{key}` must be from 0 to 100 `{key}` debe estar entre 0 y 100
|
||||
@@ -10650,6 +10661,10 @@ breakText Glyphs Glifos
|
||||
@msg A joint does not close by {gap} pt. Una unión no cierra por {gap} pt.
|
||||
@msg Two panels pass through each other. Dos paneles se atraviesan entre sí.
|
||||
@msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer debe ser "singleLine", "everyLine", "standardSingleLine" o "standardEveryLine"
|
||||
Leaf Vine Enredadera de hojas
|
||||
Blossom Chain Cadena de flores
|
||||
Pennant Garland Guirnalda de banderines
|
||||
Lantern String Cadena de faroles
|
||||
Orbit Lines Líneas orbitales
|
||||
Petal Garland Guirnalda de pétalos
|
||||
Lattice Braid Trenza reticular
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -4788,6 +4788,10 @@ font-technology Variable Muuttuvat
|
||||
Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Näyttää piirtopinnalla kunkin viipaleen numeron ruudussa sen vasemmassa yläkulmassa; kun asetus on pois päältä, viipaleiden ääriviivat näkyvät edelleen.
|
||||
The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. Käyttäjä- ja objektiviipaleiden ääriviivojen ja niiden numeroruutujen väri; automaattiset viipaleet käyttävät siitä himmeämpää sävyä.
|
||||
New type takes this language while Document Setup's language is English: USA and [Normal Character Style] sets none; type already in a document keeps its own language. Uusi teksti saa tämän kielen, kun Asiakirjan asetusten kieli on Englanti: USA eikä [Normaali merkkityyli] määritä kieltä; asiakirjassa jo oleva teksti säilyttää oman kielensä.
|
||||
In paragraphs with Hyphenate on, a listed word is hyphenated only at the hyphens typed in it, or never when it has none, whatever its language or case. Kappaleissa, joissa Tavuta on käytössä, luettelon sana saa tavuviivan vain siihen kirjoitettujen yhdysmerkkien kohdalle tai ei koskaan, jos niitä ei ole, kielestä ja kirjainkoosta riippumatta.
|
||||
On the desktop, this folder's .wasm plug-ins load at startup and when OK sets a new folder, except in Safe Mode; one that asks for permissions loads only after you grant them. The web version loads none. Työpöytäversiossa tämän kansion .wasm-laajennukset ladataan käynnistettäessä ja kun OK asettaa uuden kansion, paitsi vikasietotilassa; käyttöoikeuksia pyytävä laajennus ladataan vasta, kun myönnät ne. Verkkoversio ei lataa yhtään.
|
||||
Large gives each filter or command plug-in run at least 250 million instructions, with the same time limit; Normal keeps the plug-in's own budget. Live effects, exporters and importers keep theirs. Suuri antaa suodatin- tai komentolaajennuksen jokaiselle ajolle vähintään 250 miljoonaa käskyä samalla aikarajalla; Normaali säilyttää laajennuksen oman budjetin. Live-tehosteet, viejät ja tuojat säilyttävät omansa.
|
||||
New type takes this language while Document Setup's language is English: USA; type already in a document keeps its own language. Uusi teksti saa tämän kielen, kun Asiakirjan asetusten kieli on Englanti: USA; asiakirjassa jo oleva teksti säilyttää oman kielensä.
|
||||
In paragraphs with Hyphenate on, a listed word breaks only at the hyphens typed in it, or nowhere when it has none, whatever its language or case. Kappaleissa, joissa Tavuta on käytössä, luettelon sana tavutetaan vain siihen kirjoitettujen yhdysmerkkien kohdalta tai ei lainkaan, jos niitä ei ole, kielestä ja kirjainkoosta riippumatta.
|
||||
On the desktop, the .wasm plug-ins in this folder load at startup and when you click OK with a new folder here, except in Safe Mode; the web version does not load them. Työpöytäversiossa tämän kansion .wasm-laajennukset ladataan käynnistettäessä ja kun napsautat OK uuden kansion kanssa tässä, paitsi vikasietotilassa; verkkoversio ei lataa niitä.
|
||||
Normal keeps each plug-in's own limits; with Large, a plug-in filter or command may run at least 250 million instructions besides those for its input. The time limit stays the same. Normaali säilyttää kunkin laajennuksen omat rajat; Suuri-asetuksella laajennuksen suodin tai komento voi suorittaa vähintään 250 miljoonaa käskyä syötteensä käskyjen lisäksi. Aikaraja pysyy samana.
|
||||
@@ -4802,8 +4806,8 @@ font-technology Variable Muuttuvat
|
||||
Shows each tool group's name above its tools in the toolbar; off, the groups follow one another with nothing between them. Näyttää kunkin työkaluryhmän nimen sen työkalujen yläpuolella työkalurivissä; pois päältä ryhmät seuraavat toisiaan ilman mitään välissä.
|
||||
From now on, documents you open or create open as tabs; off, each opens in a floating window. Documents already open stay where they are. Tästä lähtien avaamasi tai luomasi asiakirjat avautuvat välilehtinä; pois päältä kukin avautuu kelluvaan ikkunaan. Jo avoinna olevat asiakirjat pysyvät paikoillaan.
|
||||
Makes the document tabs taller and their names larger. Tekee asiakirjojen välilehdistä korkeampia ja niiden nimistä suurempia.
|
||||
From the next start, the system draws the window's title bar where VectorCraft would otherwise draw its own. Seuraavasta käynnistyksestä alkaen järjestelmä piirtää ikkunan otsikkorivin siellä, missä VectorCraft muuten piirtäisi omansa.
|
||||
From the next start, VectorCraft draws the window's title bar even where the desktop would draw it, unless System Title Bar is on. Seuraavasta käynnistyksestä alkaen VectorCraft piirtää ikkunan otsikkorivin silloinkin, kun työpöytä piirtäisi sen, ellei Järjestelmän otsikkorivi ole päällä.
|
||||
From the next start, the system draws the window's title bar where VectorCraft would otherwise draw its own; on Linux and the BSDs, the VECTORCRAFT_TITLEBAR variable takes precedence. Seuraavasta käynnistyksestä alkaen järjestelmä piirtää ikkunan otsikkorivin siellä, missä VectorCraft muuten piirtäisi omansa; Linuxissa ja BSD-järjestelmissä VECTORCRAFT_TITLEBAR-muuttuja menee edelle.
|
||||
From the next start, VectorCraft draws the window's title bar even where the desktop would draw it, unless System Title Bar is on or the VECTORCRAFT_TITLEBAR variable chooses it. Seuraavasta käynnistyksestä alkaen VectorCraft piirtää ikkunan otsikkorivin silloinkin, kun työpöytä piirtäisi sen, ellei Järjestelmän otsikkorivi ole päällä tai VECTORCRAFT_TITLEBAR-muuttuja valitse sitä.
|
||||
Makes the interface larger or smaller; art on the canvas keeps its size at the same zoom. Suurentaa tai pienentää käyttöliittymää; kankaalla oleva kuvitus säilyttää kokonsa samalla zoomauksella.
|
||||
The tool pointers VectorCraft draws grow and shrink with UI Scaling; off, they keep their size. VectorCraftin piirtämät työkaluosoittimet kasvavat ja pienenevät Käyttöliittymän skaalauksen mukana; pois päältä ne säilyttävät kokonsa.
|
||||
The language of the interface; Auto uses the system's language. The dialog switches language as soon as you choose one. Käyttöliittymän kieli; Automaattinen käyttää järjestelmän kieltä. Valintaikkuna vaihtaa kielen heti, kun valitset sellaisen.
|
||||
@@ -4829,6 +4833,9 @@ font-technology Variable Muuttuvat
|
||||
Open Recent Files and the Home screen list at most this many recent files; 0 lists none, and VectorCraft still remembers up to 30. Avaa viimeisimmät tiedostot ja Aloitus-näkymä luettelevat enintään näin monta viimeisintä tiedostoa; 0 ei luettele yhtään, ja VectorCraft muistaa silti enintään 30.
|
||||
When a document opens, a linked EPS image that shows its saved preview keeps it instead of reading the EPS file again; changed files still follow Update Links. Kun asiakirja avataan, linkitetty EPS-kuva, joka näyttää tallennetun esikatselunsa, säilyttää sen eikä lue EPS-tiedostoa uudelleen; muuttuneet tiedostot noudattavat silti Päivitä linkit -asetusta.
|
||||
In Pixel Preview, images are drawn smoothed; off, their pixels show with hard edges. Outside Pixel Preview, images are always smoothed. Pikseliesikatselussa kuvat piirretään pehmennettyinä; pois päältä niiden pikseleillä on terävät reunat. Pikseliesikatselun ulkopuolella kuvat pehmennetään aina.
|
||||
PDF Text PDF-teksti
|
||||
The text of a PDF you open or embed comes in as editable type, or as outlines that look the same on a computer without its fonts. Avaamasi tai upottamasi PDF:n teksti tuodaan muokattavana tekstinä tai ääriviivoina, jotka näyttävät samalta tietokoneella, jossa sen fontteja ei ole.
|
||||
Linked pages show the file's own text. Linkitetyt sivut näyttävät tiedoston oman tekstin.
|
||||
When a linked file changes, Automatically reads it again, Ask When Modified asks you first, and Manually leaves it and shows a note in the status bar. Kun linkitetty tiedosto muuttuu, Automaattisesti lukee sen uudelleen, Kysy, kun muokattu kysyy ensin, ja Manuaalisesti jättää sen ennalleen ja näyttää ilmoituksen tilarivillä.
|
||||
On the desktop, the folder New from Template… and Save as Template… start in; leave it blank for VectorCraft Templates in your documents folder. Työpöytäversiossa kansio, josta Uusi mallipohjasta… ja Tallenna mallipohjana… alkavat; jätä tyhjäksi, niin käytetään asiakirjakansiosi VectorCraft Templates -kansiota.
|
||||
Edit Original opens a linked file in the system's default app for its type; off, a linked raster image opens in PhotoCraft where it is installed. Muokkaa alkuperäistä avaa linkitetyn tiedoston järjestelmän oletussovelluksessa sen tyypin mukaan; pois päältä linkitetty rasterikuva avautuu PhotoCraftissa, jos se on asennettu.
|
||||
@@ -5832,6 +5839,10 @@ liquify-list-end {0}, {1} {0} ja {1}
|
||||
@msg this trace would make more than {max} anchor points, more than the document can show smoothly: raise Noise, lower Paths or Colors, or pick a lower-fidelity preset tämä jäljitys tuottaisi yli {max} ankkuripistettä, enemmän kuin asiakirja näyttää sujuvasti: nosta kohinaa, vähennä polkuja tai värejä tai valitse epätarkempi esiasetus
|
||||
@msg select an envelope valitse vääristyskuori
|
||||
@msg select an image valitse kuva
|
||||
@msg object {_1} is an image changed by Perspective Distort or Free Distort, which this command does not work on objekti {_1} on kuva, jota on muutettu Perspektiivivääristyksellä tai Vapaalla vääristyksellä, eikä tämä komento toimi sille
|
||||
@msg image {_1} cannot be distorted this way: its corners would not make a convex shape kuvaa {_1} ei voi vääristää näin: sen kulmat eivät muodostaisi kuperaa muotoa
|
||||
@msg image {_1} cannot be distorted this way: its corners would cross the warp's horizon kuvaa {_1} ei voi vääristää näin: sen kulmat ylittäisivät vääristyksen horisontin
|
||||
@msg image {_1} cannot be distorted this way: its corners would be too close together for a perspective map kuvaa {_1} ei voi vääristää näin: sen kulmat olisivat liian lähellä toisiaan perspektiivikuvausta varten
|
||||
@msg `background` must be edges, corners or colors `background`-arvon on oltava edges, corners tai colors
|
||||
@msg `match` must be distance or channels `match`-arvon on oltava distance tai channels
|
||||
@msg `{key}` must be from 0 to 100 `{key}`-arvon on oltava väliltä 0–100
|
||||
@@ -8989,6 +9000,10 @@ breakText Glyphs Merkit
|
||||
@msg A joint does not close by {gap} pt. Liitos ei sulkeudu, rako {gap} pt.
|
||||
@msg Two panels pass through each other. Kaksi paneelia kulkee toistensa läpi.
|
||||
@msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer on oltava "singleLine", "everyLine", "standardSingleLine" tai "standardEveryLine"
|
||||
Leaf Vine Lehtiköynnös
|
||||
Blossom Chain Kukkaketju
|
||||
Pennant Garland Viiririvistö
|
||||
Lantern String Lyhtyketju
|
||||
Orbit Lines Kiertoradan viivat
|
||||
Petal Garland Terälehtiköynnös
|
||||
Lattice Braid Ristikkopunos
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -3373,6 +3373,10 @@ digits Malayalam Malayalam
|
||||
Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Affiche sur la zone de travail le numéro de chaque tranche dans un cadre en haut à gauche de la tranche. Désactivée, les contours des tranches restent affichés.
|
||||
The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. La couleur des contours des tranches utilisateur et objet et de leurs cadres de numéro. Les tranches automatiques utilisent une nuance plus terne de cette couleur.
|
||||
New type takes this language while Document Setup's language is English: USA and [Normal Character Style] sets none; type already in a document keeps its own language. Le nouveau texte prend cette langue tant que la langue de Format de document est l’anglais des États-Unis et que [Style de caractère normal] n’en définit aucune. Le texte déjà présent dans un document garde sa langue.
|
||||
In paragraphs with Hyphenate on, a listed word is hyphenated only at the hyphens typed in it, or never when it has none, whatever its language or case. Dans les paragraphes où Césure est activée, un mot de la liste ne reçoit de trait de césure qu’aux traits d’union saisis dedans, ou jamais s’il n’en a pas, quelles que soient sa langue et sa casse.
|
||||
On the desktop, this folder's .wasm plug-ins load at startup and when OK sets a new folder, except in Safe Mode; one that asks for permissions loads only after you grant them. The web version loads none. Dans la version de bureau, les modules externes .wasm de ce dossier se chargent au démarrage et quand OK définit un nouveau dossier, sauf en mode sans échec. Un module qui demande des autorisations ne se charge qu’une fois celles-ci accordées. La version web n’en charge aucun.
|
||||
Large gives each filter or command plug-in run at least 250 million instructions, with the same time limit; Normal keeps the plug-in's own budget. Live effects, exporters and importers keep theirs. Grand donne à chaque exécution d’un module externe de filtre ou de commande au moins 250 millions d’instructions, avec la même limite de temps. Normal garde le budget propre du module. Les effets dynamiques, exportateurs et importateurs gardent le leur.
|
||||
New type takes this language while Document Setup's language is English: USA; type already in a document keeps its own language. Le nouveau texte prend cette langue tant que la langue de Format de document est l’anglais des États-Unis. Le texte déjà présent dans un document garde sa langue.
|
||||
In paragraphs with Hyphenate on, a listed word breaks only at the hyphens typed in it, or nowhere when it has none, whatever its language or case. Dans les paragraphes où Césure est activée, un mot de la liste n’est coupé qu’aux traits d’union saisis dedans, ou nulle part s’il n’en a pas, quelles que soient sa langue et sa casse.
|
||||
On the desktop, the .wasm plug-ins in this folder load at startup and when you click OK with a new folder here, except in Safe Mode; the web version does not load them. Dans la version de bureau, les modules externes .wasm de ce dossier se chargent au démarrage et lorsque vous cliquez sur OK avec un nouveau dossier ici, sauf en mode sans échec. La version web ne les charge pas.
|
||||
Normal keeps each plug-in's own limits; with Large, a plug-in filter or command may run at least 250 million instructions besides those for its input. The time limit stays the same. Normal conserve les limites propres à chaque module externe. Avec Grand, un filtre ou une commande d’un module externe peut exécuter au moins 250 millions d’instructions en plus de celles de son entrée. La limite de temps reste la même.
|
||||
@@ -3387,8 +3391,8 @@ digits Malayalam Malayalam
|
||||
Shows each tool group's name above its tools in the toolbar; off, the groups follow one another with nothing between them. Affiche le nom de chaque groupe d’outils au-dessus de ses outils dans la barre d’outils. Désactivé, les groupes se suivent sans rien entre eux.
|
||||
From now on, documents you open or create open as tabs; off, each opens in a floating window. Documents already open stay where they are. Désormais, les documents que vous ouvrez ou créez s’ouvrent dans des onglets. Désactivé, chacun s’ouvre dans une fenêtre flottante. Les documents déjà ouverts restent où ils sont.
|
||||
Makes the document tabs taller and their names larger. Rend les onglets des documents plus hauts et leurs noms plus grands.
|
||||
From the next start, the system draws the window's title bar where VectorCraft would otherwise draw its own. À partir du prochain démarrage, le système dessine la barre de titre de la fenêtre là où VectorCraft dessinerait sinon la sienne.
|
||||
From the next start, VectorCraft draws the window's title bar even where the desktop would draw it, unless System Title Bar is on. À partir du prochain démarrage, VectorCraft dessine la barre de titre de la fenêtre même là où le bureau la dessinerait, sauf si Barre de titre du système est activée.
|
||||
From the next start, the system draws the window's title bar where VectorCraft would otherwise draw its own; on Linux and the BSDs, the VECTORCRAFT_TITLEBAR variable takes precedence. À partir du prochain démarrage, le système dessine la barre de titre de la fenêtre là où VectorCraft dessinerait sinon la sienne. Sous Linux et les BSD, la variable VECTORCRAFT_TITLEBAR a la priorité.
|
||||
From the next start, VectorCraft draws the window's title bar even where the desktop would draw it, unless System Title Bar is on or the VECTORCRAFT_TITLEBAR variable chooses it. À partir du prochain démarrage, VectorCraft dessine la barre de titre de la fenêtre même là où le bureau la dessinerait, sauf si Barre de titre du système est activée ou si la variable VECTORCRAFT_TITLEBAR la choisit.
|
||||
Makes the interface larger or smaller; art on the canvas keeps its size at the same zoom. Agrandit ou réduit l’interface. L’illustration de la zone de travail garde sa taille au même zoom.
|
||||
The tool pointers VectorCraft draws grow and shrink with UI Scaling; off, they keep their size. Les pointeurs d’outil que dessine VectorCraft grandissent et rétrécissent avec la Mise à l’échelle de l’interface. Désactivé, ils gardent leur taille.
|
||||
The language of the interface; Auto uses the system's language. The dialog switches language as soon as you choose one. La langue de l’interface. Auto utilise la langue du système. La boîte de dialogue change de langue dès que vous en choisissez une.
|
||||
@@ -3414,6 +3418,9 @@ digits Malayalam Malayalam
|
||||
Open Recent Files and the Home screen list at most this many recent files; 0 lists none, and VectorCraft still remembers up to 30. Ouvrir les fichiers récents et l’écran Accueil listent au plus ce nombre de fichiers récents. 0 n’en liste aucun, et VectorCraft en retient toujours jusqu’à 30.
|
||||
When a document opens, a linked EPS image that shows its saved preview keeps it instead of reading the EPS file again; changed files still follow Update Links. À l’ouverture d’un document, une image EPS liée qui montre son aperçu enregistré le garde au lieu de relire le fichier EPS. Les fichiers modifiés suivent toujours Mettre à jour les liens.
|
||||
In Pixel Preview, images are drawn smoothed; off, their pixels show with hard edges. Outside Pixel Preview, images are always smoothed. En Aperçu en pixels, les images sont dessinées lissées. Désactivée, leurs pixels ont des bords nets. Hors de l’Aperçu en pixels, les images sont toujours lissées.
|
||||
PDF Text Texte PDF
|
||||
The text of a PDF you open or embed comes in as editable type, or as outlines that look the same on a computer without its fonts. Le texte d’un PDF que vous ouvrez ou incorporez arrive en texte modifiable, ou en contours qui s’affichent de la même façon sur un ordinateur sans ses polices.
|
||||
Linked pages show the file's own text. Les pages liées affichent le texte propre au fichier.
|
||||
When a linked file changes, Automatically reads it again, Ask When Modified asks you first, and Manually leaves it and shows a note in the status bar. Quand un fichier lié change, Automatiquement le relit, Demander en cas de modification vous le demande d’abord, et Manuellement le laisse tel quel avec une note dans la barre d’état.
|
||||
On the desktop, the folder New from Template… and Save as Template… start in; leave it blank for VectorCraft Templates in your documents folder. Dans la version de bureau, Nouveau d’après un modèle… et Enregistrer comme modèle… s’ouvrent dans ce dossier. Laissez-le vide pour VectorCraft Templates dans votre dossier de documents.
|
||||
Edit Original opens a linked file in the system's default app for its type; off, a linked raster image opens in PhotoCraft where it is installed. Modifier l’original ouvre un fichier lié dans l’application par défaut du système pour son type. Désactivée, une image matricielle liée s’ouvre dans PhotoCraft s’il est installé.
|
||||
@@ -5564,6 +5571,10 @@ liquify-list-end {0}, {1} {0} et {1}
|
||||
@msg this trace would make more than {max} anchor points, more than the document can show smoothly: raise Noise, lower Paths or Colors, or pick a lower-fidelity preset cette vectorisation créerait plus de {max} points d’ancrage, plus que le document ne peut afficher de façon fluide : augmentez Bruit, réduisez Tracés ou Couleurs, ou choisissez un paramètre prédéfini moins fidèle
|
||||
@msg select an envelope sélectionnez une enveloppe
|
||||
@msg select an image sélectionnez une image
|
||||
@msg object {_1} is an image changed by Perspective Distort or Free Distort, which this command does not work on l’objet {_1} est une image modifiée par Distorsion de perspective ou Distorsion manuelle, sur laquelle cette commande ne fonctionne pas
|
||||
@msg image {_1} cannot be distorted this way: its corners would not make a convex shape l’image {_1} ne peut pas être déformée ainsi, car ses coins ne formeraient pas une forme convexe
|
||||
@msg image {_1} cannot be distorted this way: its corners would cross the warp's horizon l’image {_1} ne peut pas être déformée ainsi, car ses coins franchiraient l’horizon de la déformation
|
||||
@msg image {_1} cannot be distorted this way: its corners would be too close together for a perspective map l’image {_1} ne peut pas être déformée ainsi, car ses coins seraient trop proches pour une projection en perspective
|
||||
@msg `background` must be edges, corners or colors `background` doit valoir edges, corners ou colors
|
||||
@msg `match` must be distance or channels `match` doit valoir distance ou channels
|
||||
@msg `{key}` must be from 0 to 100 `{key}` doit être compris entre 0 et 100
|
||||
@@ -10720,6 +10731,10 @@ breakText Glyphs Glyphes
|
||||
@msg A joint does not close by {gap} pt. Un joint ne se ferme pas, avec un écart de {gap} pt.
|
||||
@msg Two panels pass through each other. Deux panneaux se traversent.
|
||||
@msg {_1} × {_2} pixels is too large for GIF (at most 65535 pixels a side): lower the resolution {_1} × {_2} pixels, c’est trop grand pour le GIF (65535 pixels par côté au plus) : réduisez la résolution
|
||||
Leaf Vine Liane feuillue
|
||||
Blossom Chain Chaîne de fleurs
|
||||
Pennant Garland Guirlande de fanions
|
||||
Lantern String Guirlande de lanternes
|
||||
Orbit Lines Lignes orbitales
|
||||
Petal Garland Guirlande de pétales
|
||||
Lattice Braid Tresse en treillis
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -3451,6 +3451,10 @@ arrowhead Feather પીંછું
|
||||
Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. લાઇન સેગમેન્ટના છેડાને એ રીતે સ્નેપ કરે છે કે તે નજીકના સીધા સેગમેન્ટને કાટખૂણે મળે.
|
||||
Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. કેનવાસ પર દરેક સ્લાઇસનો નંબર તેના ઉપરના ડાબા ખૂણે એક બૉક્સમાં બતાવે છે; બંધ હોય ત્યારે પણ સ્લાઇસની રૂપરેખાઓ દેખાય છે.
|
||||
The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. યુઝર અને ઑબ્જેક્ટ સ્લાઇસની રૂપરેખાઓ અને તેમના નંબર બૉક્સનો રંગ; ઑટો સ્લાઇસ તેની ઝાંખી છાયા વાપરે છે.
|
||||
In paragraphs with Hyphenate on, a listed word is hyphenated only at the hyphens typed in it, or never when it has none, whatever its language or case. હાઇફનેટ કરો ચાલુ હોય તેવા ફકરાઓમાં, સૂચિમાંના શબ્દને ફક્ત તેમાં લખેલા હાઇફન પર જ હાઇફન લાગે છે, અથવા કોઈ ન હોય તો ક્યારેય નહીં, તેની ભાષા કે કેસ ગમે તે હોય.
|
||||
On the desktop, this folder's .wasm plug-ins load at startup and when OK sets a new folder, except in Safe Mode; one that asks for permissions loads only after you grant them. The web version loads none. ડેસ્કટોપ સંસ્કરણમાં, આ ફોલ્ડરના .wasm પ્લગ-ઇન્સ શરૂઆતમાં અને ઠીક નવું ફોલ્ડર સેટ કરે ત્યારે લોડ થાય છે, સેફ મોડ સિવાય; પરવાનગીઓ માગતું પ્લગ-ઇન તમે તે આપો પછી જ લોડ થાય છે. વેબ સંસ્કરણ કોઈ લોડ કરતું નથી.
|
||||
Large gives each filter or command plug-in run at least 250 million instructions, with the same time limit; Normal keeps the plug-in's own budget. Live effects, exporters and importers keep theirs. મોટું ફિલ્ટર કે કમાન્ડ પ્લગ-ઇનના દરેક રનને એ જ સમય મર્યાદા સાથે ઓછામાં ઓછી 250 મિલિયન સૂચનાઓ આપે છે; સામાન્ય પ્લગ-ઇનનું પોતાનું બજેટ રાખે છે. લાઇવ ઇફેક્ટ્સ, એક્સપોર્ટર્સ અને ઇમ્પોર્ટર્સ પોતાનું રાખે છે.
|
||||
New type takes this language while Document Setup's language is English: USA; type already in a document keeps its own language. દસ્તાવેજ સેટઅપની ભાષા અંગ્રેજી: USA હોય ત્યાં સુધી નવા ટેક્સ્ટને આ ભાષા મળે છે; દસ્તાવેજમાં પહેલેથી રહેલું ટેક્સ્ટ પોતાની ભાષા રાખે છે.
|
||||
In paragraphs with Hyphenate on, a listed word breaks only at the hyphens typed in it, or nowhere when it has none, whatever its language or case. હાઇફનેટ કરો ચાલુ હોય તેવા ફકરાઓમાં, સૂચિમાંનો શબ્દ ફક્ત તેમાં લખેલા હાઇફન પર જ તૂટે છે, અથવા કોઈ ન હોય તો ક્યાંય નહીં, તેની ભાષા કે કેસ ગમે તે હોય.
|
||||
On the desktop, the .wasm plug-ins in this folder load at startup and when you click OK with a new folder here, except in Safe Mode; the web version does not load them. ડેસ્કટોપ સંસ્કરણમાં, આ ફોલ્ડરના .wasm પ્લગ-ઇન્સ શરૂઆતમાં અને અહીં નવા ફોલ્ડર સાથે ઠીક પર ક્લિક કરો ત્યારે લોડ થાય છે, સેફ મોડ સિવાય; વેબ સંસ્કરણ તેમને લોડ કરતું નથી.
|
||||
Normal keeps each plug-in's own limits; with Large, a plug-in filter or command may run at least 250 million instructions besides those for its input. The time limit stays the same. સામાન્ય દરેક પ્લગ-ઇનની પોતાની મર્યાદાઓ રાખે છે; મોટું સાથે, પ્લગ-ઇન ફિલ્ટર અથવા આદેશ તેના ઇનપુટ માટેની સૂચનાઓ ઉપરાંત ઓછામાં ઓછી 250 મિલિયન સૂચનાઓ ચલાવી શકે છે. સમય મર્યાદા એ જ રહે છે.
|
||||
@@ -3465,8 +3469,8 @@ arrowhead Feather પીંછું
|
||||
Shows each tool group's name above its tools in the toolbar; off, the groups follow one another with nothing between them. ટૂલબારમાં દરેક ટૂલ ગ્રૂપનું નામ તેના ટૂલ્સની ઉપર બતાવે છે; બંધ હોય ત્યારે, ગ્રૂપ વચ્ચે કંઈ રાખ્યા વિના એક પછી એક આવે છે.
|
||||
From now on, documents you open or create open as tabs; off, each opens in a floating window. Documents already open stay where they are. હવેથી તમે ખોલો કે બનાવો તે દસ્તાવેજો ટેબ તરીકે ખૂલે છે; બંધ હોય ત્યારે, દરેક એક ફ્લોટિંગ વિન્ડોમાં ખૂલે છે. પહેલેથી ખુલ્લા દસ્તાવેજો જ્યાં છે ત્યાં જ રહે છે.
|
||||
Makes the document tabs taller and their names larger. દસ્તાવેજના ટૅબને ઊંચા અને તેમનાં નામ મોટાં બનાવે છે.
|
||||
From the next start, the system draws the window's title bar where VectorCraft would otherwise draw its own. આગલી શરૂઆતથી, જ્યાં VectorCraft અન્યથા પોતાનો ટાઇટલ બાર દોરે ત્યાં સિસ્ટમ વિન્ડોનો ટાઇટલ બાર દોરે છે.
|
||||
From the next start, VectorCraft draws the window's title bar even where the desktop would draw it, unless System Title Bar is on. આગલી શરૂઆતથી, ડેસ્કટોપ વિન્ડોનો ટાઇટલ બાર દોરે ત્યાં પણ VectorCraft તેને દોરે છે, સિવાય કે સિસ્ટમ ટાઇટલ બાર ચાલુ હોય.
|
||||
From the next start, the system draws the window's title bar where VectorCraft would otherwise draw its own; on Linux and the BSDs, the VECTORCRAFT_TITLEBAR variable takes precedence. આગલી શરૂઆતથી, જ્યાં VectorCraft અન્યથા પોતાનો ટાઇટલ બાર દોરે ત્યાં સિસ્ટમ વિન્ડોનો ટાઇટલ બાર દોરે છે; Linux અને BSD પર VECTORCRAFT_TITLEBAR ચલને અગ્રતા મળે છે.
|
||||
From the next start, VectorCraft draws the window's title bar even where the desktop would draw it, unless System Title Bar is on or the VECTORCRAFT_TITLEBAR variable chooses it. આગલી શરૂઆતથી, ડેસ્કટોપ વિન્ડોનો ટાઇટલ બાર દોરે ત્યાં પણ VectorCraft તેને દોરે છે, સિવાય કે સિસ્ટમ ટાઇટલ બાર ચાલુ હોય અથવા VECTORCRAFT_TITLEBAR ચલ તેને પસંદ કરે.
|
||||
Makes the interface larger or smaller; art on the canvas keeps its size at the same zoom. ઇન્ટરફેસને મોટું કે નાનું બનાવે છે; સમાન ઝૂમ પર કેનવાસ પરની આર્ટ પોતાનું કદ જાળવે છે.
|
||||
The tool pointers VectorCraft draws grow and shrink with UI Scaling; off, they keep their size. VectorCraft જે ટૂલ પોઇન્ટર દોરે છે તે UI સ્કેલિંગ સાથે મોટા અને નાના થાય છે; બંધ હોય ત્યારે, તે પોતાનું કદ જાળવે છે.
|
||||
The language of the interface; Auto uses the system's language. The dialog switches language as soon as you choose one. ઇન્ટરફેસની ભાષા; ઑટો સિસ્ટમની ભાષા વાપરે છે. તમે ભાષા પસંદ કરો કે તરત જ ડાયલોગ તે ભાષામાં બદલાય છે.
|
||||
@@ -3492,6 +3496,9 @@ arrowhead Feather પીંછું
|
||||
Open Recent Files and the Home screen list at most this many recent files; 0 lists none, and VectorCraft still remembers up to 30. તાજેતરની ફાઇલો ખોલો અને હોમ સ્ક્રીન વધુમાં વધુ આટલી તાજેતરની ફાઇલો બતાવે છે; 0 એક પણ બતાવતું નથી, અને VectorCraft તો પણ 30 સુધી યાદ રાખે છે.
|
||||
When a document opens, a linked EPS image that shows its saved preview keeps it instead of reading the EPS file again; changed files still follow Update Links. દસ્તાવેજ ખૂલે ત્યારે, પોતાનું સાચવેલું પૂર્વાવલોકન બતાવતી લિંક કરેલી EPS છબી EPS ફાઇલ ફરીથી વાંચવાને બદલે તે પૂર્વાવલોકન રાખે છે; બદલાયેલી ફાઇલો હજુ પણ લિંક અપડેટ કરો ને અનુસરે છે.
|
||||
In Pixel Preview, images are drawn smoothed; off, their pixels show with hard edges. Outside Pixel Preview, images are always smoothed. પિક્સેલ પૂર્વાવલોકનમાં, છબીઓ સુંવાળી દોરાય છે; બંધ હોય ત્યારે, તેમના પિક્સેલ તીક્ષ્ણ કિનારીઓ સાથે દેખાય છે. પિક્સેલ પૂર્વાવલોકનની બહાર, છબીઓ હંમેશા સુંવાળી હોય છે.
|
||||
PDF Text PDF ટેક્સ્ટ
|
||||
The text of a PDF you open or embed comes in as editable type, or as outlines that look the same on a computer without its fonts. તમે ખોલો કે એમ્બેડ કરો તે PDF નું ટેક્સ્ટ સંપાદનયોગ્ય ટેક્સ્ટ તરીકે આવે છે, અથવા આઉટલાઇન્સ તરીકે, જે તેના ફૉન્ટ વગરના કમ્પ્યુટર પર પણ એકસરખી દેખાય છે.
|
||||
Linked pages show the file's own text. લિંક કરેલાં પેજ ફાઇલનું પોતાનું ટેક્સ્ટ બતાવે છે.
|
||||
When a linked file changes, Automatically reads it again, Ask When Modified asks you first, and Manually leaves it and shows a note in the status bar. લિંક કરેલી ફાઇલ બદલાય ત્યારે, આપમેળે તેને ફરીથી વાંચે છે, ફેરફાર થાય ત્યારે પૂછો પહેલાં તમને પૂછે છે, અને જાતે તેને એમ જ રહેવા દે છે અને સ્ટેટસ બારમાં નોંધ બતાવે છે.
|
||||
On the desktop, the folder New from Template… and Save as Template… start in; leave it blank for VectorCraft Templates in your documents folder. ડેસ્કટોપ સંસ્કરણમાં, જે ફોલ્ડરમાં ટેમ્પ્લેટમાંથી નવું… અને ટેમ્પ્લેટ તરીકે સાચવો… શરૂ થાય છે; તમારા દસ્તાવેજ ફોલ્ડરમાંના VectorCraft Templates માટે તેને ખાલી છોડો.
|
||||
Edit Original opens a linked file in the system's default app for its type; off, a linked raster image opens in PhotoCraft where it is installed. મૂળ સંપાદિત કરો લિંક કરેલી ફાઇલને તેના પ્રકાર માટેની સિસ્ટમની ડિફૉલ્ટ ઍપમાં ખોલે છે; બંધ હોય ત્યારે, લિંક કરેલી રાસ્ટર છબી PhotoCraft ઇન્સ્ટોલ હોય તો તેમાં ખૂલે છે.
|
||||
@@ -5644,6 +5651,10 @@ swatch [Registration] [રજિસ્ટ્રેશન]
|
||||
Standard Single-line Composer સ્ટાન્ડર્ડ સિંગલ-લાઇન કમ્પોઝર
|
||||
Standard Every-line Composer સ્ટાન્ડર્ડ એવરી-લાઇન કમ્પોઝર
|
||||
@msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer આમાંથી એક હોવું જોઈએ: "singleLine", "everyLine", "standardSingleLine" અથવા "standardEveryLine"
|
||||
Leaf Vine પાંદડાની વેલ
|
||||
Blossom Chain ફૂલોની સાંકળ
|
||||
Pennant Garland ધ્વજપટ્ટીની માળા
|
||||
Lantern String ફાનસની હાર
|
||||
Orbit Lines ભ્રમણકક્ષાની રેખાઓ
|
||||
Petal Garland પાંખડીઓની માળા
|
||||
Lattice Braid જાળી વેણી
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 72 and column 5.
|
@@ -4767,6 +4767,10 @@ arrowhead Feather पंख
|
||||
Edit type set in fonts that aren't available? जो फ़ॉन्ट उपलब्ध नहीं हैं, उनमें सेट टेक्स्ट एडिट करें?
|
||||
Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. कैनवास पर हर स्लाइस का नंबर उसके ऊपरी बाएँ कोने में एक बॉक्स में दिखाता है; बंद होने पर भी स्लाइस की आउटलाइन दिखती रहती हैं।
|
||||
The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. यूज़र और ऑब्जेक्ट स्लाइस की आउटलाइन और उनके नंबर बॉक्स का रंग; ऑटो स्लाइस इसकी हल्की छाया इस्तेमाल करते हैं।
|
||||
In paragraphs with Hyphenate on, a listed word is hyphenated only at the hyphens typed in it, or never when it has none, whatever its language or case. जिन पैराग्राफ़ में हाइफ़नेशन चालू है, उनमें सूची के शब्द पर हाइफ़न केवल उसमें टाइप किए गए हाइफ़न पर लगता है, या कोई न हो तो कभी नहीं, उसकी भाषा या केस चाहे जो हो।
|
||||
On the desktop, this folder's .wasm plug-ins load at startup and when OK sets a new folder, except in Safe Mode; one that asks for permissions loads only after you grant them. The web version loads none. डेस्कटॉप संस्करण में, इस फ़ोल्डर के .wasm प्लग-इन शुरू होने पर और ठीक है से नया फ़ोल्डर सेट होने पर लोड होते हैं, सुरक्षित मोड को छोड़कर; अनुमतियाँ माँगने वाला प्लग-इन आपके उन्हें देने के बाद ही लोड होता है। वेब संस्करण कोई लोड नहीं करता।
|
||||
Large gives each filter or command plug-in run at least 250 million instructions, with the same time limit; Normal keeps the plug-in's own budget. Live effects, exporters and importers keep theirs. बड़ा फ़िल्टर या कमांड प्लग-इन के हर रन को उसी समय सीमा के साथ कम से कम 25 करोड़ निर्देश देता है; सामान्य प्लग-इन का अपना बजट रखता है। लाइव इफ़ेक्ट, एक्सपोर्टर और इंपोर्टर अपना बजट रखते हैं।
|
||||
New type takes this language while Document Setup's language is English: USA; type already in a document keeps its own language. जब तक डॉक्यूमेंट सेटअप की भाषा अंग्रेज़ी: USA है, नए टेक्स्ट को यह भाषा मिलती है; डॉक्यूमेंट में पहले से मौजूद टेक्स्ट अपनी भाषा रखता है।
|
||||
In paragraphs with Hyphenate on, a listed word breaks only at the hyphens typed in it, or nowhere when it has none, whatever its language or case. जिन पैराग्राफ़ में हाइफ़नेशन चालू है, उनमें सूची का शब्द केवल उसमें टाइप किए गए हाइफ़न पर टूटता है, या कोई न हो तो कहीं नहीं, उसकी भाषा या केस चाहे जो हो।
|
||||
On the desktop, the .wasm plug-ins in this folder load at startup and when you click OK with a new folder here, except in Safe Mode; the web version does not load them. डेस्कटॉप संस्करण में, इस फ़ोल्डर के .wasm प्लग-इन शुरू होने पर और यहाँ नया फ़ोल्डर देकर ठीक है पर क्लिक करने पर लोड होते हैं, सुरक्षित मोड को छोड़कर; वेब संस्करण उन्हें लोड नहीं करता।
|
||||
Normal keeps each plug-in's own limits; with Large, a plug-in filter or command may run at least 250 million instructions besides those for its input. The time limit stays the same. सामान्य हर प्लग-इन की अपनी सीमाएँ रखता है; बड़ा के साथ, प्लग-इन फ़िल्टर या कमांड अपने इनपुट के निर्देशों के अलावा कम से कम 250 मिलियन निर्देश चला सकता है। समय सीमा वही रहती है।
|
||||
@@ -4781,8 +4785,8 @@ arrowhead Feather पंख
|
||||
Shows each tool group's name above its tools in the toolbar; off, the groups follow one another with nothing between them. टूलबार में हर टूल ग्रुप का नाम उसके टूल्स के ऊपर दिखाता है; बंद होने पर, ग्रुप बिना किसी अंतर के एक के बाद एक आते हैं।
|
||||
From now on, documents you open or create open as tabs; off, each opens in a floating window. Documents already open stay where they are. अब से आप जो डॉक्यूमेंट ओपन करते या बनाते हैं, वे टैब के रूप में खुलते हैं; बंद होने पर, हर एक फ़्लोटिंग विंडो में खुलता है। पहले से खुले डॉक्यूमेंट जहाँ हैं वहीं रहते हैं।
|
||||
Makes the document tabs taller and their names larger. डॉक्यूमेंट टैब को ऊँचा और उनके नाम बड़े बनाता है।
|
||||
From the next start, the system draws the window's title bar where VectorCraft would otherwise draw its own. अगली शुरुआत से, जहाँ VectorCraft अन्यथा अपना टाइटल बार बनाता, वहाँ सिस्टम विंडो का टाइटल बार बनाता है।
|
||||
From the next start, VectorCraft draws the window's title bar even where the desktop would draw it, unless System Title Bar is on. अगली शुरुआत से, VectorCraft विंडो का टाइटल बार वहाँ भी बनाता है जहाँ डेस्कटॉप उसे बनाता, जब तक सिस्टम टाइटल बार चालू न हो।
|
||||
From the next start, the system draws the window's title bar where VectorCraft would otherwise draw its own; on Linux and the BSDs, the VECTORCRAFT_TITLEBAR variable takes precedence. अगली शुरुआत से, जहाँ VectorCraft अन्यथा अपना टाइटल बार बनाता, वहाँ सिस्टम विंडो का टाइटल बार बनाता है; Linux और BSD पर VECTORCRAFT_TITLEBAR वेरिएबल को प्राथमिकता मिलती है।
|
||||
From the next start, VectorCraft draws the window's title bar even where the desktop would draw it, unless System Title Bar is on or the VECTORCRAFT_TITLEBAR variable chooses it. अगली शुरुआत से, VectorCraft विंडो का टाइटल बार वहाँ भी बनाता है जहाँ डेस्कटॉप उसे बनाता, जब तक सिस्टम टाइटल बार चालू न हो या VECTORCRAFT_TITLEBAR वेरिएबल उसे न चुने।
|
||||
Makes the interface larger or smaller; art on the canvas keeps its size at the same zoom. इंटरफ़ेस को बड़ा या छोटा करता है; उसी ज़ूम पर कैनवास का आर्टवर्क अपना आकार बनाए रखता है।
|
||||
The tool pointers VectorCraft draws grow and shrink with UI Scaling; off, they keep their size. VectorCraft जो टूल पॉइंटर बनाता है, वे यूआई स्केलिंग के साथ बड़े और छोटे होते हैं; बंद होने पर, वे अपना आकार बनाए रखते हैं।
|
||||
The language of the interface; Auto uses the system's language. The dialog switches language as soon as you choose one. इंटरफ़ेस की भाषा; स्वचालित सिस्टम की भाषा इस्तेमाल करता है। आप कोई भाषा चुनते ही डायलॉग उस भाषा में बदल जाता है।
|
||||
@@ -4808,6 +4812,9 @@ arrowhead Feather पंख
|
||||
Open Recent Files and the Home screen list at most this many recent files; 0 lists none, and VectorCraft still remembers up to 30. रीसेंट फ़ाइल्स मेनू व होम स्क्रीन अधिकतम इतनी हाल की फ़ाइलें दिखाते हैं; 0 कोई नहीं दिखाता, फिर भी VectorCraft 30 तक याद रखता है।
|
||||
When a document opens, a linked EPS image that shows its saved preview keeps it instead of reading the EPS file again; changed files still follow Update Links. डॉक्यूमेंट खुलने पर, अपना सेव किया प्रीव्यू दिखाने वाली लिंक की गई EPS इमेज EPS फ़ाइल को फिर से पढ़ने के बजाय वही प्रीव्यू रखती है; बदली हुई फ़ाइलें फिर भी अद्यतन लिंक के अनुसार चलती हैं।
|
||||
In Pixel Preview, images are drawn smoothed; off, their pixels show with hard edges. Outside Pixel Preview, images are always smoothed. पिक्सेल प्रीव्यू में, इमेज स्मूद बनाई जाती हैं; बंद होने पर, उनके पिक्सेल के किनारे तीखे दिखते हैं। पिक्सेल प्रीव्यू के बाहर, इमेज हमेशा स्मूद होती हैं।
|
||||
PDF Text PDF टेक्स्ट
|
||||
The text of a PDF you open or embed comes in as editable type, or as outlines that look the same on a computer without its fonts. आप जो PDF खोलते या एम्बेड करते हैं, उसका टेक्स्ट संपादन योग्य टेक्स्ट के रूप में आता है, या रूपरेखा के रूप में, जो उसके फ़ॉन्ट के बिना वाले कंप्यूटर पर भी वैसी ही दिखती है।
|
||||
Linked pages show the file's own text. लिंक किए गए पृष्ठ फ़ाइल का अपना टेक्स्ट दिखाते हैं।
|
||||
When a linked file changes, Automatically reads it again, Ask When Modified asks you first, and Manually leaves it and shows a note in the status bar. जब कोई लिंक की गई फ़ाइल बदलती है, अपने-आप उसे फिर से पढ़ता है, बदलाव होने पर पूछें पहले आपसे पूछता है, व मैन्युअल उसे वैसे ही छोड़कर स्टेटस बार में एक नोट दिखाता है।
|
||||
On the desktop, the folder New from Template… and Save as Template… start in; leave it blank for VectorCraft Templates in your documents folder. डेस्कटॉप संस्करण में, वह फ़ोल्डर जिसमें टेम्पलेट से नया… व टेम्पलेट के रूप में सेव करें… शुरू होते हैं; अपने डॉक्यूमेंट फ़ोल्डर में VectorCraft Templates के लिए इसे खाली छोड़ें।
|
||||
Edit Original opens a linked file in the system's default app for its type; off, a linked raster image opens in PhotoCraft where it is installed. मूल एडिट करें लिंक की गई फ़ाइल को उसके प्रकार के लिए सिस्टम के डिफ़ॉल्ट ऐप में खोलता है; बंद होने पर, लिंक की गई रास्टर इमेज PhotoCraft इंस्टॉल होने पर उसमें खुलती है।
|
||||
@@ -8905,6 +8912,10 @@ liquify-list-end {0}, {1} {0} और {1}
|
||||
@msg select a text object एक टेक्स्ट ऑब्जेक्ट चुनें
|
||||
@msg select an envelope एक लिफाफे सिलेक्ट करें
|
||||
@msg select an image एक इमेज चुनें
|
||||
@msg object {_1} is an image changed by Perspective Distort or Free Distort, which this command does not work on ऑब्जेक्ट {_1} पर्सपेक्टिव या फ़्री डिस्टॉर्ट से बदली गई इमेज है, जिस पर यह कमांड काम नहीं करता
|
||||
@msg image {_1} cannot be distorted this way: its corners would not make a convex shape इमेज {_1} को इस तरह डिस्टॉर्ट नहीं किया जा सकता: इसके कोने उत्तल आकार नहीं बनाएँगे
|
||||
@msg image {_1} cannot be distorted this way: its corners would cross the warp's horizon इमेज {_1} को इस तरह डिस्टॉर्ट नहीं किया जा सकता: इसके कोने डिस्टॉर्ट के क्षितिज को पार कर जाएँगे
|
||||
@msg image {_1} cannot be distorted this way: its corners would be too close together for a perspective map इमेज {_1} को इस तरह डिस्टॉर्ट नहीं किया जा सकता: इसके कोने पर्सपेक्टिव मैपिंग के लिए एक-दूसरे के बहुत पास होंगे
|
||||
@msg `background` must be edges, corners or colors `background` edges, corners या colors होना चाहिए
|
||||
@msg `match` must be distance or channels `match` distance या channels होना चाहिए
|
||||
@msg `{key}` must be from 0 to 100 `{key}` 0 से 100 तक होना चाहिए
|
||||
@@ -10363,6 +10374,10 @@ theme Appearance अपीयरेंस
|
||||
@msg A panel is not joined to the rest by a crease. कोई पैनल किसी क्रीज़ लाइन से बाकी से जुड़ा नहीं है।
|
||||
@msg A fold line is on a non-printing layer. एक फ़ोल्ड लाइन नॉन-प्रिंटिंग लेयर पर है।
|
||||
@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} पैनल: {panels}, हिंज: {hinges}, एरर: {errors}, वॉर्निंग: {warnings}
|
||||
Leaf Vine पत्तों की बेल
|
||||
Blossom Chain फूलों की शृंखला
|
||||
Pennant Garland झंडियों की माला
|
||||
Lantern String लालटेन की शृंखला
|
||||
Orbit Lines कक्षीय रेखाएँ
|
||||
Petal Garland पंखुड़ी माला
|
||||
Lattice Braid जाली चोटी
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -3976,6 +3976,10 @@ mark-style Japanese Japán
|
||||
Edit type set in fonts that aren't available? Szerkeszti a nem elérhető betűtípusokkal szedett szöveget?
|
||||
Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. A vásznon minden szelet számát egy keretben mutatja a szelet bal felső sarkában; kikapcsolva a szeletek körvonalai továbbra is látszanak.
|
||||
The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. A felhasználói és objektumszeletek körvonalainak és számkereteinek színe; az automatikus szeletek ennek egy halványabb árnyalatát használják.
|
||||
In paragraphs with Hyphenate on, a listed word is hyphenated only at the hyphens typed in it, or never when it has none, whatever its language or case. Azokban a bekezdésekben, ahol az Elválasztás be van kapcsolva, a felsorolt szó csak a beleírt kötőjeleknél kap elválasztójelet, vagy soha, ha nincs benne, nyelvétől és kis- vagy nagybetűitől függetlenül.
|
||||
On the desktop, this folder's .wasm plug-ins load at startup and when OK sets a new folder, except in Safe Mode; one that asks for permissions loads only after you grant them. The web version loads none. Az asztali változatban a mappa .wasm bővítményei indításkor töltődnek be, és amikor az OK új mappát állít be, kivéve csökkentett módban; az engedélyeket kérő bővítmény csak azok megadása után töltődik be. A webes változat egyet sem tölt be.
|
||||
Large gives each filter or command plug-in run at least 250 million instructions, with the same time limit; Normal keeps the plug-in's own budget. Live effects, exporters and importers keep theirs. A Nagy egy szűrő- vagy parancsbővítmény minden futásának legalább 250 millió utasítást ad, ugyanazzal az időkorláttal; a Normál megtartja a bővítmény saját keretét. Az élő effektusok, exportálók és importálók megtartják a sajátjukat.
|
||||
New type takes this language while Document Setup's language is English: USA; type already in a document keeps its own language. Az új szöveg ezt a nyelvet kapja, amíg a Dokumentumbeállítás nyelve Angol: amerikai; a dokumentumban már meglévő szöveg megtartja a saját nyelvét.
|
||||
In paragraphs with Hyphenate on, a listed word breaks only at the hyphens typed in it, or nowhere when it has none, whatever its language or case. Azokban a bekezdésekben, ahol az Elválasztás be van kapcsolva, a felsorolt szó csak a beleírt kötőjeleknél válik el, vagy sehol, ha nincs benne, nyelvétől és kis- vagy nagybetűitől függetlenül.
|
||||
On the desktop, the .wasm plug-ins in this folder load at startup and when you click OK with a new folder here, except in Safe Mode; the web version does not load them. Az asztali változatban a mappa .wasm bővítményei indításkor töltődnek be, és amikor itt új mappával az OK gombra kattint, kivéve csökkentett módban; a webes változat nem tölti be őket.
|
||||
Normal keeps each plug-in's own limits; with Large, a plug-in filter or command may run at least 250 million instructions besides those for its input. The time limit stays the same. A Normál megtartja minden bővítmény saját korlátait; a Nagy beállítással egy bővítményszűrő vagy -parancs legalább 250 millió utasítást futtathat a bemenetéhez tartozókon felül. Az időkorlát nem változik.
|
||||
@@ -3990,8 +3994,8 @@ mark-style Japanese Japán
|
||||
Shows each tool group's name above its tools in the toolbar; off, the groups follow one another with nothing between them. Az eszköztárban minden eszközcsoport nevét az eszközei fölött mutatja; kikapcsolva a csoportok egymás után következnek, semmi sincs köztük.
|
||||
From now on, documents you open or create open as tabs; off, each opens in a floating window. Documents already open stay where they are. Mostantól a megnyitott vagy létrehozott dokumentumok lapfülön nyílnak meg; kikapcsolva mindegyik lebegő ablakban nyílik meg. A már megnyitott dokumentumok a helyükön maradnak.
|
||||
Makes the document tabs taller and their names larger. Magasabbá teszi a dokumentumok lapfüleit, a nevüket pedig nagyobbá.
|
||||
From the next start, the system draws the window's title bar where VectorCraft would otherwise draw its own. A következő indítástól a rendszer rajzolja az ablak címsorát ott, ahol a VectorCraft egyébként a sajátját rajzolná.
|
||||
From the next start, VectorCraft draws the window's title bar even where the desktop would draw it, unless System Title Bar is on. A következő indítástól a VectorCraft rajzolja az ablak címsorát ott is, ahol az asztali környezet rajzolná, hacsak nincs bekapcsolva a Rendszer címsora.
|
||||
From the next start, the system draws the window's title bar where VectorCraft would otherwise draw its own; on Linux and the BSDs, the VECTORCRAFT_TITLEBAR variable takes precedence. A következő indítástól a rendszer rajzolja az ablak címsorát ott, ahol a VectorCraft egyébként a sajátját rajzolná; Linuxon és a BSD-rendszereken a VECTORCRAFT_TITLEBAR változó élvez elsőbbséget.
|
||||
From the next start, VectorCraft draws the window's title bar even where the desktop would draw it, unless System Title Bar is on or the VECTORCRAFT_TITLEBAR variable chooses it. A következő indítástól a VectorCraft rajzolja az ablak címsorát ott is, ahol az asztali környezet rajzolná, hacsak nincs bekapcsolva a Rendszer címsora, vagy a VECTORCRAFT_TITLEBAR változó nem választja ki.
|
||||
Makes the interface larger or smaller; art on the canvas keeps its size at the same zoom. Nagyobbá vagy kisebbé teszi a felületet; a vásznon lévő grafika azonos nagyításnál megtartja a méretét.
|
||||
The tool pointers VectorCraft draws grow and shrink with UI Scaling; off, they keep their size. A VectorCraft által rajzolt eszközmutatók a Felület méretezésével együtt nőnek és kisebbednek; kikapcsolva megtartják a méretüket.
|
||||
The language of the interface; Auto uses the system's language. The dialog switches language as soon as you choose one. A felület nyelve; az Automatikus a rendszer nyelvét használja. A párbeszédablak azonnal nyelvet vált, amint választ egyet.
|
||||
@@ -4017,6 +4021,9 @@ mark-style Japanese Japán
|
||||
Open Recent Files and the Home screen list at most this many recent files; 0 lists none, and VectorCraft still remembers up to 30. A Legutóbbi fájlok megnyitása és a Kezdőképernyő legfeljebb ennyi legutóbbi fájlt sorol fel; 0 esetén egyet sem, és a VectorCraft ekkor is megjegyez legfeljebb 30-at.
|
||||
When a document opens, a linked EPS image that shows its saved preview keeps it instead of reading the EPS file again; changed files still follow Update Links. Dokumentum megnyitásakor a mentett előnézetét mutató csatolt EPS-kép megtartja azt, ahelyett hogy újra beolvasná az EPS-fájlt; a módosult fájlokra továbbra is a Csatolások frissítése érvényes.
|
||||
In Pixel Preview, images are drawn smoothed; off, their pixels show with hard edges. Outside Pixel Preview, images are always smoothed. Pixeles előnézetben a képek simítva jelennek meg; kikapcsolva a képpontjaik éles szélűek. A Pixeles előnézeten kívül a képek mindig simítottak.
|
||||
PDF Text PDF-szöveg
|
||||
The text of a PDF you open or embed comes in as editable type, or as outlines that look the same on a computer without its fonts. A megnyitott vagy beágyazott PDF szövege szerkeszthető szövegként érkezik, vagy vázlatként, amely a betűkészletei nélküli számítógépen is ugyanúgy néz ki.
|
||||
Linked pages show the file's own text. A csatolt oldalak a fájl saját szövegét mutatják.
|
||||
When a linked file changes, Automatically reads it again, Ask When Modified asks you first, and Manually leaves it and shows a note in the status bar. Ha egy csatolt fájl megváltozik, az Automatikusan újra beolvassa, a Kérdés módosításkor előbb rákérdez, a Kézzel pedig változatlanul hagyja, és megjegyzést mutat az állapotsoron.
|
||||
On the desktop, the folder New from Template… and Save as Template… start in; leave it blank for VectorCraft Templates in your documents folder. Az asztali változatban a mappa, amelyből az Új sablonból… és a Mentés sablonként… indul; hagyja üresen a dokumentumok mappájában lévő VectorCraft Templates mappához.
|
||||
Edit Original opens a linked file in the system's default app for its type; off, a linked raster image opens in PhotoCraft where it is installed. Az Eredeti szerkesztése a csatolt fájlt a rendszer adott típushoz tartozó alapértelmezett alkalmazásában nyitja meg; kikapcsolva a csatolt raszterkép a PhotoCraftban nyílik meg, ha telepítve van.
|
||||
@@ -6379,6 +6386,10 @@ liquify-list-end {0}, {1} {0} és {1}
|
||||
@msg a symbol can't hold an instance of itself egy szimbólum nem tartalmazhatja a saját példányát
|
||||
@msg select an envelope jelölj ki egy burkolót
|
||||
@msg select an image jelölj ki egy képet
|
||||
@msg object {_1} is an image changed by Perspective Distort or Free Distort, which this command does not work on ez a parancs nem működik Perspektivikus torzítással vagy Szabad torzítással módosított képen: {_1}
|
||||
@msg image {_1} cannot be distorted this way: its corners would not make a convex shape a kép nem torzítható így, mert a sarkai nem alkotnának konvex alakzatot: {_1}
|
||||
@msg image {_1} cannot be distorted this way: its corners would cross the warp's horizon a kép nem torzítható így, mert a sarkai átlépnék a torzítás horizontját: {_1}
|
||||
@msg image {_1} cannot be distorted this way: its corners would be too close together for a perspective map a kép nem torzítható így, mert a sarkai túl közel lennének egymáshoz a perspektivikus leképezéshez: {_1}
|
||||
@msg `background` must be edges, corners or colors a `background` értéke edges, corners vagy colors lehet
|
||||
@msg `match` must be distance or channels a `match` értéke distance vagy channels lehet
|
||||
@msg `{key}` must be from 0 to 100 a `{key}` értéke 0 és 100 között lehet
|
||||
@@ -10746,6 +10757,10 @@ breakText Glyphs Glifák
|
||||
@msg A panel is not joined to the rest by a crease. Egy panelt egyetlen bigvonal sem köt a többihez.
|
||||
@msg A fold line is on a non-printing layer. Egy hajtásvonal nem nyomtatható rétegen van.
|
||||
@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Panelek: {panels}, zsanérok: {hinges}, hibák: {errors}, figyelmeztetések: {warnings}
|
||||
Leaf Vine Leveles inda
|
||||
Blossom Chain Virágfüzér
|
||||
Pennant Garland Zászlófüzér
|
||||
Lantern String Lámpásfüzér
|
||||
Orbit Lines Pályavonalak
|
||||
Petal Garland Sziromfüzér
|
||||
Lattice Braid Rácsfonat
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5187,6 +5187,10 @@ font-technology Variable Variabel
|
||||
Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Menampilkan nomor setiap irisan dalam kotak di sudut kiri atasnya di kanvas; saat nonaktif, garis tepi irisan tetap ditampilkan.
|
||||
The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. Warna garis tepi irisan pengguna dan objek serta kotak nomornya; irisan otomatis memakai nuansa yang lebih redup dari warna ini.
|
||||
New type takes this language while Document Setup's language is English: USA and [Normal Character Style] sets none; type already in a document keeps its own language. Teks baru mendapat bahasa ini selama bahasa di Pengaturan dokumen adalah Inggris: USA dan [Gaya karakter normal] tidak menetapkan bahasa; teks yang sudah ada di dokumen mempertahankan bahasanya sendiri.
|
||||
In paragraphs with Hyphenate on, a listed word is hyphenated only at the hyphens typed in it, or never when it has none, whatever its language or case. Di paragraf dengan Pemenggalan kata aktif, kata dalam daftar hanya diberi tanda penggal pada tanda hubung yang diketik di dalamnya, atau tidak pernah jika tidak ada, apa pun bahasa atau huruf besar-kecilnya.
|
||||
On the desktop, this folder's .wasm plug-ins load at startup and when OK sets a new folder, except in Safe Mode; one that asks for permissions loads only after you grant them. The web version loads none. Di versi desktop, plug-in .wasm di folder ini dimuat saat memulai dan saat OK menetapkan folder baru, kecuali dalam Mode aman; plug-in yang meminta izin baru dimuat setelah Anda memberikannya. Versi web tidak memuat satu pun.
|
||||
Large gives each filter or command plug-in run at least 250 million instructions, with the same time limit; Normal keeps the plug-in's own budget. Live effects, exporters and importers keep theirs. Besar memberi setiap jalannya plug-in filter atau perintah setidaknya 250 juta instruksi, dengan batas waktu yang sama; Normal mempertahankan anggaran plug-in itu sendiri. Efek langsung, pengekspor, dan pengimpor mempertahankan milik mereka.
|
||||
New type takes this language while Document Setup's language is English: USA; type already in a document keeps its own language. Teks baru mendapat bahasa ini selama bahasa di Pengaturan dokumen adalah Inggris: USA; teks yang sudah ada di dokumen mempertahankan bahasanya sendiri.
|
||||
In paragraphs with Hyphenate on, a listed word breaks only at the hyphens typed in it, or nowhere when it has none, whatever its language or case. Di paragraf dengan Pemenggalan kata aktif, kata dalam daftar hanya dipenggal pada tanda hubung yang diketik di dalamnya, atau tidak di mana pun jika tidak ada, apa pun bahasa atau huruf besar-kecilnya.
|
||||
On the desktop, the .wasm plug-ins in this folder load at startup and when you click OK with a new folder here, except in Safe Mode; the web version does not load them. Di versi desktop, plug-in .wasm di folder ini dimuat saat memulai dan saat Anda mengeklik OK dengan folder baru di sini, kecuali dalam Mode aman; versi web tidak memuatnya.
|
||||
Normal keeps each plug-in's own limits; with Large, a plug-in filter or command may run at least 250 million instructions besides those for its input. The time limit stays the same. Normal mempertahankan batas setiap plug-in sendiri; dengan Besar, filter atau perintah plug-in dapat menjalankan setidaknya 250 juta instruksi selain instruksi untuk masukannya. Batas waktu tetap sama.
|
||||
@@ -5201,8 +5205,8 @@ font-technology Variable Variabel
|
||||
Shows each tool group's name above its tools in the toolbar; off, the groups follow one another with nothing between them. Menampilkan nama setiap grup alat di atas alat-alatnya di bilah alat; jika nonaktif, grup-grup berurutan tanpa apa pun di antaranya.
|
||||
From now on, documents you open or create open as tabs; off, each opens in a floating window. Documents already open stay where they are. Mulai sekarang, dokumen yang Anda buka atau buat terbuka sebagai tab; jika nonaktif, masing-masing terbuka di jendela mengambang. Dokumen yang sudah terbuka tetap di tempatnya.
|
||||
Makes the document tabs taller and their names larger. Membuat tab dokumen lebih tinggi dan namanya lebih besar.
|
||||
From the next start, the system draws the window's title bar where VectorCraft would otherwise draw its own. Mulai dari peluncuran berikutnya, sistem menggambar bilah judul jendela di tempat VectorCraft biasanya menggambar miliknya sendiri.
|
||||
From the next start, VectorCraft draws the window's title bar even where the desktop would draw it, unless System Title Bar is on. Mulai dari peluncuran berikutnya, VectorCraft menggambar bilah judul jendela bahkan di tempat desktop akan menggambarnya, kecuali Bilah judul sistem aktif.
|
||||
From the next start, the system draws the window's title bar where VectorCraft would otherwise draw its own; on Linux and the BSDs, the VECTORCRAFT_TITLEBAR variable takes precedence. Mulai dari peluncuran berikutnya, sistem menggambar bilah judul jendela di tempat VectorCraft biasanya menggambar miliknya sendiri; di Linux dan BSD, variabel VECTORCRAFT_TITLEBAR lebih diutamakan.
|
||||
From the next start, VectorCraft draws the window's title bar even where the desktop would draw it, unless System Title Bar is on or the VECTORCRAFT_TITLEBAR variable chooses it. Mulai dari peluncuran berikutnya, VectorCraft menggambar bilah judul jendela bahkan di tempat desktop akan menggambarnya, kecuali Bilah judul sistem aktif atau variabel VECTORCRAFT_TITLEBAR memilihnya.
|
||||
Makes the interface larger or smaller; art on the canvas keeps its size at the same zoom. Memperbesar atau memperkecil antarmuka; gambar di kanvas mempertahankan ukurannya pada zoom yang sama.
|
||||
The tool pointers VectorCraft draws grow and shrink with UI Scaling; off, they keep their size. Penunjuk alat yang digambar VectorCraft membesar dan mengecil mengikuti Penskalaan UI; jika nonaktif, ukurannya tetap.
|
||||
The language of the interface; Auto uses the system's language. The dialog switches language as soon as you choose one. Bahasa antarmuka; Otomatis menggunakan bahasa sistem. Dialog berganti bahasa begitu Anda memilih salah satunya.
|
||||
@@ -5228,6 +5232,9 @@ font-technology Variable Variabel
|
||||
Open Recent Files and the Home screen list at most this many recent files; 0 lists none, and VectorCraft still remembers up to 30. Buka berkas terbaru dan layar Home menampilkan paling banyak sejumlah ini berkas terbaru; 0 tidak menampilkan satu pun, dan VectorCraft tetap mengingat hingga 30.
|
||||
When a document opens, a linked EPS image that shows its saved preview keeps it instead of reading the EPS file again; changed files still follow Update Links. Saat dokumen dibuka, gambar EPS tertaut yang menampilkan pratinjau tersimpannya mempertahankannya alih-alih membaca berkas EPS lagi; berkas yang berubah tetap mengikuti Perbarui tautan.
|
||||
In Pixel Preview, images are drawn smoothed; off, their pixels show with hard edges. Outside Pixel Preview, images are always smoothed. Dalam Pratinjau piksel, gambar digambar halus; jika nonaktif, pikselnya tampil dengan tepi tajam. Di luar Pratinjau piksel, gambar selalu dihaluskan.
|
||||
PDF Text Teks PDF
|
||||
The text of a PDF you open or embed comes in as editable type, or as outlines that look the same on a computer without its fonts. Teks PDF yang Anda buka atau sematkan masuk sebagai teks yang dapat diedit, atau sebagai outline yang tampak sama di komputer tanpa fontnya.
|
||||
Linked pages show the file's own text. Halaman tertaut menampilkan teks milik berkas itu sendiri.
|
||||
When a linked file changes, Automatically reads it again, Ask When Modified asks you first, and Manually leaves it and shows a note in the status bar. Saat berkas tertaut berubah, Otomatis membacanya lagi, Tanya saat diubah bertanya dulu kepada Anda, dan Secara manual membiarkannya lalu menampilkan catatan di bilah status.
|
||||
On the desktop, the folder New from Template… and Save as Template… start in; leave it blank for VectorCraft Templates in your documents folder. Di versi desktop, folder tempat Baru dari templat… dan Simpan sebagai templat… dimulai; biarkan kosong untuk VectorCraft Templates di folder dokumen Anda.
|
||||
Edit Original opens a linked file in the system's default app for its type; off, a linked raster image opens in PhotoCraft where it is installed. Edit asli membuka berkas tertaut di aplikasi bawaan sistem untuk jenisnya; jika nonaktif, gambar raster tertaut terbuka di PhotoCraft jika terpasang.
|
||||
@@ -8595,6 +8602,10 @@ breakText Glyphs Glif
|
||||
@msg A joint does not close by {gap} pt. Sebuah sambungan tidak menutup sejauh {gap} pt.
|
||||
@msg Two panels pass through each other. Dua panel saling menembus.
|
||||
@msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer harus "singleLine", "everyLine", "standardSingleLine", atau "standardEveryLine"
|
||||
Leaf Vine Sulur Daun
|
||||
Blossom Chain Rangkaian Bunga
|
||||
Pennant Garland Untaian Panji
|
||||
Lantern String Rangkaian Lentera
|
||||
Orbit Lines Garis Orbit
|
||||
Petal Garland Rangkaian Kelopak
|
||||
Lattice Braid Anyaman Kisi
|
||||
@@ -9028,3 +9039,7 @@ file-filter Applications Aplikasi
|
||||
@msg the slices' descriptor has a reference of an unknown kind ({_1}) deskriptor irisan memiliki referensi dengan jenis yang tidak dikenal ({_1})
|
||||
@msg the slices' descriptor has a value of an unknown type ({_1}) deskriptor irisan memiliki nilai dengan tipe yang tidak dikenal ({_1})
|
||||
@msg the layers can't be read ({e}): the file was placed as its merged image lapisan tidak dapat dibaca ({e}): berkas ditempatkan sebagai gambar gabungannya
|
||||
@msg object {_1} is an image changed by Perspective Distort or Free Distort, which this command does not work on objek {_1} adalah gambar yang diubah dengan Distorsi perspektif atau Distorsi bebas, dan perintah ini tidak dapat digunakan padanya
|
||||
@msg image {_1} cannot be distorted this way: its corners would not make a convex shape gambar {_1} tidak dapat didistorsi dengan cara ini: sudut-sudutnya tidak akan membentuk bangun cembung
|
||||
@msg image {_1} cannot be distorted this way: its corners would cross the warp's horizon gambar {_1} tidak dapat didistorsi dengan cara ini: sudut-sudutnya akan melewati cakrawala distorsi
|
||||
@msg image {_1} cannot be distorted this way: its corners would be too close together for a perspective map gambar {_1} tidak dapat didistorsi dengan cara ini: sudut-sudutnya terlalu berdekatan untuk pemetaan perspektif
|
||||
|
Can't render this file because it is too large.
|
Loaded 100 of 142 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user