|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
//<2F>ļ<EFBFBD>: <20><>ʽת<CABD><D7AA><EFBFBD><EFBFBD>
|
|
|
|
|
|
//<2F><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>:
|
|
|
|
|
|
// <09><>ȡEMF<4D><46>ʽ
|
|
|
|
|
|
//
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д: 2024-10-20
|
|
|
|
|
|
//
|
|
|
|
|
|
//GIT :https://github.com/mathog/libUEMF.git
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
#include ".\otherformat.h"
|
|
|
|
|
|
#include "afxcoll.h"
|
|
|
|
|
|
#include "uemf.h"
|
|
|
|
|
|
#include "uemf_print.h"
|
|
|
|
|
|
#include "upmf.h"
|
|
|
|
|
|
#include "uemf_utf.h"
|
|
|
|
|
|
#include "uemf_safe.h"
|
|
|
|
|
|
#include "uemf_endian.h"
|
|
|
|
|
|
#include ".\DrawOperator\Utils.h"
|
|
|
|
|
|
#include ".\DrawOperator\EmfDefine.h"
|
|
|
|
|
|
|
|
|
|
|
|
namespace NFormatReader
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
class CEmfFile :
|
|
|
|
|
|
public COtherFormat
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
CEmfFile(void);
|
|
|
|
|
|
virtual ~CEmfFile(void);
|
|
|
|
|
|
|
|
|
|
|
|
int Read(LPCTSTR lpszPathName);
|
|
|
|
|
|
int Read(CFile& fr);
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
//Ԫ<><D4AA><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
|
int ReadEMFArc(double sx, double sy, double ax, double ay, double angle, DWORD type, PEMF_CALLBACK_DATA d);
|
|
|
|
|
|
int ReadEMFLine(const CList<EMRLINETOS, EMRLINETOS>& list, PEMF_CALLBACK_DATA d);
|
|
|
|
|
|
int ReadEMFLine_EMR_POLYGON16(const CList<EMRLINETOS, EMRLINETOS>& list, PEMF_CALLBACK_DATA d);
|
|
|
|
|
|
int ReadEMFEllipse(double cx, double cy, double rx, double ry, COLORREF color);
|
|
|
|
|
|
|
|
|
|
|
|
int ReadEMFPolyLine(const CList<EMRLINETOS, EMRLINETOS>& list, PEMF_CALLBACK_DATA d);
|
|
|
|
|
|
int ReadEMFClipPolyLine(const CList<EMRLINETOS, EMRLINETOS>& list, PEMF_CALLBACK_DATA d);
|
|
|
|
|
|
|
|
|
|
|
|
int ReadEMFPolyLine_EMR_POLYPOLYLINE16(const CList<EMRLINETOS, EMRLINETOS>& list, PEMF_CALLBACK_DATA d);
|
|
|
|
|
|
int ReadEMFText(const TCHUNK_SPECS &tsp, char * textString, char *fontspec, PEMF_CALLBACK_DATA d);
|
|
|
|
|
|
int ReadEMFPolyBezierto(const CList<EMRLINETOS, EMRLINETOS>& list, PEMF_CALLBACK_DATA d);
|
|
|
|
|
|
int ReadEMFPolyBezierto_EMR_POLYBEZIERTO16(const CList<EMRLINETOS, EMRLINETOS>& list, PEMF_CALLBACK_DATA d);
|
|
|
|
|
|
int ReadEMFImage(CRect8 rect, const CString &imagePath);
|
|
|
|
|
|
int ReadEMFRect(CRect8 rect, PEMF_CALLBACK_DATA d);
|
|
|
|
|
|
|
|
|
|
|
|
int ReadEMFDraw(PEMF_CALLBACK_DATA d);
|
|
|
|
|
|
virtual POSITION AddElement(void* pElement, int type);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int AI_hack(PU_EMRHEADER pEmr);
|
|
|
|
|
|
//EMF<4D>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>Զ<EFBFBD>ȡ
|
|
|
|
|
|
int myEnhMetaFileProc(char *contents, unsigned int length, PEMF_CALLBACK_DATA d);
|
|
|
|
|
|
|
|
|
|
|
|
//<2F>ü<EFBFBD><C3BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
void enlarge_clips(PEMF_CALLBACK_DATA d);
|
|
|
|
|
|
int in_clips(PEMF_CALLBACK_DATA d, const char* test);
|
|
|
|
|
|
void add_clips(PEMF_CALLBACK_DATA d, const char* clippath, unsigned int logic);
|
|
|
|
|
|
int combine_ops_to_livarot(const int op);
|
|
|
|
|
|
|
|
|
|
|
|
void output_style(PEMF_CALLBACK_DATA d, int iType);
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>
|
|
|
|
|
|
double pix_to_x_point(PEMF_CALLBACK_DATA d, double px, double py);
|
|
|
|
|
|
double pix_to_y_point(PEMF_CALLBACK_DATA d, double px, double py);
|
|
|
|
|
|
double _pix_x_to_point(PEMF_CALLBACK_DATA d, double px);
|
|
|
|
|
|
double _pix_y_to_point(PEMF_CALLBACK_DATA d, double py);
|
|
|
|
|
|
double pix_to_abs_size(PEMF_CALLBACK_DATA d, double px);
|
|
|
|
|
|
void snap_to_faraway_pair(double *x, double *y);
|
|
|
|
|
|
|
|
|
|
|
|
int trinfo_load_bk(TR_INFO *tri, int usebk, TRCOLORREF bkcolor);
|
|
|
|
|
|
int trinfo_check_bk(TR_INFO *tri, int usebk, TRCOLORREF bkcolor);
|
|
|
|
|
|
|
|
|
|
|
|
void delete_object(PEMF_CALLBACK_DATA d, int index);
|
|
|
|
|
|
void insert_object(PEMF_CALLBACK_DATA d, int index, int type, PU_ENHMETARECORD pObj);
|
|
|
|
|
|
|
|
|
|
|
|
int trinfo_load_qe(TR_INFO *tri, double qe);
|
|
|
|
|
|
double current_scale(PEMF_CALLBACK_DATA d);
|
|
|
|
|
|
|
|
|
|
|
|
void select_pen(PEMF_CALLBACK_DATA d, int index);
|
|
|
|
|
|
void select_extpen(PEMF_CALLBACK_DATA d, int index);
|
|
|
|
|
|
void select_brush(PEMF_CALLBACK_DATA d, int index);
|
|
|
|
|
|
void select_font(PEMF_CALLBACK_DATA d, int index);
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t *unknown_chars(size_t count);
|
|
|
|
|
|
|
|
|
|
|
|
int isNon(char *font);
|
|
|
|
|
|
void msdepua(uint32_t *text);
|
|
|
|
|
|
int NonToUnicode(uint32_t *text, char *font);
|
|
|
|
|
|
|
|
|
|
|
|
COLORREF sethexcolor(TRCOLORREF color);
|
|
|
|
|
|
COLORREF sethexcolor(U_COLORREF color);
|
|
|
|
|
|
U_COLORREF gethexcolor(uint32_t color);
|
|
|
|
|
|
COLORREF getRGBAColor(uint8_t r, uint8_t g, uint8_t b, uint8_t a);
|
|
|
|
|
|
|
|
|
|
|
|
double current_rotation(PEMF_CALLBACK_DATA d);
|
|
|
|
|
|
void enlarge_hatches(PEMF_CALLBACK_DATA d);
|
|
|
|
|
|
|
|
|
|
|
|
int in_hatches(PEMF_CALLBACK_DATA d, char *test);
|
|
|
|
|
|
uint32_t add_image(PEMF_CALLBACK_DATA d, void *pEmr, uint32_t cbBits, uint32_t cbBmi,
|
|
|
|
|
|
uint32_t iUsage, uint32_t offBits, uint32_t offBmi);
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t add_hatch(PEMF_CALLBACK_DATA d, uint32_t hatchType, U_COLORREF hatchColor);
|
|
|
|
|
|
void free_emf_strings(EMF_STRINGS name);
|
|
|
|
|
|
|
|
|
|
|
|
void common_image_extraction(PEMF_CALLBACK_DATA d, void *pEmr,
|
|
|
|
|
|
double dx, double dy, double dw, double dh, int sx, int sy, int sw, int sh,
|
|
|
|
|
|
uint32_t iUsage, uint32_t offBits, uint32_t cbBits, uint32_t offBmi, uint32_t cbBmi, U_RECTL rc);
|
|
|
|
|
|
|
|
|
|
|
|
std::string GenerateUniqueFilename(const std::string& baseName, const std::string& extension);
|
|
|
|
|
|
bool Save_RGBA_As_BMP(const std::string &ename, std::unique_ptr<char[]> rgba_data, uint32_t width, uint32_t height);
|
|
|
|
|
|
|
|
|
|
|
|
int RemovePathFile();
|
|
|
|
|
|
bool IsOutsideModelSpace(double x0, double y0, const CRect8 &rect); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
|
std::list<EMRLINETOS> FilterPointsInRect(PEMF_CALLBACK_DATA d, const std::list<EMRLINETOS>& points, bool state);
|
|
|
|
|
|
std::list<EMRLINETOS> FilterPointsInRect(PEMF_CALLBACK_DATA d, const std::list<EMRLINETOS>& points);
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
CString GetFontName(CString faceName);
|
|
|
|
|
|
int U_EMR_COMMENT_F(PEMF_CALLBACK_DATA d, const char* contents, const char* blimit, int recnum, int off);
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EEB4A6>
|
|
|
|
|
|
int ReadEMFLine_FillRects(const std::list<EMRLINETOS>& list, PEMF_CALLBACK_DATA d, const CString &str);
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
int ReadEMFLine_FillRects(const std::list<EMRLINETOS>& list, PEMF_CALLBACK_DATA d);
|
|
|
|
|
|
//<2F><><EFBFBD>ƹ<EFBFBD><C6B9><EFBFBD>ͼ<EFBFBD>γ<EFBFBD><CEB3><EFBFBD>
|
|
|
|
|
|
int ReadEMF_PMR_RectFill(const std::list<EMRLINETOS>& list, PEMF_CALLBACK_DATA d, const CString& str);
|
|
|
|
|
|
//<2F><><EFBFBD>汴<EFBFBD><E6B1B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
int ReadEMF_PMR_DrawBeziers(const std::list<EMRLINETOS>& listc, PEMF_CALLBACK_DATA d);
|
|
|
|
|
|
//
|
|
|
|
|
|
int ReadEMF_PMR_RectLine(const std::list<EMRLINETOS>& list, PEMF_CALLBACK_DATA d);
|
|
|
|
|
|
//
|
|
|
|
|
|
int ReadEMF_PMR_Line(const std::list<EMRLINETOS>& list, PEMF_CALLBACK_DATA d);
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
int U_PMR_Object_F(PEMF_CALLBACK_DATA d, const char* contents, const char* blimit, U_OBJ_ACCUM* ObjCont, int term);
|
|
|
|
|
|
int U_PMF_PATH_F(PEMF_CALLBACK_DATA d, const char* contents, const char* blimit);
|
|
|
|
|
|
int U_PMR_DrawBeziers_F(PEMF_CALLBACK_DATA d, const char* contents);
|
|
|
|
|
|
int U_PMF_REGIONNODE_F(PEMF_CALLBACK_DATA d, const char* contents, int Level, const char* blimit);
|
|
|
|
|
|
int U_PMF_REGIONNODECHILDNODES_F(PEMF_CALLBACK_DATA d, const char* contents, int Level, const char* blimit);
|
|
|
|
|
|
int U_PMF_BRUSH_F(PEMF_CALLBACK_DATA d, const char* contents, const char* blimit);
|
|
|
|
|
|
int U_PMR_DRAWLINES_F(PEMF_CALLBACK_DATA d, const char* contents);
|
|
|
|
|
|
protected:
|
|
|
|
|
|
// ʹ<><CAB9>list<73><74>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
std::list<std::list<EMRLINETOS>> m_FilllineLists_std_list;
|
|
|
|
|
|
|
|
|
|
|
|
struct _CURRENT_ELE {
|
|
|
|
|
|
DWORD m_dwID; //<2F><>ǰԪ<C7B0>صľ<D8B5><C4BE><EFBFBD>ID<49><44>
|
|
|
|
|
|
BOOL m_bCurentView; //<2F><>ǰԪ<C7B0>صĿ<D8B5><C4BF><EFBFBD>״̬
|
|
|
|
|
|
|
|
|
|
|
|
COLORREF m_colCurrent; //<2F><>ǰԪ<C7B0>ص<EFBFBD><D8B5><EFBFBD>ɫ
|
|
|
|
|
|
COLORREF m_bColCurrent; //<2F><>ǰԪ<C7B0>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD>ɫ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>ã<EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
CString m_emfImagePath; // ͼƬ<CDBC><C6AC>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>Ŀ¼
|
|
|
|
|
|
|
|
|
|
|
|
CRect8 m_rect; //<2F><>ͼ<EFBFBD><CDBC>С
|
|
|
|
|
|
};
|
|
|
|
|
|
_CURRENT_ELE m_curElement;
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
};
|