faf56b692999cee7c15dc95bcefe8d682ad834f2
[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 struct FileData;
26
27 gboolean pixbuf_to_file_as_png (GdkPixbuf *pixbuf, const gchar *filename);
28
29 void pixbuf_inline_register_stock_icons();
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_ARCHIVE               "gq-icon-archive-file"
38 #define PIXBUF_INLINE_BROKEN                "gq-icon-broken"
39 #define PIXBUF_INLINE_COLLECTION            "gq-icon-collection"
40 #define PIXBUF_INLINE_ICON_180              "gq-icon-rotate-180"
41 #define PIXBUF_INLINE_ICON_BOOK             "gq-icon-book"
42 #define PIXBUF_INLINE_ICON_CONFIG           "gq-icon-config"
43 #define PIXBUF_INLINE_ICON_DRAW_RECTANGLE   "gq-icon-draw-rectangle"
44 #define PIXBUF_INLINE_ICON_EXIF             "gq-icon-exif"
45 #define PIXBUF_INLINE_ICON_EXPOSURE         "gq-icon-exposure"
46 #define PIXBUF_INLINE_ICON_FLOAT            "gq-icon-float"
47 #define PIXBUF_INLINE_ICON                  "gqview-icon"
48 #define PIXBUF_INLINE_ICON_GRAYSCALE        "gq-icon-grayscale"
49 #define PIXBUF_INLINE_ICON_HEIF             "gq-icon-heic"
50 #define PIXBUF_INLINE_ICON_HIDETOOLS        "gq-icon-hidetools"
51 #define PIXBUF_INLINE_ICON_MAINTENANCE      "gq-icon-maintenance"
52 #define PIXBUF_INLINE_ICON_MARKS            "gq-icon-marks"
53 #define PIXBUF_INLINE_ICON_MOVE             "gq-icon-move"
54 #define PIXBUF_INLINE_ICON_ORIGINAL         "gq-icon-original"
55 #define PIXBUF_INLINE_ICON_PANORAMA         "gq-icon-panorama"
56 #define PIXBUF_INLINE_ICON_PDF              "gq-icon-pdf"
57 #define PIXBUF_INLINE_ICON_PROPERTIES       "gq-icon-properties"
58 #define PIXBUF_INLINE_ICON_RENAME           "gq-icon-rename"
59 #define PIXBUF_INLINE_ICON_SELECT_ALL       "gq-icon-select-all"
60 #define PIXBUF_INLINE_ICON_SELECT_INVERT    "gq-icon-select-invert"
61 #define PIXBUF_INLINE_ICON_SELECT_NONE      "gq-icon-select-none"
62 #define PIXBUF_INLINE_ICON_SELECT_RECTANGLE "gq-icon-select-rectangle"
63 #define PIXBUF_INLINE_ICON_SORT             "gq-icon-sort"
64 #define PIXBUF_INLINE_ICON_THUMB            "gq-icon-thumb"
65 #define PIXBUF_INLINE_ICON_TOOLS            "gq-icon-tools"
66 #define PIXBUF_INLINE_ICON_VIEW             "gq-icon-view"
67 #define PIXBUF_INLINE_ICON_ZOOMFILLHOR      "gq-icon-zoomfillhor"
68 #define PIXBUF_INLINE_ICON_ZOOMFILLVERT     "gq-icon-zoomfillvert"
69 #define PIXBUF_INLINE_LOGO                  "geeqie-logo"
70 #define PIXBUF_INLINE_METADATA              "gq-icon-metadata"
71 #define PIXBUF_INLINE_SCROLLER              "gq-scroller"
72 #define PIXBUF_INLINE_SPLIT_PANE_SYNC       "gq-icon-split-pane-sync"
73 #define PIXBUF_INLINE_UNKNOWN               "gq-icon-unknown"
74 #define PIXBUF_INLINE_VIDEO                 "gq-icon-video"
75
76 GdkPixbuf *pixbuf_copy_rotate_90(GdkPixbuf *src, gboolean counter_clockwise);
77 GdkPixbuf *pixbuf_copy_mirror(GdkPixbuf *src, gboolean mirror, gboolean flip);
78 GdkPixbuf* pixbuf_apply_orientation(GdkPixbuf *pixbuf, gint orientation);
79
80 void pixbuf_draw_rect_fill(GdkPixbuf *pb,
81                            gint x, gint y, gint w, gint h,
82                            gint r, gint g, gint b, gint a);
83
84 void pixbuf_set_rect_fill(GdkPixbuf *pb,
85                           gint x, gint y, gint w, gint h,
86                           gint r, gint g, gint b, gint a);
87
88 void pixbuf_set_rect(GdkPixbuf *pb,
89                      gint x, gint y, gint w, gint h,
90                      gint r, gint g, gint b, gint a,
91                      gint left, gint right, gint top, gint bottom);
92
93 void pixbuf_pixel_set(GdkPixbuf *pb, gint x, gint y, gint r, gint g, gint b, gint a);
94
95
96 void pixbuf_draw_layout(GdkPixbuf *pixbuf, PangoLayout *layout, GtkWidget *widget,
97                         gint x, gint y,
98                         guint8 r, guint8 g, guint8 b, guint8 a);
99
100
101 void pixbuf_draw_triangle(GdkPixbuf *pb,
102                           gint clip_x, gint clip_y, gint clip_w, gint clip_h,
103                           gint x1, gint y1, gint x2, gint y2, gint x3, gint y3,
104                           guint8 r, guint8 g, guint8 b, guint8 a);
105
106 void pixbuf_draw_line(GdkPixbuf *pb,
107                       gint clip_x, gint clip_y, gint clip_w, gint clip_h,
108                       gint x1, gint y1, gint x2, gint y2,
109                       guint8 r, guint8 g, guint8 b, guint8 a);
110
111 void pixbuf_draw_shadow(GdkPixbuf *pb,
112                         gint clip_x, gint clip_y, gint clip_w, gint clip_h,
113                         gint x, gint y, gint w, gint h, gint border,
114                         guint8 r, guint8 g, guint8 b, guint8 a);
115
116 void pixbuf_desaturate_rect(GdkPixbuf *pb,
117                             gint x, gint y, gint w, gint h);
118 void pixbuf_highlight_overunderexposed(GdkPixbuf *pb,
119                             gint x, gint y, gint w, gint h);
120 void pixbuf_ignore_alpha_rect(GdkPixbuf *pb,
121                  gint x, gint y, gint w, gint h);
122
123 /* clipping utils */
124
125 gboolean util_clip_region(gint x, gint y, gint w, gint h,
126                           gint clip_x, gint clip_y, gint clip_w, gint clip_h,
127                           gint *rx, gint *ry, gint *rw, gint *rh);
128 void util_clip_triangle(gint x1, gint y1, gint x2, gint y2, gint x3, gint y3,
129                         gint *rx, gint *ry, gint *rw, gint *rh);
130
131
132 #endif
133 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */