2022-05-03 10:25:52 +00:00
|
|
|
|
#ifndef __HGOFDIMPL_HPP__
|
|
|
|
|
#define __HGOFDIMPL_HPP__
|
|
|
|
|
|
|
|
|
|
#include "HGOfd.h"
|
|
|
|
|
extern "C"
|
|
|
|
|
{
|
|
|
|
|
#include "zip.h"
|
|
|
|
|
};
|
|
|
|
|
#include "tinyxml2.h"
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <list>
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
class HGOfdReaderImpl
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
HGOfdReaderImpl();
|
|
|
|
|
~HGOfdReaderImpl();
|
|
|
|
|
|
|
|
|
|
HGResult Open(const HGChar* fileName);
|
|
|
|
|
HGResult Close();
|
|
|
|
|
HGResult GetPageCount(HGUInt* count);
|
|
|
|
|
HGResult GetPageInfo(HGUInt page, HGOfdPageInfo* info);
|
|
|
|
|
HGResult LoadImage(HGUInt page, HGFloat xScale, HGFloat yScale,
|
|
|
|
|
HGUInt imgType, HGUInt imgOrigin, HGImage* image);
|
|
|
|
|
|
|
|
|
|
private:
|
2022-11-26 02:42:06 +00:00
|
|
|
|
HGResult ReadXml(const char *name, std::string &content);
|
|
|
|
|
HGResult ReadJpeg(const char* name, HGJpegLoadInfo *info, HGFloat xScale, HGFloat yScale, HGUInt imgType, HGUInt imgOrigin, HGImage* image);
|
2022-05-03 10:25:52 +00:00
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
zip* m_zip;
|
|
|
|
|
std::vector<std::string> m_contentNames;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class HGOfdImageWriterImpl
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
HGOfdImageWriterImpl();
|
|
|
|
|
~HGOfdImageWriterImpl();
|
|
|
|
|
|
|
|
|
|
HGResult Open(const HGChar* fileName);
|
|
|
|
|
HGResult Close();
|
2022-05-13 03:56:46 +00:00
|
|
|
|
HGResult SaveJpegImage(HGImage image, const HGJpegSaveInfo* info);
|
2022-05-03 10:25:52 +00:00
|
|
|
|
|
|
|
|
|
private:
|
2022-11-26 02:42:06 +00:00
|
|
|
|
HGResult AddOfdXml();
|
|
|
|
|
HGResult AddDocXml();
|
|
|
|
|
HGResult AddDocResXml();
|
|
|
|
|
HGResult AddPublicResXml();
|
|
|
|
|
HGResult AddXmlFile(tinyxml2::XMLDocument &xmlDoc, const HGChar *name);
|
|
|
|
|
HGResult AddJpegImageFile(HGImage image, const HGJpegSaveInfo* info, const HGChar* name);
|
|
|
|
|
HGResult AddContentXmlFile(HGUInt index, HGFloat physicalWidth, HGFloat physicalHeight);
|
2022-05-03 10:25:52 +00:00
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
zip* m_zip;
|
|
|
|
|
std::list<std::string> m_tmpFiles;
|
|
|
|
|
HGUInt m_curImgIndex;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif /* __HGOFDIMPL_HPP__ */
|