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

Переделано открытие EMF на манер WMF, т.е. теперь первоначальный обсчет всех...

Переделано открытие EMF на манер WMF, т.е. теперь первоначальный обсчет всех точек делается в классе CEmfFile, чтобы не было проблем с клипом как в WMF. Реализованы записи ExcludeClipRect и SetArcDirection. Исправлены мелкие баги при открытии EMF.

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@62391 954022d7-b5bf-4e40-9824-e11837661b57
parent 0ddbb6af
...@@ -26,8 +26,6 @@ namespace MetaFile ...@@ -26,8 +26,6 @@ namespace MetaFile
virtual void PlayMetaFile() = 0; virtual void PlayMetaFile() = 0;
virtual void ClearFile() {/* , */} virtual void ClearFile() {/* , */}
//virtual double TranslateX(int nX) = 0;
//virtual double TranslateY(int nY) = 0;
virtual TRect* GetDCBounds() = 0; virtual TRect* GetDCBounds() = 0;
virtual double GetPixelHeight() = 0; virtual double GetPixelHeight() = 0;
virtual double GetPixelWidth() = 0; virtual double GetPixelWidth() = 0;
......
...@@ -608,7 +608,7 @@ namespace MetaFile ...@@ -608,7 +608,7 @@ namespace MetaFile
BYTE nDashStyle = Aggplus::DashStyleSolid;; BYTE nDashStyle = Aggplus::DashStyleSolid;;
// WinGDI 1px PS_SOLID // WinGDI 1px PS_SOLID
if (1 == pPen->GetWidth() && PS_SOLID != ulPenStyle) if (1 >= pPen->GetWidth() && PS_SOLID != ulPenStyle)
{ {
dWidth = 0; // 1p dWidth = 0; // 1p
......
...@@ -121,6 +121,9 @@ typedef unsigned char BYTE; ...@@ -121,6 +121,9 @@ typedef unsigned char BYTE;
#define PS_GEOMETRIC 0x00010000 #define PS_GEOMETRIC 0x00010000
#define PS_TYPE_MASK 0x000F0000 #define PS_TYPE_MASK 0x000F0000
#define AD_COUNTERCLOCKWISE 1
#define AD_CLOCKWISE 2
/* Text Alignment Options */ /* Text Alignment Options */
#define TA_NOUPDATECP 0 #define TA_NOUPDATECP 0
#define TA_UPDATECP 1 #define TA_UPDATECP 1
......
...@@ -864,8 +864,7 @@ namespace MetaFile ...@@ -864,8 +864,7 @@ namespace MetaFile
{ {
unsigned int unIndex = (unY * unWidth + unX) * 4; unsigned int unIndex = (unY * unWidth + unX) * 4;
if ((0xff == pCur[unIndex + 0] && 0xff == pCur[unIndex + 1] && 0xff == pCur[unIndex + 2]) || if (0xff == pCur[unIndex + 0] && 0xff == pCur[unIndex + 1] && 0xff == pCur[unIndex + 2])
(0x00 == pCur[unIndex + 0] && 0x00 == pCur[unIndex + 1] && 0x00 == pCur[unIndex + 2]))
pCur[unIndex + 3] = 0; pCur[unIndex + 3] = 0;
} }
} }
...@@ -879,8 +878,7 @@ namespace MetaFile ...@@ -879,8 +878,7 @@ namespace MetaFile
{ {
unsigned int unIndex = (unY * unWidth + unX) * 4; unsigned int unIndex = (unY * unWidth + unX) * 4;
if ((0xff == pCur[unIndex + 0] && 0xff == pCur[unIndex + 1] && 0xff == pCur[unIndex + 2]) || if (0 == pCur[unIndex + 0] && 0 == pCur[unIndex + 1] && 0 == pCur[unIndex + 2])
(0x00 == pCur[unIndex + 0] && 0x00 == pCur[unIndex + 1] && 0x00 == pCur[unIndex + 2]))
pCur[unIndex + 3] = 0; pCur[unIndex + 3] = 0;
} }
} }
......
...@@ -535,13 +535,11 @@ namespace MetaFile ...@@ -535,13 +535,11 @@ namespace MetaFile
unsigned short* pUnicode = NULL; unsigned short* pUnicode = NULL;
if (oText.fuOptions & ETO_SMALL_CHARS) if (oText.fuOptions & ETO_SMALL_CHARS)
{ {
unsigned char* pString = new unsigned char[oText.cChars + 1]; unsigned char* pString = new unsigned char[oText.cChars];
if (!pString) if (!pString)
return *this; return *this;
pString[oText.cChars] = 0x00;
ReadBytes(pString, oText.cChars); ReadBytes(pString, oText.cChars);
oText.cChars++;
pUnicode = new unsigned short[oText.cChars]; pUnicode = new unsigned short[oText.cChars];
if (!pUnicode) if (!pUnicode)
...@@ -558,13 +556,11 @@ namespace MetaFile ...@@ -558,13 +556,11 @@ namespace MetaFile
} }
else else
{ {
pUnicode = new unsigned short[oText.cChars + 1]; pUnicode = new unsigned short[oText.cChars];
if (!pUnicode) if (!pUnicode)
return *this; return *this;
pUnicode[oText.cChars] = 0x0000;
ReadBytes(pUnicode, oText.cChars); ReadBytes(pUnicode, oText.cChars);
oText.cChars++;
} }
oText.TextString = pUnicode; oText.TextString = pUnicode;
} }
...@@ -920,7 +916,6 @@ namespace MetaFile ...@@ -920,7 +916,6 @@ namespace MetaFile
void ReadEmrTextA(TEmfEmrText& oText, unsigned int unOffset) void ReadEmrTextA(TEmfEmrText& oText, unsigned int unOffset)
{ {
ReadEmrTextBase<unsigned char>(oText, unOffset); ReadEmrTextBase<unsigned char>(oText, unOffset);
// TODO: Charset
} }
void ReadEmrTextW(TEmfEmrText& oText, unsigned int unOffset) void ReadEmrTextW(TEmfEmrText& oText, unsigned int unOffset)
{ {
......
...@@ -30,6 +30,12 @@ namespace MetaFile ...@@ -30,6 +30,12 @@ namespace MetaFile
pNewCommand = new CEmfClipCommandPath(&pPathCommand->m_oPath, pPathCommand->m_unMode); pNewCommand = new CEmfClipCommandPath(&pPathCommand->m_oPath, pPathCommand->m_unMode);
break; break;
} }
case EMF_CLIPCOMMAND_EXCLUDE:
{
CEmfClipCommandExclude* pExclude = (CEmfClipCommandExclude*)pCommand;
pNewCommand = new CEmfClipCommandExclude(pExclude->m_oClip, pExclude->m_oBB);
break;
}
} }
if (pNewCommand) if (pNewCommand)
...@@ -40,7 +46,7 @@ namespace MetaFile ...@@ -40,7 +46,7 @@ namespace MetaFile
{ {
Clear(); Clear();
} }
bool CEmfClip::Intersect(TEmfRectL& oRect) bool CEmfClip::Intersect(TRectD& oRect)
{ {
CEmfClipCommandBase* pCommand = new CEmfClipCommandIntersect(oRect); CEmfClipCommandBase* pCommand = new CEmfClipCommandIntersect(oRect);
if (!pCommand) if (!pCommand)
...@@ -49,6 +55,15 @@ namespace MetaFile ...@@ -49,6 +55,15 @@ namespace MetaFile
m_vCommands.push_back(pCommand); m_vCommands.push_back(pCommand);
return true; return true;
} }
bool CEmfClip::Exclude(TRectD& oClip, TRectD& oBB)
{
CEmfClipCommandBase* pCommand = new CEmfClipCommandExclude(oClip, oBB);
if (!pCommand)
return false;
m_vCommands.push_back(pCommand);
return true;
}
bool CEmfClip::SetPath(CEmfPath* pPath, unsigned int unMode) bool CEmfClip::SetPath(CEmfPath* pPath, unsigned int unMode)
{ {
CEmfClipCommandBase* pCommand = new CEmfClipCommandPath(pPath, unMode); CEmfClipCommandBase* pCommand = new CEmfClipCommandPath(pPath, unMode);
...@@ -72,7 +87,7 @@ namespace MetaFile ...@@ -72,7 +87,7 @@ namespace MetaFile
case EMF_CLIPCOMMAND_INTERSECT: case EMF_CLIPCOMMAND_INTERSECT:
{ {
CEmfClipCommandIntersect* pIntersect = (CEmfClipCommandIntersect*)pCommand; CEmfClipCommandIntersect* pIntersect = (CEmfClipCommandIntersect*)pCommand;
pOutput->IntersectClip(pIntersect->m_oRect.lLeft, pIntersect->m_oRect.lTop, pIntersect->m_oRect.lRight, pIntersect->m_oRect.lBottom); pOutput->IntersectClip(pIntersect->m_oRect.dLeft, pIntersect->m_oRect.dTop, pIntersect->m_oRect.dRight, pIntersect->m_oRect.dBottom);
break; break;
} }
case EMF_CLIPCOMMAND_SETPATH: case EMF_CLIPCOMMAND_SETPATH:
...@@ -81,6 +96,30 @@ namespace MetaFile ...@@ -81,6 +96,30 @@ namespace MetaFile
pClipPath->m_oPath.Draw(pOutput, false, false, pClipPath->m_unMode); pClipPath->m_oPath.Draw(pOutput, false, false, pClipPath->m_unMode);
break; break;
} }
case EMF_CLIPCOMMAND_EXCLUDE:
{
CEmfClipCommandExclude* pExclude = (CEmfClipCommandExclude*)pCommand;
pOutput->StartClipPath(RGN_AND, ALTERNATE);
TRectD& oClip = pExclude->m_oClip;
TRectD& oBB = pExclude->m_oBB;
pOutput->MoveTo(oClip.dLeft, oClip.dTop);
pOutput->LineTo(oClip.dRight, oClip.dTop);
pOutput->LineTo(oClip.dRight, oClip.dBottom);
pOutput->LineTo(oClip.dLeft, oClip.dBottom);
pOutput->ClosePath();
pOutput->MoveTo(oBB.dLeft, oBB.dTop);
pOutput->LineTo(oBB.dRight, oBB.dTop);
pOutput->LineTo(oBB.dRight, oBB.dBottom);
pOutput->LineTo(oBB.dLeft, oBB.dBottom);
pOutput->ClosePath();
pOutput->EndClipPath(RGN_AND);
break;
}
} }
} }
......
...@@ -12,7 +12,8 @@ namespace MetaFile ...@@ -12,7 +12,8 @@ namespace MetaFile
{ {
EMF_CLIPCOMMAND_UNKNOWN = 0x00, EMF_CLIPCOMMAND_UNKNOWN = 0x00,
EMF_CLIPCOMMAND_INTERSECT = 0x01, EMF_CLIPCOMMAND_INTERSECT = 0x01,
EMF_CLIPCOMMAND_SETPATH = 0x02 EMF_CLIPCOMMAND_SETPATH = 0x02,
EMF_CLIPCOMMAND_EXCLUDE = 0x03
} EEmfClipCommandType; } EEmfClipCommandType;
class CEmfClipCommandBase class CEmfClipCommandBase
...@@ -32,7 +33,7 @@ namespace MetaFile ...@@ -32,7 +33,7 @@ namespace MetaFile
class CEmfClipCommandIntersect : public CEmfClipCommandBase class CEmfClipCommandIntersect : public CEmfClipCommandBase
{ {
public: public:
CEmfClipCommandIntersect(TEmfRectL& oRect) : m_oRect(oRect) CEmfClipCommandIntersect(TRectD& oRect) : m_oRect(oRect)
{ {
} }
~CEmfClipCommandIntersect() ~CEmfClipCommandIntersect()
...@@ -44,7 +45,7 @@ namespace MetaFile ...@@ -44,7 +45,7 @@ namespace MetaFile
} }
public: public:
TEmfRectL m_oRect; TRectD m_oRect;
}; };
class CEmfClipCommandPath : public CEmfClipCommandBase class CEmfClipCommandPath : public CEmfClipCommandBase
{ {
...@@ -65,6 +66,24 @@ namespace MetaFile ...@@ -65,6 +66,24 @@ namespace MetaFile
CEmfPath m_oPath; CEmfPath m_oPath;
unsigned int m_unMode; unsigned int m_unMode;
}; };
class CEmfClipCommandExclude : public CEmfClipCommandBase
{
public:
CEmfClipCommandExclude(TRectD& oClip, TRectD& oBB) : m_oClip(oClip), m_oBB(oBB)
{
}
~CEmfClipCommandExclude()
{
}
EEmfClipCommandType GetType()
{
return EMF_CLIPCOMMAND_INTERSECT;
}
public:
TRectD m_oClip;
TRectD m_oBB;
};
class CEmfClip : public IClip class CEmfClip : public IClip
{ {
...@@ -74,7 +93,8 @@ namespace MetaFile ...@@ -74,7 +93,8 @@ namespace MetaFile
void operator=(CEmfClip& oClip); void operator=(CEmfClip& oClip);
void Reset(); void Reset();
bool Intersect(TEmfRectL& oRect); bool Intersect(TRectD& oRect);
bool Exclude(TRectD& oClip, TRectD& oBB);
bool SetPath(CEmfPath* pPath, unsigned int umMode); bool SetPath(CEmfPath* pPath, unsigned int umMode);
void ClipOnRenderer(IOutputDevice* pOutput); void ClipOnRenderer(IOutputDevice* pOutput);
......
This diff is collapsed.
...@@ -50,90 +50,30 @@ namespace MetaFile ...@@ -50,90 +50,30 @@ namespace MetaFile
CEmfPath::~CEmfPath() CEmfPath::~CEmfPath()
{ {
Clear(); Clear();
} }
bool CEmfPath::MoveTo(TEmfPointS& oPoint) bool CEmfPath::MoveTo(double dX, double dY)
{
CEmfPathCommandBase* pCommand = new CEmfPathMoveTo(oPoint);
if (!pCommand)
return false;
m_pCommands.push_back(pCommand);
return true;
}
bool CEmfPath::MoveTo(TEmfPointL& oPoint)
{
CEmfPathCommandBase* pCommand = new CEmfPathMoveTo(oPoint);
if (!pCommand)
return false;
m_pCommands.push_back(pCommand);
return true;
}
bool CEmfPath::MoveTo(int lX, int lY)
{ {
CEmfPathCommandBase* pCommand = new CEmfPathMoveTo(lX, lY); CEmfPathCommandBase* pCommand = new CEmfPathMoveTo(dX, dY);
if (!pCommand) if (!pCommand)
return false; return false;
m_pCommands.push_back(pCommand); m_pCommands.push_back(pCommand);
return true; return true;
} }
bool CEmfPath::LineTo(TEmfPointS& oPoint) bool CEmfPath::LineTo(double dX, double dY)
{
CEmfPathCommandBase* pCommand = new CEmfPathLineTo(oPoint);
if (!pCommand)
return false;
m_pCommands.push_back(pCommand);
return true;
}
bool CEmfPath::LineTo(TEmfPointL& oPoint)
{ {
CEmfPathCommandBase* pCommand = new CEmfPathLineTo(oPoint); CEmfPathCommandBase* pCommand = new CEmfPathLineTo(dX, dY);
if (!pCommand) if (!pCommand)
return false; return false;
m_pCommands.push_back(pCommand); m_pCommands.push_back(pCommand);
return true; return true;
} }
bool CEmfPath::LineTo(int lX, int lY) bool CEmfPath::CurveTo(double dX1, double dY1, double dX2, double dY2, double dXE, double dYE)
{
CEmfPathCommandBase* pCommand = new CEmfPathLineTo(lX, lY);
if (!pCommand)
return false;
m_pCommands.push_back(pCommand);
return true;
}
bool CEmfPath::CurveTo(TEmfPointS& oPoint1, TEmfPointS& oPoint2, TEmfPointS& oPointE)
{
CEmfPathCommandBase* pCommand = new CEmfPathCurveTo(oPoint1, oPoint2, oPointE);
if (!pCommand)
return false;
m_pCommands.push_back(pCommand);
return true;
}
bool CEmfPath::CurveTo(TEmfPointL& oPoint1, TEmfPointL& oPoint2, TEmfPointL& oPointE)
{
CEmfPathCommandBase* pCommand = new CEmfPathCurveTo(oPoint1, oPoint2, oPointE);
if (!pCommand)
return false;
m_pCommands.push_back(pCommand);
return true;
}
bool CEmfPath::CurveTo(int lX1, int lY1, int lX2, int lY2, int lXE, int lYE)
{ {
CEmfPathCommandBase* pCommand = new CEmfPathCurveTo(lX1, lY1, lX2, lY2, lXE, lYE); CEmfPathCommandBase* pCommand = new CEmfPathCurveTo(dX1, dY1, dX2, dY2, dXE, dYE);
if (!pCommand) if (!pCommand)
return false; return false;
...@@ -141,9 +81,9 @@ namespace MetaFile ...@@ -141,9 +81,9 @@ namespace MetaFile
return true; return true;
} }
bool CEmfPath::ArcTo(int lL, int lT, int lR, int lB, double dStart, double dSweep) bool CEmfPath::ArcTo(double dL, double dT, double dR, double dB, double dStart, double dSweep)
{ {
CEmfPathCommandBase* pCommand = new CEmfPathArcTo(lL, lT, lR, lB, dStart, dSweep); CEmfPathCommandBase* pCommand = new CEmfPathArcTo(dL, dT, dR, dB, dStart, dSweep);
if (!pCommand) if (!pCommand)
return false; return false;
......
...@@ -32,20 +32,10 @@ namespace MetaFile ...@@ -32,20 +32,10 @@ namespace MetaFile
class CEmfPathMoveTo : public CEmfPathCommandBase class CEmfPathMoveTo : public CEmfPathCommandBase
{ {
public: public:
CEmfPathMoveTo(TEmfPointL& oPoint) CEmfPathMoveTo(double dX, double dY)
{ {
x = oPoint.x; x = dX;
y = oPoint.y; y = dY;
}
CEmfPathMoveTo(TEmfPointS& oPoint)
{
x = oPoint.x;
y = oPoint.y;
}
CEmfPathMoveTo(int lX, int lY)
{
x = lX;
y = lY;
} }
virtual ~CEmfPathMoveTo() virtual ~CEmfPathMoveTo()
{ {
...@@ -57,26 +47,16 @@ namespace MetaFile ...@@ -57,26 +47,16 @@ namespace MetaFile
public: public:
int x; double x;
int y; double y;
}; };
class CEmfPathLineTo : public CEmfPathCommandBase class CEmfPathLineTo : public CEmfPathCommandBase
{ {
public: public:
CEmfPathLineTo(TEmfPointL& oPoint) CEmfPathLineTo(double dX, double dY)
{
x = oPoint.x;
y = oPoint.y;
}
CEmfPathLineTo(TEmfPointS& oPoint)
{ {
x = oPoint.x; x = dX;
y = oPoint.y; y = dY;
}
CEmfPathLineTo(int lX, int lY)
{
x = lX;
y = lY;
} }
virtual ~CEmfPathLineTo() virtual ~CEmfPathLineTo()
{ {
...@@ -88,38 +68,20 @@ namespace MetaFile ...@@ -88,38 +68,20 @@ namespace MetaFile
public: public:
int x; double x;
int y; double y;
}; };
class CEmfPathCurveTo : public CEmfPathCommandBase class CEmfPathCurveTo : public CEmfPathCommandBase
{ {
public: public:
CEmfPathCurveTo(TEmfPointL& oPoint1, TEmfPointL& oPoint2, TEmfPointL& oPointE) CEmfPathCurveTo(double dX1, double dY1, double dX2, double dY2, double dXE, double dYE)
{
x1 = oPoint1.x;
y1 = oPoint1.y;
x2 = oPoint2.x;
y2 = oPoint2.y;
xE = oPointE.x;
yE = oPointE.y;
}
CEmfPathCurveTo(TEmfPointS& oPoint1, TEmfPointS& oPoint2, TEmfPointS& oPointE)
{
x1 = oPoint1.x;
y1 = oPoint1.y;
x2 = oPoint2.x;
y2 = oPoint2.y;
xE = oPointE.x;
yE = oPointE.y;
}
CEmfPathCurveTo(int lX1, int lY1, int lX2, int lY2, int lXE, int lYE)
{ {
x1 = lX1; x1 = dX1;
y1 = lY1; y1 = dY1;
x2 = lX2; x2 = dX2;
y2 = lY2; y2 = dY2;
xE = lXE; xE = dXE;
yE = lYE; yE = dYE;
} }
virtual ~CEmfPathCurveTo() virtual ~CEmfPathCurveTo()
{ {
...@@ -131,22 +93,22 @@ namespace MetaFile ...@@ -131,22 +93,22 @@ namespace MetaFile
public: public:
int x1; double x1;
int y1; double y1;
int x2; double x2;
int y2; double y2;
int xE; double xE;
int yE; double yE;
}; };
class CEmfPathArcTo : public CEmfPathCommandBase class CEmfPathArcTo : public CEmfPathCommandBase
{ {
public: public:
CEmfPathArcTo(int lL, int lT, int lR, int lB, double dStart, double dSweep) CEmfPathArcTo(double dL, double dT, double dR, double dB, double dStart, double dSweep)
{ {
left = lL; left = dL;
top = lT; top = dT;
right = lR; right = dR;
bottom = lB; bottom = dB;
start = dStart; start = dStart;
sweep = dSweep; sweep = dSweep;
} }
...@@ -160,10 +122,10 @@ namespace MetaFile ...@@ -160,10 +122,10 @@ namespace MetaFile
public: public:
int left; double left;
int top; double top;
int right; double right;
int bottom; double bottom;
double start; double start;
double sweep; double sweep;
}; };
...@@ -192,16 +154,10 @@ namespace MetaFile ...@@ -192,16 +154,10 @@ namespace MetaFile
CEmfPath(CEmfPath* pPath); CEmfPath(CEmfPath* pPath);
~CEmfPath(); ~CEmfPath();
bool MoveTo(TEmfPointS& oPoint); bool MoveTo(double dX, double dY);
bool MoveTo(TEmfPointL& oPoint); bool LineTo(double dX, double dY);
bool MoveTo(int lX, int lY); bool CurveTo(double dX1, double dY1, double dX2, double dY2, double dXE, double dYE);
bool LineTo(TEmfPointS& oPoint); bool ArcTo(double dL, double dT, double dR, double dB, double dStart, double dSweep);
bool LineTo(TEmfPointL& oPoint);
bool LineTo(int lX, int lY);
bool CurveTo(TEmfPointS& oPoint1, TEmfPointS& oPoint2, TEmfPointS& oPointE);
bool CurveTo(TEmfPointL& oPoint1, TEmfPointL& oPoint2, TEmfPointL& oPointE);
bool CurveTo(int lX1, int lY1, int lX2, int lY2, int lXE, int lYE);
bool ArcTo(int lL, int lT, int lR, int lB, double dStart, double dSweep);
bool Close(); bool Close();
void Draw(IOutputDevice* pOutput, bool bStroke, bool bFill, unsigned int unClipMode = -1); void Draw(IOutputDevice* pOutput, bool bStroke, bool bFill, unsigned int unClipMode = -1);
......
...@@ -54,7 +54,7 @@ namespace MetaFile ...@@ -54,7 +54,7 @@ namespace MetaFile
CEmfDC* Copy(); CEmfDC* Copy();
void SetMapMode(unsigned int ulMapMode); void SetMapMode(unsigned int ulMapMode);
unsigned int GetMapMode(); unsigned int GetMapMode();
TEmfXForm* GetTransform(); TEmfXForm* GetTransform();
TEmfXForm* GetInverseTransform(); TEmfXForm* GetInverseTransform();
void MultiplyTransform(TEmfXForm& oForm, unsigned int ulMode); void MultiplyTransform(TEmfXForm& oForm, unsigned int ulMode);
...@@ -67,20 +67,20 @@ namespace MetaFile ...@@ -67,20 +67,20 @@ namespace MetaFile
void RemoveFont(CEmfLogFont* pFont); void RemoveFont(CEmfLogFont* pFont);
CEmfLogFont* GetFont(); CEmfLogFont* GetFont();
void SetTextAlign(unsigned int ulAlign); void SetTextAlign(unsigned int ulAlign);
unsigned int GetTextAlign(); unsigned int GetTextAlign();
void SetBgMode(unsigned int ulBgMode); void SetBgMode(unsigned int ulBgMode);
unsigned int GetBgMode(); unsigned int GetBgMode();
void SetBgColor(TEmfColor& oColor); void SetBgColor(TEmfColor& oColor);
TEmfColor& GetBgColor(); TEmfColor& GetBgColor();
void SetMiterLimit(unsigned int ulMiter); void SetMiterLimit(unsigned int ulMiter);
unsigned int GetMiterLimit(); unsigned int GetMiterLimit();
void SetFillMode(unsigned int ulFillMode); void SetFillMode(unsigned int ulFillMode);
unsigned int GetFillMode(); unsigned int GetFillMode();
void SetPen(CEmfLogPen* pPen); void SetPen(CEmfLogPen* pPen);
void RemovePen(CEmfLogPen* pPen); void RemovePen(CEmfLogPen* pPen);
CEmfLogPen* GetPen(); CEmfLogPen* GetPen();
void SetStretchMode(unsigned int& oMode); void SetStretchMode(unsigned int& oMode);
unsigned int GetStretchMode(); unsigned int GetStretchMode();
double GetPixelWidth(); double GetPixelWidth();
double GetPixelHeight(); double GetPixelHeight();
void SetWindowOrigin(TEmfPointL& oPoint); void SetWindowOrigin(TEmfPointL& oPoint);
...@@ -90,7 +90,7 @@ namespace MetaFile ...@@ -90,7 +90,7 @@ namespace MetaFile
void SetViewportExtents(TEmfSizeL& oPoint); void SetViewportExtents(TEmfSizeL& oPoint);
TEmfWindow* GetViewport(); TEmfWindow* GetViewport();
void SetRop2Mode(unsigned int& nMode); void SetRop2Mode(unsigned int& nMode);
unsigned int GetRop2Mode(); unsigned int GetRop2Mode();
void SetPalette(CEmfLogPalette* pPalette); void SetPalette(CEmfLogPalette* pPalette);
void RemovePalette(CEmfLogPalette* pPalette); void RemovePalette(CEmfLogPalette* pPalette);
CEmfLogPalette* GetPalette(); CEmfLogPalette* GetPalette();
...@@ -99,6 +99,8 @@ namespace MetaFile ...@@ -99,6 +99,8 @@ namespace MetaFile
TEmfPointL& GetCurPos(); TEmfPointL& GetCurPos();
CEmfClip* GetClip(); CEmfClip* GetClip();
void ClipToPath(CEmfPath* pPath, unsigned int unMode); void ClipToPath(CEmfPath* pPath, unsigned int unMode);
void SetArcDirection(unsigned int unDirection);
unsigned int GetArcDirection();
private: private:
...@@ -108,8 +110,6 @@ namespace MetaFile ...@@ -108,8 +110,6 @@ namespace MetaFile
private: private:
CEmfLogPen m_oDefaultPen;
CEmfLogBrushEx m_oDefaultBrush;
unsigned int m_ulMapMode; unsigned int m_ulMapMode;
CEmfLogBrushEx* m_pBrush; CEmfLogBrushEx* m_pBrush;
CEmfLogPen* m_pPen; CEmfLogPen* m_pPen;
...@@ -131,6 +131,7 @@ namespace MetaFile ...@@ -131,6 +131,7 @@ namespace MetaFile
TEmfWindow m_oViewport; TEmfWindow m_oViewport;
TEmfPointL m_oCurPos; TEmfPointL m_oCurPos;
CEmfClip m_oClip; CEmfClip m_oClip;
unsigned int m_unArcDirection;
}; };
} }
......
...@@ -675,11 +675,10 @@ namespace MetaFile ...@@ -675,11 +675,10 @@ namespace MetaFile
if (!(fuOptions & ETO_NO_RECT)) if (!(fuOptions & ETO_NO_RECT))
unSize += 16; unSize += 16;
// .
if (fuOptions & ETO_SMALL_CHARS) if (fuOptions & ETO_SMALL_CHARS)
unSize += (cChars - 1); unSize += cChars;
else else
unSize += 2 * (cChars - 1); unSize += 2 * cChars;
return unSize; return unSize;
} }
......
...@@ -160,7 +160,7 @@ namespace MetaFile ...@@ -160,7 +160,7 @@ namespace MetaFile
if (!pBgraData) if (!pBgraData)
return; return;
memset(pBgraData, 0x00, nWidth * nHeight * 4); memset(pBgraData, 0xff, nWidth * nHeight * 4);
CBgraFrame oFrame; CBgraFrame oFrame;
oFrame.put_Data(pBgraData); oFrame.put_Data(pBgraData);
oFrame.put_Width(nWidth); oFrame.put_Width(nWidth);
......
...@@ -42,11 +42,11 @@ void ConvertFile(CMetaFile &oMetaFile, std::wstring wsFilePath) ...@@ -42,11 +42,11 @@ void ConvertFile(CMetaFile &oMetaFile, std::wstring wsFilePath)
oMetaFile.ConvertToRaster(wsDstFilePath.c_str(), 4, 1000); oMetaFile.ConvertToRaster(wsDstFilePath.c_str(), 4, 1000);
} }
} }
void ConvertFolder(CMetaFile &oMetaFile, std::wstring wsFolderPath) void ConvertFolder(CMetaFile &oMetaFile, std::wstring wsFolderPath, const int nType)
{ {
oMetaFile.Close(); oMetaFile.Close();
std::vector<std::wstring> vFiles = GetAllFilesInFolder(wsFolderPath, L"wmf"); std::vector<std::wstring> vFiles = GetAllFilesInFolder(wsFolderPath, nType == c_lMetaEmf ? L"emf" : L"wmf");
for (int nIndex = 0; nIndex < vFiles.size(); nIndex++) for (int nIndex = 0; nIndex < vFiles.size(); nIndex++)
{ {
std::wstring wsFilePath = wsFolderPath; std::wstring wsFilePath = wsFolderPath;
...@@ -62,20 +62,14 @@ void ConvertFolder(CMetaFile &oMetaFile, std::wstring wsFolderPath) ...@@ -62,20 +62,14 @@ void ConvertFolder(CMetaFile &oMetaFile, std::wstring wsFolderPath)
} }
} }
#include "../../common/String.h" void main()
void Test()
{ {
CApplicationFonts oFonts; CApplicationFonts oFonts;
oFonts.Initialize(); oFonts.Initialize();
CMetaFile oMetaFile(&oFonts); CMetaFile oMetaFile(&oFonts);
//ConvertFile(oMetaFile, L"D://Test Files//fulltest.wmf"); ConvertFolder(oMetaFile, L"D://Test Files//", c_lMetaEmf);
ConvertFolder(oMetaFile, L"D://Test Files//Bugs//ALL//");
}
void main()
{
Test();
//_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); //_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
//_CrtDumpMemoryLeaks(); //_CrtDumpMemoryLeaks();
} }
\ No newline at end of file
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