1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//! Print crop/trim mark generation for pages declaring a `bleed` margin.
//!
//! When a page declares a positive bleed `b`, the media box expands to
//! `(w + 2b) × (h + 2b)` and the trim box is the inner rectangle
//! `[b, b, w, h]`. Standard crop marks are an L-shaped bracket of two short
//! line segments at each of the four trim corners, drawn entirely OUTSIDE the
//! trim box in the surrounding bleed margin (they never cross into the trim
//! area). They are painted in a registration color (black, ~1px) on top of all
//! page content so they remain visible.
//!
//! Marks are emitted as [`SceneCommand::StrokeLine`] primitives — the IR's
//! dedicated axis-aligned line command — so each corner bracket is exactly two
//! segments and a full page yields eight segments. All geometry is computed
//! deterministically from `b`, `w`, and `h` (no floating-point nondeterminism:
//! every coordinate is an exact sum/difference of the inputs).
use crate;
/// Registration color for crop marks: opaque black.
const MARK_COLOR: Color = srgb;
/// Crop-mark stroke width in pixels (thin hairline).
const MARK_STROKE_WIDTH: f64 = 1.0;
/// Maximum mark length in pixels. The actual length is `min(b, MARK_MAX_LEN)`
/// so the bracket always fits within the bleed margin (a mark can never be
/// longer than the bleed it lives in) while staying a recognizable size for
/// generous bleeds.
const MARK_MAX_LEN: f64 = 18.0;
/// Append crop-mark stroke commands for the four trim corners.
///
/// `b` is the (positive) bleed in pixels; `trim_w`/`trim_h` are the trim-box
/// width/height in pixels. The trim box occupies `[b, b]` … `[b + trim_w,
/// b + trim_h]` within the media box.
///
/// Each corner gets an L-bracket of two segments that run from the trim corner
/// OUTWARD into the bleed (away from the trim box), so no segment overlaps the
/// trim area. Exactly eight segments are appended.
pub
/// Push a single hairline crop-mark segment.