X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=jam.h;h=10f547ac55ad7dfe9c58575204a04e9818446328;hb=954187d247a71d34fa3db2bea80372d79cec5add;hp=47d80be2e534b5d811958d27c8225fd3d2888e00;hpb=50b49b5bf24f448fbcbac99099ef9bad72f89beb;p=paperjam.git diff --git a/jam.h b/jam.h index 47d80be..10f547a 100644 --- a/jam.h +++ b/jam.h @@ -7,6 +7,7 @@ #include #include #include +#include using namespace std; @@ -16,6 +17,16 @@ typedef unsigned int uint; #define UNUSED __attribute__((unused)) #define FORMAT_CHECK(x,y,z) __attribute__((format(x,y,z))) +static inline bool is_zero(double z) +{ + return fabs(z) < 1e-6; +} + +static inline bool is_equal(double x, double y) +{ + return is_zero(x-y); +} + #include "pdf-tools.h" /*** Representation of commands ***/ @@ -51,8 +62,10 @@ public: extern arg_val null_arg; struct out_context { + QPDF *pdf; QPDFObjectHandle resources; QPDFObjectHandle xobjects; + QPDFObjectHandle egstates; string contents; int res_cnt; string new_resource(const string type); @@ -60,18 +73,19 @@ struct out_context { }; struct page { - int index; + int index; // Position in the source PDF, 0 for synthesized pages double width; // Physical dimensions of media double height; - BBox bbox; // Bounds useful contents + BBox image_box; // 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; - } + page(double _w=0, double _h=0) : index(0), width(_w), height(_h), image_box() { } + page(page *p) + { + index = p->index; + width = p->width; + height = p->height; + image_box = p->image_box; + } }; struct empty_page : public page {