Simplify vflist_get_formatted()
[geeqie.git] / src / pixbuf_util.h
1 /*
2  * Copyright (C) 2004 John Ellis
3  * Copyright (C) 2008 - 2016 The Geeqie Team
4  *
5  * Author: John Ellis
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21
22 #ifndef PIXBUF_UTIL_H
23 #define PIXBUF_UTIL_H
24
25
26 gboolean pixbuf_to_file_as_png (GdkPixbuf *pixbuf, const gchar *filename);
27 gboolean pixbuf_to_file_as_jpg(GdkPixbuf *pixbuf, const gchar *filename, gint quality);
28
29 void pixbuf_inline_register_stock_icons(void);
30 gboolean register_theme_icon_as_stock(const gchar *key, const gchar *icon);
31
32 GdkPixbuf *pixbuf_inline(const gchar *key);
33 GdkPixbuf *pixbuf_fallback(FileData *fd, gint requested_width, gint requested_height);
34
35 gboolean pixbuf_scale_aspect(gint req_w, gint req_h, gint old_w, gint old_h, gint *new_w, gint *new_h);
36
37 #define PIXBUF_INLINE_FOLDER_CLOSED     "folder_closed"
38 #define PIXBUF_INLINE_FOLDER_LOCKED     "folder_locked"
39 #define PIXBUF_INLINE_FOLDER_OPEN       "folder_open"
40 #define PIXBUF_INLINE_FOLDER_UP         "folder_up"
41 #define PIXBUF_INLINE_SCROLLER          "scroller"
42 #define PIXBUF_INLINE_BROKEN            "broken"
43 #define PIXBUF_INLINE_METADATA          "metadata"
44 #define PIXBUF_INLINE_UNKNOWN           "unknown"
45 #define PIXBUF_INLINE_VIDEO                     "video"
46 #define PIXBUF_INLINE_COLLECTION        "collection"
47 #define PIXBUF_INLINE_ICON              "icon"
48 #define PIXBUF_INLINE_LOGO              "logo"
49 #define PIXBUF_INLINE_ARCHIVE           "archive"
50
51 #define PIXBUF_INLINE_ICON_FLOAT        "icon_float"
52 #define PIXBUF_INLINE_ICON_THUMB        "icon_thumb"
53
54 #define PIXBUF_INLINE_ICON_BOOK         "icon_book"
55 #define PIXBUF_INLINE_ICON_CONFIG       "icon_config"
56 #define PIXBUF_INLINE_ICON_TOOLS        "icon_tools"
57 #define PIXBUF_INLINE_ICON_VIEW         "icon_view"
58 #define PIXBUF_INLINE_ICON_PANORAMA             "icon_panorama"
59 #define PIXBUF_INLINE_ICON_MAINTENANCE  "icon_maintenance"
60 #define PIXBUF_INLINE_ICON_ZOOMFILLHOR  "icon_zoomfillhor"
61 #define PIXBUF_INLINE_ICON_ZOOMFILLVERT "icon_zoomfillvert"
62 #define PIXBUF_INLINE_ICON_HIDETOOLS    "icon_hidetools"
63 #define PIXBUF_INLINE_ICON_EXIF         "icon_exif"
64 #define PIXBUF_INLINE_ICON_MARKS        "icon_marks"
65 #define PIXBUF_INLINE_ICON_INFO         "icon_info"
66 #define PIXBUF_INLINE_ICON_SORT         "icon_sort"
67 #define PIXBUF_INLINE_ICON_PDF          "icon_pdf"
68 #define PIXBUF_INLINE_ICON_DRAW_RECTANGLE       "icon_draw_rectangle"
69 #define PIXBUF_INLINE_ICON_MOVE         "icon_move"
70 #define PIXBUF_INLINE_ICON_RENAME       "icon_rename"
71 #define PIXBUF_INLINE_ICON_SELECT_ALL   "icon_select_all"
72 #define PIXBUF_INLINE_ICON_SELECT_NONE  "icon_select_none"
73 #define PIXBUF_INLINE_ICON_SELECT_INVERT        "icon_select_invert"
74 #define PIXBUF_INLINE_ICON_SELECT_RECTANGLE     "icon_select_rectangle"
75 #define PIXBUF_INLINE_ICON_FILE_FILTER  "icon_file_filter"
76 #define PIXBUF_INLINE_ICON_TRASH        "icon_trash"
77 #define PIXBUF_INLINE_ICON_HEIF "icon_heic"
78 #define PIXBUF_INLINE_ICON_GRAYSCALE    "icon_grayscale"
79 #define PIXBUF_INLINE_ICON_EXPOSURE             "icon_exposure"
80 #define PIXBUF_INLINE_SPLIT_PANE_SYNC   "icon_split_pane_sync"
81
82 #define PIXBUF_INLINE_ICON_CW   "icon_rotate_clockwise"
83 #define PIXBUF_INLINE_ICON_CCW  "icon_rotate_counter_clockwise"
84 #define PIXBUF_INLINE_ICON_180  "icon_rotate_180"
85 #define PIXBUF_INLINE_ICON_MIRROR       "icon_mirror"
86 #define PIXBUF_INLINE_ICON_FLIP "icon_flip"
87 #define PIXBUF_INLINE_ICON_ORIGINAL     "icon_original"
88
89 GdkPixbuf *pixbuf_copy_rotate_90(GdkPixbuf *src, gboolean counter_clockwise);
90 GdkPixbuf *pixbuf_copy_mirror(GdkPixbuf *src, gboolean mirror, gboolean flip);
91 GdkPixbuf* pixbuf_apply_orientation(GdkPixbuf *pixbuf, gint orientation);
92
93 void pixbuf_draw_rect_fill(GdkPixbuf *pb,
94                            gint x, gint y, gint w, gint h,
95                            gint r, gint g, gint b, gint a);
96
97 void pixbuf_draw_rect(GdkPixbuf *pb,
98                       gint x, gint y, gint w, gint h,
99                       gint r, gint g, gint b, gint a,
100                       gint left, gint right, gint top, gint bottom);
101
102 void pixbuf_set_rect_fill(GdkPixbuf *pb,
103                           gint x, gint y, gint w, gint h,
104                           gint r, gint g, gint b, gint a);
105
106 void pixbuf_set_rect(GdkPixbuf *pb,
107                      gint x, gint y, gint w, gint h,
108                      gint r, gint g, gint b, gint a,
109                      gint left, gint right, gint top, gint bottom);
110
111 void pixbuf_pixel_set(GdkPixbuf *pb, gint x, gint y, gint r, gint g, gint b, gint a);
112
113
114 void pixbuf_draw_layout(GdkPixbuf *pixbuf, PangoLayout *layout, GtkWidget *widget,
115                         gint x, gint y,
116                         guint8 r, guint8 g, guint8 b, guint8 a);
117
118
119 void pixbuf_draw_triangle(GdkPixbuf *pb,
120                           gint clip_x, gint clip_y, gint clip_w, gint clip_h,
121                           gint x1, gint y1, gint x2, gint y2, gint x3, gint y3,
122                           guint8 r, guint8 g, guint8 b, guint8 a);
123
124 void pixbuf_draw_line(GdkPixbuf *pb,
125                       gint clip_x, gint clip_y, gint clip_w, gint clip_h,
126                       gint x1, gint y1, gint x2, gint y2,
127                       guint8 r, guint8 g, guint8 b, guint8 a);
128
129 void pixbuf_draw_shadow(GdkPixbuf *pb,
130                         gint clip_x, gint clip_y, gint clip_w, gint clip_h,
131                         gint x, gint y, gint w, gint h, gint border,
132                         guint8 r, guint8 g, guint8 b, guint8 a);
133
134 void pixbuf_desaturate_rect(GdkPixbuf *pb,
135                             gint x, gint y, gint w, gint h);
136 void pixbuf_highlight_overunderexposed(GdkPixbuf *pb,
137                             gint x, gint y, gint w, gint h);
138 void pixbuf_ignore_alpha_rect(GdkPixbuf *pb,
139                  gint x, gint y, gint w, gint h);
140
141 /* clipping utils */
142
143 gboolean util_clip_region(gint x, gint y, gint w, gint h,
144                           gint clip_x, gint clip_y, gint clip_w, gint clip_h,
145                           gint *rx, gint *ry, gint *rw, gint *rh);
146 void util_clip_triangle(gint x1, gint y1, gint x2, gint y2, gint x3, gint y3,
147                         gint *rx, gint *ry, gint *rw, gint *rh);
148
149
150 #endif
151 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */