code_app/modules/imgproc/CvxText.hpp

35 lines
1.0 KiB
C++
Raw Normal View History

2022-06-13 11:56:43 +00:00
#ifndef __CVXTEXT_H__
#define __CVXTEXT_H__
#include "HGImgProc.h"
#include <ft2build.h>
#include <freetype/freetype.h>
2022-06-14 09:06:19 +00:00
#include <freetype/ftbitmap.h>
#include <freetype/ftoutln.h>
#include <freetype/ftglyph.h>
#include <vector>
2022-06-13 11:56:43 +00:00
class CvxText
{
public:
CvxText();
~CvxText();
2022-06-14 09:06:19 +00:00
HGResult Create(const HGChar *fontPath);
HGResult Destroy();
HGResult DrawString(HGImage image, const HGChar* text, HGColor color, HGUInt posType, HGInt locationX, HGInt locationY,
HGUInt fontSize, HGBool bold, HGBool underline, HGBool italic, HGBool strikeout);
2022-06-13 11:56:43 +00:00
private:
2022-06-14 09:06:19 +00:00
void MeasureChar(HGUInt wc, HGUInt fontSize, HGBool bold, HGBool italic, FT_BBox& acbox);
void GetStringLocation(const HGChar* text, HGUInt fontSize, HGBool bold, HGBool underline, HGBool italic, HGBool strikeout,
HGUInt &width, HGUInt &height, std::vector<HGRect> &vPos);
2022-06-15 01:50:21 +00:00
void DrawChar(HGImage image, HGUInt wc, HGColor color, HGInt x, HGInt y, HGUInt fontSize, HGBool bold, HGBool italic);
2022-06-13 11:56:43 +00:00
private:
FT_Library m_library;
FT_Face m_face;
};
#endif /* __CVXTEXT_H__ */