aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2021-02-21 11:11:31 +0100
committerJay Berkenbilt <ejb@ql.org>2021-02-21 12:36:30 +0100
commit901f1a788c6dcb5291539fe4edc271cf53d85a2a (patch)
treed292df8a8bfd710fec940f19223c6424bd581d45
parent05eb5826d8b8beb19e8ec65915af1476e7dd1db3 (diff)
downloadqpdf-901f1a788c6dcb5291539fe4edc271cf53d85a2a.tar.zst
Enhance QPDFMatrix API
-rw-r--r--ChangeLog8
-rw-r--r--include/qpdf/QPDFMatrix.hh1
-rw-r--r--include/qpdf/QPDFObjectHandle.hh5
-rw-r--r--libqpdf/QPDFObjectHandle.cc24
4 files changed, 35 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index c3b6629e..9621b3ff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2021-02-21 Jay Berkenbilt <ejb@ql.org>
+
+ * Allow QPDFObjectHandle::newArray and
+ QPDFObjectHandle::newFromMatrix take QPDFMatrix as well as
+ QPDFObjectHandle::Matrix
+
+ * Make member variables a--f of QPDFMatrix public
+
2021-02-20 Jay Berkenbilt <ejb@ql.org>
* Allow --rotate=0 to clear rotation from a page.
diff --git a/include/qpdf/QPDFMatrix.hh b/include/qpdf/QPDFMatrix.hh
index 8a8bff60..9448fb99 100644
--- a/include/qpdf/QPDFMatrix.hh
+++ b/include/qpdf/QPDFMatrix.hh
@@ -90,7 +90,6 @@ class QPDFMatrix
QPDFObjectHandle::Rectangle transformRectangle(
QPDFObjectHandle::Rectangle r);
- private:
double a;
double b;
double c;
diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh
index efcd653a..bb877622 100644
--- a/include/qpdf/QPDFObjectHandle.hh
+++ b/include/qpdf/QPDFObjectHandle.hh
@@ -47,6 +47,7 @@ class QPDF_Array;
class QPDFTokenizer;
class QPDFExc;
class Pl_QPDFTokenizer;
+class QPDFMatrix;
class QPDFObjectHandle
{
@@ -522,6 +523,8 @@ class QPDFObjectHandle
QPDF_DLL
static QPDFObjectHandle newArray(Matrix const&);
QPDF_DLL
+ static QPDFObjectHandle newArray(QPDFMatrix const&);
+ QPDF_DLL
static QPDFObjectHandle newDictionary();
QPDF_DLL
static QPDFObjectHandle newDictionary(
@@ -535,6 +538,8 @@ class QPDFObjectHandle
// form of newArray.
QPDF_DLL
static QPDFObjectHandle newFromMatrix(Matrix const&);
+ QPDF_DLL
+ static QPDFObjectHandle newFromMatrix(QPDFMatrix const&);
// Create a new stream and associate it with the given qpdf
// object. A subsequent call must be made to replaceStreamData()
diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc
index 6c37829d..ceb91630 100644
--- a/libqpdf/QPDFObjectHandle.cc
+++ b/libqpdf/QPDFObjectHandle.cc
@@ -19,6 +19,7 @@
#include <qpdf/QPDFExc.hh>
#include <qpdf/QPDFPageObjectHelper.hh>
#include <qpdf/SparseOHArray.hh>
+#include <qpdf/QPDFMatrix.hh>
#include <qpdf/QTC.hh>
#include <qpdf/QUtil.hh>
@@ -2567,15 +2568,34 @@ QPDFObjectHandle::newArray(Matrix const& matrix)
}
QPDFObjectHandle
+QPDFObjectHandle::newArray(QPDFMatrix const& matrix)
+{
+ std::vector<QPDFObjectHandle> items;
+ items.push_back(newReal(matrix.a));
+ items.push_back(newReal(matrix.b));
+ items.push_back(newReal(matrix.c));
+ items.push_back(newReal(matrix.d));
+ items.push_back(newReal(matrix.e));
+ items.push_back(newReal(matrix.f));
+ return newArray(items);
+}
+
+QPDFObjectHandle
QPDFObjectHandle::newFromRectangle(Rectangle const& rect)
{
return newArray(rect);
}
QPDFObjectHandle
-QPDFObjectHandle::newFromMatrix(Matrix const& rect)
+QPDFObjectHandle::newFromMatrix(Matrix const& m)
{
- return newArray(rect);
+ return newArray(m);
+}
+
+QPDFObjectHandle
+QPDFObjectHandle::newFromMatrix(QPDFMatrix const& m)
+{
+ return newArray(m);
}
QPDFObjectHandle