OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_PAGEOBJ_H_ | 7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_PAGEOBJ_H_ |
8 #define CORE_INCLUDE_FPDFAPI_FPDF_PAGEOBJ_H_ | 8 #define CORE_INCLUDE_FPDFAPI_FPDF_PAGEOBJ_H_ |
9 | 9 |
10 #include "core/include/fxge/fx_ge.h" | 10 #include "core/include/fxge/fx_ge.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 FX_PATHPOINT* GetPoints() { return m_pObject->m_pPoints; } | 46 FX_PATHPOINT* GetPoints() { return m_pObject->m_pPoints; } |
47 | 47 |
48 CFX_FloatRect GetBoundingBox() const { return m_pObject->GetBoundingBox(); } | 48 CFX_FloatRect GetBoundingBox() const { return m_pObject->GetBoundingBox(); } |
49 | 49 |
50 CFX_FloatRect GetBoundingBox(FX_FLOAT line_width, | 50 CFX_FloatRect GetBoundingBox(FX_FLOAT line_width, |
51 FX_FLOAT miter_limit) const { | 51 FX_FLOAT miter_limit) const { |
52 return m_pObject->GetBoundingBox(line_width, miter_limit); | 52 return m_pObject->GetBoundingBox(line_width, miter_limit); |
53 } | 53 } |
54 | 54 |
55 void Transform(const CFX_AffineMatrix* pMatrix) { | 55 void Transform(const CFX_Matrix* pMatrix) { GetModify()->Transform(pMatrix); } |
56 GetModify()->Transform(pMatrix); | |
57 } | |
58 | 56 |
59 void Append(CPDF_Path src, const CFX_AffineMatrix* pMatrix) { | 57 void Append(CPDF_Path src, const CFX_Matrix* pMatrix) { |
60 m_pObject->Append(src.m_pObject, pMatrix); | 58 m_pObject->Append(src.m_pObject, pMatrix); |
61 } | 59 } |
62 | 60 |
63 void AppendRect(FX_FLOAT left, | 61 void AppendRect(FX_FLOAT left, |
64 FX_FLOAT bottom, | 62 FX_FLOAT bottom, |
65 FX_FLOAT right, | 63 FX_FLOAT right, |
66 FX_FLOAT top) { | 64 FX_FLOAT top) { |
67 m_pObject->AppendRect(left, bottom, right, top); | 65 m_pObject->AppendRect(left, bottom, right, top); |
68 } | 66 } |
69 | 67 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 CPDF_TextObject* GetText(int i) const { return m_pObject->m_pTextList[i]; } | 100 CPDF_TextObject* GetText(int i) const { return m_pObject->m_pTextList[i]; } |
103 | 101 |
104 CFX_FloatRect GetClipBox() const; | 102 CFX_FloatRect GetClipBox() const; |
105 | 103 |
106 void AppendPath(CPDF_Path path, int type, FX_BOOL bAutoMerge); | 104 void AppendPath(CPDF_Path path, int type, FX_BOOL bAutoMerge); |
107 | 105 |
108 void DeletePath(int layer_index); | 106 void DeletePath(int layer_index); |
109 | 107 |
110 void AppendTexts(CPDF_TextObject** pTexts, int count); | 108 void AppendTexts(CPDF_TextObject** pTexts, int count); |
111 | 109 |
112 void Transform(const CFX_AffineMatrix& matrix); | 110 void Transform(const CFX_Matrix& matrix); |
113 }; | 111 }; |
114 class CPDF_ColorStateData { | 112 class CPDF_ColorStateData { |
115 public: | 113 public: |
116 CPDF_ColorStateData() : m_FillRGB(0), m_StrokeRGB(0) {} | 114 CPDF_ColorStateData() : m_FillRGB(0), m_StrokeRGB(0) {} |
117 | 115 |
118 CPDF_ColorStateData(const CPDF_ColorStateData& src); | 116 CPDF_ColorStateData(const CPDF_ColorStateData& src); |
119 | 117 |
120 void Default(); | 118 void Default(); |
121 | 119 |
122 CPDF_Color m_FillColor; | 120 CPDF_Color m_FillColor; |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 | 353 |
356 class CPDF_PageObject : public CPDF_GraphicStates { | 354 class CPDF_PageObject : public CPDF_GraphicStates { |
357 public: | 355 public: |
358 static CPDF_PageObject* Create(int type); | 356 static CPDF_PageObject* Create(int type); |
359 virtual ~CPDF_PageObject(); | 357 virtual ~CPDF_PageObject(); |
360 | 358 |
361 CPDF_PageObject* Clone() const; | 359 CPDF_PageObject* Clone() const; |
362 | 360 |
363 void Copy(const CPDF_PageObject* pSrcObject); | 361 void Copy(const CPDF_PageObject* pSrcObject); |
364 | 362 |
365 virtual void Transform(const CFX_AffineMatrix& matrix) = 0; | 363 virtual void Transform(const CFX_Matrix& matrix) = 0; |
366 | 364 |
367 void RemoveClipPath(); | 365 void RemoveClipPath(); |
368 | 366 |
369 void AppendClipPath(CPDF_Path path, int type, FX_BOOL bAutoMerge); | 367 void AppendClipPath(CPDF_Path path, int type, FX_BOOL bAutoMerge); |
370 | 368 |
371 void CopyClipPath(CPDF_PageObject* pObj); | 369 void CopyClipPath(CPDF_PageObject* pObj); |
372 | 370 |
373 void TransformClipPath(CFX_AffineMatrix& matrix); | 371 void TransformClipPath(CFX_Matrix& matrix); |
374 | 372 |
375 void TransformGeneralState(CFX_AffineMatrix& matrix); | 373 void TransformGeneralState(CFX_Matrix& matrix); |
376 | 374 |
377 void SetColorState(CPDF_ColorState state) { m_ColorState = state; } | 375 void SetColorState(CPDF_ColorState state) { m_ColorState = state; } |
378 | 376 |
379 FX_RECT GetBBox(const CFX_AffineMatrix* pMatrix) const; | 377 FX_RECT GetBBox(const CFX_Matrix* pMatrix) const; |
380 | 378 |
381 int m_Type; | 379 int m_Type; |
382 | 380 |
383 FX_FLOAT m_Left; | 381 FX_FLOAT m_Left; |
384 | 382 |
385 FX_FLOAT m_Right; | 383 FX_FLOAT m_Right; |
386 | 384 |
387 FX_FLOAT m_Top; | 385 FX_FLOAT m_Top; |
388 | 386 |
389 FX_FLOAT m_Bottom; | 387 FX_FLOAT m_Bottom; |
(...skipping 30 matching lines...) Expand all Loading... |
420 | 418 |
421 void GetCharRect(int index, CFX_FloatRect& rect) const; | 419 void GetCharRect(int index, CFX_FloatRect& rect) const; |
422 | 420 |
423 FX_FLOAT GetCharWidth(FX_DWORD charcode) const; | 421 FX_FLOAT GetCharWidth(FX_DWORD charcode) const; |
424 FX_FLOAT GetSpaceCharWidth() const; | 422 FX_FLOAT GetSpaceCharWidth() const; |
425 | 423 |
426 FX_FLOAT GetPosX() const { return m_PosX; } | 424 FX_FLOAT GetPosX() const { return m_PosX; } |
427 | 425 |
428 FX_FLOAT GetPosY() const { return m_PosY; } | 426 FX_FLOAT GetPosY() const { return m_PosY; } |
429 | 427 |
430 void GetTextMatrix(CFX_AffineMatrix* pMatrix) const; | 428 void GetTextMatrix(CFX_Matrix* pMatrix) const; |
431 | 429 |
432 CPDF_Font* GetFont() const { return m_TextState.GetFont(); } | 430 CPDF_Font* GetFont() const { return m_TextState.GetFont(); } |
433 | 431 |
434 FX_FLOAT GetFontSize() const { return m_TextState.GetFontSize(); } | 432 FX_FLOAT GetFontSize() const { return m_TextState.GetFontSize(); } |
435 | 433 |
436 void SetEmpty(); | 434 void SetEmpty(); |
437 | 435 |
438 void SetText(const CFX_ByteString& text); | 436 void SetText(const CFX_ByteString& text); |
439 | 437 |
440 void SetText(CFX_ByteString* pStrs, FX_FLOAT* pKerning, int nSegs); | 438 void SetText(CFX_ByteString* pStrs, FX_FLOAT* pKerning, int nSegs); |
441 | 439 |
442 void SetText(int nChars, FX_DWORD* pCharCodes, FX_FLOAT* pKernings); | 440 void SetText(int nChars, FX_DWORD* pCharCodes, FX_FLOAT* pKernings); |
443 | 441 |
444 void SetPosition(FX_FLOAT x, FX_FLOAT y); | 442 void SetPosition(FX_FLOAT x, FX_FLOAT y); |
445 | 443 |
446 void SetTextState(CPDF_TextState TextState); | 444 void SetTextState(CPDF_TextState TextState); |
447 | 445 |
448 // CPDF_PageObject: | 446 // CPDF_PageObject: |
449 void Transform(const CFX_AffineMatrix& matrix) override; | 447 void Transform(const CFX_Matrix& matrix) override; |
450 | 448 |
451 void CalcCharPos(FX_FLOAT* pPosArray) const; | 449 void CalcCharPos(FX_FLOAT* pPosArray) const; |
452 | 450 |
453 void SetData(int nChars, | 451 void SetData(int nChars, |
454 FX_DWORD* pCharCodes, | 452 FX_DWORD* pCharCodes, |
455 FX_FLOAT* pCharPos, | 453 FX_FLOAT* pCharPos, |
456 FX_FLOAT x, | 454 FX_FLOAT x, |
457 FX_FLOAT y); | 455 FX_FLOAT y); |
458 | 456 |
459 void GetData(int& nChars, FX_DWORD*& pCharCodes, FX_FLOAT*& pCharPos) { | 457 void GetData(int& nChars, FX_DWORD*& pCharCodes, FX_FLOAT*& pCharPos) { |
(...skipping 28 matching lines...) Expand all Loading... |
488 FX_DWORD* m_pCharCodes; | 486 FX_DWORD* m_pCharCodes; |
489 | 487 |
490 FX_FLOAT* m_pCharPos; | 488 FX_FLOAT* m_pCharPos; |
491 }; | 489 }; |
492 | 490 |
493 class CPDF_PathObject : public CPDF_PageObject { | 491 class CPDF_PathObject : public CPDF_PageObject { |
494 public: | 492 public: |
495 CPDF_PathObject() { m_Type = PDFPAGE_PATH; } | 493 CPDF_PathObject() { m_Type = PDFPAGE_PATH; } |
496 ~CPDF_PathObject() override {} | 494 ~CPDF_PathObject() override {} |
497 | 495 |
498 void Transform(const CFX_AffineMatrix& maxtrix) override; | 496 void Transform(const CFX_Matrix& maxtrix) override; |
499 | 497 |
500 void SetGraphState(CPDF_GraphState GraphState); | 498 void SetGraphState(CPDF_GraphState GraphState); |
501 | 499 |
502 void CalcBoundingBox(); | 500 void CalcBoundingBox(); |
503 | 501 |
504 CPDF_Path m_Path; | 502 CPDF_Path m_Path; |
505 | 503 |
506 int m_FillType; | 504 int m_FillType; |
507 | 505 |
508 FX_BOOL m_bStroke; | 506 FX_BOOL m_bStroke; |
509 | 507 |
510 CFX_AffineMatrix m_Matrix; | 508 CFX_Matrix m_Matrix; |
511 | 509 |
512 protected: | 510 protected: |
513 void CopyData(const CPDF_PageObject* pSrcObject) override; | 511 void CopyData(const CPDF_PageObject* pSrcObject) override; |
514 }; | 512 }; |
515 | 513 |
516 class CPDF_ImageObject : public CPDF_PageObject { | 514 class CPDF_ImageObject : public CPDF_PageObject { |
517 public: | 515 public: |
518 CPDF_ImageObject(); | 516 CPDF_ImageObject(); |
519 ~CPDF_ImageObject() override; | 517 ~CPDF_ImageObject() override; |
520 | 518 |
521 void Transform(const CFX_AffineMatrix& matrix) override; | 519 void Transform(const CFX_Matrix& matrix) override; |
522 | 520 |
523 CPDF_Image* m_pImage; | 521 CPDF_Image* m_pImage; |
524 | 522 |
525 CFX_AffineMatrix m_Matrix; | 523 CFX_Matrix m_Matrix; |
526 | 524 |
527 void CalcBoundingBox(); | 525 void CalcBoundingBox(); |
528 | 526 |
529 private: | 527 private: |
530 void CopyData(const CPDF_PageObject* pSrcObject) override; | 528 void CopyData(const CPDF_PageObject* pSrcObject) override; |
531 }; | 529 }; |
532 | 530 |
533 class CPDF_ShadingObject : public CPDF_PageObject { | 531 class CPDF_ShadingObject : public CPDF_PageObject { |
534 public: | 532 public: |
535 CPDF_ShadingObject(); | 533 CPDF_ShadingObject(); |
536 ~CPDF_ShadingObject() override; | 534 ~CPDF_ShadingObject() override; |
537 | 535 |
538 CPDF_ShadingPattern* m_pShading; | 536 CPDF_ShadingPattern* m_pShading; |
539 | 537 |
540 CFX_AffineMatrix m_Matrix; | 538 CFX_Matrix m_Matrix; |
541 | 539 |
542 void Transform(const CFX_AffineMatrix& matrix) override; | 540 void Transform(const CFX_Matrix& matrix) override; |
543 | 541 |
544 void CalcBoundingBox(); | 542 void CalcBoundingBox(); |
545 | 543 |
546 protected: | 544 protected: |
547 void CopyData(const CPDF_PageObject* pSrcObject) override; | 545 void CopyData(const CPDF_PageObject* pSrcObject) override; |
548 }; | 546 }; |
549 | 547 |
550 class CPDF_FormObject : public CPDF_PageObject { | 548 class CPDF_FormObject : public CPDF_PageObject { |
551 public: | 549 public: |
552 CPDF_FormObject() { | 550 CPDF_FormObject() { |
553 m_Type = PDFPAGE_FORM; | 551 m_Type = PDFPAGE_FORM; |
554 m_pForm = NULL; | 552 m_pForm = NULL; |
555 } | 553 } |
556 ~CPDF_FormObject() override; | 554 ~CPDF_FormObject() override; |
557 | 555 |
558 void Transform(const CFX_AffineMatrix& matrix) override; | 556 void Transform(const CFX_Matrix& matrix) override; |
559 | 557 |
560 CPDF_Form* m_pForm; | 558 CPDF_Form* m_pForm; |
561 | 559 |
562 CFX_AffineMatrix m_FormMatrix; | 560 CFX_Matrix m_FormMatrix; |
563 | 561 |
564 void CalcBoundingBox(); | 562 void CalcBoundingBox(); |
565 | 563 |
566 protected: | 564 protected: |
567 void CopyData(const CPDF_PageObject* pSrcObject) override; | 565 void CopyData(const CPDF_PageObject* pSrcObject) override; |
568 }; | 566 }; |
569 | 567 |
570 #endif // CORE_INCLUDE_FPDFAPI_FPDF_PAGEOBJ_H_ | 568 #endif // CORE_INCLUDE_FPDFAPI_FPDF_PAGEOBJ_H_ |
OLD | NEW |