📄 fbv.h
字号:
/* fbv -- simple image viewer for the linux framebuffer Copyright (C) 2000, 2001, 2003 Mateusz Golicz This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.*/#ifndef _FBV_H_#define _FBV_H_#include <stdio.h>#include <sys/time.h>#include <sys/types.h>#include <unistd.h>#include <getopt.h>#include <stdlib.h>#include <termios.h>#include <string.h>#include <signal.h>#include <assert.h>#define IDSTRING "fbv 1.0b, s-tech"#define DEFAULT_FRAMEBUFFER "/dev/fb0"#define FBV_SUPPORT_GIF#define FBV_SUPPORT_JPEG#define FBV_SUPPORT_PNG#define FBV_SUPPORT_BMP#define FH_ERROR_OK 0#define FH_ERROR_FILE 1 /* read/access error */#define FH_ERROR_FORMAT 2 /* file format error */#define DIRTION_SOURCE 0#define DIRTION_LEFT 1#define DIRTION_DOWN 2#define DIRTION_RIGHT 3#define REVOLVE_UP_DIRTION 0#define REVOLVE_DOWN_DIRTION 1#define REVOLVE_LEFT_DIRTION 0#define REVOLVE_RIGHT_DIRTION 1#define MAX_FILENAME_LENGTH 256void fb_display(unsigned char *rgbbuff, unsigned char * alpha, int x_size, int y_size, int x_pan, int y_pan, int x_offs, int y_offs);void getCurrentRes(int *x, int *y);int fh_bmp_id(char *name);int fh_bmp_load(char *name,unsigned char *buffer, unsigned char **alpha, int x,int y);int fh_bmp_getsize(char *name,int *x,int *y);int fh_jpeg_id(char *name);int fh_jpeg_load(char *name,unsigned char *buffer, unsigned char **alpha, int x,int y);int fh_jpeg_getsize(char *name,int *x,int *y);int fh_png_id(char *name);int fh_png_load(char *name,unsigned char *buffer, unsigned char **alpha, int x,int y);int fh_png_getsize(char *name,int *x,int *y);int fh_gif_id(char *name);int fh_gif_load(char *name,unsigned char *buffer, unsigned char **alpha, int x,int y);int fh_gif_getsize(char *name,int *x,int *y);typedef struct YUV { unsigned char Y; char Cr; char Cb; unsigned char p_Y; char p_Cr; char p_Cb;}YUV;typedef struct RGB{ unsigned char r; unsigned char g; unsigned char b; unsigned char p_r; unsigned char p_g; unsigned char p_b; }RGB;struct image{ int width, height; unsigned char *rgb; unsigned char *alpha; char filename[MAX_FILENAME_LENGTH]; int do_free;};typedef struct tag_screen_show_pos{ int x_pan; int y_pan; int x_offs; int y_offs; int transform_rotation;}screen_show_pos;typedef struct tag_image_show_param{ int source_width, source_height; int max_width, max_height; int current_width, current_height; int screen_width, screen_height; int show_width, show_height; int rotation_direction; int updown_direction; int left_right_dirtion;}image_show_param;typedef struct tag_image_color_param{ int bright; int contrast; int saturation; int sharpen; int reflect; int muzzy; int engrave; int emboss; int exposure; int GrayWeightAverage; int GrayAverage; int RGB_red; int RGB_green; int RGB_blue;}image_color_param;#ifndef min#define min(value0, value1) ((value0<value1)? value0: value1)#endif#ifndef max#define max(value0, value1) ((value0>value1)? value0: value1)#endifunsigned char *simple_resize(unsigned char * orgin,int ox,int oy,int dx,int dy);unsigned char *alpha_resize(unsigned char * alpha,int ox,int oy,int dx,int dy);unsigned char *color_average_resize(unsigned char * orgin,int ox,int oy,int dx,int dy);unsigned char *rotate(unsigned char *i, int ox, int oy, int rot);unsigned char *alpha_rotate(unsigned char *i, int ox, int oy, int rot);int clear_console();void image_dofresh();void setup_console(int t);void save_bake_filename(char *psrc, char *bakefilename);void do_image_resize(struct image *i, int img_width, int img_height);void do_alpha_resize(struct image *i, int img_width, int img_height);void do_revolve_left(struct image *i);void do_alpha_revolve_left(struct image *i);void do_revolve_updown(struct image *i);void do_alpha_revolve_updown(struct image *i);void do_rotate_horizontal(struct image *i);void do_alpha_rotate_horizontal(struct image *i);void do_rotate_anti_clockwise_vertical(struct image *i);void do_alpha_rotate_anti_clockwise_vertical(struct image *i);void do_rotate_clockwise_vertical(struct image *i);void do_alpha_rotate_clockwise_vertical(struct image *i);void do_restore_image(struct image *i, int ignoreaspect, int cal);void do_image_comment(struct image *i);void do_little_scale(struct image *i);void do_large_scale(struct image *i);void do_image_full_screen(struct image *i, int ignoreaspect);int load_image_comment(char *filename, int *x_size, int *y_size);void write_JPEG_file(struct image *i);void image_data_process(struct image *img);void do_image_Sharpen(struct image *img, unsigned char *paddr);void do_image_muzzy(struct image *img, unsigned char *paddr);void do_image_Engrave(struct image *img, unsigned char *paddr);void do_image_Emboss(struct image *img, unsigned char *paddr);void do_image_Exposure(struct image *img, unsigned char *paddr);void do_image_reflect(struct image *img, unsigned char *paddr);void do_image_GrayWeightAverage(struct image *img, unsigned char *paddr);void do_image_GrayAverage(struct image *img, unsigned char *paddr);void do_image_Saturation(struct image *img, int step, unsigned char *paddr);void do_image_ContrastChange(struct image *img, int step, unsigned char *paddr);void do_image_BrightnessChange(struct image *img, int step, unsigned char *paddr);void do_image_RGBChange(struct image *img, int red, int green, int blue, unsigned char *paddr);void RGB2YUV(RGB *p_colRGB, YUV *p_YUV);void YUV2RGB(YUV *p_colYUV, RGB *p_RGB);void RGBtoHLS(unsigned char *pbuffer, double *H, double *L, double *S);void HLStoRGB(unsigned char *pbuffer, const double H, const double L, const double S);float fooHuetoRGB (double m1, double m2, double h);void float_SaturationtChange(struct image *img, int step, unsigned char *paddr);void Brightness_adjust(unsigned char *pdata, int length, int step);void RGBChange_adjust(unsigned char *pimg, int width, int height, int red, int green, int blue);#include "image.h"#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -