1 Star 0 Fork 2

gite-hub / libhge9

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
cchar.h 1.26 KB
一键复制 编辑 原始数据 按行查看 历史
gite-hub 提交于 2023-10-13 13:05 . ft
#ifndef CCHAR_H
#define CCHAR_H
/**
* @file cchar.h
* @author MYL
* @email yunlongma0@163.com
* @version V1.0
* @date 18-06-2021
* @brief char class
* @details 主要存储字符的字形数据、字符编码、类型和位图数据
*/
#include <cstring>
struct glyphMetrics {
int width;
int height;
int horiBearingX;
int horiBearingY;
int horiAdvance;
int vertBearingX;
int vertBearingY;
int vertAdvance;
};
enum class ImageType {
Gray, /**< GRAY模式1个像素用1个字节保存 */
Mono /**< MONO模式每1个像素仅用1bit保存,只有黑和白 */
};
class CChar {
public:
CChar(int code, ImageType type);
virtual ~CChar();
void setInfo(glyphMetrics* metrics);
void getInfo(glyphMetrics* metrics);
unsigned char* getOrCreateBuffer(size_t size);
//unsigned char& operator [] (size_t i);
int code() const;
ImageType type() const;
private:
int m_code; /**< char code. */
unsigned char* m_data; /**< char bitmap data. */
glyphMetrics m_metrics; /**< char metrics data. */
size_t m_size; /**< char bitmap data size. */
ImageType m_type; /**< char bitmap type. */
};
#endif // CCHAR_H
C++
1
https://gitee.com/gite-hub/libhge9.git
git@gitee.com:gite-hub/libhge9.git
gite-hub
libhge9
libhge9
master

搜索帮助