~andrewsomething/imagination/debian

« back to all changes in this revision

Viewing changes to transitions/four_box_wipe.c

  • Committer: Andrew Starr-Bochicchio
  • Date: 2009-09-29 23:38:39 UTC
  • mfrom: (1.1.2)
  • Revision ID: a.starr.b@gmail.com-20090929233839-ucjnl2f35kw5fbx8
Tags: 2.0-1
* New upstream release. (Closes: #543218).
* debian/control: Build-depend on xsltproc, docbook-xsl, quilt,
  and doc-base.
* debian/imagination.doc-base: Register docs.
* debian/patches/10_link_math_lib.patch:
 - Add '-lm' to link to the math lib.
* debian/README.source: Explain quilt.
* debian/rules: Add quilt magic.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *
18
18
 */
19
19
 
20
 
#include "export_to_ppm.h"
21
 
#include <gdk/gdk.h>
 
20
#include <cairo.h>
 
21
#include <glib.h>
22
22
 
23
23
/* Local functions declarations */
24
24
static void
25
 
transition_render( GdkDrawable *window,
26
 
                                   GdkPixbuf   *image_from,
27
 
                                   GdkPixbuf   *image_to,
28
 
                                   gdouble      progress,
29
 
                                   gint         file_desc,
30
 
                                   gint         type );
 
25
transition_render( cairo_t         *cr,
 
26
                                   cairo_surface_t *image_from,
 
27
                                   cairo_surface_t *image_to,
 
28
                                   gdouble          progress,
 
29
                                   gint             type);
31
30
 
32
31
/* Plug-in API */
33
32
void
48
47
}
49
48
 
50
49
void
51
 
img_corners_in( GdkDrawable *window,
52
 
                GdkPixbuf   *image_from,
53
 
                GdkPixbuf   *image_to,
54
 
                gdouble      progress,
55
 
                gint         file_desc )
 
50
img_corners_in( cairo_t         *cr,
 
51
                                cairo_surface_t *image_from,
 
52
                                cairo_surface_t *image_to,
 
53
                                gdouble          progress)
56
54
{
57
 
        transition_render( window, image_from, image_to, progress, file_desc, 1 );
 
55
        transition_render( cr, image_from, image_to, progress, 1 );
58
56
}
59
57
 
60
58
void
61
 
img_corners_out( GdkDrawable *window,
62
 
                 GdkPixbuf   *image_from,
63
 
                 GdkPixbuf   *image_to,
64
 
                 gdouble      progress,
65
 
                 gint         file_desc )
 
59
img_corners_out(cairo_t         *cr,
 
60
                                cairo_surface_t *image_from,
 
61
                                cairo_surface_t *image_to,
 
62
                                gdouble          progress)
66
63
{
67
 
        transition_render( window, image_from, image_to, progress, file_desc, 2 );
 
64
        transition_render( cr, image_from, image_to, progress, 2 );
68
65
}
69
66
 
70
67
/* Local functions definitions */
71
68
static void
72
 
transition_render( GdkDrawable *window,
73
 
                                   GdkPixbuf   *image_from,
74
 
                                   GdkPixbuf   *image_to,
75
 
                                   gdouble      progress,
76
 
                                   gint         file_desc,
77
 
                                   gint         type )
 
69
transition_render( cairo_t         *cr,
 
70
                                   cairo_surface_t *image_from,
 
71
                                   cairo_surface_t *image_to,
 
72
                                   gdouble          progress,
 
73
                                   gint                 direction )
78
74
{
79
 
        cairo_t         *cr;
80
 
        cairo_surface_t *surface;
81
 
        gint             width, height;
82
 
        gint             w, h, x, y;
83
 
 
84
 
        gdk_drawable_get_size( window, &width, &height );
85
 
 
86
 
        if( file_desc < 0 )
87
 
        {
88
 
                cr = gdk_cairo_create( window );
89
 
        }
90
 
        else
91
 
        {
92
 
                surface = cairo_image_surface_create( CAIRO_FORMAT_RGB24,
93
 
                                                                                          width, height );
94
 
                cr = cairo_create( surface );
95
 
        }
96
 
 
97
 
        gdk_cairo_set_source_pixbuf( cr, image_from, 0, 0 );
 
75
        gint width, height, w, h, x, y;
 
76
 
 
77
        width  = cairo_image_surface_get_width( image_from );
 
78
        height = cairo_image_surface_get_height( image_from );
 
79
 
 
80
        cairo_set_source_surface( cr, image_from, 0, 0 );
98
81
        cairo_paint( cr );
99
82
 
100
 
        gdk_cairo_set_source_pixbuf( cr, image_to, 0, 0 );
 
83
        cairo_set_source_surface( cr, image_to, 0, 0 );
101
84
        w = width  * progress / 2;
102
85
        h = height * progress / 2;
103
 
        switch( type )
 
86
        switch( direction )
104
87
        {
105
88
                case 1:
106
89
                        cairo_rectangle( cr, 0, 0, w, h );
119
102
        }
120
103
        cairo_clip(cr );
121
104
        cairo_paint(cr);
122
 
 
123
 
        cairo_destroy(cr);
124
 
 
125
 
        if(file_desc < 0)
126
 
                return;
127
 
 
128
 
        img_export_cairo_to_ppm(surface, file_desc);
129
 
        cairo_surface_destroy(surface);
130
105
}