Fix coords

This commit is contained in:
Svetlana Kulikova
2025-08-27 15:18:59 +03:00
parent 5c98a92faf
commit bb40cd0467
2 changed files with 16 additions and 6 deletions

View File

@ -1135,6 +1135,15 @@ int main(int argc, char* argv[])
}
}
BYTE* pColor = new BYTE[12] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
// REDACT
if (true)
{
int pRect[4] = { 307499, 217499, 1799999, 1124999 };
if (!RedactPage(pGrFile, nTestPage, pRect, 1, pColor, 12))
std::cout << "Redact false" << std::endl;
}
int i = nTestPage;
//for (int i = 0; i < nPagesCount; ++i)
{
@ -1162,7 +1171,6 @@ int main(int argc, char* argv[])
RELEASEARRAYOBJECTS(res);
}
}
free(pInfo);
// LINKS

View File

@ -812,6 +812,7 @@ void CPdfReader::DrawPageOnRenderer(IRenderer* pRenderer, int _nPageIndex, bool*
((GlobalParamsAdaptor*)globalParams)->ClearRedact();
pRenderer->SetTransform(1, 0, 0, 1, 0, 0);
for (int i = 0 ; i < m_vRedact.size(); ++i)
{
if (m_vRedact[i]->m_nPageIndex == _nPageIndex)
@ -827,12 +828,13 @@ void CPdfReader::DrawPageOnRenderer(IRenderer* pRenderer, int _nPageIndex, bool*
ret = *((int*)pMemory);
double B = ret / 100000.0;
LONG lColor = (LONG)(((LONG)(R * 255)) | ((LONG)(G * 255) << 8) | ((LONG)(B * 255) << 16) | ((LONG)255 << 24));
pRenderer->PathCommandClose();
pRenderer->PathCommandEnd();
pRenderer->put_BrushColor1(lColor);
pRenderer->PathCommandMoveTo(m_vRedact[i]->m_arrRedactBox[0], m_vRedact[i]->m_arrRedactBox[1]);
pRenderer->PathCommandLineTo(m_vRedact[i]->m_arrRedactBox[0], m_vRedact[i]->m_arrRedactBox[3]);
pRenderer->PathCommandLineTo(m_vRedact[i]->m_arrRedactBox[2], m_vRedact[i]->m_arrRedactBox[3]);
pRenderer->PathCommandLineTo(m_vRedact[i]->m_arrRedactBox[2], m_vRedact[i]->m_arrRedactBox[1]);
pRenderer->PathCommandMoveTo(PdfReader::PDFCoordsToMM(m_vRedact[i]->m_arrRedactBox[0]), PdfReader::PDFCoordsToMM(m_vRedact[i]->m_arrRedactBox[1]));
pRenderer->PathCommandLineTo(PdfReader::PDFCoordsToMM(m_vRedact[i]->m_arrRedactBox[0]), PdfReader::PDFCoordsToMM(m_vRedact[i]->m_arrRedactBox[3]));
pRenderer->PathCommandLineTo(PdfReader::PDFCoordsToMM(m_vRedact[i]->m_arrRedactBox[2]), PdfReader::PDFCoordsToMM(m_vRedact[i]->m_arrRedactBox[3]));
pRenderer->PathCommandLineTo(PdfReader::PDFCoordsToMM(m_vRedact[i]->m_arrRedactBox[2]), PdfReader::PDFCoordsToMM(m_vRedact[i]->m_arrRedactBox[1]));
pRenderer->PathCommandClose();
pRenderer->DrawPath(c_nWindingFillMode);
pRenderer->PathCommandEnd();