| File was renamed from usbcameralib/src/main/cpp/watermark.c |
| | |
| | | #include "watermark.h" |
| | | #include "charencode.h" |
| | | #include "ImageProc.h" |
| | | #include "apptimer.h" |
| | | |
| | | //static pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER; |
| | | typedef enum { |
| | |
| | | static int pic_width = 0, pic_height = 0; |
| | | static color_t wm_color; |
| | | |
| | | static void PrintTime(apptimer_var_t val) |
| | | { |
| | | text_t text; |
| | | |
| | | text.x = 10; |
| | | text.y = 10; |
| | | |
| | | memset(text.text, 0, sizeof (text.text)); |
| | | |
| | | strcpy(text.text, FormatTime().c_str()); |
| | | |
| | | PrepareWatermark(RED, 24, 2, 1, &text); |
| | | |
| | | AppTimer_add(PrintTime, D_SEC(1)); |
| | | } |
| | | |
| | | void InitWatermark(const char *font, int width, int height) |
| | | { |
| | | LOGI("InitWatermark"); |
| | |
| | | |
| | | pic_width = width; |
| | | pic_height = height; |
| | | |
| | | AppTimer_add(PrintTime, D_SEC(1)); |
| | | } |
| | | |
| | | void UninitWatermark(void) |
| | |
| | | wm = NULL; |
| | | } |
| | | wm_num = 0; |
| | | AppTimer_delete(PrintTime); |
| | | } |
| | | |
| | | void PrepareWatermark(int color, int font_size, int multiple, int num, const text_t *texts) |
| | |
| | | const int bytes_per_line = font_size / 8; |
| | | |
| | | wm_num = 0; |
| | | wm_color = color; |
| | | wm_color = static_cast<color_t>(color); |
| | | |
| | | //FILE *fp = fopen("/storage/self/primary/ms_unicode.bin", "rb"); |
| | | //FILE *fp = fopen("/system/ms_unicode.bin", "rb"); |
| | |
| | | uint8_t zm[64*64/8]; // 最大 |
| | | |
| | | for (int m = 0; m < num; ++m) { |
| | | char *str = texts[m].text; |
| | | const char *str = texts[m].text; |
| | | |
| | | int screen_x = texts[m].x; |
| | | int screen_y = texts[m].y; |
| | | offset = 0; |
| | | |
| | | while (str != NULL && offset < strlen(str)) { |
| | | int skip = enc_utf8_to_unicode_one(str + offset, &unicode); |
| | | int skip = enc_utf8_to_unicode_one(reinterpret_cast<const unsigned char *>(str + offset), &unicode); |
| | | int next_x = 0; |
| | | |
| | | if (skip == 0) { |