fixes in gradient parsing
[swftools.git] / pdf2swf / xpdf / Page.h
index 7207b20..36f96e1 100644 (file)
@@ -2,14 +2,16 @@
 //
 // Page.h
 //
-// Copyright 1996-2002 Glyph & Cog, LLC
+// Copyright 1996-2003 Glyph & Cog, LLC
 //
 //========================================================================
 
 #ifndef PAGE_H
 #define PAGE_H
 
-#ifdef __GNUC__
+#include <aconf.h>
+
+#ifdef USE_GCC_PRAGMAS
 #pragma interface
 #endif
 
@@ -23,8 +25,14 @@ class Catalog;
 
 //------------------------------------------------------------------------
 
-struct PDFRectangle {
+class PDFRectangle {
+public:
   double x1, y1, x2, y2;
+
+  PDFRectangle() { x1 = y1 = x2 = y2 = 0; }
+  PDFRectangle(double x1A, double y1A, double x2A, double y2A)
+    { x1 = x1A; y1 = y1A; x2 = x2A; y2 = y2A; }
+  GBool isValid() { return x1 != 0 || y1 != 0 || x2 != 0 || y2 != 0; }
 };
 
 //------------------------------------------------------------------------
@@ -43,7 +51,6 @@ public:
   ~PageAttrs();
 
   // Accessors.
-  PDFRectangle *getBox() { return limitToCropBox ? &cropBox : &mediaBox; }
   PDFRectangle *getMediaBox() { return &mediaBox; }
   PDFRectangle *getCropBox() { return &cropBox; }
   GBool isCropped() { return haveCropBox; }
@@ -75,7 +82,6 @@ private:
   PDFRectangle mediaBox;
   PDFRectangle cropBox;
   GBool haveCropBox;
-  GBool limitToCropBox;
   PDFRectangle bleedBox;
   PDFRectangle trimBox;
   PDFRectangle artBox;
@@ -97,8 +103,7 @@ class Page {
 public:
 
   // Constructor.
-  Page(XRef *xrefA, int numA, Dict *pageDict, PageAttrs *attrsA,
-       GBool printCommandsA);
+  Page(XRef *xrefA, int numA, Dict *pageDict, PageAttrs *attrsA);
 
   // Destructor.
   ~Page();
@@ -107,12 +112,17 @@ public:
   GBool isOk() { return ok; }
 
   // Get page parameters.
-  PDFRectangle *getBox() { return attrs->getBox(); }
   PDFRectangle *getMediaBox() { return attrs->getMediaBox(); }
   PDFRectangle *getCropBox() { return attrs->getCropBox(); }
   GBool isCropped() { return attrs->isCropped(); }
-  double getWidth() { return attrs->getBox()->x2 - attrs->getBox()->x1; }
-  double getHeight() { return attrs->getBox()->y2 - attrs->getBox()->y1; }
+  double getMediaWidth() 
+    { return attrs->getMediaBox()->x2 - attrs->getMediaBox()->x1; }
+  double getMediaHeight()
+    { return attrs->getMediaBox()->y2 - attrs->getMediaBox()->y1; }
+  double getCropWidth() 
+    { return attrs->getCropBox()->x2 - attrs->getCropBox()->x1; }
+  double getCropHeight()
+    { return attrs->getCropBox()->y2 - attrs->getCropBox()->y1; }
   PDFRectangle *getBleedBox() { return attrs->getBleedBox(); }
   PDFRectangle *getTrimBox() { return attrs->getTrimBox(); }
   PDFRectangle *getArtBox() { return attrs->getArtBox(); }
@@ -134,8 +144,23 @@ public:
   Object *getContents(Object *obj) { return contents.fetch(xref, obj); }
 
   // Display a page.
-  void display(OutputDev *out, double dpi, int rotate,
-              Links *links, Catalog *catalog);
+  void display(OutputDev *out, double hDPI, double vDPI,
+              int rotate, GBool useMediaBox, GBool crop,
+              Links *links, Catalog *catalog,
+              GBool (*abortCheckCbk)(void *data) = NULL,
+              void *abortCheckCbkData = NULL);
+
+  // Display part of a page.
+  void displaySlice(OutputDev *out, double hDPI, double vDPI,
+                   int rotate, GBool useMediaBox, GBool crop,
+                   int sliceX, int sliceY, int sliceW, int sliceH,
+                   Links *links, Catalog *catalog,
+                   GBool (*abortCheckCbk)(void *data) = NULL,
+                   void *abortCheckCbkData = NULL);
+
+  // Get the page's default CTM.
+  void getDefaultCTM(double *ctm, double hDPI, double vDPI,
+                    int rotate, GBool upsideDown);
 
 private:
 
@@ -144,7 +169,6 @@ private:
   PageAttrs *attrs;            // page attributes
   Object annots;               // annotations array
   Object contents;             // page contents
-  GBool printCommands;         // print the drawing commands (for debugging)
   GBool ok;                    // true if page is valid
 };