- Better error messages from instantiation
- "-f" switch
- Help
-- Cropmarks: settable colors
| # Position bbox on a new paper
| paper("a4")
| pen=1pt # Line width
| len=5mm # Cross arm length
| offset=5mm # Distance from border
+| color="RRGGBB"
| book
| signature=<n>
| rotate=1 # Override rotation decision
| scale=1 # Override scaling factor
| hspace / vspace / space # Distance between tiles
-| cmark, cpen, clen, coffset # Cropmark parameters
+| cmark, cpen, clen, coffset, ccolor # Cropmark parameters
# Send pages to multiple pipes and merge their results
mix { ..., ..., ...}
{ "t" sx, AT_DIMEN }, \
{ "b" sx, AT_DIMEN }
+// Colors
+
+class color_spec {
+ double rgb[3];
+public:
+ color_spec(string s)
+ {
+ if (s.length() != 6)
+ die("Invalid color specification \"%s\": expecting 6 hex digits", s.c_str());
+ for (int i=0; i<3; i++)
+ {
+ int x = 0;
+ for (int j=0; j<2; j++)
+ {
+ char c = s[2*i+j];
+ if (c >= '0' && c <= '9')
+ x = (x << 4) | (c - '0');
+ else if (c >= 'a' && c <= 'f')
+ x = (x << 4) | (c - 'a' + 10);
+ else if (c >= 'A' && c <= 'F')
+ x = (x << 4) | (c - 'A' + 10);
+ }
+ rgb[i] = x / 255.;
+ }
+ }
+ string to_string()
+ {
+ return pdf_coord(rgb[0]) + " " + pdf_coord(rgb[1]) + " " + pdf_coord(rgb[2]);
+ }
+};
+
// Cropmarks
class cropmark_spec {
double offset;
string crop_cross(double x, double y, uint mask);
QPDFObjectHandle egstate;
+ color_spec color;
public:
- cropmark_spec(cmd *c, const string prefix="", const string def_type="cross")
+ cropmark_spec(cmd *c, const string prefix="", const string def_type="cross") : color(c->arg(prefix + "color")->as_string("000000"))
{
string t = c->arg(prefix + "mark")->as_string(def_type);
if (t == "none")
return "";
string s = "q ";
- s += "0 0 0 RG ";
+ s += color.to_string() + " RG ";
s += xform.to_string() + " cm ";
if (egstate.isNull())
{ px "mark", AT_STRING }, \
{ px "pen", AT_DIMEN }, \
{ px "len", AT_DIMEN }, \
- { px "offset",AT_DIMEN }
+ { px "offset",AT_DIMEN }, \
+ { px "color", AT_STRING }
// Scaling preserving aspect ratio