fbxmask.c
来自「libfxb是linux下只写操作framebuffer的一个轻量级的库。」· C语言 代码 · 共 54 行
C
54 行
#include <libfbx/libfbx.h>#include <stdlib.h>#include <time.h>#include <config.h>int main(){ int i; int r, g, b; fb_surface *image; fb_surface *image2; fb_init(); image = fb_load_ppm(IMAGEDIR "/smiley_mask.ppm"); image2 = fb_load_ppm(IMAGEDIR "/smiley.ppm"); fb_cls(); for(i = 0; i < 150; i++) { fb_line(rand() % 100 + fb_screen->width / 2 - 50, rand() % 100 + fb_screen->height / 2 - 50, rand() % 100 + fb_screen->width / 2 - 50, rand() % 100 + fb_screen->height / 2 - 50, rand() % 256, rand() % 256, rand() % 256, fb_screen); } fb_getpixel(0, 0, &r, &g, &b, image); fb_printf(0, 0, "Masked image, bg = (%x, %x, %x)", r, g, b); fb_draw_masked_image(image, fb_screen, (fb_screen->width - image->width) / 2, (fb_screen->height - image->height) / 2, image->width, image->height); sleep(4); fb_getpixel(0, 0, &r, &g, &b, image2); fb_printf(0, 0, "Unmasked image, bg = (%x, %x, %x)", r, g, b); fb_draw_image(image2, fb_screen, (fb_screen->width - image2->width) / 2, (fb_screen->height - image2->height) / 2); sleep(4); fb_cleanup(); return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?