mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Добавлены классы для клипа.
git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@62193 954022d7-b5bf-4e40-9824-e11837661b57
This commit is contained in:
committed by
Alexander Trofimov
parent
af5644357a
commit
b9225cbf8f
77
DesktopEditor/raster/Metafile/Emf/EmfClip.cpp
Normal file
77
DesktopEditor/raster/Metafile/Emf/EmfClip.cpp
Normal file
@ -0,0 +1,77 @@
|
||||
#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();
|
||||
}
|
||||
}
|
||||
91
DesktopEditor/raster/Metafile/Emf/EmfClip.h
Normal file
91
DesktopEditor/raster/Metafile/Emf/EmfClip.h
Normal file
@ -0,0 +1,91 @@
|
||||
#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
|
||||
@ -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);
|
||||
|
||||
Reference in New Issue
Block a user