]> mj.ucw.cz Git - paperjam.git/blobdiff - jam.h
Measure bboxes by Ghostscripting
[paperjam.git] / jam.h
diff --git a/jam.h b/jam.h
index b18aa82a4f95f218f23f67479bd2a1e97faa1584..a966cea36d72bce230f9b775284f190ef8ef05eb 100644 (file)
--- a/jam.h
+++ b/jam.h
@@ -37,25 +37,32 @@ public:
   virtual string dump() { return "<undef>"; }
 };
 
-struct page_out {
+struct out_context {
   QPDFObjectHandle resources;
   QPDFObjectHandle xobjects;
   string contents;
   int res_cnt;
   string new_resource(const string type);
-  page_out() { res_cnt = 0; }
+  out_context() { res_cnt = 0; }
 };
 
 struct page {
   int index;
-  double width;
+  double width;                // Physical dimensions of media
   double height;
-  virtual void render(page_out *out UNUSED, pdf_matrix xform UNUSED) { abort(); }
+  BBox bbox;           // Bounds useful contents
+  virtual void render(out_context *out UNUSED, pdf_matrix xform UNUSED) { abort(); }
   page(double _w=0, double _h=0) : width(_w), height(_h) { }
+  page(page *p) {
+    index = p->index;
+    width = p->width;
+    height = p->height;
+    bbox = p->bbox;
+  }
 };
 
 struct empty_page : public page {
-  void render(page_out *out UNUSED, pdf_matrix xform UNUSED) { }
+  void render(out_context *out UNUSED, pdf_matrix xform UNUSED) { }
   empty_page(double _w=0, double _h=0) : page(_w, _h) { };
 };
 
@@ -98,7 +105,12 @@ vector<page *> run_command_list(list<cmd *> &cmds, vector<page *> &pages);
 // parse.cc
 
 void parse(const char *in, list<cmd *> &cmds);
+void help();
 
 // cmds.cc
 
 extern const cmd_def cmd_table[];
+
+// gs.cc
+
+vector<BBox> gs_bboxes(const char *in);