mirror of
https://gitee.com/anod/open_agb_firm.git
synced 2025-05-06 22:04:10 +08:00
74 lines
2.7 KiB
C
74 lines
2.7 KiB
C
#ifndef _ANOD_COMPILED_FONT_H_
|
|
#define _ANOD_COMPILED_FONT_H_
|
|
|
|
#include <stdint.h>
|
|
|
|
#define ACFONT_NOT_FOUND -1
|
|
#define ACFONT_INVALID -2
|
|
#define ACFONT_READ_EOF -3
|
|
#define ACFONT_NOT_SUPPORT -4
|
|
#define ACFONT_MEM_EMPTY -5
|
|
|
|
extern int acf_set_font(const char *);
|
|
extern const char *acf_draw(int, int, unsigned, unsigned, unsigned, const char *);
|
|
|
|
#include "acf_dev.h"
|
|
#include "acf_cfg.h"
|
|
|
|
#if ACF_CANVAS == ACFDEV_U8GBITMAP
|
|
|
|
#include "c_stdint.h"
|
|
#include "c_stdio.h"
|
|
#include "c_stdlib.h"
|
|
#include "c_string.h"
|
|
|
|
extern uint8_t *acfCanvas;
|
|
|
|
#include "vfs.h"
|
|
|
|
#define ACF_BYTE_SIZE 8
|
|
#define ACF_CANVAS_SIZE(w, h) ((w) * (h) / ACF_BYTE_SIZE)
|
|
#define ACF_BYTE_WIDTH(w, h) ((w) / ACF_BYTE_SIZE)
|
|
#define ACF_BYTE_OFFSET(x, y, w, h) (((h) - (y)-1) * ACF_BYTE_WIDTH(w, h) + (x) / ACF_BYTE_SIZE)
|
|
#define ACF_U8G_BMP_BIT(x, y) (1 << (7 - (x) % 8))
|
|
|
|
#define FILE_T int
|
|
#define FILE_OPEN(path, mode) vfs_open(path, mode)
|
|
#define FILE_READ(f, pos, size) vfs_read(f, pos, size)
|
|
#define FILE_SEEK(f,p) vfs_lseek(f,p,VFS_SEEK_SET)
|
|
#define FILE_SEEKEND(f) vfs_lseek(f,0,VFS_SEEK_END)
|
|
#define FILE_TELL(f) vfs_tell(f)
|
|
|
|
#define ACF_LIT_POINT(x, y, w, h, islit) \
|
|
{ \
|
|
if (0 <= (x) && (x) < w && 0 <= (y) && (y) < h) \
|
|
{ \
|
|
if ((islit)) \
|
|
acfCanvas[ACF_BYTE_OFFSET(x, y, w, h)] |= ACF_U8G_BMP_BIT(x, y); \
|
|
else \
|
|
acfCanvas[ACF_BYTE_OFFSET(x, y, w, h)] &= ~ACF_U8G_BMP_BIT(x, y); \
|
|
} \
|
|
}
|
|
#elif ACF_CANVAS == ACFDEV_OPENAGB
|
|
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <console.h>
|
|
|
|
#include "fs.h"
|
|
|
|
#define ACF_LIT_POINT(x, y, w, h, islit) \
|
|
{ \
|
|
if (0 <= (x) && (x) < w && 0 <= (y) && (y) < h) \
|
|
{ \
|
|
if ((islit)) \
|
|
frame[240*y + x] |= color; \
|
|
} \
|
|
}
|
|
|
|
#else
|
|
#endif
|
|
|
|
#endif //_ANOD_COMPILED_FONT_H_
|