File tree Expand file tree Collapse file tree 1 file changed +15
-12
lines changed Expand file tree Collapse file tree 1 file changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -125,19 +125,22 @@ GIF file without closing and reopening it.
125
125
126
126
6. Putting it all together
127
127
128
- gd_GIF *gif = gd_open_gif("some_animation.gif");
129
- char *buffer = malloc(gif->width * gif->height * 3);
130
- for (unsigned looped = 1;; looped++) {
131
- while (gd_get_frame(gif)) {
132
- gd_render_frame(gif, buffer);
133
- /* insert code to render buffer to screen here */
128
+ A simplified skeleton of a GIF viewer may look like this:
129
+
130
+ gd_GIF *gif = gd_open_gif("some_animation.gif");
131
+ char *buffer = malloc(gif->width * gif->height * 3);
132
+ for (unsigned looped = 1;; looped++) {
133
+ while (gd_get_frame(gif)) {
134
+ gd_render_frame(gif, buffer);
135
+ /* insert code to render buffer to screen
136
+ and wait for delay time to pass here */
137
+ }
138
+ if (looped == gif->loop_count)
139
+ break;
140
+ gd_rewind(gif);
134
141
}
135
- if (looped == gif->loop_count)
136
- break;
137
- gd_rewind(gif);
138
- }
139
- free(buffer);
140
- gd_close_gif(gif);
142
+ free(buffer);
143
+ gd_close_gif(gif);
141
144
142
145
7. Reading streamed metadata with extension hooks
143
146
You can’t perform that action at this time.
0 commit comments