A Simple X Image Viewer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 年之前
14 年之前
14 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /* Copyright 2011 Bert Muennich
  2. *
  3. * This file is part of sxiv.
  4. *
  5. * sxiv is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published
  7. * by the Free Software Foundation; either version 2 of the License,
  8. * or (at your option) any later version.
  9. *
  10. * sxiv is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with sxiv. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef IMAGE_H
  19. #define IMAGE_H
  20. #include <Imlib2.h>
  21. #include "types.h"
  22. #include "window.h"
  23. typedef struct {
  24. Imlib_Image im;
  25. unsigned int delay;
  26. } img_frame_t;
  27. typedef struct {
  28. img_frame_t *frames;
  29. int cap;
  30. int cnt;
  31. int sel;
  32. bool animate;
  33. int length;
  34. } multi_img_t;
  35. typedef struct {
  36. Imlib_Image im;
  37. int w;
  38. int h;
  39. win_t *win;
  40. float x;
  41. float y;
  42. scalemode_t scalemode;
  43. float zoom;
  44. bool checkpan;
  45. bool dirty;
  46. bool aa;
  47. bool alpha;
  48. Imlib_Color_Modifier cmod;
  49. int gamma;
  50. struct {
  51. bool on;
  52. int delay;
  53. } ss;
  54. multi_img_t multi;
  55. } img_t;
  56. void img_init(img_t*, win_t*);
  57. bool img_load(img_t*, const fileinfo_t*);
  58. CLEANUP void img_close(img_t*, bool);
  59. void img_render(img_t*);
  60. bool img_fit_win(img_t*, scalemode_t);
  61. bool img_zoom(img_t*, float);
  62. bool img_zoom_in(img_t*);
  63. bool img_zoom_out(img_t*);
  64. bool img_move(img_t*, float, float);
  65. bool img_pan(img_t*, direction_t, int);
  66. bool img_pan_edge(img_t*, direction_t);
  67. void img_rotate(img_t*, degree_t);
  68. void img_flip(img_t*, flipdir_t);
  69. void img_toggle_antialias(img_t*);
  70. bool img_change_gamma(img_t*, int);
  71. bool img_frame_navigate(img_t*, int);
  72. bool img_frame_animate(img_t*);
  73. #endif /* IMAGE_H */