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.
20
#include "export_to_ppm.h"
23
/* Local functions declarations */
25
transition_render( GdkDrawable *window,
26
GdkPixbuf *image_from,
34
img_get_plugin_info( gchar **group,
39
*group = "Bow Tie Wipe";
41
*trans = g_new( gchar *, 7 );
42
(*trans)[i++] = "Vertical";
43
(*trans)[i++] = "img_vertical";
44
(*trans)[i++] = GINT_TO_POINTER( 36 );
45
(*trans)[i++] = "Horizontal";
46
(*trans)[i++] = "img_horizontal";
47
(*trans)[i++] = GINT_TO_POINTER( 37 );
52
img_vertical( GdkDrawable *window,
53
GdkPixbuf *image_from,
58
transition_render( window, image_from, image_to, progress, file_desc, 1 );
62
img_horizontal( GdkDrawable *window,
63
GdkPixbuf *image_from,
68
transition_render( window, image_from, image_to, progress, file_desc, 2 );
72
/* Local functions definitions */
74
transition_render( GdkDrawable *window,
75
GdkPixbuf *image_from,
82
cairo_surface_t *surface;
86
gdk_drawable_get_size( window, &width, &height );
90
cr = gdk_cairo_create( window );
94
surface = cairo_image_surface_create( CAIRO_FORMAT_RGB24,
96
cr = cairo_create( surface );
99
gdk_cairo_set_source_pixbuf( cr, image_from, 0, 0 );
102
gdk_cairo_set_source_pixbuf( cr, image_to, 0, 0 );
106
case 1: /* vertical */
108
cairo_move_to( cr, tmp * ( 1 - 2 * progress ), 0 );
109
cairo_line_to( cr, tmp, height * progress );
110
cairo_line_to( cr, tmp * ( 1 + 2 * progress ), 0 );
111
cairo_close_path( cr );
114
cairo_move_to( cr, tmp * ( 1 - 2 * progress ), height );
115
cairo_line_to( cr, tmp, height * ( 1 - progress ) );
116
cairo_line_to( cr, tmp * ( 1 + 2 * progress ), height );
117
cairo_close_path( cr );
121
case 2: /* horizontal */
123
cairo_move_to( cr, 0, tmp * ( 1 - 2 * progress ) );
124
cairo_line_to( cr, width * progress, tmp );
125
cairo_line_to( cr, 0, tmp * ( 1 + 2 * progress ) );
126
cairo_close_path( cr );
129
cairo_move_to( cr, width, tmp * ( 1 - 2 * progress ) );
130
cairo_line_to( cr, width * ( 1 - progress ), tmp );
131
cairo_line_to( cr, width, tmp * ( 1 + 2 * progress ) );
132
cairo_close_path( cr );
142
img_export_cairo_to_ppm(surface, file_desc);
143
cairo_surface_destroy(surface);