本文整理汇总了C++中Annotation::annotate方法的典型用法代码示例。如果您正苦于以下问题:C++ Annotation::annotate方法的具体用法?C++ Annotation::annotate怎么用?C++ Annotation::annotate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Annotation
的用法示例。
在下文中一共展示了Annotation::annotate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: save_screenshot
void save_screenshot(const char *dir, const char* name, const Annotation& ann = Annotation()) {
char filename[PATH_MAX];
int ret = snprintf(filename, sizeof(filename), "%s/%s.png", dir, name);
assert(ret >= 0 && (size_t)ret < sizeof(filename));
auto screenshot = u8x8_bitmap_to_cimg<uint8_t>(&u8g2, 3, black, white);
screenshot.resize(screenshot.width() * SCREENSHOT_SCALE, screenshot.height() * SCREENSHOT_SCALE);
// Create a bigger output image
size_t width = screenshot.width() + 2*SCREENSHOT_BORDER + (ann.margin[LEFT] + ann.margin[RIGHT]) * SCREENSHOT_SCALE;
size_t height = screenshot.height() + 2*SCREENSHOT_BORDER + (ann.margin[TOP] + ann.margin[BOTTOM]) * SCREENSHOT_SCALE;
auto output = CImg<uint8_t>(width, height, 1, 3, /* value for all channels */ 255);
// Draw the screenshot in the center
output.draw_image(translate_x(0, ann), translate_y(0, ann), 0, 0, screenshot);
// Draw a 1px border around the screenshot, just inside the
// SCREENSHOT_BORDER area (leaving a bit of white space between
// the border and the screenshot).
draw_outline(output, ann.margin[LEFT] * SCREENSHOT_SCALE, ann.margin[TOP] * SCREENSHOT_SCALE, screenshot.width() + 2 * SCREENSHOT_BORDER, screenshot.height() + 2 * SCREENSHOT_BORDER, grey);
ann.annotate(output);
output.save_png(filename);
printf("Generated %s\n", filename);
}