For the sake of consistency, use glib basic types everywhere.
[geeqie.git] / src / pixbuf_util.h
1 /*
2  * Geeqie
3  * (C) 2004 John Ellis
4  * Copyright (C) 2008 The Geeqie Team
5  *
6  * Author: John Ellis
7  *
8  * This software is released under the GNU General Public License (GNU GPL).
9  * Please read the included file COPYING for more information.
10  * This software comes with no warranty of any kind, use at your own risk!
11  */
12
13
14 #ifndef PIXBUF_UTIL_H
15 #define PIXBUF_UTIL_H
16
17
18 gboolean pixbuf_to_file_as_png (GdkPixbuf *pixbuf, const gchar *filename);
19 gboolean pixbuf_to_file_as_jpg(GdkPixbuf *pixbuf, const gchar *filename, gint quality);
20
21
22 GdkPixbuf *pixbuf_inline(const gchar *key);
23 GdkPixbuf *pixbuf_fallback(FileData *fd, gint requested_width, gint requested_height);
24
25 gint pixbuf_scale_aspect(gint req_w, gint req_h, gint old_w, gint old_h, gint *new_w, gint *new_h);
26
27 #define PIXBUF_INLINE_FOLDER_CLOSED     "folder_closed"
28 #define PIXBUF_INLINE_FOLDER_LOCKED     "folder_locked"
29 #define PIXBUF_INLINE_FOLDER_OPEN       "folder_open"
30 #define PIXBUF_INLINE_FOLDER_UP         "folder_up"
31 #define PIXBUF_INLINE_SCROLLER          "scroller"
32 #define PIXBUF_INLINE_BROKEN            "broken"
33 #define PIXBUF_INLINE_ICON              "icon"
34 #define PIXBUF_INLINE_LOGO              "logo"
35
36 #define PIXBUF_INLINE_ICON_FLOAT        "icon_float"
37 #define PIXBUF_INLINE_ICON_THUMB        "icon_thumb"
38
39 #define PIXBUF_INLINE_ICON_BOOK         "icon_book"
40 #define PIXBUF_INLINE_ICON_CONFIG       "icon_config"
41 #define PIXBUF_INLINE_ICON_TOOLS        "icon_tools"
42 #define PIXBUF_INLINE_ICON_VIEW         "icon_view"
43
44
45 GdkPixbuf *pixbuf_copy_rotate_90(GdkPixbuf *src, gint counter_clockwise);
46 GdkPixbuf *pixbuf_copy_mirror(GdkPixbuf *src, gint mirror, gint flip);
47 GdkPixbuf* pixbuf_apply_orientation(GdkPixbuf *pixbuf, gint orientation);
48
49 void pixbuf_draw_rect_fill(GdkPixbuf *pb,
50                            gint x, gint y, gint w, gint h,
51                            gint r, gint g, gint b, gint a);
52
53 void pixbuf_draw_rect(GdkPixbuf *pb,
54                       gint x, gint y, gint w, gint h,
55                       gint r, gint g, gint b, gint a,
56                       gint left, gint right, gint top, gint bottom);
57
58 void pixbuf_set_rect_fill(GdkPixbuf *pb,
59                           gint x, gint y, gint w, gint h,
60                           gint r, gint g, gint b, gint a);
61
62 void pixbuf_set_rect(GdkPixbuf *pb,
63                      gint x, gint y, gint w, gint h,
64                      gint r, gint g, gint b, gint a,
65                      gint left, gint right, gint top, gint bottom);
66
67 void pixbuf_pixel_set(GdkPixbuf *pb, gint x, gint y, gint r, gint g, gint b, gint a);
68
69
70 void pixbuf_draw_layout(GdkPixbuf *pixbuf, PangoLayout *layout, GtkWidget *widget,
71                         gint x, gint y,
72                         guint8 r, guint8 g, guint8 b, guint8 a);
73
74
75 void pixbuf_draw_triangle(GdkPixbuf *pb,
76                           gint clip_x, gint clip_y, gint clip_w, gint clip_h,
77                           gint x1, gint y1, gint x2, gint y2, gint x3, gint y3,
78                           guint8 r, guint8 g, guint8 b, guint8 a);
79
80 void pixbuf_draw_line(GdkPixbuf *pb,
81                       gint clip_x, gint clip_y, gint clip_w, gint clip_h,
82                       gint x1, gint y1, gint x2, gint y2,
83                       guint8 r, guint8 g, guint8 b, guint8 a);
84
85 void pixbuf_draw_shadow(GdkPixbuf *pb,
86                         gint clip_x, gint clip_y, gint clip_w, gint clip_h,
87                         gint x, gint y, gint w, gint h, gint border,
88                         guint8 r, guint8 g, guint8 b, guint8 a);
89
90 void pixbuf_desaturate_rect(GdkPixbuf *pb,
91                             gint x, gint y, gint w, gint h);
92
93
94 /* clipping utils */
95
96 gint util_clip_region(gint x, gint y, gint w, gint h,
97                       gint clip_x, gint clip_y, gint clip_w, gint clip_h,
98                       gint *rx, gint *ry, gint *rw, gint *rh);
99 void util_clip_triangle(gint x1, gint y1, gint x2, gint y2, gint x3, gint y3,
100                         gint *rx, gint *ry, gint *rw, gint *rh);
101
102
103 #endif