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

Добавлены классы для клипа.

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@62193 954022d7-b5bf-4e40-9824-e11837661b57
parent af564435
#include "EmfClip.h"
#include "EmfOutputDevice.h"
namespace MetaFile
{
CEmfClip::CEmfClip()
{
}
CEmfClip::~CEmfClip()
{
Clear();
}
void CEmfClip::operator=(CEmfClip& oClip)
{
Clear();
for (unsigned int ulIndex = 0; ulIndex < oClip.m_vCommands.size(); ulIndex++)
{
CEmfClipCommandBase* pCommand = oClip.m_vCommands.at(ulIndex);
CEmfClipCommandBase* pNewCommand = NULL;
switch (pCommand->GetType())
{
case EMF_CLIPCOMMAND_INTERSECT:
{
pNewCommand = new CEmfClipCommandIntersect(((CEmfClipCommandIntersect*)pCommand)->m_oRect);
break;
}
}
if (pNewCommand)
m_vCommands.push_back(pNewCommand);
}
}
void CEmfClip::Reset()
{
Clear();
}
bool CEmfClip::Intersect(TEmfRectL& oRect)
{
CEmfClipCommandBase* pCommand = new CEmfClipCommandIntersect(oRect);
if (!pCommand)
return false;
m_vCommands.push_back(pCommand);
return true;
}
void CEmfClip::ClipOnRenderer(CEmfOutputDevice* pOutput)
{
if (pOutput)
return;
pOutput->ResetClip();
for (unsigned int ulIndex = 0; ulIndex < m_vCommands.size(); ulIndex++)
{
CEmfClipCommandBase* pCommand = m_vCommands.at(ulIndex);
switch (pCommand->GetType())
{
case EMF_CLIPCOMMAND_INTERSECT:
{
CEmfClipCommandIntersect* pIntersect = (CEmfClipCommandIntersect*)pCommand;
pOutput->IntersectClip(pIntersect->m_oRect.lLeft, pIntersect->m_oRect.lTop, pIntersect->m_oRect.lRight, pIntersect->m_oRect.lBottom);
break;
}
}
}
}
void CEmfClip::Clear()
{
for (unsigned int ulIndex = 0; ulIndex < m_vCommands.size(); ulIndex++)
{
CEmfClipCommandBase* pCommand = m_vCommands.at(ulIndex);
delete pCommand;
}
m_vCommands.clear();
}
}
\ No newline at end of file
#ifndef _EMF_CLIP_H
#define _EMF_CLIP_H
#include <vector>
#include "EmfTypes.h"
#include "EmfPath.h"
namespace MetaFile
{
class CEmfOutputDevice;
typedef enum
{
EMF_CLIPCOMMAND_UNKNOWN = 0x00,
EMF_CLIPCOMMAND_INTERSECT = 0x01,
EMF_CLIPCOMMAND_SETPATH = 0x02
} EEmfClipCommandType;
class CEmfClipCommandBase
{
public:
CEmfClipCommandBase()
{
}
virtual ~CEmfClipCommandBase()
{
}
virtual EEmfClipCommandType GetType()
{
return EMF_CLIPCOMMAND_UNKNOWN;
}
};
class CEmfClipCommandIntersect : public CEmfClipCommandBase
{
public:
CEmfClipCommandIntersect(TEmfRectL& oRect) : m_oRect(oRect)
{
}
~CEmfClipCommandIntersect()
{
}
EEmfClipCommandType GetType()
{
return EMF_CLIPCOMMAND_INTERSECT;
}
public:
TEmfRectL m_oRect;
};
class CEmfClipCommandPath : public CEmfClipCommandBase
{
public:
CEmfClipCommandPath(CEmfPath* pPath, unsigned int unMode) : m_oPath(pPath), m_unMode(unMode)
{
}
~CEmfClipCommandPath()
{
}
EEmfClipCommandType GetType()
{
return EMF_CLIPCOMMAND_SETPATH;
}
public:
CEmfPath m_oPath;
unsigned int m_unMode;
};
class CEmfClip
{
public:
CEmfClip();
~CEmfClip();
void operator=(CEmfClip& oClip);
void Reset();
bool Intersect(TEmfRectL& oRect);
void ClipOnRenderer(CEmfOutputDevice* pOutput);
private:
void Clear();
private:
std::vector<CEmfClipCommandBase*> m_vCommands;
};
}
#endif // _EMF_CLIP_H
\ No newline at end of file
......@@ -6,6 +6,13 @@ namespace MetaFile
CEmfPath::CEmfPath()
{
}
CEmfPath::CEmfPath(CEmfPath* pPath)
{
if (pPath)
{
}
}
CEmfPath::~CEmfPath()
{
Clear();
......
......@@ -190,6 +190,7 @@ namespace MetaFile
public:
CEmfPath();
CEmfPath(CEmfPath* pPath);
~CEmfPath();
bool MoveTo(TEmfPointS& oPoint);
......
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