Mercurial > geeqie.yaz
comparison src/pixbuf-renderer.h @ 23:17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
##### an offical release when making enhancements and translation updates. #####
Fri Mar 18 19:52:38 2005 John Ellis <johne@verizon.net>
* pixbuf-renderer.c: Fix broken 2pass queueing so it merges a single
queue item for each tile, and now that a tile holds a queue pointer
there is no need to walk the tile list to find a possible merge victim.
Thu Mar 17 19:23:56 2005 John Ellis <johne@verizon.net>
* image.c, pixbuf-renderer.[ch]: More progress, and 2 pass zoom now
works again (mostly).
Tue Mar 15 23:17:41 2005 John Ellis <johne@verizon.net>
* image.[ch]: Start conversion to use of PixbufRenderer.
* pixbuf-renderer.[ch]: Additions and fixes for use by ImageWindow.
* fullscreen.c, image-overlay.c, img-view.c, info.c, layout.c,
layout_image.c, print.c: Changes for above ImageWindow conversion.
* typedefs.h: Remove unused ImageWindow variables.
Mon Mar 14 20:45:50 2005 John Ellis <johne@verizon.net>
* pan-view.c: Convert to using new PixbufRenderer.
* pixbuf-renderer.[ch]: Clean up and fixes.
Sun Mar 13 10:21:35 2005 John Ellis <johne@verizon.net>
* image.c (image_scroller_start): Unref scroller pixbuf after adding it
as an overlay to avoid leaking it.
* pixbuf-renderer.[ch]: All functions defined in header file are now
implemented.
Fri Mar 11 17:05:36 2005 John Ellis <johne@verizon.net>
* pixbuf-renderer.[ch]: Set up object properties and additional.
Mar 10 19:22:18 2005 John Ellis <johne@verizon.net>
* pixbuf-renderer.[ch]: FIx scrolling to use old method of gdk_draw and
not gdk_scroll, as scroll often invalidates the entire window (!). Also
merged in source tiles code from image.c.
* pan-view.c: Change picked up when testing PixbufRender zoom.
Tue Mar 8 23:26:00 2005 John Ellis <johne@verizon.net>
* pixbuf-renderer.[ch]: Start of turning image drawing portion of
ImageWindow into an actual GtkWidget.
* src/Makefile.am: Add pixbuf-renderer.[ch].
* pan-view.c: Added temporary hack button and callback for testing
PixbufRenderer widget.
author | gqview |
---|---|
date | Sat, 19 Mar 2005 01:15:17 +0000 |
parents | |
children | 104e34f9ab1f |
comparison
equal
deleted
inserted
replaced
22:e9625635e162 | 23:17acca639a86 |
---|---|
1 /* | |
2 * GQview | |
3 * (C) 2005 John Ellis | |
4 * | |
5 * Author: John Ellis | |
6 * | |
7 * This software is released under the GNU General Public License (GNU GPL). | |
8 * Please read the included file COPYING for more information. | |
9 * This software comes with no warranty of any kind, use at your own risk! | |
10 */ | |
11 | |
12 #ifndef PIXBUF_RENDERER_H | |
13 #define PIXBUF_RENDERER_H | |
14 | |
15 #include <gtk/gtkeventbox.h> | |
16 #include <gtk/gtkwindow.h> | |
17 | |
18 | |
19 #define TYPE_PIXBUF_RENDERER (pixbuf_renderer_get_type()) | |
20 #define PIXBUF_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_PIXBUF_RENDERER, PixbufRenderer)) | |
21 #define PIXBUF_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_PIXBUF_RENDERER, PixbufRendererClass)) | |
22 #define IS_PIXBUF_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_PIXBUF_RENDERER)) | |
23 #define IS_PIXBUF_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_PIXBUF_RENDERER)) | |
24 #define PIXBUF_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_PIXBUF_RENDERER, PixbufRendererClass)) | |
25 | |
26 | |
27 typedef struct _PixbufRenderer PixbufRenderer; | |
28 typedef struct _PixbufRendererClass PixbufRendererClass; | |
29 | |
30 | |
31 typedef gint (* PixbufRendererTileRequestFunc)(PixbufRenderer *pr, gint x, gint y, | |
32 gint width, gint height, GdkPixbuf *pixbuf, gpointer user_data); | |
33 typedef void (* PixbufRendererTileDisposeFunc)(PixbufRenderer *pr, gint x, gint y, | |
34 gint width, gint height, GdkPixbuf *pixbuf, gpointer user_data); | |
35 typedef enum { | |
36 PR_SCROLL_RESET_TOPLEFT = 0, | |
37 PR_SCROLL_RESET_CENTER, | |
38 PR_SCROLL_RESET_NOCHANGE | |
39 } PixbufRendererScrollResetType; | |
40 | |
41 struct _PixbufRenderer | |
42 { | |
43 GtkEventBox eventbox; | |
44 | |
45 gint image_width; /* image actual dimensions (pixels) */ | |
46 gint image_height; | |
47 | |
48 GdkPixbuf *pixbuf; | |
49 | |
50 gint window_width; /* allocated size of window (drawing area) */ | |
51 gint window_height; | |
52 | |
53 gint x_offset; /* offset of image start (non-zero when image < window) */ | |
54 gint y_offset; | |
55 | |
56 gint vis_width; /* dimensions of visible part of image */ | |
57 gint vis_height; | |
58 | |
59 gint width; /* size of scaled image (result) */ | |
60 gint height; | |
61 | |
62 gint x_scroll; /* scroll offset of image (into width, height to start drawing) */ | |
63 gint y_scroll; | |
64 | |
65 gdouble zoom_min; | |
66 gdouble zoom_max; | |
67 gdouble zoom; /* zoom we want (0 is auto) */ | |
68 gdouble scale; /* zoom we got (should never be 0) */ | |
69 | |
70 GdkInterpType zoom_quality; | |
71 gboolean zoom_2pass; | |
72 gboolean zoom_expand; | |
73 | |
74 GdkRgbDither dither_quality; | |
75 | |
76 PixbufRendererScrollResetType scroll_reset; | |
77 | |
78 gboolean has_frame; | |
79 | |
80 GtkWidget *parent_window; /* resize parent_window when image dimensions change */ | |
81 | |
82 gboolean window_fit; | |
83 gboolean window_limit; | |
84 gint window_limit_size; | |
85 | |
86 gint tile_cache_max; /* max mb to use for offscreen buffer */ | |
87 | |
88 /*< private >*/ | |
89 | |
90 gint tile_width; | |
91 gint tile_height; | |
92 gint tile_cols; /* count of tile columns */ | |
93 GList *tiles; /* list of buffer tiles */ | |
94 gint tile_cache_size; /* allocated size of pixmaps/pixbufs */ | |
95 GList *draw_queue; /* list of areas to redraw */ | |
96 GList *draw_queue_2pass;/* list when 2 pass is enabled */ | |
97 | |
98 gint draw_idle_id; | |
99 gint draw_idle_high; /* current idle_id has high priority */ | |
100 | |
101 gboolean in_drag; | |
102 gint drag_last_x; | |
103 gint drag_last_y; | |
104 gint drag_moved; | |
105 | |
106 gboolean source_tiles_enabled; | |
107 gint source_tiles_cache_size; | |
108 | |
109 GList *source_tiles; /* list of active source tiles */ | |
110 gint source_tile_width; | |
111 gint source_tile_height; | |
112 | |
113 PixbufRendererTileRequestFunc func_tile_request; | |
114 PixbufRendererTileDisposeFunc func_tile_dispose; | |
115 | |
116 gpointer func_tile_data; | |
117 | |
118 gboolean delay_flip; | |
119 gboolean loading; | |
120 | |
121 gint scroller_id; | |
122 gint scroller_overlay; | |
123 gint scroller_x; | |
124 gint scroller_y; | |
125 gint scroller_xpos; | |
126 gint scroller_ypos; | |
127 gint scroller_xinc; | |
128 gint scroller_yinc; | |
129 | |
130 GList *overlay_list; | |
131 }; | |
132 | |
133 struct _PixbufRendererClass | |
134 { | |
135 GtkEventBoxClass parent_class; | |
136 | |
137 void (* zoom) (PixbufRenderer *pr, gdouble zoom); | |
138 void (* clicked) (PixbufRenderer *pr, GdkEventButton *event); | |
139 void (* scroll_notify) (PixbufRenderer *pr); | |
140 }; | |
141 | |
142 | |
143 GType pixbuf_renderer_get_type (void); | |
144 | |
145 PixbufRenderer *pixbuf_renderer_new(void); | |
146 | |
147 void pixbuf_renderer_set_parent(PixbufRenderer *pr, GtkWindow *window); | |
148 GtkWindow *pixbuf_renderer_get_parent(PixbufRenderer *pr); | |
149 | |
150 /* display a pixbuf */ | |
151 | |
152 void pixbuf_renderer_set_pixbuf(PixbufRenderer *pr, GdkPixbuf *pixbuf, gdouble zoom); | |
153 GdkPixbuf *pixbuf_renderer_get_pixbuf(PixbufRenderer *pr); | |
154 | |
155 /* display an on-request array of pixbuf tiles */ | |
156 | |
157 void pixbuf_renderer_set_tiles(PixbufRenderer *pr, gint width, gint height, | |
158 gint tile_width, gint tile_height, gint cache_size, | |
159 PixbufRendererTileRequestFunc func_request, | |
160 PixbufRendererTileDisposeFunc func_dispose, | |
161 gpointer user_data, | |
162 gdouble zoom); | |
163 gint pixbuf_renderer_get_tiles(PixbufRenderer *pr); | |
164 | |
165 /* update region of existing image */ | |
166 | |
167 void pixbuf_renderer_area_changed(PixbufRenderer *pr, gint x, gint y, gint width, gint height); | |
168 | |
169 /* scrolling */ | |
170 | |
171 void pixbuf_renderer_scroll(PixbufRenderer *pr, gint x, gint y); | |
172 void pixbuf_renderer_scroll_to_point(PixbufRenderer *pr, gint x, gint y, | |
173 gdouble x_align, gdouble y_align); | |
174 | |
175 /* zoom */ | |
176 | |
177 void pixbuf_renderer_zoom_adjust(PixbufRenderer *pr, gdouble increment); | |
178 void pixbuf_renderer_zoom_adjust_at_point(PixbufRenderer *pr, gdouble increment, gint x, gint y); | |
179 | |
180 void pixbuf_renderer_zoom_set(PixbufRenderer *pr, gdouble zoom); | |
181 gdouble pixbuf_renderer_zoom_get(PixbufRenderer *pr); | |
182 gdouble pixbuf_renderer_zoom_get_scale(PixbufRenderer *pr); | |
183 | |
184 void pixbuf_renderer_zoom_set_limits(PixbufRenderer *pr, gdouble min, gdouble max); | |
185 | |
186 /* sizes */ | |
187 | |
188 gint pixbuf_renderer_get_image_size(PixbufRenderer *pr, gint *width, gint *height); | |
189 gint pixbuf_renderer_get_scaled_size(PixbufRenderer *pr, gint *width, gint *height); | |
190 | |
191 /* region of image in pixel coordinates */ | |
192 gint pixbuf_renderer_get_visible_rect(PixbufRenderer *pr, GdkRectangle *rect); | |
193 | |
194 /* actual size of the PixbufRenderer window minus borders, | |
195 * x and y are the scroll offset and include zoom factor. | |
196 */ | |
197 gint pixbuf_renderer_get_virtual_rect(PixbufRenderer *pr, GdkRectangle *rect); | |
198 | |
199 /* background color */ | |
200 | |
201 void pixbuf_renderer_set_color(PixbufRenderer *pr, GdkColor *color); | |
202 void pixbuf_renderer_set_black(PixbufRenderer *pr, gint black); | |
203 | |
204 /* overlay */ | |
205 | |
206 gint pixbuf_renderer_overlay_add(PixbufRenderer *pr, GdkPixbuf *pixbuf, gint x, gint y, | |
207 gint relative, gint always); | |
208 void pixbuf_renderer_overlay_set(PixbufRenderer *pr, gint id, GdkPixbuf *pixbuf, gint x, gint y); | |
209 gint pixbuf_renderer_overlay_get(PixbufRenderer *pr, gint id, GdkPixbuf **pixbuf, gint *x, gint *y); | |
210 void pixbuf_renderer_overlay_remove(PixbufRenderer *pr, gint id); | |
211 | |
212 | |
213 #endif | |
214 |