[Swfdec] screenshot of swf file

Evgeny Zinoviev luethus at gmail.com
Sun Nov 8 06:52:39 PST 2009


#include <stdlib.h>
#include <iostream>
#include <swfdec/swfdec.h>
#include <cairo.h>

using namespace std;

void swfdec_player_save (SwfdecPlayer *player, guint width, guint height,
const char *filename) {
    cairo_surface_t *surface;
    cairo_t *cr;

    surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width,
height);
    cr = cairo_create (surface);
    swfdec_player_render (player, cr);
    cairo_destroy (cr);
    cairo_surface_write_to_png (surface, filename);
    cairo_surface_destroy (surface);
}

int main(int argc, char *argv[]) {
    char *input = argv[1];
    char *output = argv[2];

    SwfdecPlayer *player = swfdec_player_new(NULL);
    SwfdecURL *url = swfdec_url_new_from_input(input);
    swfdec_player_set_url(player, url);

    swfdec_player_save(player, 300, 300, output);

    return 0;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/swfdec/attachments/20091108/dc2dd6ad/attachment.htm 


More information about the Swfdec mailing list