Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
fpdf_editpage.cpp
Go to the documentation of this file.
1// Copyright 2014 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#include "public/fpdf_edit.h"
8
9#include <algorithm>
10#include <memory>
11#include <utility>
12#include <vector>
13
14#include "constants/page_object.h"
15#include "core/fpdfapi/edit/cpdf_pagecontentgenerator.h"
16#include "core/fpdfapi/page/cpdf_colorspace.h"
17#include "core/fpdfapi/page/cpdf_docpagedata.h"
18#include "core/fpdfapi/page/cpdf_form.h"
19#include "core/fpdfapi/page/cpdf_formobject.h"
20#include "core/fpdfapi/page/cpdf_imageobject.h"
21#include "core/fpdfapi/page/cpdf_page.h"
22#include "core/fpdfapi/page/cpdf_pageimagecache.h"
23#include "core/fpdfapi/page/cpdf_pageobject.h"
24#include "core/fpdfapi/page/cpdf_pathobject.h"
25#include "core/fpdfapi/page/cpdf_shadingobject.h"
26#include "core/fpdfapi/page/cpdf_textobject.h"
27#include "core/fpdfapi/parser/cpdf_array.h"
28#include "core/fpdfapi/parser/cpdf_dictionary.h"
29#include "core/fpdfapi/parser/cpdf_document.h"
30#include "core/fpdfapi/parser/cpdf_name.h"
31#include "core/fpdfapi/parser/cpdf_number.h"
32#include "core/fpdfapi/parser/cpdf_string.h"
33#include "core/fpdfapi/render/cpdf_docrenderdata.h"
34#include "core/fpdfdoc/cpdf_annot.h"
35#include "core/fpdfdoc/cpdf_annotlist.h"
36#include "core/fxcrt/fx_extension.h"
37#include "core/fxcrt/fx_memcpy_wrappers.h"
38#include "core/fxcrt/stl_util.h"
39#include "fpdfsdk/cpdfsdk_helpers.h"
40#include "public/fpdf_formfill.h"
41#include "third_party/base/containers/span.h"
42#include "third_party/base/numerics/safe_conversions.h"
43
44#ifdef PDF_ENABLE_XFA
45#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
46#include "fpdfsdk/fpdfxfa/cpdfxfa_page.h"
47#endif // PDF_ENABLE_XFA
48
49namespace {
50
51static_assert(FPDF_PAGEOBJ_TEXT ==
52 static_cast<int>(CPDF_PageObject::Type::kText),
53 "FPDF_PAGEOBJ_TEXT/CPDF_PageObject::TEXT mismatch");
54static_assert(FPDF_PAGEOBJ_PATH ==
55 static_cast<int>(CPDF_PageObject::Type::kPath),
56 "FPDF_PAGEOBJ_PATH/CPDF_PageObject::PATH mismatch");
57static_assert(FPDF_PAGEOBJ_IMAGE ==
58 static_cast<int>(CPDF_PageObject::Type::kImage),
59 "FPDF_PAGEOBJ_IMAGE/CPDF_PageObject::IMAGE mismatch");
60static_assert(FPDF_PAGEOBJ_SHADING ==
61 static_cast<int>(CPDF_PageObject::Type::kShading),
62 "FPDF_PAGEOBJ_SHADING/CPDF_PageObject::SHADING mismatch");
63static_assert(FPDF_PAGEOBJ_FORM ==
64 static_cast<int>(CPDF_PageObject::Type::kForm),
65 "FPDF_PAGEOBJ_FORM/CPDF_PageObject::FORM mismatch");
66
67bool IsPageObject(CPDF_Page* pPage) {
68 if (!pPage)
69 return false;
70
71 RetainPtr<const CPDF_Dictionary> pFormDict = pPage->GetDict();
72 if (!pFormDict->KeyExist(pdfium::page_object::kType))
73 return false;
74
75 RetainPtr<const CPDF_Name> pName =
76 ToName(pFormDict->GetObjectFor(pdfium::page_object::kType)->GetDirect());
77 return pName && pName->GetString() == "Page";
78}
79
80void CalcBoundingBox(CPDF_PageObject* pPageObj) {
81 switch (pPageObj->GetType()) {
83 break;
84 }
86 CPDF_PathObject* pPathObj = pPageObj->AsPath();
87 pPathObj->CalcBoundingBox();
88 break;
89 }
91 CPDF_ImageObject* pImageObj = pPageObj->AsImage();
92 pImageObj->CalcBoundingBox();
93 break;
94 }
96 CPDF_ShadingObject* pShadingObj = pPageObj->AsShading();
97 pShadingObj->CalcBoundingBox();
98 break;
99 }
101 CPDF_FormObject* pFormObj = pPageObj->AsForm();
102 pFormObj->CalcBoundingBox();
103 break;
104 }
105 }
106}
107
108RetainPtr<CPDF_Dictionary> GetMarkParamDict(FPDF_PAGEOBJECTMARK mark) {
109 CPDF_ContentMarkItem* pMarkItem =
111 return pMarkItem ? pMarkItem->GetParam() : nullptr;
112}
113
114RetainPtr<CPDF_Dictionary> GetOrCreateMarkParamsDict(FPDF_DOCUMENT document,
115 FPDF_PAGEOBJECTMARK mark) {
117 if (!pDoc)
118 return nullptr;
119
120 CPDF_ContentMarkItem* pMarkItem =
122 if (!pMarkItem)
123 return nullptr;
124
125 RetainPtr<CPDF_Dictionary> pParams = pMarkItem->GetParam();
126 if (!pParams) {
127 pParams = pDoc->New<CPDF_Dictionary>();
128 pMarkItem->SetDirectDict(pParams);
129 }
130 return pParams;
131}
132
133bool PageObjectContainsMark(CPDF_PageObject* pPageObj,
134 FPDF_PAGEOBJECTMARK mark) {
135 const CPDF_ContentMarkItem* pMarkItem =
137 return pMarkItem && pPageObj->GetContentMarks()->ContainsItem(pMarkItem);
138}
139
140CPDF_FormObject* CPDFFormObjectFromFPDFPageObject(FPDF_PAGEOBJECT page_object) {
141 auto* pPageObj = CPDFPageObjectFromFPDFPageObject(page_object);
142 return pPageObj ? pPageObj->AsForm() : nullptr;
143}
144
145const CPDF_PageObjectHolder* CPDFPageObjHolderFromFPDFFormObject(
146 FPDF_PAGEOBJECT page_object) {
147 CPDF_FormObject* pFormObject = CPDFFormObjectFromFPDFPageObject(page_object);
148 return pFormObject ? pFormObject->form() : nullptr;
149}
150
151} // namespace
152
154 auto pDoc =
155 std::make_unique<CPDF_Document>(std::make_unique<CPDF_DocRenderData>(),
156 std::make_unique<CPDF_DocPageData>());
157 pDoc->CreateNewDoc();
158
159 time_t currentTime;
160 ByteString DateStr;
162 if (FXSYS_time(&currentTime) != -1) {
163 tm* pTM = FXSYS_localtime(&currentTime);
164 if (pTM) {
165 DateStr = ByteString::Format(
166 "D:%04d%02d%02d%02d%02d%02d", pTM->tm_year + 1900, pTM->tm_mon + 1,
167 pTM->tm_mday, pTM->tm_hour, pTM->tm_min, pTM->tm_sec);
168 }
169 }
170 }
171
172 RetainPtr<CPDF_Dictionary> pInfoDict = pDoc->GetInfo();
173 if (pInfoDict) {
175 pInfoDict->SetNewFor<CPDF_String>("CreationDate", DateStr, false);
176 pInfoDict->SetNewFor<CPDF_String>("Creator", L"PDFium");
177 }
178
179 // Caller takes ownership of pDoc.
180 return FPDFDocumentFromCPDFDocument(pDoc.release());
181}
182
183FPDF_EXPORT void FPDF_CALLCONV FPDFPage_Delete(FPDF_DOCUMENT document,
184 int page_index) {
185 auto* pDoc = CPDFDocumentFromFPDFDocument(document);
186 if (!pDoc)
187 return;
188
189 CPDF_Document::Extension* pExtension = pDoc->GetExtension();
190 if (pExtension) {
191 pExtension->DeletePage(page_index);
192 return;
193 }
194
195 pDoc->DeletePage(page_index);
196}
197
199FPDF_MovePages(FPDF_DOCUMENT document,
200 const int* page_indices,
201 unsigned long page_indices_len,
202 int dest_page_index) {
203 auto* doc = CPDFDocumentFromFPDFDocument(document);
204 if (!doc) {
205 return false;
206 }
207
208 return doc->MovePages({page_indices, page_indices_len}, dest_page_index);
209}
210
211FPDF_EXPORT FPDF_PAGE FPDF_CALLCONV FPDFPage_New(FPDF_DOCUMENT document,
212 int page_index,
213 double width,
214 double height) {
216 if (!pDoc)
217 return nullptr;
218
219 page_index = std::clamp(page_index, 0, pDoc->GetPageCount());
220 RetainPtr<CPDF_Dictionary> pPageDict(pDoc->CreateNewPage(page_index));
221 if (!pPageDict)
222 return nullptr;
223
224 pPageDict->SetRectFor(pdfium::page_object::kMediaBox,
225 CFX_FloatRect(0, 0, width, height));
226 pPageDict->SetNewFor<CPDF_Number>(pdfium::page_object::kRotate, 0);
227 pPageDict->SetNewFor<CPDF_Dictionary>(pdfium::page_object::kResources);
228
229#ifdef PDF_ENABLE_XFA
230 if (pDoc->GetExtension()) {
231 auto pXFAPage = pdfium::MakeRetain<CPDFXFA_Page>(pDoc, page_index);
232 pXFAPage->LoadPDFPageFromDict(pPageDict);
233 return FPDFPageFromIPDFPage(pXFAPage.Leak()); // Caller takes ownership.
234 }
235#endif // PDF_ENABLE_XFA
236
237 auto pPage = pdfium::MakeRetain<CPDF_Page>(pDoc, pPageDict);
238 pPage->AddPageImageCache();
239 pPage->ParseContent();
240
241 return FPDFPageFromIPDFPage(pPage.Leak()); // Caller takes ownership.
242}
243
245 CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
246 return IsPageObject(pPage) ? pPage->GetPageRotation() : -1;
247}
248
250FPDFPage_InsertObject(FPDF_PAGE page, FPDF_PAGEOBJECT page_object) {
252 if (!pPageObj)
253 return;
254
255 std::unique_ptr<CPDF_PageObject> pPageObjHolder(pPageObj);
256 CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
257 if (!IsPageObject(pPage))
258 return;
259
260 pPageObj->SetDirty(true);
261 pPage->AppendPageObject(std::move(pPageObjHolder));
262 CalcBoundingBox(pPageObj);
263}
264
266FPDFPage_RemoveObject(FPDF_PAGE page, FPDF_PAGEOBJECT page_object) {
268 if (!pPageObj)
269 return false;
270
271 CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
272 if (!IsPageObject(pPage))
273 return false;
274
275 // Caller takes ownership.
276 return !!pPage->RemovePageObject(pPageObj).release();
277}
278
280 CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
281 if (!IsPageObject(pPage))
282 return -1;
283
284 return pdfium::base::checked_cast<int>(pPage->GetPageObjectCount());
285}
286
287FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV FPDFPage_GetObject(FPDF_PAGE page,
288 int index) {
289 CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
290 if (!IsPageObject(pPage))
291 return nullptr;
292
293 return FPDFPageObjectFromCPDFPageObject(pPage->GetPageObjectByIndex(index));
294}
295
297 CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
298 return pPage && pPage->BackgroundAlphaNeeded();
299}
300
302FPDFPageObj_Destroy(FPDF_PAGEOBJECT page_object) {
303 delete CPDFPageObjectFromFPDFPageObject(page_object);
304}
305
307FPDFPageObj_CountMarks(FPDF_PAGEOBJECT page_object) {
309 if (!pPageObj)
310 return -1;
311
312 return pdfium::base::checked_cast<int>(
313 pPageObj->GetContentMarks()->CountItems());
314}
315
316FPDF_EXPORT FPDF_PAGEOBJECTMARK FPDF_CALLCONV
317FPDFPageObj_GetMark(FPDF_PAGEOBJECT page_object, unsigned long index) {
319 if (!pPageObj)
320 return nullptr;
321
322 CPDF_ContentMarks* pMarks = pPageObj->GetContentMarks();
323 if (index >= pMarks->CountItems())
324 return nullptr;
325
326 return FPDFPageObjectMarkFromCPDFContentMarkItem(pMarks->GetItem(index));
327}
328
329FPDF_EXPORT FPDF_PAGEOBJECTMARK FPDF_CALLCONV
330FPDFPageObj_AddMark(FPDF_PAGEOBJECT page_object, FPDF_BYTESTRING name) {
332 if (!pPageObj)
333 return nullptr;
334
335 CPDF_ContentMarks* pMarks = pPageObj->GetContentMarks();
336 pMarks->AddMark(name);
337 pPageObj->SetDirty(true);
338
339 const size_t index = pMarks->CountItems() - 1;
340 return FPDFPageObjectMarkFromCPDFContentMarkItem(pMarks->GetItem(index));
341}
342
344FPDFPageObj_RemoveMark(FPDF_PAGEOBJECT page_object, FPDF_PAGEOBJECTMARK mark) {
346 CPDF_ContentMarkItem* pMarkItem =
348 if (!pPageObj || !pMarkItem)
349 return false;
350
351 if (!pPageObj->GetContentMarks()->RemoveMark(pMarkItem))
352 return false;
353
354 pPageObj->SetDirty(true);
355 return true;
356}
357
359FPDFPageObjMark_GetName(FPDF_PAGEOBJECTMARK mark,
360 void* buffer,
361 unsigned long buflen,
362 unsigned long* out_buflen) {
363 const CPDF_ContentMarkItem* pMarkItem =
365 if (!pMarkItem || !out_buflen)
366 return false;
367
368 *out_buflen = Utf16EncodeMaybeCopyAndReturnLength(
369 WideString::FromUTF8(pMarkItem->GetName().AsStringView()), buffer,
370 buflen);
371 return true;
372}
373
375FPDFPageObjMark_CountParams(FPDF_PAGEOBJECTMARK mark) {
376 const CPDF_ContentMarkItem* pMarkItem =
378 if (!pMarkItem)
379 return -1;
380
381 RetainPtr<const CPDF_Dictionary> pParams = pMarkItem->GetParam();
382 return pParams ? fxcrt::CollectionSize<int>(*pParams) : 0;
383}
384
386FPDFPageObjMark_GetParamKey(FPDF_PAGEOBJECTMARK mark,
387 unsigned long index,
388 void* buffer,
389 unsigned long buflen,
390 unsigned long* out_buflen) {
391 if (!out_buflen)
392 return false;
393
394 RetainPtr<const CPDF_Dictionary> pParams = GetMarkParamDict(mark);
395 if (!pParams)
396 return false;
397
398 CPDF_DictionaryLocker locker(pParams);
399 for (auto& it : locker) {
400 if (index == 0) {
401 *out_buflen = Utf16EncodeMaybeCopyAndReturnLength(
402 WideString::FromUTF8(it.first.AsStringView()), buffer, buflen);
403 return true;
404 }
405 --index;
406 }
407
408 return false;
409}
410
411FPDF_EXPORT FPDF_OBJECT_TYPE FPDF_CALLCONV
412FPDFPageObjMark_GetParamValueType(FPDF_PAGEOBJECTMARK mark,
413 FPDF_BYTESTRING key) {
414 RetainPtr<const CPDF_Dictionary> pParams = GetMarkParamDict(mark);
415 if (!pParams)
416 return FPDF_OBJECT_UNKNOWN;
417
418 RetainPtr<const CPDF_Object> pObject = pParams->GetObjectFor(key);
419 return pObject ? pObject->GetType() : FPDF_OBJECT_UNKNOWN;
420}
421
423FPDFPageObjMark_GetParamIntValue(FPDF_PAGEOBJECTMARK mark,
424 FPDF_BYTESTRING key,
425 int* out_value) {
426 if (!out_value)
427 return false;
428
429 RetainPtr<const CPDF_Dictionary> pParams = GetMarkParamDict(mark);
430 if (!pParams)
431 return false;
432
433 RetainPtr<const CPDF_Object> pObj = pParams->GetObjectFor(key);
434 if (!pObj || !pObj->IsNumber())
435 return false;
436
437 *out_value = pObj->GetInteger();
438 return true;
439}
440
442FPDFPageObjMark_GetParamStringValue(FPDF_PAGEOBJECTMARK mark,
443 FPDF_BYTESTRING key,
444 void* buffer,
445 unsigned long buflen,
446 unsigned long* out_buflen) {
447 if (!out_buflen)
448 return false;
449
450 RetainPtr<const CPDF_Dictionary> pParams = GetMarkParamDict(mark);
451 if (!pParams)
452 return false;
453
454 RetainPtr<const CPDF_Object> pObj = pParams->GetObjectFor(key);
455 if (!pObj || !pObj->IsString())
456 return false;
457
458 *out_buflen = Utf16EncodeMaybeCopyAndReturnLength(
459 WideString::FromUTF8(pObj->GetString().AsStringView()), buffer, buflen);
460 return true;
461}
462
464FPDFPageObjMark_GetParamBlobValue(FPDF_PAGEOBJECTMARK mark,
465 FPDF_BYTESTRING key,
466 void* buffer,
467 unsigned long buflen,
468 unsigned long* out_buflen) {
469 if (!out_buflen)
470 return false;
471
472 RetainPtr<const CPDF_Dictionary> pParams = GetMarkParamDict(mark);
473 if (!pParams)
474 return false;
475
476 RetainPtr<const CPDF_Object> pObj = pParams->GetObjectFor(key);
477 if (!pObj || !pObj->IsString())
478 return false;
479
480 ByteString result = pObj->GetString();
481 const unsigned long len =
482 pdfium::base::checked_cast<unsigned long>(result.GetLength());
483
484 if (buffer && len <= buflen)
485 memcpy(buffer, result.c_str(), len);
486
487 *out_buflen = len;
488 return true;
489}
490
492FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT page_object) {
494 if (!pPageObj) {
495 return false;
496 }
498 return true;
499 }
500 if (pPageObj->general_state().GetSoftMask()) {
501 return true;
502 }
503 if (pPageObj->general_state().GetFillAlpha() != 1.0f) {
504 return true;
505 }
506 if (pPageObj->IsPath() &&
507 pPageObj->general_state().GetStrokeAlpha() != 1.0f) {
508 return true;
509 }
510 if (!pPageObj->IsForm()) {
511 return false;
512 }
513
514 const CPDF_Form* pForm = pPageObj->AsForm()->form();
515 if (!pForm) {
516 return false;
517 }
518
519 const CPDF_Transparency& trans = pForm->GetTransparency();
520 return trans.IsGroup() || trans.IsIsolated();
521}
522
524FPDFPageObjMark_SetIntParam(FPDF_DOCUMENT document,
525 FPDF_PAGEOBJECT page_object,
526 FPDF_PAGEOBJECTMARK mark,
527 FPDF_BYTESTRING key,
528 int value) {
530 if (!pPageObj || !PageObjectContainsMark(pPageObj, mark))
531 return false;
532
533 RetainPtr<CPDF_Dictionary> pParams =
534 GetOrCreateMarkParamsDict(document, mark);
535 if (!pParams)
536 return false;
537
538 pParams->SetNewFor<CPDF_Number>(key, value);
539 pPageObj->SetDirty(true);
540 return true;
541}
542
544FPDFPageObjMark_SetStringParam(FPDF_DOCUMENT document,
545 FPDF_PAGEOBJECT page_object,
546 FPDF_PAGEOBJECTMARK mark,
547 FPDF_BYTESTRING key,
548 FPDF_BYTESTRING value) {
550 if (!pPageObj || !PageObjectContainsMark(pPageObj, mark))
551 return false;
552
553 RetainPtr<CPDF_Dictionary> pParams =
554 GetOrCreateMarkParamsDict(document, mark);
555 if (!pParams)
556 return false;
557
558 pParams->SetNewFor<CPDF_String>(key, value, false);
559 pPageObj->SetDirty(true);
560 return true;
561}
562
564FPDFPageObjMark_SetBlobParam(FPDF_DOCUMENT document,
565 FPDF_PAGEOBJECT page_object,
566 FPDF_PAGEOBJECTMARK mark,
567 FPDF_BYTESTRING key,
568 void* value,
569 unsigned long value_len) {
571 if (!pPageObj || !PageObjectContainsMark(pPageObj, mark))
572 return false;
573
574 RetainPtr<CPDF_Dictionary> pParams =
575 GetOrCreateMarkParamsDict(document, mark);
576 if (!pParams)
577 return false;
578
579 if (!value && value_len > 0)
580 return false;
581
582 pParams->SetNewFor<CPDF_String>(
583 key, ByteString(static_cast<const char*>(value), value_len), true);
584 pPageObj->SetDirty(true);
585 return true;
586}
587
589FPDFPageObjMark_RemoveParam(FPDF_PAGEOBJECT page_object,
590 FPDF_PAGEOBJECTMARK mark,
591 FPDF_BYTESTRING key) {
593 if (!pPageObj)
594 return false;
595
596 RetainPtr<CPDF_Dictionary> pParams = GetMarkParamDict(mark);
597 if (!pParams)
598 return false;
599
600 auto removed = pParams->RemoveFor(key);
601 if (!removed)
602 return false;
603
604 pPageObj->SetDirty(true);
605 return true;
606}
607
608FPDF_EXPORT int FPDF_CALLCONV FPDFPageObj_GetType(FPDF_PAGEOBJECT page_object) {
610 return pPageObj ? static_cast<int>(pPageObj->GetType())
612}
613
615 CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
616 if (!IsPageObject(pPage))
617 return false;
618
621 return true;
622}
623
625FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object,
626 double a,
627 double b,
628 double c,
629 double d,
630 double e,
631 double f) {
633 if (!pPageObj)
634 return;
635
636 CFX_Matrix matrix((float)a, (float)b, (float)c, (float)d, (float)e, (float)f);
637 pPageObj->Transform(matrix);
638}
639
641FPDFPageObj_GetMatrix(FPDF_PAGEOBJECT page_object, FS_MATRIX* matrix) {
643 if (!pPageObj || !matrix)
644 return false;
645
646 switch (pPageObj->GetType()) {
649 return true;
652 return true;
655 return true;
657 return false;
660 return true;
661 }
662}
663
665FPDFPageObj_SetMatrix(FPDF_PAGEOBJECT page_object, const FS_MATRIX* matrix) {
667 if (!pPageObj || !matrix)
668 return false;
669
670 CFX_Matrix cmatrix = CFXMatrixFromFSMatrix(*matrix);
671 switch (pPageObj->GetType()) {
673 pPageObj->AsText()->SetTextMatrix(cmatrix);
674 break;
676 pPageObj->AsPath()->SetPathMatrix(cmatrix);
677 break;
679 pPageObj->AsImage()->SetImageMatrix(cmatrix);
680 break;
682 return false;
684 pPageObj->AsForm()->SetFormMatrix(cmatrix);
685 break;
686 }
687 pPageObj->SetDirty(true);
688 return true;
689}
690
692FPDFPageObj_SetBlendMode(FPDF_PAGEOBJECT page_object,
693 FPDF_BYTESTRING blend_mode) {
695 if (!pPageObj)
696 return;
697
699 pPageObj->SetDirty(true);
700}
701
703 double a,
704 double b,
705 double c,
706 double d,
707 double e,
708 double f) {
709 CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
710 if (!pPage)
711 return;
712
713 CPDF_AnnotList AnnotList(pPage);
714 for (size_t i = 0; i < AnnotList.Count(); ++i) {
715 CPDF_Annot* pAnnot = AnnotList.GetAt(i);
716 CFX_Matrix matrix((float)a, (float)b, (float)c, (float)d, (float)e,
717 (float)f);
719
720 RetainPtr<CPDF_Dictionary> pAnnotDict = pAnnot->GetMutableAnnotDict();
721 RetainPtr<CPDF_Array> pRectArray = pAnnotDict->GetMutableArrayFor("Rect");
722 if (pRectArray)
723 pRectArray->Clear();
724 else
725 pRectArray = pAnnotDict->SetNewFor<CPDF_Array>("Rect");
726
727 pRectArray->AppendNew<CPDF_Number>(rect.left);
728 pRectArray->AppendNew<CPDF_Number>(rect.bottom);
729 pRectArray->AppendNew<CPDF_Number>(rect.right);
730 pRectArray->AppendNew<CPDF_Number>(rect.top);
731
732 // TODO(unknown): Transform AP's rectangle
733 }
734}
735
737 int rotate) {
738 CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
739 if (!IsPageObject(pPage))
740 return;
741
742 rotate %= 4;
743 pPage->GetMutableDict()->SetNewFor<CPDF_Number>(pdfium::page_object::kRotate,
744 rotate * 90);
746}
747
748FPDF_BOOL FPDFPageObj_SetFillColor(FPDF_PAGEOBJECT page_object,
749 unsigned int R,
750 unsigned int G,
751 unsigned int B,
752 unsigned int A) {
754 if (!pPageObj || R > 255 || G > 255 || B > 255 || A > 255)
755 return false;
756
757 std::vector<float> rgb = {R / 255.f, G / 255.f, B / 255.f};
759 pPageObj->mutable_color_state().SetFillColor(
761 std::move(rgb));
762 pPageObj->SetDirty(true);
763 return true;
764}
765
767FPDFPageObj_GetFillColor(FPDF_PAGEOBJECT page_object,
768 unsigned int* R,
769 unsigned int* G,
770 unsigned int* B,
771 unsigned int* A) {
772 auto* pPageObj = CPDFPageObjectFromFPDFPageObject(page_object);
773 if (!pPageObj || !R || !G || !B || !A)
774 return false;
775
776 if (!pPageObj->color_state().HasRef()) {
777 return false;
778 }
779
780 FX_COLORREF fill_color = pPageObj->color_state().GetFillColorRef();
781 *R = FXSYS_GetRValue(fill_color);
782 *G = FXSYS_GetGValue(fill_color);
783 *B = FXSYS_GetBValue(fill_color);
785 return true;
786}
787
789FPDFPageObj_GetBounds(FPDF_PAGEOBJECT page_object,
790 float* left,
791 float* bottom,
792 float* right,
793 float* top) {
795 if (!pPageObj)
796 return false;
797
798 const CFX_FloatRect& bbox = pPageObj->GetRect();
799 *left = bbox.left;
800 *bottom = bbox.bottom;
801 *right = bbox.right;
802 *top = bbox.top;
803 return true;
804}
805
807FPDFPageObj_GetRotatedBounds(FPDF_PAGEOBJECT page_object,
808 FS_QUADPOINTSF* quad_points) {
809 CPDF_PageObject* cpage_object = CPDFPageObjectFromFPDFPageObject(page_object);
810 if (!cpage_object || !quad_points)
811 return false;
812
813 CFX_Matrix matrix;
814 switch (cpage_object->GetType()) {
816 matrix = cpage_object->AsText()->GetTextMatrix();
817 break;
819 matrix = cpage_object->AsImage()->matrix();
820 break;
821 default:
822 // TODO(crbug.com/pdfium/1840): Support more object types.
823 return false;
824 }
825
826 const CFX_FloatRect& bbox = cpage_object->GetOriginalRect();
827 const CFX_PointF bottom_left = matrix.Transform({bbox.left, bbox.bottom});
828 const CFX_PointF bottom_right = matrix.Transform({bbox.right, bbox.bottom});
829 const CFX_PointF top_right = matrix.Transform({bbox.right, bbox.top});
830 const CFX_PointF top_left = matrix.Transform({bbox.left, bbox.top});
831
832 // See PDF 32000-1:2008, figure 64 for the QuadPoints ordering.
833 quad_points->x1 = bottom_left.x;
834 quad_points->y1 = bottom_left.y;
835 quad_points->x2 = bottom_right.x;
836 quad_points->y2 = bottom_right.y;
837 quad_points->x3 = top_right.x;
838 quad_points->y3 = top_right.y;
839 quad_points->x4 = top_left.x;
840 quad_points->y4 = top_left.y;
841 return true;
842}
843
845FPDFPageObj_SetStrokeColor(FPDF_PAGEOBJECT page_object,
846 unsigned int R,
847 unsigned int G,
848 unsigned int B,
849 unsigned int A) {
850 auto* pPageObj = CPDFPageObjectFromFPDFPageObject(page_object);
851 if (!pPageObj || R > 255 || G > 255 || B > 255 || A > 255)
852 return false;
853
854 std::vector<float> rgb = {R / 255.f, G / 255.f, B / 255.f};
856 pPageObj->mutable_color_state().SetStrokeColor(
858 std::move(rgb));
859 pPageObj->SetDirty(true);
860 return true;
861}
862
864FPDFPageObj_GetStrokeColor(FPDF_PAGEOBJECT page_object,
865 unsigned int* R,
866 unsigned int* G,
867 unsigned int* B,
868 unsigned int* A) {
869 auto* pPageObj = CPDFPageObjectFromFPDFPageObject(page_object);
870 if (!pPageObj || !R || !G || !B || !A) {
871 return false;
872 }
873 if (!pPageObj->color_state().HasRef()) {
874 return false;
875 }
876
877 FX_COLORREF stroke_color = pPageObj->color_state().GetStrokeColorRef();
878 *R = FXSYS_GetRValue(stroke_color);
879 *G = FXSYS_GetGValue(stroke_color);
880 *B = FXSYS_GetBValue(stroke_color);
882 return true;
883}
884
886FPDFPageObj_SetStrokeWidth(FPDF_PAGEOBJECT page_object, float width) {
887 auto* pPageObj = CPDFPageObjectFromFPDFPageObject(page_object);
888 if (!pPageObj || width < 0.0f)
889 return false;
890
892 pPageObj->SetDirty(true);
893 return true;
894}
895
897FPDFPageObj_GetStrokeWidth(FPDF_PAGEOBJECT page_object, float* width) {
898 auto* pPageObj = CPDFPageObjectFromFPDFPageObject(page_object);
899 if (!pPageObj || !width)
900 return false;
901
902 *width = pPageObj->graph_state().GetLineWidth();
903 return true;
904}
905
907FPDFPageObj_GetLineJoin(FPDF_PAGEOBJECT page_object) {
908 auto* pPageObj = CPDFPageObjectFromFPDFPageObject(page_object);
909 return pPageObj ? static_cast<int>(pPageObj->graph_state().GetLineJoin())
910 : -1;
911}
912
914FPDFPageObj_SetLineJoin(FPDF_PAGEOBJECT page_object, int line_join) {
915 auto* pPageObj = CPDFPageObjectFromFPDFPageObject(page_object);
916 if (!pPageObj)
917 return false;
918
919 if (line_join < FPDF_LINEJOIN_MITER || line_join > FPDF_LINEJOIN_BEVEL)
920 return false;
921
923 static_cast<CFX_GraphStateData::LineJoin>(line_join));
924 pPageObj->SetDirty(true);
925 return true;
926}
927
929FPDFPageObj_GetLineCap(FPDF_PAGEOBJECT page_object) {
930 auto* pPageObj = CPDFPageObjectFromFPDFPageObject(page_object);
931 return pPageObj ? static_cast<int>(pPageObj->graph_state().GetLineCap()) : -1;
932}
933
935FPDFPageObj_SetLineCap(FPDF_PAGEOBJECT page_object, int line_cap) {
936 auto* pPageObj = CPDFPageObjectFromFPDFPageObject(page_object);
937 if (!pPageObj)
938 return false;
939
940 if (line_cap < FPDF_LINECAP_BUTT ||
942 return false;
943 }
945 static_cast<CFX_GraphStateData::LineCap>(line_cap));
946 pPageObj->SetDirty(true);
947 return true;
948}
949
951FPDFPageObj_GetDashPhase(FPDF_PAGEOBJECT page_object, float* phase) {
952 auto* pPageObj = CPDFPageObjectFromFPDFPageObject(page_object);
953 if (!pPageObj || !phase)
954 return false;
955
956 *phase = pPageObj->graph_state().GetLineDashPhase();
957 return true;
958}
959
961FPDFPageObj_SetDashPhase(FPDF_PAGEOBJECT page_object, float phase) {
962 auto* pPageObj = CPDFPageObjectFromFPDFPageObject(page_object);
963 if (!pPageObj)
964 return false;
965
967 pPageObj->SetDirty(true);
968 return true;
969}
970
972FPDFPageObj_GetDashCount(FPDF_PAGEOBJECT page_object) {
973 auto* pPageObj = CPDFPageObjectFromFPDFPageObject(page_object);
974 return pPageObj ? pdfium::base::checked_cast<int>(
975 pPageObj->graph_state().GetLineDashSize())
976 : -1;
977}
978
980FPDFPageObj_GetDashArray(FPDF_PAGEOBJECT page_object,
981 float* dash_array,
982 size_t dash_count) {
983 auto* pPageObj = CPDFPageObjectFromFPDFPageObject(page_object);
984 if (!pPageObj || !dash_array)
985 return false;
986
987 auto dash_vector = pPageObj->graph_state().GetLineDashArray();
988 if (dash_vector.size() > dash_count)
989 return false;
990
991 FXSYS_memcpy(dash_array, dash_vector.data(),
992 dash_vector.size() * sizeof(float));
993 return true;
994}
995
997FPDFPageObj_SetDashArray(FPDF_PAGEOBJECT page_object,
998 const float* dash_array,
999 size_t dash_count,
1000 float phase) {
1001 if (dash_count > 0 && !dash_array)
1002 return false;
1003
1004 auto* pPageObj = CPDFPageObjectFromFPDFPageObject(page_object);
1005 if (!pPageObj)
1006 return false;
1007
1008 std::vector<float> dashes;
1009 if (dash_count > 0) {
1010 dashes.reserve(dash_count);
1011 dashes.assign(dash_array, dash_array + dash_count);
1012 }
1013
1014 pPageObj->mutable_graph_state().SetLineDash(dashes, phase, 1.0f);
1015
1016 pPageObj->SetDirty(true);
1017 return true;
1018}
1019
1021FPDFFormObj_CountObjects(FPDF_PAGEOBJECT form_object) {
1022 const auto* pObjectList = CPDFPageObjHolderFromFPDFFormObject(form_object);
1023 return pObjectList ? pdfium::base::checked_cast<int>(
1024 pObjectList->GetPageObjectCount())
1025 : -1;
1026}
1027
1028FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
1029FPDFFormObj_GetObject(FPDF_PAGEOBJECT form_object, unsigned long index) {
1030 const auto* pObjectList = CPDFPageObjHolderFromFPDFFormObject(form_object);
1031 if (!pObjectList)
1032 return nullptr;
1033
1034 return FPDFPageObjectFromCPDFPageObject(
1035 pObjectList->GetPageObjectByIndex(index));
1036}
constexpr CFX_FloatRect(float l, float b, float r, float t)
float GetLineDashPhase() const
void SetLineWidth(float width)
void SetLineJoin(CFX_GraphStateData::LineJoin join)
void SetLineDashPhase(float phase)
float GetLineWidth() const
CFX_GraphStateData::LineCap GetLineCap() const
CFX_GraphStateData::LineJoin GetLineJoin() const
void SetLineCap(CFX_GraphStateData::LineCap cap)
CFX_Matrix & operator=(const CFX_Matrix &other)=default
CFX_FloatRect TransformRect(const CFX_FloatRect &rect) const
CFX_Matrix(float a1, float b1, float c1, float d1, float e1, float f1)
CPDF_AnnotList(CPDF_Page *pPage)
CFX_FloatRect GetRect() const
static RetainPtr< CPDF_ColorSpace > GetStockCS(Family family)
FX_COLORREF GetStrokeColorRef() const
FX_COLORREF GetFillColorRef() const
bool HasRef() const
const ByteString & GetName() const
RetainPtr< CPDF_Dictionary > GetParam()
void SetDirectDict(RetainPtr< CPDF_Dictionary > pDict)
bool RemoveMark(CPDF_ContentMarkItem *pMarkItem)
bool ContainsItem(const CPDF_ContentMarkItem *pItem) const
void AddMark(ByteString name)
virtual void DeletePage(int page_index)=0
int GetPageCount() const
void DeletePage(int iPage)
bool MovePages(pdfium::span< const int > page_indices, int dest_page_index)
Extension * GetExtension() const
void SetFormMatrix(const CFX_Matrix &matrix)
const CPDF_Form * form() const
const CFX_Matrix & form_matrix() const
float GetStrokeAlpha() const
void SetFillAlpha(float alpha)
void SetStrokeAlpha(float alpha)
BlendMode GetBlendType() const
void SetBlendMode(const ByteString &mode)
RetainPtr< const CPDF_Dictionary > GetSoftMask() const
void SetImageMatrix(const CFX_Matrix &matrix)
const CFX_Matrix & matrix() const
const CPDF_Transparency & GetTransparency() const
virtual void Transform(const CFX_Matrix &matrix)=0
const CFX_FloatRect & GetOriginalRect() const
const CPDF_ColorState & color_state() const
void SetDirty(bool value)
const CPDF_GeneralState & general_state() const
virtual Type GetType() const =0
CPDF_GeneralState & mutable_general_state()
virtual CPDF_ShadingObject * AsShading()
const CFX_FloatRect & GetRect() const
virtual CPDF_ImageObject * AsImage()
CPDF_ContentMarks * GetContentMarks()
virtual CPDF_FormObject * AsForm()
virtual CPDF_TextObject * AsText()
virtual CPDF_PathObject * AsPath()
const CFX_GraphState & graph_state() const
virtual bool IsForm() const
CFX_GraphState & mutable_graph_state()
virtual bool IsPath() const
CPDF_ColorState & mutable_color_state()
void UpdateDimensions()
int GetPageRotation() const
void SetPathMatrix(const CFX_Matrix &matrix)
const CFX_Matrix & matrix() const
CFX_Matrix GetTextMatrix() const
void SetTextMatrix(const CFX_Matrix &matrix)
bool IsIsolated() const
static ByteString Format(const char *pFormat,...)
const char * c_str() const
Definition bytestring.h:76
ByteString & operator=(ByteString &&that) noexcept
static WideString FromUTF8(ByteStringView str)
FPDF_BOOL IsPDFSandboxPolicyEnabled(FPDF_DWORD policy)
CPDF_ContentMarkItem * CPDFContentMarkItemFromFPDFPageObjectMark(FPDF_PAGEOBJECTMARK mark)
FS_MATRIX FSMatrixFromCFXMatrix(const CFX_Matrix &matrix)
CPDF_Page * CPDFPageFromFPDFPage(FPDF_PAGE page)
CPDF_Document * CPDFDocumentFromFPDFDocument(FPDF_DOCUMENT doc)
CPDF_PageObject * CPDFPageObjectFromFPDFPageObject(FPDF_PAGEOBJECT page_object)
CFX_Matrix CFXMatrixFromFSMatrix(const FS_MATRIX &matrix)
#define FPDF_LINECAP_BUTT
Definition fpdf_edit.h:58
FPDF_EXPORT int FPDF_CALLCONV FPDFPage_GetRotation(FPDF_PAGE page)
FPDF_EXPORT int FPDF_CALLCONV FPDFFormObj_CountObjects(FPDF_PAGEOBJECT form_object)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObj_SetStrokeColor(FPDF_PAGEOBJECT page_object, unsigned int R, unsigned int G, unsigned int B, unsigned int A)
FPDF_EXPORT int FPDF_CALLCONV FPDFPageObj_GetLineCap(FPDF_PAGEOBJECT page_object)
#define FPDF_PAGEOBJ_UNKNOWN
Definition fpdf_edit.h:38
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_MovePages(FPDF_DOCUMENT document, const int *page_indices, unsigned long page_indices_len, int dest_page_index)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObjMark_GetParamKey(FPDF_PAGEOBJECTMARK mark, unsigned long index, void *buffer, unsigned long buflen, unsigned long *out_buflen)
FPDF_EXPORT int FPDF_CALLCONV FPDFPageObj_GetDashCount(FPDF_PAGEOBJECT page_object)
FPDF_EXPORT FPDF_PAGE FPDF_CALLCONV FPDFPage_New(FPDF_DOCUMENT document, int page_index, double width, double height)
FPDF_EXPORT void FPDF_CALLCONV FPDFPage_InsertObject(FPDF_PAGE page, FPDF_PAGEOBJECT page_object)
FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetRotation(FPDF_PAGE page, int rotate)
FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV FPDF_CreateNewDocument()
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObj_SetFillColor(FPDF_PAGEOBJECT page_object, unsigned int R, unsigned int G, unsigned int B, unsigned int A)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObj_GetDashPhase(FPDF_PAGEOBJECT page_object, float *phase)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_HasTransparency(FPDF_PAGE page)
#define FPDF_LINEJOIN_MITER
Definition fpdf_edit.h:62
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObj_GetRotatedBounds(FPDF_PAGEOBJECT page_object, FS_QUADPOINTSF *quad_points)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObj_GetFillColor(FPDF_PAGEOBJECT page_object, unsigned int *R, unsigned int *G, unsigned int *B, unsigned int *A)
FPDF_EXPORT int FPDF_CALLCONV FPDFPageObjMark_CountParams(FPDF_PAGEOBJECTMARK mark)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObj_RemoveMark(FPDF_PAGEOBJECT page_object, FPDF_PAGEOBJECTMARK mark)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObjMark_SetIntParam(FPDF_DOCUMENT document, FPDF_PAGEOBJECT page_object, FPDF_PAGEOBJECTMARK mark, FPDF_BYTESTRING key, int value)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObjMark_GetParamStringValue(FPDF_PAGEOBJECTMARK mark, FPDF_BYTESTRING key, void *buffer, unsigned long buflen, unsigned long *out_buflen)
FPDF_EXPORT int FPDF_CALLCONV FPDFPageObj_CountMarks(FPDF_PAGEOBJECT page_object)
#define FPDF_LINECAP_PROJECTING_SQUARE
Definition fpdf_edit.h:60
FPDF_EXPORT void FPDF_CALLCONV FPDFPage_TransformAnnots(FPDF_PAGE page, double a, double b, double c, double d, double e, double f)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_RemoveObject(FPDF_PAGE page, FPDF_PAGEOBJECT page_object)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObjMark_GetParamBlobValue(FPDF_PAGEOBJECTMARK mark, FPDF_BYTESTRING key, void *buffer, unsigned long buflen, unsigned long *out_buflen)
FPDF_EXPORT int FPDF_CALLCONV FPDFPageObj_GetLineJoin(FPDF_PAGEOBJECT page_object)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObjMark_RemoveParam(FPDF_PAGEOBJECT page_object, FPDF_PAGEOBJECTMARK mark, FPDF_BYTESTRING key)
FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV FPDFPage_GetObject(FPDF_PAGE page, int index)
FPDF_EXPORT FPDF_OBJECT_TYPE FPDF_CALLCONV FPDFPageObjMark_GetParamValueType(FPDF_PAGEOBJECTMARK mark, FPDF_BYTESTRING key)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObjMark_GetParamIntValue(FPDF_PAGEOBJECTMARK mark, FPDF_BYTESTRING key, int *out_value)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObj_SetLineJoin(FPDF_PAGEOBJECT page_object, int line_join)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObj_SetLineCap(FPDF_PAGEOBJECT page_object, int line_cap)
FPDF_EXPORT int FPDF_CALLCONV FPDFPageObj_GetType(FPDF_PAGEOBJECT page_object)
#define FPDF_PAGEOBJ_PATH
Definition fpdf_edit.h:40
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObjMark_SetStringParam(FPDF_DOCUMENT document, FPDF_PAGEOBJECT page_object, FPDF_PAGEOBJECTMARK mark, FPDF_BYTESTRING key, FPDF_BYTESTRING value)
#define FPDF_PAGEOBJ_TEXT
Definition fpdf_edit.h:39
#define FPDF_PAGEOBJ_SHADING
Definition fpdf_edit.h:42
#define FPDF_PAGEOBJ_IMAGE
Definition fpdf_edit.h:41
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObjMark_SetBlobParam(FPDF_DOCUMENT document, FPDF_PAGEOBJECT page_object, FPDF_PAGEOBJECTMARK mark, FPDF_BYTESTRING key, void *value, unsigned long value_len)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObj_GetBounds(FPDF_PAGEOBJECT page_object, float *left, float *bottom, float *right, float *top)
FPDF_EXPORT FPDF_PAGEOBJECTMARK FPDF_CALLCONV FPDFPageObj_GetMark(FPDF_PAGEOBJECT page_object, unsigned long index)
FPDF_EXPORT void FPDF_CALLCONV FPDFPage_Delete(FPDF_DOCUMENT document, int page_index)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObj_GetStrokeWidth(FPDF_PAGEOBJECT page_object, float *width)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObj_SetMatrix(FPDF_PAGEOBJECT page_object, const FS_MATRIX *matrix)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObj_SetDashPhase(FPDF_PAGEOBJECT page_object, float phase)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObj_SetStrokeWidth(FPDF_PAGEOBJECT page_object, float width)
#define FPDF_LINEJOIN_BEVEL
Definition fpdf_edit.h:64
#define FPDF_PAGEOBJ_FORM
Definition fpdf_edit.h:43
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT page_object)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GenerateContent(FPDF_PAGE page)
FPDF_EXPORT int FPDF_CALLCONV FPDFPage_CountObjects(FPDF_PAGE page)
FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV FPDFFormObj_GetObject(FPDF_PAGEOBJECT form_object, unsigned long index)
FPDF_EXPORT FPDF_PAGEOBJECTMARK FPDF_CALLCONV FPDFPageObj_AddMark(FPDF_PAGEOBJECT page_object, FPDF_BYTESTRING name)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObjMark_GetName(FPDF_PAGEOBJECTMARK mark, void *buffer, unsigned long buflen, unsigned long *out_buflen)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObj_GetMatrix(FPDF_PAGEOBJECT page_object, FS_MATRIX *matrix)
FPDF_EXPORT void FPDF_CALLCONV FPDFPageObj_SetBlendMode(FPDF_PAGEOBJECT page_object, FPDF_BYTESTRING blend_mode)
FPDF_EXPORT void FPDF_CALLCONV FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object, double a, double b, double c, double d, double e, double f)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObj_GetStrokeColor(FPDF_PAGEOBJECT page_object, unsigned int *R, unsigned int *G, unsigned int *B, unsigned int *A)
FPDF_EXPORT void FPDF_CALLCONV FPDFPageObj_Destroy(FPDF_PAGEOBJECT page_object)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObj_SetDashArray(FPDF_PAGEOBJECT page_object, const float *dash_array, size_t dash_count, float phase)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObj_GetDashArray(FPDF_PAGEOBJECT page_object, float *dash_array, size_t dash_count)
#define FPDF_CALLCONV
Definition fpdfview.h:227
#define FPDF_EXPORT
Definition fpdfview.h:221
#define FPDF_POLICY_MACHINETIME_ACCESS
Definition fpdfview.h:325
#define FPDF_OBJECT_UNKNOWN
Definition fpdfview.h:36
BlendMode
Definition fx_dib.h:49
constexpr uint8_t FXSYS_GetRValue(uint32_t bgr)
Definition fx_dib.h:73
constexpr unsigned int FXSYS_GetUnsignedAlpha(float alpha)
Definition fx_dib.h:85
constexpr uint8_t FXSYS_GetGValue(uint32_t bgr)
Definition fx_dib.h:77
constexpr uint8_t FXSYS_GetBValue(uint32_t bgr)
Definition fx_dib.h:81
time_t FXSYS_time(time_t *tloc)
struct tm * FXSYS_localtime(const time_t *tp)
const char kResources[]
const char kMediaBox[]
const char kRotate[]