mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Доработка чтения EMF.
git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@62161 954022d7-b5bf-4e40-9824-e11837661b57
This commit is contained in:
committed by
Alexander Trofimov
parent
c47baee6b1
commit
98411309fb
@ -112,8 +112,8 @@ namespace MetaFile
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
long lCalcLen = (((nWidth * ushPlanes * ushBitCount + 31) & ~31) / 8) * abs(nHeight);
|
||||
if (lCalcLen != lBufLen)
|
||||
return false;
|
||||
//if (lCalcLen != lBufLen)
|
||||
// return false;
|
||||
|
||||
pBgraBuffer = new BYTE[nWidth * nHeight * 4 * sizeof(BYTE)];
|
||||
if (NULL == pBgraBuffer)
|
||||
@ -266,6 +266,14 @@ namespace MetaFile
|
||||
if (lCalcLen != lBufLen)
|
||||
return false;
|
||||
|
||||
// 2 <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
// (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> * 3) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 4.
|
||||
int nAdd = 0;
|
||||
while (0 != div_t(div(2 * nWidth + nAdd, 4)).rem)
|
||||
{
|
||||
nAdd++;
|
||||
}
|
||||
|
||||
pBgraBuffer = new BYTE[nWidth * nHeight * 4 * sizeof(BYTE)];
|
||||
if (NULL == pBgraBuffer)
|
||||
return false;
|
||||
@ -291,6 +299,7 @@ namespace MetaFile
|
||||
pBgraBuffer[nIndex + 2] = (unsigned char)(unB / 31.0 * 255);
|
||||
pBgraBuffer[nIndex + 3] = 255;
|
||||
}
|
||||
pBuffer += nAdd; lBufLen -= nAdd;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -311,6 +320,7 @@ namespace MetaFile
|
||||
pBgraBuffer[nIndex + 2] = (unsigned char)(unB / 31.0 * 255);
|
||||
pBgraBuffer[nIndex + 3] = 255;
|
||||
}
|
||||
pBuffer += nAdd; lBufLen -= nAdd;
|
||||
}
|
||||
}
|
||||
|
||||
@ -495,6 +505,5 @@ namespace MetaFile
|
||||
ReadImageCoreHeader(pHeaderBuffer + 4, ulHeaderBufferLen - 4, pImageBuffer, ulImageBufferLen, ppDstBuffer, pulWidth, pulHeight);
|
||||
else // BitmapInfoHeader
|
||||
ReadImageInfoHeader(pHeaderBuffer + 4, ulHeaderBufferLen - 4, pImageBuffer, ulImageBufferLen, ppDstBuffer, pulWidth, pulHeight);
|
||||
|
||||
}
|
||||
}
|
||||
@ -72,6 +72,17 @@ namespace MetaFile
|
||||
if (pCur + 4 >= pEnd)
|
||||
return 0;
|
||||
|
||||
float output;
|
||||
|
||||
*((unsigned char*)(&output) + 0) = pCur[0];
|
||||
*((unsigned char*)(&output) + 1) = pCur[1];
|
||||
*((unsigned char*)(&output) + 2) = pCur[2];
|
||||
*((unsigned char*)(&output) + 3) = pCur[3];
|
||||
|
||||
pCur += 4;
|
||||
|
||||
return output;
|
||||
|
||||
long lIntValue = (long)((pCur[0] << 16) | ((pCur[1]) << 8) | ((pCur[2]) << 0));
|
||||
long lFracValue = (long)(pCur[3]);
|
||||
pCur += 4;
|
||||
@ -184,8 +195,8 @@ namespace MetaFile
|
||||
}
|
||||
CDataStream& operator>>(TEmfSizeL& oSize)
|
||||
{
|
||||
*this >> oSize.ulX;
|
||||
*this >> oSize.ulY;
|
||||
*this >> oSize.cx;
|
||||
*this >> oSize.cy;
|
||||
|
||||
return *this;
|
||||
}
|
||||
@ -347,6 +358,70 @@ namespace MetaFile
|
||||
|
||||
return *this;
|
||||
}
|
||||
CDataStream& operator>>(TEmfSetDiBitsToDevice& oBitmap)
|
||||
{
|
||||
*this >> oBitmap.Bounds;
|
||||
*this >> oBitmap.xDest;
|
||||
*this >> oBitmap.yDest;
|
||||
*this >> oBitmap.xSrc;
|
||||
*this >> oBitmap.ySrc;
|
||||
*this >> oBitmap.cxSrc;
|
||||
*this >> oBitmap.cySrc;
|
||||
*this >> oBitmap.offBmiSrc;
|
||||
*this >> oBitmap.cbBmiSrc;
|
||||
*this >> oBitmap.offBitsSrc;
|
||||
*this >> oBitmap.cbBitsSrc;
|
||||
*this >> oBitmap.UsageSrc;
|
||||
*this >> oBitmap.iStartScan;
|
||||
*this >> oBitmap.cScans;
|
||||
|
||||
return *this;
|
||||
}
|
||||
CDataStream& operator>>(TEmfDibPatternBrush& oBitmap)
|
||||
{
|
||||
*this >> oBitmap.Usage;
|
||||
*this >> oBitmap.offBmi;
|
||||
*this >> oBitmap.cbBmi;
|
||||
*this >> oBitmap.offBits;
|
||||
*this >> oBitmap.cbBits;
|
||||
|
||||
return *this;
|
||||
}
|
||||
CDataStream& operator>>(TEmfLogPaletteEntry& oEntry)
|
||||
{
|
||||
*this >> oEntry.Reserved;
|
||||
*this >> oEntry.Blue;
|
||||
*this >> oEntry.Green;
|
||||
*this >> oEntry.Red;
|
||||
return *this;
|
||||
}
|
||||
CDataStream& operator>>(CEmfLogPalette& oPalette)
|
||||
{
|
||||
unsigned short ushVersion;
|
||||
|
||||
*this >> ushVersion;
|
||||
*this >> oPalette.NumberOfEntries;
|
||||
|
||||
if (oPalette.NumberOfEntries > 0)
|
||||
{
|
||||
oPalette.PaletteEntries = new TEmfLogPaletteEntry[oPalette.NumberOfEntries];
|
||||
if (!oPalette.PaletteEntries)
|
||||
{
|
||||
oPalette.NumberOfEntries = 0;
|
||||
oPalette.PaletteEntries = NULL;
|
||||
return *this;
|
||||
}
|
||||
|
||||
for (unsigned short ushIndex = 0; ushIndex < oPalette.NumberOfEntries; ushIndex++)
|
||||
{
|
||||
*this >> oPalette.PaletteEntries[ushIndex];
|
||||
}
|
||||
}
|
||||
else
|
||||
oPalette.PaletteEntries = NULL;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool IsValid() const
|
||||
{
|
||||
@ -379,6 +454,11 @@ namespace MetaFile
|
||||
pCur -= ulSkipBack;
|
||||
}
|
||||
|
||||
void SeekToStart()
|
||||
{
|
||||
pCur = pBuffer;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
BYTE *pBuffer;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
61
DesktopEditor/raster/Metafile/Emf/EmfObjects.cpp
Normal file
61
DesktopEditor/raster/Metafile/Emf/EmfObjects.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
#include "EmfObjects.h"
|
||||
#include "../../../raster/ImageFileFormatChecker.h"
|
||||
#include "../../../graphics/Image.h"
|
||||
|
||||
namespace MetaFile
|
||||
{
|
||||
CEmfLogBrushEx::CEmfLogBrushEx() : Color(255, 255, 255)
|
||||
{
|
||||
BrushStyle = BS_SOLID;
|
||||
BrushHatch = HS_HORIZONTAL;
|
||||
DibPatternPath = L"";
|
||||
BrushAlpha = 255;
|
||||
DibBuffer = NULL;
|
||||
DibWidth = 0;
|
||||
DibHeigth = 0;
|
||||
}
|
||||
CEmfLogBrushEx::~CEmfLogBrushEx()
|
||||
{
|
||||
if (BS_DIBPATTERN == BrushStyle && L"" != DibPatternPath)
|
||||
::_wunlink(DibPatternPath.c_str());
|
||||
|
||||
if (DibBuffer)
|
||||
delete[] DibBuffer;
|
||||
}
|
||||
void CEmfLogBrushEx::SetDibPattern(unsigned char* pBuffer, unsigned long ulWidth, unsigned long ulHeight)
|
||||
{
|
||||
DibBuffer = pBuffer;
|
||||
DibWidth = ulWidth;
|
||||
DibHeigth = ulHeight;
|
||||
|
||||
if (ulWidth <= 0 || ulHeight <= 0)
|
||||
return;
|
||||
|
||||
unsigned long ulBufferSize = 4 * ulWidth * ulHeight;
|
||||
Aggplus::CImage oImage;
|
||||
BYTE* pBufferPtr = new BYTE[ulBufferSize];
|
||||
oImage.Create(pBufferPtr, ulWidth, ulHeight, 4 * ulWidth);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> pBufferPtr
|
||||
for (unsigned long ulIndex = 0; ulIndex < ulBufferSize; ulIndex += 4)
|
||||
{
|
||||
pBufferPtr[0] = (unsigned char)pBuffer[ulIndex + 0];
|
||||
pBufferPtr[1] = (unsigned char)pBuffer[ulIndex + 1];
|
||||
pBufferPtr[2] = (unsigned char)pBuffer[ulIndex + 2];
|
||||
pBufferPtr[3] = (unsigned char)pBuffer[ulIndex + 3];
|
||||
pBufferPtr += 4;
|
||||
}
|
||||
|
||||
FILE *pTempFile = NULL;
|
||||
std::wstring wsTempFileName;
|
||||
if (!WmfOpenTempFile(&wsTempFileName, &pTempFile, L"wb", L".emf0", NULL))
|
||||
return;
|
||||
|
||||
::fclose(pTempFile);
|
||||
|
||||
oImage.SaveFile(wsTempFileName, _CXIMAGE_FORMAT_PNG);
|
||||
|
||||
BrushStyle = BS_DIBPATTERN;
|
||||
DibPatternPath = wsTempFileName;
|
||||
}
|
||||
}
|
||||
@ -2,7 +2,9 @@
|
||||
#define _EMF_OBJECTS_H
|
||||
|
||||
#include "EmfTypes.h"
|
||||
#include "../Wmf/WmfUtils.h"
|
||||
#include "../Wmf/WmfTypes.h"
|
||||
#include "../../Common/Types.h"
|
||||
|
||||
namespace MetaFile
|
||||
{
|
||||
@ -11,7 +13,8 @@ namespace MetaFile
|
||||
EMF_OBJECT_UNKNOWN = 0x00,
|
||||
EMF_OBJECT_BRUSH = 0x01,
|
||||
EMF_OBJECT_FONT = 0x02,
|
||||
EMF_OBJECT_PEN = 0x03
|
||||
EMF_OBJECT_PEN = 0x03,
|
||||
EMF_OBJECT_PALETTE = 0x04
|
||||
} EEmfObjectType;
|
||||
|
||||
class CEmfObjectBase
|
||||
@ -29,23 +32,23 @@ namespace MetaFile
|
||||
{
|
||||
public:
|
||||
|
||||
CEmfLogBrushEx()
|
||||
{
|
||||
BrushStyle = BS_SOLID;
|
||||
BrushHatch = HS_HORIZONTAL;
|
||||
}
|
||||
virtual ~CEmfLogBrushEx()
|
||||
{
|
||||
}
|
||||
CEmfLogBrushEx();
|
||||
virtual ~CEmfLogBrushEx();
|
||||
virtual EEmfObjectType GetType()
|
||||
{
|
||||
return EMF_OBJECT_BRUSH;
|
||||
}
|
||||
void SetDibPattern(unsigned char* pBuffer, unsigned long ulWidth, unsigned long ulHeight);
|
||||
|
||||
public:
|
||||
unsigned long BrushStyle;
|
||||
TEmfColor Color;
|
||||
unsigned long BrushHatch;
|
||||
unsigned long BrushStyle;
|
||||
TEmfColor Color;
|
||||
unsigned long BrushHatch;
|
||||
unsigned long BrushAlpha;
|
||||
std::wstring DibPatternPath;
|
||||
unsigned char* DibBuffer;
|
||||
unsigned long DibWidth;
|
||||
unsigned long DibHeigth;
|
||||
};
|
||||
|
||||
class CEmfLogFont : public CEmfObjectBase
|
||||
@ -74,7 +77,7 @@ namespace MetaFile
|
||||
class CEmfLogPen : public CEmfObjectBase
|
||||
{
|
||||
public:
|
||||
CEmfLogPen()
|
||||
CEmfLogPen() : PenStyle(PS_SOLID), Width(1), Color(0, 0, 0)
|
||||
{
|
||||
StyleEntry = NULL;
|
||||
}
|
||||
@ -96,6 +99,30 @@ namespace MetaFile
|
||||
unsigned long NumStyleEntries;
|
||||
unsigned long* StyleEntry;
|
||||
};
|
||||
|
||||
class CEmfLogPalette : public CEmfObjectBase
|
||||
{
|
||||
public:
|
||||
CEmfLogPalette()
|
||||
{
|
||||
NumberOfEntries = 0;
|
||||
PaletteEntries = NULL;
|
||||
}
|
||||
virtual ~CEmfLogPalette()
|
||||
{
|
||||
if (PaletteEntries)
|
||||
delete[] PaletteEntries;
|
||||
}
|
||||
virtual EEmfObjectType GetType()
|
||||
{
|
||||
return EMF_OBJECT_PALETTE;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
unsigned short NumberOfEntries;
|
||||
TEmfLogPaletteEntry* PaletteEntries;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // _EMF_OBJECTS_H
|
||||
@ -25,9 +25,13 @@ namespace MetaFile
|
||||
virtual void StartPath() = 0;
|
||||
virtual void MoveTo(long lX, long lY) = 0;
|
||||
virtual void LineTo(long lX, long lY) = 0;
|
||||
virtual void CurveTo(long lX1, long lY1, long lX2, long lY2, long lXe, long lYe) = 0;
|
||||
virtual void ArcTo(long lLeft, long lTop, long lRight, long lBottom, double dStartAngle, double dSweepAngle) = 0;
|
||||
virtual void ClosePath() = 0;
|
||||
virtual void DrawPath() = 0;
|
||||
virtual void DrawPath(long lType = 0) = 0;
|
||||
virtual void EndPath() = 0;
|
||||
|
||||
virtual void UpdateDC() = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
182
DesktopEditor/raster/Metafile/Emf/EmfPath.cpp
Normal file
182
DesktopEditor/raster/Metafile/Emf/EmfPath.cpp
Normal file
@ -0,0 +1,182 @@
|
||||
#include "EmfPath.h"
|
||||
#include "EmfOutputDevice.h"
|
||||
|
||||
namespace MetaFile
|
||||
{
|
||||
CEmfPath::CEmfPath()
|
||||
{
|
||||
}
|
||||
CEmfPath::~CEmfPath()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
bool CEmfPath::MoveTo(TEmfPointS& oPoint)
|
||||
{
|
||||
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(long lX, long lY)
|
||||
{
|
||||
CEmfPathCommandBase* pCommand = new CEmfPathMoveTo(lX, lY);
|
||||
if (!pCommand)
|
||||
return false;
|
||||
|
||||
m_pCommands.push_back(pCommand);
|
||||
|
||||
return true;
|
||||
}
|
||||
bool CEmfPath::LineTo(TEmfPointS& oPoint)
|
||||
{
|
||||
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);
|
||||
if (!pCommand)
|
||||
return false;
|
||||
|
||||
m_pCommands.push_back(pCommand);
|
||||
|
||||
return true;
|
||||
}
|
||||
bool CEmfPath::LineTo(long lX, long lY)
|
||||
{
|
||||
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(long lX1, long lY1, long lX2, long lY2, long lXE, long lYE)
|
||||
{
|
||||
CEmfPathCommandBase* pCommand = new CEmfPathCurveTo(lX1, lY1, lX2, lY2, lXE, lYE);
|
||||
if (!pCommand)
|
||||
return false;
|
||||
|
||||
m_pCommands.push_back(pCommand);
|
||||
|
||||
return true;
|
||||
}
|
||||
bool CEmfPath::ArcTo(long lL, long lT, long lR, long lB, double dStart, double dSweep)
|
||||
{
|
||||
CEmfPathCommandBase* pCommand = new CEmfPathArcTo(lL, lT, lR, lB, dStart, dSweep);
|
||||
if (!pCommand)
|
||||
return false;
|
||||
|
||||
m_pCommands.push_back(pCommand);
|
||||
|
||||
return true;
|
||||
}
|
||||
bool CEmfPath::Close()
|
||||
{
|
||||
CEmfPathCommandBase* pCommand = new CEmfPathClose();
|
||||
if (!pCommand)
|
||||
return false;
|
||||
|
||||
m_pCommands.push_back(pCommand);
|
||||
|
||||
return true;
|
||||
}
|
||||
void CEmfPath::Draw(CEmfOutputDevice* pOutput, bool bStroke, bool bFill)
|
||||
{
|
||||
if (pOutput)
|
||||
{
|
||||
pOutput->StartPath();
|
||||
|
||||
for (unsigned long ulIndex = 0; ulIndex < m_pCommands.size(); ulIndex++)
|
||||
{
|
||||
CEmfPathCommandBase* pCommand = m_pCommands.at(ulIndex);
|
||||
switch (pCommand->GetType())
|
||||
{
|
||||
case EMF_PATHCOMMAND_MOVETO:
|
||||
{
|
||||
CEmfPathMoveTo* pMoveTo = (CEmfPathMoveTo*)pCommand;
|
||||
pOutput->MoveTo(pMoveTo->x, pMoveTo->y);
|
||||
break;
|
||||
}
|
||||
case EMF_PATHCOMMAND_LINETO:
|
||||
{
|
||||
CEmfPathLineTo* pLineTo = (CEmfPathLineTo*)pCommand;
|
||||
pOutput->LineTo(pLineTo->x, pLineTo->y);
|
||||
break;
|
||||
}
|
||||
case EMF_PATHCOMMAND_CURVETO:
|
||||
{
|
||||
CEmfPathCurveTo* pCurveTo = (CEmfPathCurveTo*)pCommand;
|
||||
pOutput->CurveTo(pCurveTo->x1, pCurveTo->y1, pCurveTo->x2, pCurveTo->y2, pCurveTo->xE, pCurveTo->yE);
|
||||
break;
|
||||
}
|
||||
case EMF_PATHCOMMAND_ARCTO:
|
||||
{
|
||||
CEmfPathArcTo* pArcTo = (CEmfPathArcTo*)pCommand;
|
||||
pOutput->ArcTo(pArcTo->left, pArcTo->top, pArcTo->right, pArcTo->bottom, pArcTo->start, pArcTo->sweep);
|
||||
break;
|
||||
}
|
||||
case EMF_PATHCOMMAND_CLOSE:
|
||||
{
|
||||
pOutput->ClosePath();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
long lType = (bStroke ? 1 : 0) + (bFill ? 2 : 0);
|
||||
pOutput->DrawPath(lType);
|
||||
pOutput->EndPath();
|
||||
|
||||
Clear();
|
||||
}
|
||||
}
|
||||
void CEmfPath::Clear()
|
||||
{
|
||||
for (unsigned long ulIndex = 0; ulIndex < m_pCommands.size(); ulIndex++)
|
||||
{
|
||||
CEmfPathCommandBase* pCommand = m_pCommands.at(ulIndex);
|
||||
delete pCommand;
|
||||
}
|
||||
m_pCommands.clear();
|
||||
}
|
||||
}
|
||||
218
DesktopEditor/raster/Metafile/Emf/EmfPath.h
Normal file
218
DesktopEditor/raster/Metafile/Emf/EmfPath.h
Normal file
@ -0,0 +1,218 @@
|
||||
#ifndef _EMF_PATH_H
|
||||
#define _EMF_PATH_H
|
||||
|
||||
#include "EmfTypes.h"
|
||||
#include "../Wmf/WmfTypes.h"
|
||||
#include <vector>
|
||||
|
||||
namespace MetaFile
|
||||
{
|
||||
class CEmfOutputDevice;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
EMF_PATHCOMMAND_UNKNOWN = 0x00,
|
||||
EMF_PATHCOMMAND_MOVETO = 0x01,
|
||||
EMF_PATHCOMMAND_LINETO = 0x02,
|
||||
EMF_PATHCOMMAND_CURVETO = 0x03,
|
||||
EMF_PATHCOMMAND_ARCTO = 0x04,
|
||||
EMF_PATHCOMMAND_CLOSE = 0x05
|
||||
} EEmfPathCommandType;
|
||||
|
||||
class CEmfPathCommandBase
|
||||
{
|
||||
public:
|
||||
CEmfPathCommandBase()
|
||||
{
|
||||
}
|
||||
virtual ~CEmfPathCommandBase()
|
||||
{
|
||||
}
|
||||
virtual EEmfPathCommandType GetType() = 0;
|
||||
};
|
||||
class CEmfPathMoveTo : public CEmfPathCommandBase
|
||||
{
|
||||
public:
|
||||
CEmfPathMoveTo(TEmfPointL& oPoint)
|
||||
{
|
||||
x = oPoint.x;
|
||||
y = oPoint.y;
|
||||
}
|
||||
CEmfPathMoveTo(TEmfPointS& oPoint)
|
||||
{
|
||||
x = oPoint.x;
|
||||
y = oPoint.y;
|
||||
}
|
||||
CEmfPathMoveTo(long lX, long lY)
|
||||
{
|
||||
x = lX;
|
||||
y = lY;
|
||||
}
|
||||
virtual ~CEmfPathMoveTo()
|
||||
{
|
||||
}
|
||||
virtual EEmfPathCommandType GetType()
|
||||
{
|
||||
return EMF_PATHCOMMAND_MOVETO;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
long x;
|
||||
long y;
|
||||
};
|
||||
class CEmfPathLineTo : public CEmfPathCommandBase
|
||||
{
|
||||
public:
|
||||
CEmfPathLineTo(TEmfPointL& oPoint)
|
||||
{
|
||||
x = oPoint.x;
|
||||
y = oPoint.y;
|
||||
}
|
||||
CEmfPathLineTo(TEmfPointS& oPoint)
|
||||
{
|
||||
x = oPoint.x;
|
||||
y = oPoint.y;
|
||||
}
|
||||
CEmfPathLineTo(long lX, long lY)
|
||||
{
|
||||
x = lX;
|
||||
y = lY;
|
||||
}
|
||||
virtual ~CEmfPathLineTo()
|
||||
{
|
||||
}
|
||||
virtual EEmfPathCommandType GetType()
|
||||
{
|
||||
return EMF_PATHCOMMAND_LINETO;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
long x;
|
||||
long y;
|
||||
};
|
||||
class CEmfPathCurveTo : public CEmfPathCommandBase
|
||||
{
|
||||
public:
|
||||
CEmfPathCurveTo(TEmfPointL& oPoint1, TEmfPointL& oPoint2, TEmfPointL& oPointE)
|
||||
{
|
||||
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(long lX1, long lY1, long lX2, long lY2, long lXE, long lYE)
|
||||
{
|
||||
x1 = lX1;
|
||||
y1 = lY1;
|
||||
x2 = lX2;
|
||||
y2 = lY2;
|
||||
xE = lXE;
|
||||
yE = lYE;
|
||||
}
|
||||
virtual ~CEmfPathCurveTo()
|
||||
{
|
||||
}
|
||||
virtual EEmfPathCommandType GetType()
|
||||
{
|
||||
return EMF_PATHCOMMAND_CURVETO;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
long x1;
|
||||
long y1;
|
||||
long x2;
|
||||
long y2;
|
||||
long xE;
|
||||
long yE;
|
||||
};
|
||||
class CEmfPathArcTo : public CEmfPathCommandBase
|
||||
{
|
||||
public:
|
||||
CEmfPathArcTo(long lL, long lT, long lR, long lB, double dStart, double dSweep)
|
||||
{
|
||||
left = lL;
|
||||
top = lT;
|
||||
right = lR;
|
||||
bottom = lB;
|
||||
start = dStart;
|
||||
sweep = dSweep;
|
||||
}
|
||||
virtual ~CEmfPathArcTo()
|
||||
{
|
||||
}
|
||||
virtual EEmfPathCommandType GetType()
|
||||
{
|
||||
return EMF_PATHCOMMAND_ARCTO;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
long left;
|
||||
long top;
|
||||
long right;
|
||||
long bottom;
|
||||
double start;
|
||||
double sweep;
|
||||
};
|
||||
class CEmfPathClose : public CEmfPathCommandBase
|
||||
{
|
||||
public:
|
||||
CEmfPathClose()
|
||||
{
|
||||
}
|
||||
virtual ~CEmfPathClose()
|
||||
{
|
||||
}
|
||||
virtual EEmfPathCommandType GetType()
|
||||
{
|
||||
return EMF_PATHCOMMAND_CLOSE;
|
||||
}
|
||||
|
||||
public:
|
||||
};
|
||||
|
||||
class CEmfPath
|
||||
{
|
||||
public:
|
||||
|
||||
CEmfPath();
|
||||
~CEmfPath();
|
||||
|
||||
bool MoveTo(TEmfPointS& oPoint);
|
||||
bool MoveTo(TEmfPointL& oPoint);
|
||||
bool MoveTo(long lX, long lY);
|
||||
bool LineTo(TEmfPointS& oPoint);
|
||||
bool LineTo(TEmfPointL& oPoint);
|
||||
bool LineTo(long lX, long lY);
|
||||
bool CurveTo(TEmfPointS& oPoint1, TEmfPointS& oPoint2, TEmfPointS& oPointE);
|
||||
bool CurveTo(TEmfPointL& oPoint1, TEmfPointL& oPoint2, TEmfPointL& oPointE);
|
||||
bool CurveTo(long lX1, long lY1, long lX2, long lY2, long lXE, long lYE);
|
||||
bool ArcTo(long lL, long lT, long lR, long lB, double dStart, double dSweep);
|
||||
bool Close();
|
||||
void Draw(CEmfOutputDevice* pOutput, bool bStroke, bool bFill);
|
||||
|
||||
private:
|
||||
|
||||
void Clear();
|
||||
|
||||
public:
|
||||
|
||||
std::vector<CEmfPathCommandBase*> m_pCommands;
|
||||
};
|
||||
}
|
||||
|
||||
#endif //_EMF_PATH_H
|
||||
@ -14,6 +14,8 @@ namespace MetaFile
|
||||
|
||||
m_pDC = pDC;
|
||||
m_vDCStack.push_back(pDC);
|
||||
|
||||
InitStockObjects();
|
||||
};
|
||||
CEmfPlayer::~CEmfPlayer()
|
||||
{
|
||||
@ -22,6 +24,7 @@ namespace MetaFile
|
||||
CEmfDC* pDC = m_vDCStack.at(nIndex);
|
||||
delete pDC;
|
||||
}
|
||||
m_vDCStack.clear();
|
||||
|
||||
for (CEmfObjectMap::iterator oIterator = m_mObjects.begin(); oIterator != m_mObjects.end(); oIterator++)
|
||||
{
|
||||
@ -37,6 +40,7 @@ namespace MetaFile
|
||||
CEmfDC* pDC = m_vDCStack.at(nIndex);
|
||||
delete pDC;
|
||||
}
|
||||
m_vDCStack.clear();
|
||||
|
||||
for (CEmfObjectMap::iterator oIterator = m_mObjects.begin(); oIterator != m_mObjects.end(); oIterator++)
|
||||
{
|
||||
@ -54,6 +58,7 @@ namespace MetaFile
|
||||
|
||||
m_pDC = pDC;
|
||||
m_vDCStack.push_back(pDC);
|
||||
InitStockObjects();
|
||||
}
|
||||
CEmfDC* CEmfPlayer::SaveDC()
|
||||
{
|
||||
@ -113,20 +118,119 @@ namespace MetaFile
|
||||
{
|
||||
CEmfObjectBase* pObject = oPos->second;
|
||||
|
||||
switch (pObject->GetType())
|
||||
for (int nIndex = 0; nIndex < m_vDCStack.size(); nIndex++)
|
||||
{
|
||||
case EMF_OBJECT_BRUSH: m_pDC->SetBrush((CEmfLogBrushEx*)pObject); break;
|
||||
case EMF_OBJECT_FONT: m_pDC->SetFont((CEmfLogFont*)pObject); break;
|
||||
case EMF_OBJECT_PEN: m_pDC->SetPen((CEmfLogPen*)pObject); break;
|
||||
CEmfDC* pDC = m_vDCStack.at(nIndex);
|
||||
|
||||
switch (pObject->GetType())
|
||||
{
|
||||
case EMF_OBJECT_BRUSH: m_pDC->SetBrush((CEmfLogBrushEx*)pObject); break;
|
||||
case EMF_OBJECT_FONT: m_pDC->SetFont((CEmfLogFont*)pObject); break;
|
||||
case EMF_OBJECT_PEN: m_pDC->SetPen((CEmfLogPen*)pObject); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void CEmfPlayer::SelectPalette(unsigned long ulIndex)
|
||||
{
|
||||
// DEFAULT_PALETTE
|
||||
if (ulIndex == 0x8000000F)
|
||||
m_pDC->SetPalette(NULL);
|
||||
|
||||
CEmfObjectMap::const_iterator oPos = m_mObjects.find(ulIndex);
|
||||
if (m_mObjects.end() != oPos)
|
||||
{
|
||||
CEmfObjectBase* pObject = oPos->second;
|
||||
if (EMF_OBJECT_PALETTE == pObject->GetType())
|
||||
m_pDC->SetPalette((CEmfLogPalette*)pObject);
|
||||
}
|
||||
}
|
||||
void CEmfPlayer::DeleteObject(unsigned long ulIndex)
|
||||
{
|
||||
// TODO: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> DC_BRUSH <20> DC_PEN
|
||||
|
||||
CEmfObjectMap::const_iterator oPos = m_mObjects.find(ulIndex);
|
||||
if (m_mObjects.end() != oPos)
|
||||
{
|
||||
CEmfObjectBase* pObject = oPos->second;
|
||||
|
||||
switch (pObject->GetType())
|
||||
{
|
||||
case EMF_OBJECT_BRUSH: m_pDC->RemoveBrush((CEmfLogBrushEx*)pObject); break;
|
||||
case EMF_OBJECT_FONT: m_pDC->RemoveFont((CEmfLogFont*)pObject); break;
|
||||
case EMF_OBJECT_PEN: m_pDC->RemovePen((CEmfLogPen*)pObject); break;
|
||||
}
|
||||
|
||||
delete pObject;
|
||||
m_mObjects.erase(ulIndex);
|
||||
}
|
||||
}
|
||||
void CEmfPlayer::InitStockObjects()
|
||||
{
|
||||
InitStockBrush(false, 0xff, 0xff, 0xff, 0x80000000);
|
||||
InitStockBrush(false, 0xc0, 0xc0, 0xc0, 0x80000001);
|
||||
InitStockBrush(false, 0x80, 0x80, 0x80, 0x80000002);
|
||||
InitStockBrush(false, 0x40, 0x40, 0x40, 0x80000003);
|
||||
InitStockBrush(false, 0x00, 0x00, 0x00, 0x80000004);
|
||||
InitStockBrush(true, 0x00, 0x00, 0x00, 0x80000005);
|
||||
InitStockPen(false, 0xff, 0xff, 0xff, 0x80000006);
|
||||
InitStockPen(false, 0x00, 0x00, 0x00, 0x80000007);
|
||||
InitStockPen(true, 0x00, 0x00, 0x00, 0x80000008);
|
||||
// TODO: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// DC_BRUSH <20> DC_PEN <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
void CEmfPlayer::InitStockBrush(bool bNull, unsigned char r, unsigned char g, unsigned char b, unsigned long ulIndex)
|
||||
{
|
||||
CEmfLogBrushEx* pBrush = new CEmfLogBrushEx();
|
||||
if (!pBrush)
|
||||
return;
|
||||
|
||||
if (bNull)
|
||||
pBrush->BrushStyle = BS_NULL;
|
||||
else
|
||||
{
|
||||
pBrush->BrushStyle = BS_SOLID;
|
||||
pBrush->Color.Set(r, g, b);
|
||||
}
|
||||
|
||||
RegisterObject(ulIndex, (CEmfObjectBase*)pBrush);
|
||||
}
|
||||
void CEmfPlayer::InitStockPen(bool bNull, unsigned char r, unsigned char g, unsigned char b, unsigned long ulIndex)
|
||||
{
|
||||
CEmfLogPen* pPen = new CEmfLogPen();
|
||||
if (!pPen)
|
||||
return;
|
||||
|
||||
if (bNull)
|
||||
pPen->PenStyle = PS_NULL;
|
||||
else
|
||||
{
|
||||
pPen->PenStyle = PS_COSMETIC | PS_SOLID;
|
||||
pPen->Color.Set(r, g, b);
|
||||
}
|
||||
|
||||
RegisterObject(ulIndex, (CEmfObjectBase*)pPen);
|
||||
}
|
||||
|
||||
CEmfDC::CEmfDC()
|
||||
{
|
||||
m_ulMapMode = MM_TEXT;
|
||||
m_pBrush = &m_oDefaultBrush;
|
||||
m_pPen = &m_oDefaultPen;
|
||||
m_pFont = NULL;
|
||||
m_oTransform.Init();
|
||||
m_oTextColor.Init();
|
||||
m_pBrush = NULL;
|
||||
m_oBgColor.Init();
|
||||
m_ulTextAlign = 0;
|
||||
m_ulBgMode = 0;
|
||||
m_ulMiterLimit = 0;
|
||||
m_ulFillMode = 0;
|
||||
m_ulStretchMode = 0;
|
||||
m_oWindow.Init();
|
||||
m_oViewport.Init();
|
||||
m_dPixelHeight = 1;
|
||||
m_dPixelWidth = 1;
|
||||
m_pPen = NULL;
|
||||
m_pFont = NULL;
|
||||
}
|
||||
@ -139,19 +243,83 @@ namespace MetaFile
|
||||
if (!pNewDC)
|
||||
return NULL;
|
||||
|
||||
pNewDC->m_ulMapMode = m_ulMapMode;
|
||||
pNewDC->m_pBrush = m_pBrush;
|
||||
pNewDC->m_pPen = m_pPen;
|
||||
pNewDC->m_pFont = m_pFont;
|
||||
pNewDC->m_oTransform.Copy(&m_oTransform);
|
||||
pNewDC->m_oTextColor.Copy(&m_oTextColor);
|
||||
pNewDC->m_oBgColor.Copy(&m_oBgColor);
|
||||
pNewDC->m_pBrush = m_pBrush;
|
||||
pNewDC->m_pFont = m_pFont;
|
||||
pNewDC->m_pPen = m_pPen;
|
||||
pNewDC->m_ulTextAlign = m_ulTextAlign;
|
||||
pNewDC->m_ulBgMode = m_ulBgMode;
|
||||
pNewDC->m_ulMiterLimit = m_ulMiterLimit;
|
||||
pNewDC->m_ulFillMode = m_ulFillMode;
|
||||
pNewDC->m_ulTextAlign = m_ulTextAlign;
|
||||
pNewDC->m_ulBgMode = m_ulBgMode;
|
||||
pNewDC->m_ulMiterLimit = m_ulMiterLimit;
|
||||
pNewDC->m_ulFillMode = m_ulFillMode;
|
||||
pNewDC->m_ulStretchMode = m_ulStretchMode;
|
||||
pNewDC->m_oWindow.Copy(&m_oWindow);
|
||||
pNewDC->m_oViewport.Copy(&m_oViewport);
|
||||
pNewDC->m_dPixelHeight = m_dPixelHeight;
|
||||
pNewDC->m_dPixelWidth = m_dPixelWidth;
|
||||
|
||||
return pNewDC;
|
||||
}
|
||||
void CEmfDC::SetMapMode(unsigned long ulMapMode)
|
||||
{
|
||||
m_ulMapMode = ulMapMode;
|
||||
|
||||
switch (ulMapMode)
|
||||
{
|
||||
case MM_TEXT: // 1 unit = 1pt
|
||||
{
|
||||
SetPixelWidth(1);
|
||||
SetPixelHeight(1);
|
||||
break;
|
||||
}
|
||||
case MM_LOMETRIC: // 1 unit = 0.1mm
|
||||
{
|
||||
double dPixel = 0.1 * 72 / 25.4;
|
||||
SetPixelWidth(dPixel);
|
||||
SetPixelHeight(dPixel);
|
||||
break;
|
||||
}
|
||||
case MM_HIMETRIC: // 1 unit = 0.01mm
|
||||
{
|
||||
double dPixel = 0.01 * 72 / 25.4;
|
||||
SetPixelWidth(dPixel);
|
||||
SetPixelHeight(dPixel);
|
||||
break;
|
||||
}
|
||||
case MM_LOENGLISH: // 1 unit = 0.01 inch
|
||||
{
|
||||
double dPixel = 0.01 * 72;
|
||||
SetPixelWidth(dPixel);
|
||||
SetPixelHeight(dPixel);
|
||||
break;
|
||||
}
|
||||
case MM_HIENGLISH: // 1 unit = 0.001 inch
|
||||
{
|
||||
double dPixel = 0.001 * 72;
|
||||
SetPixelWidth(dPixel);
|
||||
SetPixelHeight(dPixel);
|
||||
break;
|
||||
}
|
||||
case MM_TWIPS: // 1 unit = 1/1440 inch
|
||||
{
|
||||
SetPixelWidth(0.05);
|
||||
SetPixelHeight(0.05);
|
||||
break;
|
||||
}
|
||||
case MM_ISOTROPIC:
|
||||
case MM_ANISOTROPIC:
|
||||
{
|
||||
UpdatePixelMetrics();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
unsigned long CEmfDC::GetMapMode()
|
||||
{
|
||||
return m_ulMapMode;
|
||||
}
|
||||
TEmfXForm* CEmfDC::GetTransform()
|
||||
{
|
||||
return &m_oTransform;
|
||||
@ -168,6 +336,11 @@ namespace MetaFile
|
||||
{
|
||||
m_pBrush = pBrush;
|
||||
}
|
||||
void CEmfDC::RemoveBrush(CEmfLogBrushEx* pBrush)
|
||||
{
|
||||
if (pBrush == m_pBrush)
|
||||
m_pBrush = NULL;
|
||||
}
|
||||
CEmfLogBrushEx* CEmfDC::GetBrush()
|
||||
{
|
||||
return m_pBrush;
|
||||
@ -176,6 +349,11 @@ namespace MetaFile
|
||||
{
|
||||
m_pFont = pFont;
|
||||
}
|
||||
void CEmfDC::RemoveFont(CEmfLogFont* pFont)
|
||||
{
|
||||
if (pFont == m_pFont)
|
||||
m_pFont = NULL;
|
||||
}
|
||||
CEmfLogFont* CEmfDC::GetFont()
|
||||
{
|
||||
return m_pFont;
|
||||
@ -224,9 +402,113 @@ namespace MetaFile
|
||||
{
|
||||
m_pPen = pPen;
|
||||
}
|
||||
void CEmfDC::RemovePen(CEmfLogPen* pPen)
|
||||
{
|
||||
if (pPen == m_pPen)
|
||||
m_pPen = NULL;
|
||||
}
|
||||
CEmfLogPen* CEmfDC::GetPen()
|
||||
{
|
||||
return m_pPen;
|
||||
}
|
||||
void CEmfDC::SetStretchMode(unsigned long& oMode)
|
||||
{
|
||||
m_ulStretchMode = oMode;
|
||||
}
|
||||
unsigned long CEmfDC::GetStretchMode()
|
||||
{
|
||||
return m_ulStretchMode;
|
||||
}
|
||||
double CEmfDC::GetPixelWidth()
|
||||
{
|
||||
return m_dPixelWidth;
|
||||
}
|
||||
double CEmfDC::GetPixelHeight()
|
||||
{
|
||||
return m_dPixelHeight;
|
||||
}
|
||||
void CEmfDC::SetPixelWidth(double dPixelW)
|
||||
{
|
||||
m_dPixelWidth = dPixelW;
|
||||
}
|
||||
void CEmfDC::SetPixelHeight(double dPixelH)
|
||||
{
|
||||
m_dPixelHeight = dPixelH;
|
||||
}
|
||||
void CEmfDC::SetWindowOrigin(TEmfPointL& oPoint)
|
||||
{
|
||||
m_oWindow.lX = oPoint.x;
|
||||
m_oWindow.lY = oPoint.y;
|
||||
UpdatePixelMetrics();
|
||||
}
|
||||
void CEmfDC::SetWindowExtents(TEmfSizeL& oPoint)
|
||||
{
|
||||
m_oWindow.ulW = oPoint.cx;
|
||||
m_oWindow.ulH = oPoint.cy;
|
||||
UpdatePixelMetrics();
|
||||
}
|
||||
TEmfWindow* CEmfDC::GetWindow()
|
||||
{
|
||||
return &m_oWindow;
|
||||
}
|
||||
void CEmfDC::SetViewportOrigin(TEmfPointL& oPoint)
|
||||
{
|
||||
m_oViewport.lX = oPoint.x;
|
||||
m_oViewport.lY = oPoint.y;
|
||||
UpdatePixelMetrics();
|
||||
}
|
||||
void CEmfDC::SetViewportExtents(TEmfSizeL& oPoint)
|
||||
{
|
||||
m_oViewport.ulW = oPoint.cx;
|
||||
m_oViewport.ulH = oPoint.cy;
|
||||
UpdatePixelMetrics();
|
||||
}
|
||||
TEmfWindow* CEmfDC::GetViewport()
|
||||
{
|
||||
return &m_oViewport;
|
||||
}
|
||||
bool CEmfDC::UpdatePixelMetrics()
|
||||
{
|
||||
unsigned long ulMapMode = m_ulMapMode;
|
||||
if (MM_ISOTROPIC == ulMapMode)
|
||||
{
|
||||
if (0 == m_oWindow.ulW || 0 == m_oViewport.ulW)
|
||||
return false;
|
||||
|
||||
double dPixel = (double)m_oViewport.ulW / (double)m_oWindow.ulW;
|
||||
SetPixelHeight(dPixel);
|
||||
SetPixelWidth(dPixel);
|
||||
}
|
||||
else if (MM_ANISOTROPIC == ulMapMode)
|
||||
{
|
||||
double dPixelX = (double)m_oViewport.ulW / (double)m_oWindow.ulW;
|
||||
double dPixelY = (double)m_oViewport.ulH / (double)m_oWindow.ulH;
|
||||
|
||||
SetPixelWidth(dPixelX);
|
||||
SetPixelHeight(dPixelY);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
void CEmfDC::SetRop2Mode(unsigned long& nMode)
|
||||
{
|
||||
m_ulRop2Mode = nMode;
|
||||
}
|
||||
unsigned long CEmfDC::GetRop2Mode()
|
||||
{
|
||||
return m_ulRop2Mode;
|
||||
}
|
||||
void CEmfDC::SetPalette(CEmfLogPalette* pPalette)
|
||||
{
|
||||
m_pPalette = pPalette;
|
||||
}
|
||||
void CEmfDC::RemovePalette(CEmfLogPalette* pPalette)
|
||||
{
|
||||
if (m_pPalette == pPalette)
|
||||
m_pPalette = NULL;
|
||||
}
|
||||
CEmfLogPalette* CEmfDC::GetPalette()
|
||||
{
|
||||
return m_pPalette;
|
||||
}
|
||||
}
|
||||
@ -23,6 +23,14 @@ namespace MetaFile
|
||||
CEmfDC* GetDC();
|
||||
void RegisterObject(unsigned long ulIndex, CEmfObjectBase* pObject);
|
||||
void SelectObject(unsigned long ulIndex);
|
||||
void DeleteObject(unsigned long ulIndex);
|
||||
void SelectPalette(unsigned long ulIndex);
|
||||
|
||||
private:
|
||||
|
||||
void InitStockObjects();
|
||||
void InitStockBrush(bool bNull, unsigned char r, unsigned char g, unsigned char b, unsigned long ulIndex);
|
||||
void InitStockPen(bool bNull, unsigned char r, unsigned char g, unsigned char b, unsigned long ulIndex);
|
||||
|
||||
private:
|
||||
|
||||
@ -41,12 +49,17 @@ namespace MetaFile
|
||||
CEmfDC();
|
||||
~CEmfDC();
|
||||
CEmfDC* Copy();
|
||||
|
||||
void SetMapMode(unsigned long ulMapMode);
|
||||
unsigned long GetMapMode();
|
||||
TEmfXForm* GetTransform();
|
||||
void SetTextColor(TEmfColor& oColor);
|
||||
TEmfColor& GetTextColor();
|
||||
void SetBrush(CEmfLogBrushEx* pBrush);
|
||||
void RemoveBrush(CEmfLogBrushEx* pBrush);
|
||||
CEmfLogBrushEx* GetBrush();
|
||||
void SetFont(CEmfLogFont* pFont);
|
||||
void RemoveFont(CEmfLogFont* pFont);
|
||||
CEmfLogFont* GetFont();
|
||||
void SetTextAlign(unsigned long ulAlign);
|
||||
unsigned long GetTextAlign();
|
||||
@ -59,13 +72,39 @@ namespace MetaFile
|
||||
void SetFillMode(unsigned long ulFillMode);
|
||||
unsigned long GetFillMode();
|
||||
void SetPen(CEmfLogPen* pPen);
|
||||
void RemovePen(CEmfLogPen* pPen);
|
||||
CEmfLogPen* GetPen();
|
||||
void SetStretchMode(unsigned long& oMode);
|
||||
unsigned long GetStretchMode();
|
||||
double GetPixelWidth();
|
||||
double GetPixelHeight();
|
||||
void SetWindowOrigin(TEmfPointL& oPoint);
|
||||
void SetWindowExtents(TEmfSizeL& oPoint);
|
||||
TEmfWindow* GetWindow();
|
||||
void SetViewportOrigin(TEmfPointL& oPoint);
|
||||
void SetViewportExtents(TEmfSizeL& oPoint);
|
||||
TEmfWindow* GetViewport();
|
||||
void SetRop2Mode(unsigned long& nMode);
|
||||
unsigned long GetRop2Mode();
|
||||
void SetPalette(CEmfLogPalette* pPalette);
|
||||
void RemovePalette(CEmfLogPalette* pPalette);
|
||||
CEmfLogPalette* GetPalette();
|
||||
|
||||
private:
|
||||
|
||||
void SetPixelWidth(double dPixelW);
|
||||
void SetPixelHeight(double dPixelH);
|
||||
bool UpdatePixelMetrics();
|
||||
|
||||
private:
|
||||
|
||||
CEmfLogPen m_oDefaultPen;
|
||||
CEmfLogBrushEx m_oDefaultBrush;
|
||||
unsigned long m_ulMapMode;
|
||||
CEmfLogBrushEx* m_pBrush;
|
||||
CEmfLogPen* m_pPen;
|
||||
CEmfLogFont* m_pFont;
|
||||
CEmfLogPalette* m_pPalette;
|
||||
TEmfXForm m_oTransform;
|
||||
TEmfColor m_oTextColor;
|
||||
TEmfColor m_oBgColor;
|
||||
@ -73,6 +112,12 @@ namespace MetaFile
|
||||
unsigned long m_ulBgMode;
|
||||
unsigned long m_ulMiterLimit;
|
||||
unsigned long m_ulFillMode;
|
||||
unsigned long m_ulStretchMode;
|
||||
unsigned long m_ulRop2Mode;
|
||||
double m_dPixelWidth;
|
||||
double m_dPixelHeight;
|
||||
TEmfWindow m_oWindow;
|
||||
TEmfWindow m_oViewport;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -10,6 +10,27 @@ namespace MetaFile
|
||||
unsigned char b;
|
||||
unsigned char a; //Reserved Must be 0x00
|
||||
|
||||
TEmfColor()
|
||||
{
|
||||
r = 0;
|
||||
g = 0;
|
||||
b = 0;
|
||||
}
|
||||
|
||||
TEmfColor(unsigned char _r, unsigned char _g, unsigned char _b)
|
||||
{
|
||||
r = _r;
|
||||
g = _g;
|
||||
b = _b;
|
||||
}
|
||||
|
||||
void Set(unsigned char _r, unsigned char _g, unsigned char _b)
|
||||
{
|
||||
r = _r;
|
||||
g = _g;
|
||||
b = _b;
|
||||
}
|
||||
|
||||
void Init()
|
||||
{
|
||||
r = 0;
|
||||
@ -35,6 +56,30 @@ namespace MetaFile
|
||||
short shBottom;
|
||||
};
|
||||
|
||||
struct TEmfWindow
|
||||
{
|
||||
long lX;
|
||||
long lY;
|
||||
long ulW;
|
||||
long ulH;
|
||||
|
||||
void Init()
|
||||
{
|
||||
lX = 0;
|
||||
lY = 0;
|
||||
ulW = 1024;
|
||||
ulH = 1024;
|
||||
}
|
||||
|
||||
void Copy(TEmfWindow* pOther)
|
||||
{
|
||||
lX = pOther->lX;
|
||||
lY = pOther->lY;
|
||||
ulW = pOther->ulW;
|
||||
ulH = pOther->ulH;
|
||||
}
|
||||
};
|
||||
|
||||
struct TEmfRectL
|
||||
{
|
||||
long lLeft;
|
||||
@ -43,12 +88,6 @@ namespace MetaFile
|
||||
long lBottom;
|
||||
};
|
||||
|
||||
struct TEmfSizeL
|
||||
{
|
||||
unsigned long ulX;
|
||||
unsigned long ulY;
|
||||
};
|
||||
|
||||
struct TEmfPointL
|
||||
{
|
||||
long x;
|
||||
@ -61,6 +100,18 @@ namespace MetaFile
|
||||
short y;
|
||||
};
|
||||
|
||||
struct TEmfPointD
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
};
|
||||
|
||||
struct TEmfSizeL
|
||||
{
|
||||
unsigned long cx;
|
||||
unsigned long cy;
|
||||
};
|
||||
|
||||
struct TEmfHeader
|
||||
{
|
||||
TEmfRectL oBounds;
|
||||
@ -76,6 +127,7 @@ namespace MetaFile
|
||||
unsigned long ulPalEntries;
|
||||
TEmfSizeL oDevice;
|
||||
TEmfSizeL oMillimeters;
|
||||
TEmfRectL oFrameToBounds;
|
||||
};
|
||||
|
||||
struct TEmfStretchDIBITS
|
||||
@ -201,19 +253,19 @@ namespace MetaFile
|
||||
|
||||
struct TEmfLogFont
|
||||
{
|
||||
long Height;
|
||||
long Width;
|
||||
long Escapement;
|
||||
long Orientation;
|
||||
long Weight;
|
||||
unsigned char Italic;
|
||||
unsigned char Underline;
|
||||
unsigned char StrikOut;
|
||||
unsigned char CharSet;
|
||||
unsigned char OutPrecision;
|
||||
unsigned char ClipPrecision;
|
||||
unsigned char Quality;
|
||||
unsigned char PitchAndFamily;
|
||||
long Height;
|
||||
long Width;
|
||||
long Escapement;
|
||||
long Orientation;
|
||||
long Weight;
|
||||
unsigned char Italic;
|
||||
unsigned char Underline;
|
||||
unsigned char StrikOut;
|
||||
unsigned char CharSet;
|
||||
unsigned char OutPrecision;
|
||||
unsigned char ClipPrecision;
|
||||
unsigned char Quality;
|
||||
unsigned char PitchAndFamily;
|
||||
unsigned short FaceName[32];
|
||||
};
|
||||
|
||||
@ -250,5 +302,40 @@ namespace MetaFile
|
||||
unsigned long offBitsSrc;
|
||||
unsigned long cbBitsSrc;
|
||||
};
|
||||
|
||||
struct TEmfSetDiBitsToDevice
|
||||
{
|
||||
TEmfRectL Bounds;
|
||||
long xDest;
|
||||
long yDest;
|
||||
long xSrc;
|
||||
long ySrc;
|
||||
long cxSrc;
|
||||
long cySrc;
|
||||
unsigned long offBmiSrc;
|
||||
unsigned long cbBmiSrc;
|
||||
unsigned long offBitsSrc;
|
||||
unsigned long cbBitsSrc;
|
||||
unsigned long UsageSrc;
|
||||
unsigned long iStartScan;
|
||||
unsigned long cScans;
|
||||
};
|
||||
|
||||
struct TEmfDibPatternBrush
|
||||
{
|
||||
unsigned long Usage;
|
||||
unsigned long offBmi;
|
||||
unsigned long cbBmi;
|
||||
unsigned long offBits;
|
||||
unsigned long cbBits;
|
||||
};
|
||||
|
||||
struct TEmfLogPaletteEntry
|
||||
{
|
||||
unsigned char Reserved;
|
||||
unsigned char Blue;
|
||||
unsigned char Green;
|
||||
unsigned char Red;
|
||||
};
|
||||
};
|
||||
#endif //_EMF_TYPES_H
|
||||
@ -33,13 +33,16 @@ namespace MetaFile
|
||||
|
||||
m_pRenderer = pRenderer;
|
||||
|
||||
long lL = m_pEmfFile->m_oHeader.oBounds.lLeft;
|
||||
long lR = m_pEmfFile->m_oHeader.oBounds.lRight;
|
||||
long lT = m_pEmfFile->m_oHeader.oBounds.lTop;
|
||||
long lB = m_pEmfFile->m_oHeader.oBounds.lBottom;
|
||||
TEmfRectL* pBounds = m_pEmfFile->GetDCBounds();
|
||||
long lL = pBounds->lLeft;
|
||||
long lR = pBounds->lRight;
|
||||
long lT = pBounds->lTop;
|
||||
long lB = pBounds->lBottom;
|
||||
|
||||
m_dScaleX = (lR - lL <= 0) ? 1 : m_dW / (double)(lR - lL);
|
||||
m_dScaleY = (lB - lT <= 0) ? 1 : m_dH / (double)(lB - lT);
|
||||
|
||||
m_bStartedPath = false;
|
||||
}
|
||||
~CEmfRendererOutput()
|
||||
{
|
||||
@ -50,10 +53,13 @@ namespace MetaFile
|
||||
}
|
||||
void End()
|
||||
{
|
||||
CheckEndPath();
|
||||
}
|
||||
|
||||
void DrawBitmap(long lX, long lY, long lW, long lH, BYTE* pBuffer, unsigned long ulWidth, unsigned long ulHeight)
|
||||
{
|
||||
CheckEndPath();
|
||||
|
||||
UpdateTransform();
|
||||
|
||||
Aggplus::CImage oImage;
|
||||
@ -79,6 +85,8 @@ namespace MetaFile
|
||||
}
|
||||
void DrawText(const wchar_t* wsText, unsigned long ulCharsCount, long lX, long lY)
|
||||
{
|
||||
CheckEndPath();
|
||||
|
||||
UpdateTransform();
|
||||
|
||||
CEmfDC* pDC = m_pEmfFile->GetDC();
|
||||
@ -271,45 +279,124 @@ namespace MetaFile
|
||||
|
||||
m_pRenderer->BeginCommand(c_nPathType);
|
||||
m_pRenderer->PathCommandStart();
|
||||
|
||||
m_bStartedPath = true;
|
||||
}
|
||||
void MoveTo(long lX, long lY)
|
||||
{
|
||||
CheckStartPath();
|
||||
|
||||
double dX = TransX(lX);
|
||||
double dY = TransY(lY);
|
||||
m_pRenderer->PathCommandMoveTo(dX, dY);
|
||||
}
|
||||
void LineTo(long lX, long lY)
|
||||
{
|
||||
CheckStartPath();
|
||||
|
||||
double dX = TransX(lX);
|
||||
double dY = TransY(lY);
|
||||
m_pRenderer->PathCommandLineTo(dX, dY);
|
||||
}
|
||||
void CurveTo(long lX1, long lY1, long lX2, long lY2, long lXe, long lYe)
|
||||
{
|
||||
CheckStartPath();
|
||||
|
||||
double dX1 = TransX(lX1), dX2 = TransX(lX2), dXe = TransX(lXe);
|
||||
double dY1 = TransY(lY1), dY2 = TransY(lY2), dYe = TransY(lYe);
|
||||
m_pRenderer->PathCommandCurveTo(dX1, dY1, dX2, dY2, dXe, dYe);
|
||||
}
|
||||
void ArcTo(long lLeft, long lTop, long lRight, long lBottom, double dStart, double dSweep)
|
||||
{
|
||||
CheckStartPath();
|
||||
|
||||
double dL = TransX(lLeft);
|
||||
double dT = TransY(lTop);
|
||||
double dR = TransX(lRight);
|
||||
double dB = TransY(lBottom);
|
||||
|
||||
m_pRenderer->PathCommandArcTo(dL, dT, dR - dL, dB - dT, dStart, dSweep);
|
||||
}
|
||||
void ClosePath()
|
||||
{
|
||||
CheckStartPath();
|
||||
|
||||
m_pRenderer->PathCommandClose();
|
||||
}
|
||||
void DrawPath()
|
||||
void DrawPath(long lType = 0)
|
||||
{
|
||||
if (-1 != m_lDrawPathType)
|
||||
m_pRenderer->DrawPath(m_lDrawPathType);
|
||||
if (lType <= 0)
|
||||
{
|
||||
if (-1 != m_lDrawPathType)
|
||||
m_pRenderer->DrawPath(m_lDrawPathType);
|
||||
}
|
||||
else if (-1 != m_lDrawPathType)
|
||||
{
|
||||
bool bStroke = lType & 1 ? true : false;
|
||||
bool bFill = lType & 2 ? true : false;
|
||||
|
||||
long m_lEndType = -1;
|
||||
|
||||
if (bStroke && m_lDrawPathType & c_nStroke)
|
||||
m_lEndType = c_nStroke;
|
||||
else
|
||||
m_lEndType = c_nStroke;
|
||||
|
||||
if (bFill)
|
||||
{
|
||||
if (m_lDrawPathType & c_nWindingFillMode)
|
||||
m_lEndType = (-1 == m_lDrawPathType ? c_nWindingFillMode : m_lDrawPathType | c_nWindingFillMode);
|
||||
else if (m_lDrawPathType & c_nEvenOddFillMode)
|
||||
m_lEndType = (-1 == m_lDrawPathType ? c_nEvenOddFillMode : m_lDrawPathType | c_nEvenOddFillMode);
|
||||
}
|
||||
|
||||
if (-1 != m_lEndType)
|
||||
m_pRenderer->DrawPath(m_lEndType);
|
||||
}
|
||||
}
|
||||
void EndPath()
|
||||
{
|
||||
m_pRenderer->EndCommand(c_nPathType);
|
||||
m_pRenderer->PathCommandEnd();
|
||||
|
||||
m_bStartedPath = false;
|
||||
}
|
||||
void UpdateDC()
|
||||
{
|
||||
CheckEndPath();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
double TransX(long lX)
|
||||
void CheckStartPath()
|
||||
{
|
||||
long lL = m_pEmfFile->m_oHeader.oBounds.lLeft;
|
||||
return m_dScaleX * (double)(lX - lL);
|
||||
if (!m_bStartedPath)
|
||||
{
|
||||
StartPath();
|
||||
}
|
||||
}
|
||||
double TransY(long lY)
|
||||
void CheckEndPath()
|
||||
{
|
||||
long lT = m_pEmfFile->m_oHeader.oBounds.lTop;
|
||||
return m_dScaleY * (double)(lY - lT);
|
||||
if (m_bStartedPath)
|
||||
{
|
||||
DrawPath();
|
||||
EndPath();
|
||||
}
|
||||
}
|
||||
|
||||
double TransX(long _lX)
|
||||
{
|
||||
long lX = m_pEmfFile->TranslateY(_lX);
|
||||
TEmfRectL* pBounds = m_pEmfFile->GetDCBounds();
|
||||
long lL = pBounds->lLeft;
|
||||
return m_dScaleX * (double)(lX - lL) + m_dX;
|
||||
}
|
||||
double TransY(long _lY)
|
||||
{
|
||||
long lY = m_pEmfFile->TranslateY(_lY);
|
||||
TEmfRectL* pBounds = m_pEmfFile->GetDCBounds();
|
||||
long lT = pBounds->lTop;
|
||||
return m_dScaleY * (double)(lY - lT) + m_dY;
|
||||
}
|
||||
|
||||
bool UpdateBrush()
|
||||
@ -325,11 +412,17 @@ namespace MetaFile
|
||||
long lColor = METAFILE_RGBA(pBrush->Color.r, pBrush->Color.g, pBrush->Color.b);
|
||||
|
||||
if (BS_NULL == pBrush->BrushStyle)
|
||||
return false;
|
||||
return false;
|
||||
else if (BS_DIBPATTERN == pBrush->BrushStyle)
|
||||
{
|
||||
m_pRenderer->put_BrushType(c_BrushTypeTexture);
|
||||
m_pRenderer->put_BrushTextureMode(c_BrushTextureModeTile);
|
||||
m_pRenderer->put_BrushTexturePath(pBrush->DibPatternPath);
|
||||
}
|
||||
else //if (BS_SOLID == pBrush->BrushStyle)
|
||||
{
|
||||
m_pRenderer->put_BrushColor1(lColor);
|
||||
m_pRenderer->put_BrushAlpha1(255);
|
||||
m_pRenderer->put_BrushAlpha1(pBrush->BrushAlpha);
|
||||
m_pRenderer->put_BrushType(c_BrushTypeSolid);
|
||||
}
|
||||
|
||||
@ -345,7 +438,6 @@ namespace MetaFile
|
||||
double dKoefY = m_dScaleY;
|
||||
|
||||
TEmfXForm* pMatrix = pDC->GetTransform();
|
||||
|
||||
m_pRenderer->ResetTransform();
|
||||
m_pRenderer->SetTransform(pMatrix->M11, pMatrix->M12 * dKoefY / dKoefX, pMatrix->M21 * dKoefX / dKoefY, pMatrix->M22, pMatrix->Dx * dKoefX, pMatrix->Dy * dKoefY);
|
||||
}
|
||||
@ -362,7 +454,7 @@ namespace MetaFile
|
||||
long lColor = METAFILE_RGBA(pPen->Color.r, pPen->Color.g, pPen->Color.b);
|
||||
|
||||
// TODO: dWidth <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> PS_GEOMETRIC <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
double dWidth = pPen->Width * m_dScaleX;
|
||||
double dWidth = pPen->Width * m_dScaleX * pDC->GetPixelWidth();
|
||||
if (dWidth <= 0.01)
|
||||
dWidth = 0;
|
||||
|
||||
@ -391,13 +483,13 @@ namespace MetaFile
|
||||
|
||||
// TODO: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD> PS_SOLID.
|
||||
// TODO: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> PS_USERSTYLE
|
||||
unsigned long ulDashStyle;
|
||||
BYTE nDashStyle;
|
||||
if (PS_ALTERNATE == ulPenStyle || PS_USERSTYLE == ulPenStyle || PS_INSIDEFRAME == ulPenStyle)
|
||||
ulDashStyle = (BYTE)PS_SOLID;
|
||||
nDashStyle = (BYTE)PS_SOLID;
|
||||
else if (PS_NULL != ulPenStyle)
|
||||
ulDashStyle = (BYTE)ulPenStyle;
|
||||
nDashStyle = (BYTE)ulPenStyle;
|
||||
|
||||
m_pRenderer->put_PenDashStyle(ulDashStyle);
|
||||
m_pRenderer->put_PenDashStyle(nDashStyle);
|
||||
m_pRenderer->put_PenLineJoin(nJoinStyle);
|
||||
m_pRenderer->put_PenLineStartCap(nCapStyle);
|
||||
m_pRenderer->put_PenLineEndCap(nCapStyle);
|
||||
@ -426,20 +518,16 @@ namespace MetaFile
|
||||
|
||||
private:
|
||||
|
||||
IRenderer* m_pRenderer;
|
||||
|
||||
double m_dDpiX;
|
||||
double m_dDpiY;
|
||||
|
||||
long m_lDrawPathType;
|
||||
|
||||
double m_dX; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
double m_dY; //
|
||||
double m_dW; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
double m_dH; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
||||
double m_dScaleX;
|
||||
double m_dScaleY;
|
||||
CEmfFile* m_pEmfFile;
|
||||
IRenderer* m_pRenderer;
|
||||
long m_lDrawPathType;
|
||||
double m_dX; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
double m_dY; //
|
||||
double m_dW; //
|
||||
double m_dH; //
|
||||
double m_dScaleX; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
double m_dScaleY; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
||||
CEmfFile* m_pEmfFile;
|
||||
bool m_bStartedPath;
|
||||
};
|
||||
}
|
||||
#endif // _RENDERER_OUPUT_EMF_H
|
||||
@ -141,11 +141,11 @@ namespace MetaFile
|
||||
}
|
||||
else if (c_lMetaEmf == m_lType)
|
||||
{
|
||||
TEmfRectL oRect = m_oEmfFile.GetBounds();
|
||||
*pdX = oRect.lLeft;
|
||||
*pdY = oRect.lTop;
|
||||
*pdW = oRect.lRight - oRect.lLeft;
|
||||
*pdH = oRect.lBottom - oRect.lTop;
|
||||
TEmfRectL* pRect = m_oEmfFile.GetBounds();
|
||||
*pdX = pRect->lLeft;
|
||||
*pdY = pRect->lTop;
|
||||
*pdW = pRect->lRight - pRect->lLeft;
|
||||
*pdH = pRect->lBottom - pRect->lTop;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -158,6 +158,9 @@ namespace MetaFile
|
||||
void CMetaFile::ConvertToRaster(const wchar_t* wsOutFilePath, unsigned int unFileType, int nWidth, int nHeight)
|
||||
{
|
||||
CFontManager *pFontManager = m_pAppFonts->GenerateFontManager();
|
||||
CFontsCache* pFontCache = new CFontsCache();
|
||||
pFontCache->SetStreams(m_pAppFonts->GetStreams());
|
||||
pFontManager->SetOwnerCache(pFontCache);
|
||||
CImageFilesCache oCache;
|
||||
|
||||
CGraphicsRenderer oRenderer;
|
||||
|
||||
@ -88,7 +88,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
BOOL OpenFromFile(const wchar_t *wsFilePath)
|
||||
bool OpenFromFile(const wchar_t *wsFilePath)
|
||||
{
|
||||
if (m_pBufferData)
|
||||
delete m_pBufferData;
|
||||
@ -141,7 +141,7 @@ public:
|
||||
return m_pFontManager;
|
||||
}
|
||||
|
||||
BOOL OpenFromMemory(unsigned char *pMemory, long lLength)
|
||||
bool OpenFromMemory(unsigned char *pMemory, long lLength)
|
||||
{
|
||||
if (m_pBufferData)
|
||||
delete m_pBufferData;
|
||||
@ -3926,7 +3926,7 @@ private:
|
||||
std::wstring bsFontName = ascii_to_unicode(pFont->sFaceName);
|
||||
|
||||
// TODO: Как будет функция реализована в FontManager доделать здесь
|
||||
//BOOL bNeedFindByParams = FALSE;
|
||||
//bool bNeedFindByParams = FALSE;
|
||||
//if (TRUE == m_pFontManager->LoadFontByName(bsFontName, 1, 0, 0, 0))
|
||||
//{
|
||||
// unsigned long ulBit = 0;
|
||||
@ -3943,7 +3943,7 @@ private:
|
||||
//else
|
||||
// bNeedFindByParams = TRUE;
|
||||
|
||||
BOOL bNeedFindByParams = TRUE;
|
||||
bool bNeedFindByParams = TRUE;
|
||||
|
||||
if (bNeedFindByParams)
|
||||
{
|
||||
|
||||
@ -152,7 +152,7 @@ static void PolyPoly_To_PolyLine(TWmfPolyPoly *pPolyPoly, TWmfPolyLine *pPolyLin
|
||||
pPolyLine->ushCount++;
|
||||
}
|
||||
|
||||
static BOOL WmfOpenTempFile(std::wstring *pwsName, FILE **ppFile, wchar_t *wsMode, wchar_t *wsExt, wchar_t *wsFolder)
|
||||
static bool WmfOpenTempFile(std::wstring *pwsName, FILE **ppFile, wchar_t *wsMode, wchar_t *wsExt, wchar_t *wsFolder)
|
||||
{
|
||||
std::wstring wsTemp, wsFileName;
|
||||
FILE *pTempFile = NULL;
|
||||
|
||||
Reference in New Issue
Block a user