X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=pdf-tools.h;h=0225e9c457f951806aa07129c9a692ab55856f9e;hb=932f7160f80f9c34fcf1dcc41cb2b05b78e54956;hp=9563ec024ceb132c7a1fb457b83f04c8b61bada6;hpb=79cd6567f85450ec93f37bf5fc9546baeeec336e;p=paperjam.git diff --git a/pdf-tools.h b/pdf-tools.h index 9563ec0..0225e9c 100644 --- a/pdf-tools.h +++ b/pdf-tools.h @@ -14,24 +14,10 @@ /*** Basic macros and constants ***/ -#define UNUSED __attribute__((unused)) -#define FORMAT_CHECK(x,y,z) __attribute__((format(x,y,z))) -#define NONRET __attribute__((noreturn)) - #define A4_WIDTH 595 #define A4_HEIGHT 842 static const double mm = 72/25.4; -/*** Messages ***/ - -void debug(const char *msg, ...) FORMAT_CHECK(printf, 1, 2); -void warn(const char *msg, ...) FORMAT_CHECK(printf, 1, 2); -void die(const char *msg, ...) FORMAT_CHECK(printf, 1, 2) NONRET; -void bad(const char *msg, ...) FORMAT_CHECK(printf, 1, 2) NONRET; - -extern int debug_mode; -extern int debug_indent; - /*** Transformation matrices ***/ struct pdf_matrix { @@ -137,18 +123,14 @@ struct BBox { x_min = 0, x_max = x; y_min = 0, y_max = y; } - BBox(QPDFObjectHandle box) { - if (!parse(box)) { - warn("Invalid bounding box, falling back to A4"); - x_min = 0, x_max = A4_WIDTH; - y_min = 0, y_max = A4_HEIGHT; - } - } + BBox(QPDFObjectHandle box); QPDFObjectHandle to_array(); string to_rect(); double width() { return x_max - x_min; } double height() { return y_max - y_min; } void transform(pdf_matrix &m); + BBox transformed(pdf_matrix &m); + void join(BBox &with); private: bool parse(QPDFObjectHandle h); }; @@ -157,6 +139,6 @@ private: QPDFObjectHandle unicode_string(std::string s); QPDFObjectHandle page_to_xobject(QPDF *out, QPDFObjectHandle page); +string pdf_coord(double x, uint digits=1); #endif -