From 72a445fb5485e22cb603fd9447c70d7156bacdf6 Mon Sep 17 00:00:00 2001 From: Svetlana Kulikova Date: Mon, 4 Aug 2025 18:13:44 +0300 Subject: [PATCH] Create Redact annotation --- .../graphics/commands/AnnotField.cpp | 15 +++ DesktopEditor/graphics/commands/AnnotField.h | 5 + PdfFile/PdfEditor.cpp | 23 ++++ PdfFile/PdfFile.pro | 12 +-- PdfFile/SrcWriter/Annotation.cpp | 29 +++-- PdfFile/SrcWriter/Field.h | 36 ++++--- PdfFile/SrcWriter/Objects.cpp | 2 +- PdfFile/SrcWriter/Pages.cpp | 96 +++++++++++++++-- PdfFile/SrcWriter/Pages.h | 7 ++ .../RedactOutputDev.cpp | 100 +++++++++++++++--- .../RedactOutputDev.h | 63 ++++++----- PdfFile/SrcWriter/Types.h | 7 ++ 12 files changed, 306 insertions(+), 89 deletions(-) rename PdfFile/{SrcReader => SrcWriter}/RedactOutputDev.cpp (64%) rename PdfFile/{SrcReader => SrcWriter}/RedactOutputDev.h (78%) diff --git a/DesktopEditor/graphics/commands/AnnotField.cpp b/DesktopEditor/graphics/commands/AnnotField.cpp index bff28838e8..45a83544e6 100644 --- a/DesktopEditor/graphics/commands/AnnotField.cpp +++ b/DesktopEditor/graphics/commands/AnnotField.cpp @@ -1222,3 +1222,18 @@ bool CWidgetsInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafil return true; } + +CRedact::CRedact() : IAdvancedCommand(AdvancedCommandType::Redact) {} +CRedact::~CRedact() {} +const std::vector& CRedact::GetQuadPoints() { return m_arrQuadPoints; } +bool CRedact::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafileToRenderter* pCorrector) +{ + int n = pReader->ReadInt(); + m_arrQuadPoints.reserve(n); + for (int i = 0; i < n; ++i) + { + for (int j = 0; j < 8; ++j) + m_arrQuadPoints.push_back(pReader->ReadDouble()); + } + return true; +} diff --git a/DesktopEditor/graphics/commands/AnnotField.h b/DesktopEditor/graphics/commands/AnnotField.h index 10e741b576..2df75c1461 100644 --- a/DesktopEditor/graphics/commands/AnnotField.h +++ b/DesktopEditor/graphics/commands/AnnotField.h @@ -637,7 +637,12 @@ public: CRedact(); virtual ~CRedact(); + const std::vector& GetQuadPoints(); + bool Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafileToRenderter* pCorrector); + +private: + std::vector m_arrQuadPoints; }; #endif // _BUILD_ANNOTFIELD_H_ diff --git a/PdfFile/PdfEditor.cpp b/PdfFile/PdfEditor.cpp index e51b2b020d..0053a06807 100644 --- a/PdfFile/PdfEditor.cpp +++ b/PdfFile/PdfEditor.cpp @@ -50,6 +50,7 @@ #include "SrcWriter/Streams.h" #include "SrcWriter/Destination.h" #include "SrcWriter/Outline.h" +#include "SrcWriter/RedactOutputDev.h" #define AddToObject(oVal)\ {\ @@ -212,6 +213,8 @@ PdfWriter::CAnnotation* CreateAnnot(Object* oAnnot, Object* oType, PdfWriter::CX pAnnot = new PdfWriter::CCaretAnnotation(pXref); else if (oType->isName("Stamp")) pAnnot = new PdfWriter::CStampAnnotation(pXref); + else if (oType->isName("Redact")) + pAnnot = new PdfWriter::CRedactAnnotation(pXref); else if (oType->isName("Popup")) pAnnot = new PdfWriter::CPopupAnnotation(pXref); else if (oType->isName("Widget")) @@ -2826,6 +2829,8 @@ bool CPdfEditor::EditAnnot(int _nPageIndex, int nID) pAnnot = new PdfWriter::CCaretAnnotation(pXref); else if (oType.isName("Stamp")) pAnnot = new PdfWriter::CStampAnnotation(pXref); + else if (oType.isName("Redact")) + pAnnot = new PdfWriter::CRedactAnnotation(pXref); else if (oType.isName("Popup")) pAnnot = new PdfWriter::CPopupAnnotation(pXref); else if (oType.isName("Widget")) @@ -3503,5 +3508,23 @@ bool CPdfEditor::IsBase14(const std::wstring& wsFontName, bool& bBold, bool& bIt } void CPdfEditor::Redact(CRedact* pCommand) { + PdfWriter::CDocument* pDoc = m_pWriter->GetDocument(); + int nOriginIndex = m_nEditPage; + if (m_nMode == Mode::WriteNew) + { + PdfWriter::CPageTree* pPageTree = pDoc->GetPageTree(); + PdfWriter::CObjectBase* pObj = pPageTree->GetObj(m_nEditPage); + PdfWriter::CFakePage* pFakePage = NULL; + if (pObj) + pFakePage = dynamic_cast(pObj); + if (pFakePage) + nOriginIndex = pFakePage->GetOriginIndex(); + } + PDFDoc* pPDFDocument = NULL; + int nPageIndex = m_pReader->GetPageIndex(nOriginIndex, &pPDFDocument); + if (nPageIndex < 0 || !pPDFDocument) + return; + PdfWriter::RedactOutputDev oRedactOut(m_pWriter); + pPDFDocument->displayPage(&oRedactOut, nPageIndex, 72.0, 72.0, 0, gTrue, gFalse, gFalse); } diff --git a/PdfFile/PdfFile.pro b/PdfFile/PdfFile.pro index a0b0ce3e23..e9dcc4ee0d 100644 --- a/PdfFile/PdfFile.pro +++ b/PdfFile/PdfFile.pro @@ -57,15 +57,13 @@ SOURCES -= \ lib/xpdf/pdfinfo.cc SOURCES += \ - SrcReader/RendererOutputDev.cpp \ - SrcReader/RedactOutputDev.cpp \ + SrcReader/RendererOutputDev.cpp \ SrcReader/Adaptors.cpp \ SrcReader/PdfAnnot.cpp \ SrcReader/GfxClip.cpp HEADERS += \ - SrcReader/RendererOutputDev.h \ - SrcReader/RedactOutputDev.h \ + SrcReader/RendererOutputDev.h \ SrcReader/Adaptors.h \ SrcReader/MemoryUtils.h \ SrcReader/PdfAnnot.h \ @@ -163,7 +161,8 @@ HEADERS += \ SrcWriter/Utils.h \ SrcWriter/Metadata.h \ SrcWriter/ICCProfile.h \ - SrcWriter/States.h + SrcWriter/States.h \ + SrcWriter/RedactOutputDev.h SOURCES += \ SrcWriter/AcroForm.cpp \ @@ -192,7 +191,8 @@ SOURCES += \ SrcWriter/Streams.cpp \ SrcWriter/Utils.cpp \ SrcWriter/Metadata.cpp \ - SrcWriter/States.cpp + SrcWriter/States.cpp \ + SrcWriter/RedactOutputDev.cpp # PdfFile diff --git a/PdfFile/SrcWriter/Annotation.cpp b/PdfFile/SrcWriter/Annotation.cpp index cfbd7c4fd9..a9478faaa6 100644 --- a/PdfFile/SrcWriter/Annotation.cpp +++ b/PdfFile/SrcWriter/Annotation.cpp @@ -49,23 +49,30 @@ namespace PdfWriter { "Text", "Link", - "Sound", "FreeText", - "Stamp", + "Line", "Square", "Circle", - "StrikeOut", - "Highlight", - "Underline", - "Ink", - "FileAttachment", - "Popup", - "Line", - "Squiggly", "Polygon", "PolyLine", + "Highlight", + "Underline", + "Squiggly", + "StrikeOut", + "Stamp", "Caret", - "Widget" + "Ink", + "Popup", + "FileAttachment", + "Sound", + "Movie", + "Widget", + "Screen", + "PrinterMark", + "TrapNet", + "Watermark", + "3D", + "Redact" }; const static char* c_sAnnotIconNames[] = { diff --git a/PdfFile/SrcWriter/Field.h b/PdfFile/SrcWriter/Field.h index d0f04a61d4..0f67003f7f 100644 --- a/PdfFile/SrcWriter/Field.h +++ b/PdfFile/SrcWriter/Field.h @@ -63,23 +63,29 @@ namespace PdfWriter AnnotUnknown = -1, AnnotText = 0, AnnotLink = 1, - AnnotSound = 2, - AnnotFreeText = 3, - AnnotStamp = 4, - AnnotSquare = 5, - AnnotCircle = 6, - AnnotStrikeOut = 7, + AnnotFreeText = 2, + AnnotLine = 3, + AnnotSquare = 4, + AnnotCircle = 5, + AnnotPolygon = 6, + AnnotPolyLine = 7, AnnotHighLight = 8, AnnotUnderline = 9, - AnnotInk = 10, - AnnotFileAttachment = 11, - AnnotPopup = 12, - AnnotLine = 13, - AnnotSquiggly = 14, - AnnotPolygon = 15, - AnnotPolyLine = 16, - AnnotCaret = 17, - AnnotWidget = 18, + AnnotSquiggly = 10, + AnnotStrikeOut = 11, + AnnotStamp = 12, + AnnotCaret = 13, + AnnotInk = 14, + AnnotPopup = 15, + AnnotFileAttachment = 16, + AnnotSound = 17, + AnnotMovie = 18, + AnnotWidget = 19, + AnnotScreen = 20, + AnnotPrinterMark = 21, + AnnotTrapNet = 22, + AnnotWatermark = 23, + Annot3D = 24, AnnotRedact = 25 }; enum EWidgetType diff --git a/PdfFile/SrcWriter/Objects.cpp b/PdfFile/SrcWriter/Objects.cpp index 111ae1f84c..1016626ebe 100644 --- a/PdfFile/SrcWriter/Objects.cpp +++ b/PdfFile/SrcWriter/Objects.cpp @@ -52,7 +52,7 @@ if (pObject && !pObject->IsIndirect())\ delete pObject;\ -static const BYTE UNICODE_HEADER[] ={ 0xFE, 0xFF }; +static const BYTE UNICODE_HEADER[] = { 0xFE, 0xFF }; namespace PdfWriter { diff --git a/PdfFile/SrcWriter/Pages.cpp b/PdfFile/SrcWriter/Pages.cpp index b54478f738..5bd64b66b3 100644 --- a/PdfFile/SrcWriter/Pages.cpp +++ b/PdfFile/SrcWriter/Pages.cpp @@ -58,6 +58,13 @@ namespace PdfWriter { static const double c_dKappa = 0.552; + const static char* c_sRenderingIntent[] = + { + "AbsoluteColorimetric", + "RelativeColorimetric", + "Saturation", + "Perceptual" + }; static void QuarterEllipseA(CStream* pStream, double dX, double dY, double dXRad, double dYRad) { pStream->WriteReal(dX - dXRad); @@ -1014,12 +1021,7 @@ namespace PdfWriter double dG = unG / 255.0; double dB = unB / 255.0; - m_pStream->WriteReal(dR); - m_pStream->WriteChar(' '); - m_pStream->WriteReal(dG); - m_pStream->WriteChar(' '); - m_pStream->WriteReal(dB); - m_pStream->WriteStr(" RG\012"); + SetStrokeRGB(dR, dG, dB); m_pGrState->m_oStrokeColor.r = dR; m_pGrState->m_oStrokeColor.g = dG; @@ -1035,18 +1037,81 @@ namespace PdfWriter double dG = unG / 255.0; double dB = unB / 255.0; + SetFillRGB(dR, dG, dB); + + m_pGrState->m_oFillColor.r = dR; + m_pGrState->m_oFillColor.g = dG; + m_pGrState->m_oFillColor.b = dB; + } + void CPage::SetStrokeG(double dG) + { + // Operator : G + // Description: Заливка в DeviceG + + m_pStream->WriteReal(dG); + m_pStream->WriteStr(" G\012"); + } + void CPage::SetStrokeRGB(double dR, double dG, double dB) + { + // Operator : RG + // Description: Обводка в DeviceRGB + + m_pStream->WriteReal(dR); + m_pStream->WriteChar(' '); + m_pStream->WriteReal(dG); + m_pStream->WriteChar(' '); + m_pStream->WriteReal(dB); + m_pStream->WriteStr(" RG\012"); + } + void CPage::SetStrokeCMYK(double dC, double dM, double dY, double dK) + { + // Operator : K + // Description: Обводка в DeviceCMYK + + m_pStream->WriteReal(dC); + m_pStream->WriteChar(' '); + m_pStream->WriteReal(dM); + m_pStream->WriteChar(' '); + m_pStream->WriteReal(dY); + m_pStream->WriteChar(' '); + m_pStream->WriteReal(dK); + m_pStream->WriteStr(" K\012"); + } + void CPage::SetFillG(double dG) + { + // Operator : g + // Description: Заливка в DeviceG + + m_pStream->WriteReal(dG); + m_pStream->WriteStr(" g\012"); + } + void CPage::SetFillRGB(double dR, double dG, double dB) + { + // Operator : rg + // Description: Заливка в DeviceRGB + m_pStream->WriteReal(dR); m_pStream->WriteChar(' '); m_pStream->WriteReal(dG); m_pStream->WriteChar(' '); m_pStream->WriteReal(dB); m_pStream->WriteStr(" rg\012"); - - m_pGrState->m_oFillColor.r = dR; - m_pGrState->m_oFillColor.g = dG; - m_pGrState->m_oFillColor.b = dB; } - void CPage::Concat(double dM11, double dM12, double dM21, double dM22, double dX, double dY) + void CPage::SetFillCMYK(double dC, double dM, double dY, double dK) + { + // Operator : k + // Description: Заливка в DeviceCMYK + + m_pStream->WriteReal(dC); + m_pStream->WriteChar(' '); + m_pStream->WriteReal(dM); + m_pStream->WriteChar(' '); + m_pStream->WriteReal(dY); + m_pStream->WriteChar(' '); + m_pStream->WriteReal(dK); + m_pStream->WriteStr(" k\012"); + } + void CPage::Concat(double dM11, double dM12, double dM21, double dM22, double dX, double dY) { // Operator : cm // Description: меняем матрицу преобразований (CTM - Current Transformation Matrix) @@ -1594,6 +1659,15 @@ namespace PdfWriter m_pStream->WriteStr("EMC\012"); } + void CPage::SetRenderingIntent(ERenderingIntent eRenderingIntent) + { + // Operator : ri + // Description: Способы рендеринга/цветопередачи + + m_pStream->WriteStr("ri "); + m_pStream->WriteEscapeName(c_sRenderingIntent[(int)eRenderingIntent]); + m_pStream->WriteStr("\012"); + } CFakePage::CFakePage(int nOriginIndex) : m_nOriginIndex(nOriginIndex) { diff --git a/PdfFile/SrcWriter/Pages.h b/PdfFile/SrcWriter/Pages.h index 4be6400b78..7abd5d8008 100644 --- a/PdfFile/SrcWriter/Pages.h +++ b/PdfFile/SrcWriter/Pages.h @@ -142,7 +142,13 @@ namespace PdfWriter void GrSave(); void GrRestore(); void SetStrokeColor(unsigned char unR, unsigned char unG, unsigned char unB); + void SetStrokeG(double dG); + void SetStrokeRGB(double dR, double dG, double dB); + void SetStrokeCMYK(double dC, double dM, double dY, double dK); void SetFillColor(unsigned char unR, unsigned char unG, unsigned char unB); + void SetFillG(double dG); + void SetFillRGB(double dR, double dG, double dB); + void SetFillCMYK(double dC, double dM, double dY, double dK); void Concat(double dM11, double dM12, double dM21, double dM22, double dX, double dY); void StartTransform(double dM11, double dM12, double dM21, double dM22, double dX, double dY); void SetTransform(double dM11, double dM12, double dM21, double dM22, double dX, double dY); @@ -155,6 +161,7 @@ namespace PdfWriter void BeginMarkedContent(const std::string& sName); void BeginMarkedContentDict(const std::string& sName, CDictObject* pBDC); void EndMarkedContent(); + void SetRenderingIntent(ERenderingIntent eRenderingIntent); void BeginText(); void EndText(); diff --git a/PdfFile/SrcReader/RedactOutputDev.cpp b/PdfFile/SrcWriter/RedactOutputDev.cpp similarity index 64% rename from PdfFile/SrcReader/RedactOutputDev.cpp rename to PdfFile/SrcWriter/RedactOutputDev.cpp index e27ae1074b..582759d7fe 100644 --- a/PdfFile/SrcReader/RedactOutputDev.cpp +++ b/PdfFile/SrcWriter/RedactOutputDev.cpp @@ -80,7 +80,6 @@ void RedactOutputDev::restoreState(GfxState *pGState) //----- update graphics state void RedactOutputDev::updateAll(GfxState *pGState) { - } void RedactOutputDev::updateCTM(GfxState *pGState, double dMatrix11, double dMatrix12, double dMatrix21, double dMatrix22, double dMatrix31, double dMatrix32) { @@ -126,51 +125,126 @@ void RedactOutputDev::updateLineWidth(GfxState *pGState) { m_pPage->SetLineWidth(pGState->getLineWidth()); } -void RedactOutputDev::updateFillColorSpace(GfxState *state) +void RedactOutputDev::updateFillColorSpace(GfxState *pGState) { } -void RedactOutputDev::updateStrokeColorSpace(GfxState *state) +void RedactOutputDev::updateStrokeColorSpace(GfxState *pGState) { } void RedactOutputDev::updateFillColor(GfxState *pGState) { - + GfxColorSpace* pColorSpace = pGState->getFillColorSpace(); + GfxColorSpaceMode eMode = pColorSpace->getMode(); + GfxColor* pColor = pGState->getFillColor(); + switch (eMode) { + case csDeviceGray: + { + m_pPage->SetFillG(colToDbl(pColor->c[0])); + break; + } + case csDeviceRGB: + { + m_pPage->SetFillRGB(colToDbl(pColor->c[0]), colToDbl(pColor->c[1]), colToDbl(pColor->c[2])); + break; + } + case csDeviceCMYK: + { + m_pPage->SetFillCMYK(colToDbl(pColor->c[0]), colToDbl(pColor->c[1]), colToDbl(pColor->c[2]), colToDbl(pColor->c[3])); + break; + } + default: + break; + } } void RedactOutputDev::updateStrokeColor(GfxState *pGState) { - + GfxColorSpace* pColorSpace = pGState->getStrokeColorSpace(); + GfxColorSpaceMode eMode = pColorSpace->getMode(); + GfxColor* pColor = pGState->getStrokeColor(); + switch (eMode) { + case csDeviceGray: + { + m_pPage->SetStrokeG(colToDbl(pColor->c[0])); + break; + } + case csDeviceRGB: + { + m_pPage->SetStrokeRGB(colToDbl(pColor->c[0]), colToDbl(pColor->c[1]), colToDbl(pColor->c[2])); + break; + } + case csDeviceCMYK: + { + m_pPage->SetStrokeCMYK(colToDbl(pColor->c[0]), colToDbl(pColor->c[1]), colToDbl(pColor->c[2]), colToDbl(pColor->c[3])); + break; + } + default: + break; + } } -void RedactOutputDev::updateBlendMode(GfxState *pGState) +void RedactOutputDev::updateRenderingIntent(GfxState *pGState) +{ + GfxRenderingIntent eRI = pGState->getRenderingIntent(); + switch (eRI) + { + case GfxRenderingIntent::gfxRenderingIntentAbsoluteColorimetric: + m_pPage->SetRenderingIntent(ERenderingIntent::RenderingIntent_AbsoluteColorimetric); + break; + case GfxRenderingIntent::gfxRenderingIntentRelativeColorimetric: + m_pPage->SetRenderingIntent(ERenderingIntent::RenderingIntent_RelativeColorimetric); + break; + case GfxRenderingIntent::gfxRenderingIntentSaturation: + m_pPage->SetRenderingIntent(ERenderingIntent::RenderingIntent_Saturation); + break; + case GfxRenderingIntent::gfxRenderingIntentPerceptual: + default: + m_pPage->SetRenderingIntent(ERenderingIntent::RenderingIntent_Perceptual); + break; + } +} +//----- update text state +void RedactOutputDev::updateFont(GfxState *pGState) { } -void RedactOutputDev::updateFillOpacity(GfxState *pGState) +void RedactOutputDev::updateTextMat(GfxState *pGState) { } -void RedactOutputDev::updateStrokeOpacity(GfxState *pGState) +void RedactOutputDev::updateCharSpace(GfxState *pGState) { } -void RedactOutputDev::updateFillOverprint(GfxState *state) +void RedactOutputDev::updateRender(GfxState *pGState) { } -void RedactOutputDev::updateStrokeOverprint(GfxState *state) +void RedactOutputDev::updateRise(GfxState *pGState) { } -void RedactOutputDev::updateOverprintMode(GfxState *state) +void RedactOutputDev::updateWordSpace(GfxState *pGState) { } -void RedactOutputDev::updateRenderingIntent(GfxState *state) +void RedactOutputDev::updateHorizScaling(GfxState *pGState) { } -void RedactOutputDev::updateTransfer(GfxState *state) +void RedactOutputDev::updateTextPos(GfxState *pGState) +{ + +} +void RedactOutputDev::updateTextShift(GfxState *pGState, double shift) +{ + +} +void RedactOutputDev::saveTextPos(GfxState *pGState) +{ + +} +void RedactOutputDev::restoreTextPos(GfxState *pGState) { } diff --git a/PdfFile/SrcReader/RedactOutputDev.h b/PdfFile/SrcWriter/RedactOutputDev.h similarity index 78% rename from PdfFile/SrcReader/RedactOutputDev.h rename to PdfFile/SrcWriter/RedactOutputDev.h index 7904fc8e3f..8bc1b85bcf 100644 --- a/PdfFile/SrcReader/RedactOutputDev.h +++ b/PdfFile/SrcWriter/RedactOutputDev.h @@ -29,8 +29,8 @@ * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * */ -#ifndef _PDF_READER_REDACT_OUTPUTDEV_H -#define _PDF_READER_REDACT_OUTPUTDEV_H +#ifndef _PDF_WRITER_SRC_REDACT_OUTPUTDEV_H +#define _PDF_WRITER_SRC_REDACT_OUTPUTDEV_H #include "../PdfWriter.h" //#include "../../DesktopEditor/graphics/IRenderer.h" @@ -95,30 +95,30 @@ namespace PdfWriter virtual void updateMiterLimit(GfxState *pGState) override; virtual void updateLineWidth(GfxState *pGState) override; // updateStrokeAdjust -> setExtGState - virtual void updateFillColorSpace(GfxState *state) override; - virtual void updateStrokeColorSpace(GfxState *state) override; + virtual void updateFillColorSpace(GfxState *pGState) override; + virtual void updateStrokeColorSpace(GfxState *pGState) override; virtual void updateFillColor(GfxState *pGState) override; virtual void updateStrokeColor(GfxState *pGState) override; - virtual void updateBlendMode(GfxState *pGState) override; - virtual void updateFillOpacity(GfxState *pGState) override; - virtual void updateStrokeOpacity(GfxState *pGState) override; - virtual void updateFillOverprint(GfxState *state) override; - virtual void updateStrokeOverprint(GfxState *state) override; - virtual void updateOverprintMode(GfxState *state) override; - virtual void updateRenderingIntent(GfxState *state) override; - virtual void updateTransfer(GfxState *state) override; + // updateBlendMode -> setExtGState + // updateFillOpacity -> setExtGState + // updateStrokeOpacity -> setExtGState + // updateFillOverprint -> setExtGState + // updateStrokeOverprint -> setExtGState + // updateOverprintMode -> setExtGState + virtual void updateRenderingIntent(GfxState *pGState) override; + // updateTransfer -> setExtGState //----- update text state virtual void updateFont(GfxState *pGState) override; - virtual void updateTextMat(GfxState *state) override; - virtual void updateCharSpace(GfxState *state) override; - virtual void updateRender(GfxState *state) override; - virtual void updateRise(GfxState *state) override; - virtual void updateWordSpace(GfxState *state) override; - virtual void updateHorizScaling(GfxState *state) override; - virtual void updateTextPos(GfxState *state) override; - virtual void updateTextShift(GfxState *state, double shift) override; - virtual void saveTextPos(GfxState *state) override; - virtual void restoreTextPos(GfxState *state) override; + virtual void updateTextMat(GfxState *pGState) override; + virtual void updateCharSpace(GfxState *pGState) override; + virtual void updateRender(GfxState *pGState) override; + virtual void updateRise(GfxState *pGState) override; + virtual void updateWordSpace(GfxState *pGState) override; + virtual void updateHorizScaling(GfxState *pGState) override; + virtual void updateTextPos(GfxState *pGState) override; + virtual void updateTextShift(GfxState *pGState, double shift) override; + virtual void saveTextPos(GfxState *pGState) override; + virtual void restoreTextPos(GfxState *pGState) override; //----- path painting virtual void stroke(GfxState *pGState) override; virtual void fill(GfxState *pGState) override; @@ -132,19 +132,19 @@ namespace PdfWriter //----- text drawing virtual void beginStringOp(GfxState *pGState) override; virtual void endStringOp(GfxState *pGState) override; - virtual void beginString(GfxState *state, GString *s) override; - virtual void endString(GfxState *state) override; + virtual void beginString(GfxState *pGState, GString *s) override; + virtual void endString(GfxState *pGState) override; virtual void drawChar(GfxState *pGState, double dX, double dY, double dDx, double dDy, double dOriginX, double dOriginY, CharCode nCode, int nBytesCount, Unicode *pUnicode, int nUnicodeLen) override; virtual void drawString(GfxState *pGState, GString *seString) override; - virtual GBool beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen) override; + virtual GBool beginType3Char(GfxState *pGState, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen) override; virtual void endType3Char(GfxState *pGState) override; virtual void endTextObject(GfxState *pGState) override; virtual void beginActualText(GfxState *state, Unicode *u, int uLen) override; virtual void endActualText(GfxState *state) override; //----- additional - virtual GBool beginMarkedContent(GfxState *state, GString *s) override; - virtual GBool beginMCOShapes(GfxState *state, GString *s, Object *ref) override; - virtual void endMarkedContent(GfxState *state) override; + virtual GBool beginMarkedContent(GfxState *pGState, GString *s) override; + virtual GBool beginMCOShapes(GfxState *pGState, GString *s, Object *ref) override; + virtual void endMarkedContent(GfxState *pGState) override; virtual GBool useExtGState() override; virtual void setExtGState(Object* pDict) override; //----- image drawing @@ -156,8 +156,8 @@ namespace PdfWriter virtual void drawSoftMaskedImage(GfxState *pGState, Object *pRef, Stream *pStream, int nWidth, int nHeight, GfxImageColorMap *pColorMap, Object *maskRef, Stream *pMaskStream, int nMaskWidth, int nMaskHeight, GfxImageColorMap *pMaskColorMap, double *pMatte, GBool interpolate) override; //----- Type 3 font operators - virtual void type3D0(GfxState *state, double wx, double wy) override; - virtual void type3D1(GfxState *state, double wx, double wy, double llx, double lly, double urx, double ury) override; + virtual void type3D0(GfxState *pGState, double wx, double wy) override; + virtual void type3D1(GfxState *pGState, double wx, double wy, double llx, double lly, double urx, double ury) override; //----- form XObjects virtual void drawForm(Ref id) override; //----- transparency groups and soft masks @@ -166,7 +166,6 @@ namespace PdfWriter virtual void paintTransparencyGroup(GfxState *pGState, double *pBBox) override; virtual void setSoftMask(GfxState *pGState, double *pBBox, GBool bAlpha, Function *pTransferFunc, GfxColor *pBackdropColor) override; virtual void clearSoftMask(GfxState *pGState) override; - //----- Дополнительные функции для данного устройства private: CPdfWriter* m_pRenderer; @@ -176,4 +175,4 @@ namespace PdfWriter }; } -#endif // _PDF_READER_REDACT_OUTPUTDEV_H +#endif // _PDF_WRITER_SRC_REDACT_OUTPUTDEV_H diff --git a/PdfFile/SrcWriter/Types.h b/PdfFile/SrcWriter/Types.h index 4a87cb6af3..fa6e10d391 100644 --- a/PdfFile/SrcWriter/Types.h +++ b/PdfFile/SrcWriter/Types.h @@ -457,6 +457,13 @@ namespace PdfWriter fontCIDType2, fontCIDType2OT }; + enum class ERenderingIntent + { + RenderingIntent_AbsoluteColorimetric, + RenderingIntent_RelativeColorimetric, + RenderingIntent_Saturation, + RenderingIntent_Perceptual + }; } #endif // _PDF_WRITER_SRC_TYPES_H