2
* Copyright (c) 2009 Tadej Borovšak <tadeboro@gmail.com>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License,or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU Library General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not,write to the Free Software
16
* Foundation,Inc.,59 Temple Place - Suite 330,Boston,MA 02111-1307,USA.
22
void img_transition_set_name(gchar **name)
24
*name = "Wave Right Up";
27
void img_transition_render(GdkDrawable *window, GdkPixbuf *image_from, GdkPixbuf *image_to, gdouble progress, gint file_desc)
30
cairo_surface_t *surface;
31
cairo_pattern_t *pattern;
33
gdouble wave_factor = 1.07; // 50px
36
gdk_drawable_get_size(window, &width, &height);
40
cr = gdk_cairo_create(window);
44
surface = cairo_image_surface_create(CAIRO_FORMAT_RGB24, width, height);
45
cr = cairo_create(surface);
48
gdk_cairo_set_source_pixbuf(cr,image_from,0,0);
51
gdk_cairo_set_source_pixbuf(cr,image_to,0,0);
52
pattern = cairo_pattern_create_linear( 0, height , width, 0 );
54
cairo_pattern_add_color_stop_rgba(pattern, (1 - wave_factor) / 2, 0, 0, 0, 1 ); // start
56
stop = progress * wave_factor - ( wave_factor - 1 );
57
cairo_pattern_add_color_stop_rgba(pattern, stop, 0, 0, 0, 1 );
59
stop = progress * wave_factor;
60
cairo_pattern_add_color_stop_rgba(pattern, stop, 0, 0, 0, 0 );
62
cairo_pattern_add_color_stop_rgba(pattern, wave_factor, 0, 0, 0, 0 ); // stop
64
cairo_mask(cr, pattern);
66
cairo_pattern_destroy(pattern);
71
img_export_cairo_to_ppm(surface, file_desc);
72
cairo_surface_destroy(surface);