| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 
 | 
 
 
 #include <ssd1306.h>
 #include <logger.h>
 #include <opencv2/opencv.hpp>
 #include <CvxFont.h>
 #include <opencv_tool.h>
 #include <net_tool.h>
 
 
 int main(int argc, char *argv[]) {
 if (!getenv("DISPLAY"))setenv("DISPLAY", "localhost:10.0", 1);
 logger::instance()->init_default();
 logger::instance()->d(__FILENAME__, __LINE__, "start");
 ssd1306 ssd1306;
 ssd1306.clear();
 
 #ifdef ENABLE_FREETYPE
 cv::Mat img(64, 128, CV_8UC3, cv::Scalar(255, 255, 255));
 
 cvx::CvxFont font(logger::get_local_path() + logger::path_split + "OpenDotMatrixFont.ttf");
 cvx::CvxFont font1(logger::get_local_path() + logger::path_split + "seguisym.ttf");
 
 
 cv::String msg7 = "柒凯计算机软件服务";
 font.putText(img, msg7, cv::Point(0, ssd1306::GetLineY14(4)));
 
 font.putText(img, "blog.kekxv.com", cv::Point(0, ssd1306::GetLineY14(0) * 2 / 3), 12);
 std::vector<std::string> ips;
 net_tool::GetIP(ips);
 int line = 2;
 for (auto & ip : ips) {
 if (ip.find("127") != std::string::npos)continue;
 font.putText(img, ip, cv::Point(0, ssd1306::GetLineY14(line++) * 2 / 3), 12);
 }
 
 cv::Mat qrImg = opencv_tool::CreateQrCode("/assets/imgs/old/", 1);
 cv::Mat roi = img(
 cv::Rect(127 - qrImg.size().width, ssd1306::GetLineY14(4) - qrImg.size().height, qrImg.cols,
 qrImg.rows));
 qrImg.copyTo(roi);
 
 std::vector<uint32_t> symbols;
 symbols.push_back((uint32_t) 0x1f300 + 32 * (14 + 9 - 1) + 2 - 1);
 font1.putText(img, symbols, cv::Point(127 - qrImg.size().width - 14, ssd1306::GetLineY14(3)));
 
 
 ssd1306.draw(&img, true);
 
 #endif
 
 logger::instance()->d(__FILENAME__, __LINE__, "end");
 
 return 0;
 }
 
 |