7 // you have to provide this
11 width(NAN),height(NAN),
14 xstart(LEFT),ystart(TOP),
15 xalign(CENTER),yalign(CENTER)
18 // --- "calculated" parameters ---
21 bool landscape; // post-rotate!
23 // --- other settings ---
26 Position xstart,ystart;
28 Position xalign,yalign;
30 static bool possible(int nup); // TODO? float in_ratio,float out_ratio
31 static void preset(int nup,NupParameters &ret);
32 static float calculate(int nup, float in_ratio, float out_ratio,NupParameters &ret); // returns "quality", 1 is best
39 // required transformation: first translate, then scale
40 float xpos,ypos; // TODO: already given by sub.left,sub.bottom [but for rotation?]
41 float scale; // uniform
43 // ? "landscape" e.g. to rotate labels
45 // for border, clip, ...
46 // also stores in_width/in_height, unscaled!
47 // everything in "outer"-page coordinates
54 This class does the number-up calculation. Example:
57 param.xyz=...; // fill it with your data!
61 for (auto page : your_pages) {
62 bool newPage=nup.nextPage(page.w,page.h,edit); // w,h from input page
63 // create newPage, if required; then place current page as specified in edit
68 NupState(const NupParameters ¶m);
72 // will overwrite ret with the new parameters
73 // returns true, if a new output page should be started first
74 bool nextPage(float in_width,float in_height,NupPageEdit &ret);
77 std::pair<int,int> convert_order(int subpage) const;
78 void calculate_edit(int subx,int suby,NupPageEdit &ret) const;
82 int in_pages,out_pages;
83 int nup; // max. per page (==nupX*nupY)
84 int subpage; // on the current output-page
88 // parsing functions for cups parameters (will not calculate nupX,nupY!)
89 bool parseNupLayout(const char *val,NupParameters &ret); // lrtb, btlr, ...