Commit b570f4b6 authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander Trofimov

Реализована простая отрисовка пата.

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@63167 954022d7-b5bf-4e40-9824-e11837661b57
parent 722e67a0
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
#define MM_2_PT(X) ((X) * 72.0 / 25.4) #define MM_2_PT(X) ((X) * 72.0 / 25.4)
#define PT_2_MM(X) ((X) * 25.4 / 72.0) #define PT_2_MM(X) ((X) * 25.4 / 72.0)
#define LONG_2_BOOL(X) ((X) ? true : false)
#ifdef DrawText #ifdef DrawText
#undef DrawText #undef DrawText
#endif #endif
...@@ -435,6 +437,8 @@ HRESULT CPdfRenderer::CommandDrawText(const std::wstring& wsUnicodeText, const d ...@@ -435,6 +437,8 @@ HRESULT CPdfRenderer::CommandDrawText(const std::wstring& wsUnicodeText, const d
m_pPage->GrSave(); m_pPage->GrSave();
UpdateTransform(); UpdateTransform();
UpdateFont(); UpdateFont();
UpdatePen();
UpdateBrush();
if (!m_pFont) if (!m_pFont)
return S_FALSE; return S_FALSE;
...@@ -541,17 +545,33 @@ HRESULT CPdfRenderer::PathCommandEnd() ...@@ -541,17 +545,33 @@ HRESULT CPdfRenderer::PathCommandEnd()
} }
HRESULT CPdfRenderer::DrawPath(const LONG& lType) HRESULT CPdfRenderer::DrawPath(const LONG& lType)
{ {
if (!IsPageValid())
return S_FALSE;
m_pPage->GrSave();
UpdateTransform();
UpdatePen();
UpdateBrush();
// TODO: // TODO:
bool bStroke = LONG_2_BOOL(lType & c_nStroke);
bool bFill = LONG_2_BOOL(lType & c_nWindingFillMode);
bool bEoFill = LONG_2_BOOL(lType & c_nEvenOddFillMode);
m_oPath.Draw(m_pPage, bStroke, bFill, bEoFill);
m_pPage->GrRestore();
return S_OK; return S_OK;
} }
HRESULT CPdfRenderer::PathCommandMoveTo(const double& dX, const double& dY) HRESULT CPdfRenderer::PathCommandMoveTo(const double& dX, const double& dY)
{ {
m_oPath.MoveTo(dX, dY); m_oPath.MoveTo(MM_2_PT(dX), MM_2_PT(m_dPageHeight - dY));
return S_OK; return S_OK;
} }
HRESULT CPdfRenderer::PathCommandLineTo(const double& dX, const double& dY) HRESULT CPdfRenderer::PathCommandLineTo(const double& dX, const double& dY)
{ {
m_oPath.LineTo(dX, dY); m_oPath.LineTo(MM_2_PT(dX), MM_2_PT(m_dPageHeight - dY));
return S_OK; return S_OK;
} }
HRESULT CPdfRenderer::PathCommandLinesTo(double* pPoints, const int& nCount) HRESULT CPdfRenderer::PathCommandLinesTo(double* pPoints, const int& nCount)
...@@ -560,19 +580,19 @@ HRESULT CPdfRenderer::PathCommandLinesTo(double* pPoints, const int& nCount) ...@@ -560,19 +580,19 @@ HRESULT CPdfRenderer::PathCommandLinesTo(double* pPoints, const int& nCount)
return S_OK; return S_OK;
if (!m_oPath.IsMoveTo()) if (!m_oPath.IsMoveTo())
m_oPath.MoveTo(pPoints[0], pPoints[1]); m_oPath.MoveTo(MM_2_PT(pPoints[0]), MM_2_PT(m_dPageHeight - pPoints[1]));
int nPointsCount = (nCount / 2) - 1; int nPointsCount = (nCount / 2) - 1;
for (int nIndex = 1; nIndex <= nPointsCount; ++nIndex) for (int nIndex = 1; nIndex <= nPointsCount; ++nIndex)
{ {
m_oPath.LineTo(pPoints[nIndex * 2], pPoints[nIndex * 2 + 1]); m_oPath.LineTo(MM_2_PT(pPoints[nIndex * 2]), MM_2_PT(m_dPageHeight - pPoints[nIndex * 2 + 1]));
} }
return S_OK; return S_OK;
} }
HRESULT CPdfRenderer::PathCommandCurveTo(const double& dX1, const double& dY1, const double& dX2, const double& dY2, const double& dXe, const double& dYe) HRESULT CPdfRenderer::PathCommandCurveTo(const double& dX1, const double& dY1, const double& dX2, const double& dY2, const double& dXe, const double& dYe)
{ {
m_oPath.CurveTo(dX1, dY1, dX2, dY2, dXe, dYe); m_oPath.CurveTo(MM_2_PT(dX1), MM_2_PT(m_dPageHeight - dY1), MM_2_PT(dX2), MM_2_PT(m_dPageHeight - dY2), MM_2_PT(dXe), MM_2_PT(m_dPageHeight - dYe));
return S_OK; return S_OK;
} }
HRESULT CPdfRenderer::PathCommandCurvesTo(double* pPoints, const int& nCount) HRESULT CPdfRenderer::PathCommandCurvesTo(double* pPoints, const int& nCount)
...@@ -581,20 +601,20 @@ HRESULT CPdfRenderer::PathCommandCurvesTo(double* pPoints, const int& nCount) ...@@ -581,20 +601,20 @@ HRESULT CPdfRenderer::PathCommandCurvesTo(double* pPoints, const int& nCount)
return S_OK; return S_OK;
if (!m_oPath.IsMoveTo()) if (!m_oPath.IsMoveTo())
m_oPath.MoveTo(pPoints[0], pPoints[1]); m_oPath.MoveTo(MM_2_PT(pPoints[0]), MM_2_PT(m_dPageHeight - pPoints[1]));
int nPointsCount = (nCount - 2) / 6; int nPointsCount = (nCount - 2) / 6;
double* pCur = pPoints + 2; double* pCur = pPoints + 2;
for (int nIndex = 0; nIndex <= nPointsCount; ++nIndex, pCur += 6) for (int nIndex = 0; nIndex <= nPointsCount; ++nIndex, pCur += 6)
{ {
m_oPath.CurveTo(pCur[0], pCur[1], pCur[2], pCur[3], pCur[4], pCur[5]); m_oPath.CurveTo(MM_2_PT(pCur[0]), MM_2_PT(m_dPageHeight - pCur[1]), MM_2_PT(pCur[2]), MM_2_PT(m_dPageHeight - pCur[3]), MM_2_PT(pCur[4]), MM_2_PT(m_dPageHeight - pCur[5]));
} }
return S_OK; return S_OK;
} }
HRESULT CPdfRenderer::PathCommandArcTo(const double& dX, const double& dY, const double& dW, const double& dH, const double& dStartAngle, const double& dSweepAngle) HRESULT CPdfRenderer::PathCommandArcTo(const double& dX, const double& dY, const double& dW, const double& dH, const double& dStartAngle, const double& dSweepAngle)
{ {
m_oPath.ArcTo(dX, dY, dW, dH, dStartAngle, dSweepAngle); m_oPath.ArcTo(MM_2_PT(dX), MM_2_PT(m_dPageHeight - dY - dH), MM_2_PT(dW), MM_2_PT(dH), dStartAngle, dSweepAngle);
return S_OK; return S_OK;
} }
HRESULT CPdfRenderer::PathCommandClose() HRESULT CPdfRenderer::PathCommandClose()
...@@ -605,26 +625,28 @@ HRESULT CPdfRenderer::PathCommandClose() ...@@ -605,26 +625,28 @@ HRESULT CPdfRenderer::PathCommandClose()
HRESULT CPdfRenderer::PathCommandGetCurrentPoint(double* dX, double* dY) HRESULT CPdfRenderer::PathCommandGetCurrentPoint(double* dX, double* dY)
{ {
m_oPath.GetLastPoint(*dX, *dY); m_oPath.GetLastPoint(*dX, *dY);
*dX = PT_2_MM(*dX);
*dY = PT_2_MM(*dY);
return S_OK; return S_OK;
} }
HRESULT CPdfRenderer::PathCommandTextCHAR(const LONG& lUnicode, const double& dX, const double& dY, const double& dW, const double& dH, const double& dBaselineOffset) HRESULT CPdfRenderer::PathCommandTextCHAR(const LONG& lUnicode, const double& dX, const double& dY, const double& dW, const double& dH, const double& dBaselineOffset)
{ {
m_oPath.AddText(m_oFont, lUnicode, dX, dY, dW, dH, dBaselineOffset); m_oPath.AddText(m_oFont, lUnicode, MM_2_PT(dX), MM_2_PT(m_dPageHeight - dY), MM_2_PT(dW), MM_2_PT(dH), MM_2_PT(dBaselineOffset));
return S_OK; return S_OK;
} }
HRESULT CPdfRenderer::PathCommandText(const std::wstring& wsText, const double& dX, const double& dY, const double& dW, const double& dH, const double& dBaselineOffset) HRESULT CPdfRenderer::PathCommandText(const std::wstring& wsText, const double& dX, const double& dY, const double& dW, const double& dH, const double& dBaselineOffset)
{ {
m_oPath.AddText(m_oFont, wsText, dX, dY, dW, dH, dBaselineOffset); m_oPath.AddText(m_oFont, wsText, MM_2_PT(dX), MM_2_PT(m_dPageHeight - dY), MM_2_PT(dW), MM_2_PT(dH), MM_2_PT(dBaselineOffset));
return S_OK; return S_OK;
} }
HRESULT CPdfRenderer::PathCommandTextExCHAR(const LONG& lUnicode, const LONG& lGid, const double& dX, const double& dY, const double& dW, const double& dH, const double& dBaselineOffset, const DWORD& dwFlags) HRESULT CPdfRenderer::PathCommandTextExCHAR(const LONG& lUnicode, const LONG& lGid, const double& dX, const double& dY, const double& dW, const double& dH, const double& dBaselineOffset, const DWORD& dwFlags)
{ {
m_oPath.AddText(m_oFont, lUnicode, lGid, dX, dY, dW, dH, dBaselineOffset, dwFlags); m_oPath.AddText(m_oFont, lUnicode, lGid, MM_2_PT(dX), MM_2_PT(m_dPageHeight - dY), MM_2_PT(dW), MM_2_PT(dH), MM_2_PT(dBaselineOffset), dwFlags);
return S_OK; return S_OK;
} }
HRESULT CPdfRenderer::PathCommandTextEx(const std::wstring& wsUnicodeText, const std::wstring& wsGidText, const double& dX, const double& dY, const double& dW, const double& dH, const double& dBaselineOffset, const DWORD& dwFlags) HRESULT CPdfRenderer::PathCommandTextEx(const std::wstring& wsUnicodeText, const std::wstring& wsGidText, const double& dX, const double& dY, const double& dW, const double& dH, const double& dBaselineOffset, const DWORD& dwFlags)
{ {
m_oPath.AddText(m_oFont, wsUnicodeText, wsGidText, dX, dY, dW, dH, dBaselineOffset, dwFlags); m_oPath.AddText(m_oFont, wsUnicodeText, wsGidText, MM_2_PT(dX), MM_2_PT(m_dPageHeight - dY), MM_2_PT(dW), MM_2_PT(dH), MM_2_PT(dBaselineOffset), dwFlags);
return S_OK; return S_OK;
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
...@@ -635,8 +657,6 @@ HRESULT CPdfRenderer::DrawImage(IGrObject* pImage, const double& dX, const doubl ...@@ -635,8 +657,6 @@ HRESULT CPdfRenderer::DrawImage(IGrObject* pImage, const double& dX, const doubl
if (!IsPageValid() || !pImage) if (!IsPageValid() || !pImage)
return S_OK; return S_OK;
// TODO:
if (!DrawImage((Aggplus::CImage*)pImage, dX, dY, dW, dH, 255)) if (!DrawImage((Aggplus::CImage*)pImage, dX, dY, dW, dH, 255))
return S_FALSE; return S_FALSE;
...@@ -647,8 +667,6 @@ HRESULT CPdfRenderer::DrawImageFromFile(const std::wstring& wsImagePath, const d ...@@ -647,8 +667,6 @@ HRESULT CPdfRenderer::DrawImageFromFile(const std::wstring& wsImagePath, const d
if (!IsPageValid()) if (!IsPageValid())
return S_OK; return S_OK;
// TODO:
Aggplus::CImage oAggImage(wsImagePath); Aggplus::CImage oAggImage(wsImagePath);
if (!DrawImage(&oAggImage, dX, dY, dW, dH, nAlpha)) if (!DrawImage(&oAggImage, dX, dY, dW, dH, nAlpha))
return S_FALSE; return S_FALSE;
...@@ -770,7 +788,10 @@ bool CPdfRenderer::DrawImage(Aggplus::CImage* pImage, const double& dX, const do ...@@ -770,7 +788,10 @@ bool CPdfRenderer::DrawImage(Aggplus::CImage* pImage, const double& dX, const do
pPdfImage->LoadSMask(pData, nImageW, nImageH, nAlpha); pPdfImage->LoadSMask(pData, nImageW, nImageH, nAlpha);
pPdfImage->LoadJpx(pBuffer, nBufferSize, nImageW, nImageH); pPdfImage->LoadJpx(pBuffer, nBufferSize, nImageW, nImageH);
m_pPage->GrSave();
UpdateTransform();
m_pPage->DrawImage(pPdfImage, MM_2_PT(dX), MM_2_PT(m_dPageHeight - dY - dH), MM_2_PT(dW), MM_2_PT(dH)); m_pPage->DrawImage(pPdfImage, MM_2_PT(dX), MM_2_PT(m_dPageHeight - dY - dH), MM_2_PT(dW), MM_2_PT(dH));
m_pPage->GrRestore();
free(pBuffer); free(pBuffer);
return true; return true;
...@@ -783,8 +804,8 @@ void CPdfRenderer::UpdateFont() ...@@ -783,8 +804,8 @@ void CPdfRenderer::UpdateFont()
{ {
CFontSelectFormat oFontSelect; CFontSelectFormat oFontSelect;
oFontSelect.wsName = new std::wstring(m_oFont.GetName()); oFontSelect.wsName = new std::wstring(m_oFont.GetName());
oFontSelect.bItalic = new INT(m_oFont.IsItalic() ? 0 : 1); oFontSelect.bItalic = new INT(m_oFont.IsItalic() ? 1 : 0);
oFontSelect.bItalic = new INT(m_oFont.IsBold() ? 0 : 1); oFontSelect.bBold = new INT(m_oFont.IsBold() ? 1 : 0);
CFontInfo* pFontInfo = m_pFontManager->GetFontInfoByParams(oFontSelect); CFontInfo* pFontInfo = m_pFontManager->GetFontInfoByParams(oFontSelect);
wsFontPath = pFontInfo->m_wsFontPath; wsFontPath = pFontInfo->m_wsFontPath;
...@@ -807,4 +828,112 @@ void CPdfRenderer::UpdateTransform() ...@@ -807,4 +828,112 @@ void CPdfRenderer::UpdateTransform()
CTransform& t = m_oTransform; CTransform& t = m_oTransform;
m_pPage->Concat(t.m11, -t.m12, -t.m21, t.m22, MM_2_PT(t.dx + t.m21 * m_dPageHeight), MM_2_PT(m_dPageHeight - m_dPageHeight * t.m22 - t.dy)); m_pPage->Concat(t.m11, -t.m12, -t.m21, t.m22, MM_2_PT(t.dx + t.m21 * m_dPageHeight), MM_2_PT(m_dPageHeight - m_dPageHeight * t.m22 - t.dy));
} }
void CPdfRenderer::UpdatePen()
{
TColor& oColor = m_oPen.GetTColor();
m_pPage->SetStrokeColor(oColor.r, oColor.g, oColor.b);
m_pPage->SetLineWidth(MM_2_PT(m_oPen.GetSize()));
LONG lDashCount = 0;
double* pDashPattern = NULL;
LONG lDashStyle = m_oPen.GetDashStyle();
if (Aggplus::DashStyleSolid == lDashStyle)
{
//
}
else if (Aggplus::DashStyleCustom == lDashStyle)
{
double *pDashPatternMM = m_oPen.GetDashPattern(lDashCount);
if (pDashPatternMM && lDashCount)
{
pDashPattern = new double[lDashCount];
if (pDashPattern)
{
for (LONG lIndex = 0; lIndex < lDashCount; lIndex++)
{
pDashPattern[lIndex] = MM_2_PT(pDashPatternMM[lIndex]);
}
}
}
}
else
{
// TODO:
}
if (pDashPattern && lDashCount)
{
m_pPage->SetDash(pDashPattern, lDashCount, MM_2_PT(m_oPen.GetDashOffset()));
delete[] pDashPattern;
}
// TODO:
}
void CPdfRenderer::UpdateBrush()
{
TColor& oColor1 = m_oBrush.GetTColor1();
m_pPage->SetFillColor(oColor1.r, oColor1.g, oColor1.b);
// TODO:
}
void CPdfRenderer::CPath::Draw(PdfWriter::CPage* pPage, bool bStroke, bool bFill, bool bEoFill)
{
for (int nIndex = 0, nCount = m_vCommands.size(); nIndex < nCount; nIndex++)
{
CPathCommandBase* pCommand = m_vCommands.at(nIndex);
pCommand->Draw(pPage);
}
if (bStroke && !bFill && !bEoFill)
pPage->Stroke();
else if (bStroke && bFill)
pPage->FillStroke();
else if (bStroke && bEoFill)
pPage->EoFill();
else if (bFill)
pPage->Fill();
else if (bEoFill)
pPage->EoFill();
else
pPage->EndPath();
}
void CPdfRenderer::CPath::CPathMoveTo::Draw(PdfWriter::CPage* pPage)
{
pPage->MoveTo(x, y);
}
void CPdfRenderer::CPath::CPathLineTo::Draw(PdfWriter::CPage* pPage)
{
pPage->LineTo(x, y);
}
void CPdfRenderer::CPath::CPathCurveTo::Draw(PdfWriter::CPage* pPage)
{
pPage->CurveTo(x1, y1, x2, y2, xe, ye);
}
void CPdfRenderer::CPath::CPathArcTo::Draw(PdfWriter::CPage* pPage)
{
pPage->EllipseArcTo(x + w / 2, y + h / 2, w / 2, h / 2, startAngle, sweepAngle);
}
void CPdfRenderer::CPath::CPathClose::Draw(PdfWriter::CPage* pPage)
{
pPage->ClosePath();
}
void CPdfRenderer::CPath::CPathTextChar::Draw(PdfWriter::CPage* pPage)
{
// TODO:
}
void CPdfRenderer::CPath::CPathText::Draw(PdfWriter::CPage* pPage)
{
// TODO:
}
void CPdfRenderer::CPath::CPathTextExChar::Draw(PdfWriter::CPage* pPage)
{
// TODO:
}
void CPdfRenderer::CPath::CPathTextEx::Draw(PdfWriter::CPage* pPage)
{
// TODO:
}
\ No newline at end of file
...@@ -172,6 +172,8 @@ private: ...@@ -172,6 +172,8 @@ private:
bool DrawImage(Aggplus::CImage* pImage, const double& dX, const double& dY, const double& dW, const double& dH, const BYTE& nAlpha); bool DrawImage(Aggplus::CImage* pImage, const double& dX, const double& dY, const double& dW, const double& dH, const BYTE& nAlpha);
void UpdateFont(); void UpdateFont();
void UpdateTransform(); void UpdateTransform();
void UpdatePen();
void UpdateBrush();
bool IsValid() bool IsValid()
{ {
return m_bValid; return m_bValid;
...@@ -252,6 +254,10 @@ private: ...@@ -252,6 +254,10 @@ private:
{ {
m_oColor.Set(lColor); m_oColor.Set(lColor);
} }
inline TColor GetTColor()
{
return m_oColor;
}
inline LONG GetAlpha() inline LONG GetAlpha()
{ {
return m_nAlpha; return m_nAlpha;
...@@ -349,6 +355,11 @@ private: ...@@ -349,6 +355,11 @@ private:
} }
} }
} }
inline double*GetDashPattern(LONG& lSize)
{
lSize = m_lDashPatternSize;
return m_pDashPattern;
}
void Reset() void Reset()
{ {
...@@ -409,6 +420,10 @@ private: ...@@ -409,6 +420,10 @@ private:
{ {
return m_oColor1.lColor; return m_oColor1.lColor;
} }
inline TColor GetTColor1()
{
return m_oColor1;
}
inline void SetColor1(const LONG& lColor) inline void SetColor1(const LONG& lColor)
{ {
m_oColor1.Set(lColor); m_oColor1.Set(lColor);
...@@ -417,6 +432,10 @@ private: ...@@ -417,6 +432,10 @@ private:
{ {
return m_oColor2.lColor; return m_oColor2.lColor;
} }
inline TColor GetTColor2()
{
return m_oColor2;
}
inline void SetColor2(const LONG& lColor) inline void SetColor2(const LONG& lColor)
{ {
m_oColor2.Set(lColor); m_oColor2.Set(lColor);
...@@ -848,6 +867,7 @@ private: ...@@ -848,6 +867,7 @@ private:
virtual ~CPathCommandBase() virtual ~CPathCommandBase()
{ {
} }
virtual void Draw(PdfWriter::CPage* pPage) = 0;
virtual void GetLastPoint(double& dX, double& dY) = 0; virtual void GetLastPoint(double& dX, double& dY) = 0;
virtual EPathCommandType GetType() = 0; virtual EPathCommandType GetType() = 0;
}; };
...@@ -864,6 +884,7 @@ private: ...@@ -864,6 +884,7 @@ private:
dX = x; dX = x;
dY = y; dY = y;
} }
void Draw(PdfWriter::CPage* pPage);
EPathCommandType GetType() EPathCommandType GetType()
{ {
return rendererpathcommand_MoveTo; return rendererpathcommand_MoveTo;
...@@ -887,6 +908,7 @@ private: ...@@ -887,6 +908,7 @@ private:
dX = x; dX = x;
dY = y; dY = y;
} }
void Draw(PdfWriter::CPage* pPage);
EPathCommandType GetType() EPathCommandType GetType()
{ {
return rendererpathcommand_LineTo; return rendererpathcommand_LineTo;
...@@ -904,7 +926,7 @@ private: ...@@ -904,7 +926,7 @@ private:
{ {
x1 = dX1; x1 = dX1;
y1 = dY1; y1 = dY1;
x2 = dXe; x2 = dX2;
y2 = dY2; y2 = dY2;
xe = dXe; xe = dXe;
ye = dYe; ye = dYe;
...@@ -914,6 +936,7 @@ private: ...@@ -914,6 +936,7 @@ private:
dX = xe; dX = xe;
dY = ye; dY = ye;
} }
void Draw(PdfWriter::CPage* pPage);
EPathCommandType GetType() EPathCommandType GetType()
{ {
return rendererpathcommand_CurveTo; return rendererpathcommand_CurveTo;
...@@ -946,6 +969,7 @@ private: ...@@ -946,6 +969,7 @@ private:
dX = x; dX = x;
dY = y; dY = y;
} }
void Draw(PdfWriter::CPage* pPage);
EPathCommandType GetType() EPathCommandType GetType()
{ {
return rendererpathcommand_ArcTo; return rendererpathcommand_ArcTo;
...@@ -972,6 +996,7 @@ private: ...@@ -972,6 +996,7 @@ private:
dX = 0; dX = 0;
dY = 0; dY = 0;
} }
void Draw(PdfWriter::CPage* pPage);
EPathCommandType GetType() EPathCommandType GetType()
{ {
return rendererpathcommand_Close; return rendererpathcommand_Close;
...@@ -995,6 +1020,7 @@ private: ...@@ -995,6 +1020,7 @@ private:
dX = x; dX = x;
dY = y; dY = y;
} }
void Draw(PdfWriter::CPage* pPage);
EPathCommandType GetType() EPathCommandType GetType()
{ {
return rendererpathcommand_TextChar; return rendererpathcommand_TextChar;
...@@ -1028,6 +1054,7 @@ private: ...@@ -1028,6 +1054,7 @@ private:
dX = x; dX = x;
dY = y; dY = y;
} }
void Draw(PdfWriter::CPage* pPage);
EPathCommandType GetType() EPathCommandType GetType()
{ {
return rendererpathcommand_Text; return rendererpathcommand_Text;
...@@ -1062,6 +1089,7 @@ private: ...@@ -1062,6 +1089,7 @@ private:
dX = x; dX = x;
dY = y; dY = y;
} }
void Draw(PdfWriter::CPage* pPage);
EPathCommandType GetType() EPathCommandType GetType()
{ {
return rendererpathcommand_TextExChar; return rendererpathcommand_TextExChar;
...@@ -1097,6 +1125,7 @@ private: ...@@ -1097,6 +1125,7 @@ private:
dX = x; dX = x;
dY = y; dY = y;
} }
void Draw(PdfWriter::CPage* pPage);
EPathCommandType GetType() EPathCommandType GetType()
{ {
return rendererpathcommand_TextEx; return rendererpathcommand_TextEx;
...@@ -1197,6 +1226,7 @@ private: ...@@ -1197,6 +1226,7 @@ private:
m_vCommands.at(m_vCommands.size() - 1)->GetLastPoint(dX, dY); m_vCommands.at(m_vCommands.size() - 1)->GetLastPoint(dX, dY);
} }
} }
void Draw(PdfWriter::CPage* pPage, bool bStroke, bool bFill, bool bEoFill);
private: private:
......
...@@ -91,11 +91,15 @@ ...@@ -91,11 +91,15 @@
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<DisableSpecificWarnings>4018;4005;4267</DisableSpecificWarnings> <DisableSpecificWarnings>4018;4005;4267</DisableSpecificWarnings>
<AdditionalIncludeDirectories>..\DesktopEditor\freetype-2.5.2\include;..\DesktopEditor\agg-2.4\include;..\DesktopEditor\cximage\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\DesktopEditor\freetype-2.5.2\include;..\DesktopEditor\agg-2.4\include;..\DesktopEditor\cximage\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<BrowseInformation>true</BrowseInformation>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
<Bscmake>
<PreserveSbr>true</PreserveSbr>
</Bscmake>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
......
...@@ -887,9 +887,14 @@ void ConvertFolder(std::wstring wsFolderPath, const int nType) ...@@ -887,9 +887,14 @@ void ConvertFolder(std::wstring wsFolderPath, const int nType)
dX *= dPx2Mm; dX *= dPx2Mm;
dY *= dPx2Mm; dY *= dPx2Mm;
double dAspect = dH / dW;
dW = 1000;
dH = dAspect * dW;
oRenderer.put_Width(dW); oRenderer.put_Width(dW);
oRenderer.put_Height(dH); oRenderer.put_Height(dH);
oMetaFile.DrawOnRenderer(&oRenderer, -dX, -dY, dW, dH); //oMetaFile.DrawOnRenderer(&oRenderer, -dX, -dY, dW, dH);
oMetaFile.DrawOnRenderer(&oRenderer, 0, 0, dW, dH);
oMetaFile.Close(); oMetaFile.Close();
} }
...@@ -900,7 +905,8 @@ void ConvertFolder(std::wstring wsFolderPath, const int nType) ...@@ -900,7 +905,8 @@ void ConvertFolder(std::wstring wsFolderPath, const int nType)
} }
void TestMetafile() void TestMetafile()
{ {
ConvertFolder(L"D://Test Files//Emf//", MetaFile::c_lMetaEmf); //ConvertFolder(L"D://Test Files//Emf//", MetaFile::c_lMetaEmf);
ConvertFolder(L"D://Test Files//Wmf//", MetaFile::c_lMetaWmf);
} }
void main() void main()
......
...@@ -101,11 +101,15 @@ ...@@ -101,11 +101,15 @@
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>..\..\DesktopEditor\freetype-2.5.2\include;..\..\DesktopEditor\agg-2.4\include;..\..\DesktopEditor\cximage\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\DesktopEditor\freetype-2.5.2\include;..\..\DesktopEditor\agg-2.4\include;..\..\DesktopEditor\cximage\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4018;4005;4267</DisableSpecificWarnings> <DisableSpecificWarnings>4018;4005;4267</DisableSpecificWarnings>
<BrowseInformation>true</BrowseInformation>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
<Bscmake>
<PreserveSbr>true</PreserveSbr>
</Bscmake>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
......
...@@ -429,7 +429,7 @@ namespace PdfWriter ...@@ -429,7 +429,7 @@ namespace PdfWriter
m_pStream->WriteReal(dStartX); m_pStream->WriteReal(dStartX);
m_pStream->WriteChar(' '); m_pStream->WriteChar(' ');
m_pStream->WriteReal(dStartY); m_pStream->WriteReal(dStartY);
m_pStream->WriteStr(" l\012"); m_pStream->WriteStr(" m\012");
// Дальше рисуем по четверям // Дальше рисуем по четверям
double dCurX = dStartX, dCurY = dStartY; double dCurX = dStartX, dCurY = dStartY;
...@@ -503,7 +503,7 @@ namespace PdfWriter ...@@ -503,7 +503,7 @@ namespace PdfWriter
while (_dAngle2 < 0) while (_dAngle2 < 0)
_dAngle2 += 360; _dAngle2 += 360;
while (_dAngle2 >= 360) while (_dAngle2 > 360)
_dAngle2 -= 360; _dAngle2 -= 360;
if (!bClockDirection) if (!bClockDirection)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment