[poppler] poppler/Annot.cc poppler/Annot.h poppler/Gfx.cc poppler/Page.cc poppler/Page.h
Inigo Martinez
inigomartinez at kemper.freedesktop.org
Sun Feb 3 13:45:14 PST 2008
poppler/Annot.cc | 15 ++++-----------
poppler/Annot.h | 12 ++++++++++--
poppler/Gfx.cc | 7 ++++---
poppler/Page.cc | 9 +++++++++
poppler/Page.h | 3 +++
5 files changed, 30 insertions(+), 16 deletions(-)
New commits:
commit 37600b5e848386d2c92c3dff8219c9dda16b0dca
Author: Iñigo MartÃnez <inigomartinez at gmail.com>
Date: Sun Feb 3 22:42:51 2008 +0100
Minor changes to Annot related stuff.
Signed-off-by: Iñigo MartÃnez <inigomartinez at gmail.com>
diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index b23be2e..9e866aa 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -305,6 +305,7 @@ AnnotQuadPoints::AnnotQuadPoints(double x1, double y1, double x2, double y2,
// AnnotBorder
//------------------------------------------------------------------------
AnnotBorder::AnnotBorder() {
+ type = typeUnknown;
width = 1;
dashLength = 0;
dash = NULL;
@@ -321,6 +322,7 @@ AnnotBorder::~AnnotBorder() {
//------------------------------------------------------------------------
AnnotBorderArray::AnnotBorderArray() {
+ type = typeArray;
horizontalCorner = 0;
verticalCorner = 0;
}
@@ -380,6 +382,7 @@ AnnotBorderArray::AnnotBorderArray(Array *array) {
//------------------------------------------------------------------------
AnnotBorderBS::AnnotBorderBS() {
+ type = typeBS;
}
AnnotBorderBS::AnnotBorderBS(Dict *dict) {
@@ -487,16 +490,6 @@ AnnotColor::AnnotColor(Array *array) {
}
}
-AnnotColor::AnnotColorSpace AnnotColor::getSpace() const {
- return (AnnotColor::AnnotColorSpace) length;
-}
-
-double AnnotColor::getValue(int i) const {
- if (i >= 0 && i < length)
- return values[i];
- return 0;
-}
-
AnnotColor::~AnnotColor() {
if (values)
gfree (values);
@@ -2256,7 +2249,7 @@ AnnotText::AnnotText(XRef *xrefA, Dict *acroForm, Dict *dict, Catalog *catalog,
Annot(xrefA, acroForm, dict, catalog, obj), AnnotMarkup(xref, acroForm, dict, catalog, obj) {
type = typeText;
- flags |= flagNoZoom & flagNoRotate;
+ flags |= flagNoZoom | flagNoRotate;
initialize (xrefA, catalog, dict);
}
diff --git a/poppler/Annot.h b/poppler/Annot.h
index 0ae07e8..d9cc039 100644
--- a/poppler/Annot.h
+++ b/poppler/Annot.h
@@ -163,6 +163,12 @@ protected:
class AnnotBorder {
public:
+ enum AnnotBorderType {
+ typeUnknown,
+ typeArray,
+ typeBS,
+ };
+
enum AnnotBorderStyle {
borderSolid, // Solid
borderDashed, // Dashed
@@ -174,12 +180,14 @@ public:
AnnotBorder();
virtual ~AnnotBorder();
+ virtual AnnotBorderType getType() const { return type; }
virtual double getWidth() const { return width; }
virtual int getDashLength() const { return dashLength; }
virtual double *getDash() const { return dash; }
virtual AnnotBorderStyle getStyle() const { return style; }
protected:
+ AnnotBorderType type;
double width;
int dashLength;
double *dash;
@@ -239,8 +247,8 @@ public:
AnnotColor(Array *array);
~AnnotColor();
- AnnotColorSpace getSpace() const;
- double getValue(int i) const;
+ AnnotColorSpace getSpace() const { return (AnnotColorSpace) length; }
+ double *getValues() const { return values; }
private:
diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index f21ae6e..f068088 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -4256,9 +4256,10 @@ void Gfx::drawAnnot(Object *str, AnnotBorder *border, AnnotColor *aColor,
out->updateStrokeColorSpace(state);
}
if (aColor && (aColor->getSpace() == AnnotColor::colorRGB)) {
- r = aColor->getValue(0);
- g = aColor->getValue(1);
- b = aColor->getValue(2);
+ double *values = aColor->getValues();
+ r = values[0];
+ g = values[1];
+ b = values[2];
} else {
r = g = b = 0;
};
diff --git a/poppler/Page.cc b/poppler/Page.cc
index fb145ef..ddb0b60 100644
--- a/poppler/Page.cc
+++ b/poppler/Page.cc
@@ -313,6 +313,15 @@ Page::~Page() {
contents.free();
}
+Annots *Page::getAnnots(Catalog *catalog) {
+ Annots *annots;
+ Object obj;
+
+ annots = new Annots(xref, catalog, getAnnots(&obj));
+ obj.free();
+ return annots;
+}
+
Links *Page::getLinks(Catalog *catalog) {
Links *links;
Object obj;
diff --git a/poppler/Page.h b/poppler/Page.h
index 3b7eb4d..864a21e 100644
--- a/poppler/Page.h
+++ b/poppler/Page.h
@@ -148,6 +148,9 @@ public:
// Return a list of links.
Links *getLinks(Catalog *catalog);
+ // Return a list of annots. Ownership is transferred to the caller.
+ Annots *getAnnots(Catalog *catalog);
+
// Get contents.
Object *getContents(Object *obj) { return contents.fetch(xref, obj); }
More information about the poppler
mailing list