diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-06-04 14:47:17 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-06-04 14:47:17 +0000 |
commit | 97f4d67fbf0707feea298afa2f6471013185e066 (patch) | |
tree | 8591d399806c5d441e646a3f879227574e9217b4 /fpdfsdk/fpdf_editpath.cpp | |
parent | 714bf7821d2de6249d2779424c47027a981d5032 (diff) | |
download | pdfium-97f4d67fbf0707feea298afa2f6471013185e066.tar.xz |
Add FPDFPath_GetMatrix() and FPDFPath_SetMatrix() APIs
This is similar to the existing FPDFImageObj_SetMatrix(), but this
exposes the matrix of CPDF_PathObject and provides both a getter and a
setter.
Change-Id: Ib90a64929dae1b2be3889eca57e4af822d7823be
Reviewed-on: https://pdfium-review.googlesource.com/33670
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdf_editpath.cpp')
-rw-r--r-- | fpdfsdk/fpdf_editpath.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/fpdfsdk/fpdf_editpath.cpp b/fpdfsdk/fpdf_editpath.cpp index 7f00b85d7b..70a558d2f1 100644 --- a/fpdfsdk/fpdf_editpath.cpp +++ b/fpdfsdk/fpdf_editpath.cpp @@ -236,6 +236,55 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_GetDrawMode(FPDF_PAGEOBJECT path, return true; } +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_GetMatrix(FPDF_PAGEOBJECT path, + double* a, + double* b, + double* c, + double* d, + double* e, + double* f) { + if (!path || !a || !b || !c || !d || !e || !f) + return false; + + CPDF_PathObject* pPathObj = CPDFPathObjectFromFPDFPageObject(path); + if (!pPathObj) + return false; + + *a = pPathObj->m_Matrix.a; + *b = pPathObj->m_Matrix.b; + *c = pPathObj->m_Matrix.c; + *d = pPathObj->m_Matrix.d; + *e = pPathObj->m_Matrix.e; + *f = pPathObj->m_Matrix.f; + + return true; +} + +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_SetMatrix(FPDF_PAGEOBJECT path, + double a, + double b, + double c, + double d, + double e, + double f) { + if (!path) + return false; + + CPDF_PathObject* pPathObj = CPDFPathObjectFromFPDFPageObject(path); + if (!pPathObj) + return false; + + pPathObj->m_Matrix.a = a; + pPathObj->m_Matrix.b = b; + pPathObj->m_Matrix.c = c; + pPathObj->m_Matrix.d = d; + pPathObj->m_Matrix.e = e; + pPathObj->m_Matrix.f = f; + pPathObj->SetDirty(true); + + return true; +} + FPDF_EXPORT void FPDF_CALLCONV FPDFPath_SetLineJoin(FPDF_PAGEOBJECT path, int line_join) { auto* pPathObj = CPDFPathObjectFromFPDFPageObject(path); |