Linux.com

z-kzn-z

z-kzn-z

  • Linux.com Member
  • Posts: 1
  • Member Since: 14 May 09
  • Last Logged In: 08 Nov 09

Latest Posts

Posted by
Topic
Post Preview
Posted
  • z-kzn-z
    take a screenshot of swf file
    1. Sorry for my bad english 2. Please, help me :) I need to take a screenshot of swf and save it as image file. I found this: http://www.mail-archive.com/swfdec@lists.freedesktop.org/msg00403.html I wrote something like this: [code]#include #include #include #include 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; }[/code] , but it doesn't save screenshot to file, it save just empty png file with transparent background. How can I fix it?
    Link to this post 09 Nov 09

    1. Sorry for my bad english
    2. Please, help me :)

    I need to take a screenshot of swf and save it as image file. I found this: http://www.mail-archive.com/swfdec@lists.freedesktop.org/msg00403.html
    I wrote something like this:

    #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;
    }

    , but it doesn't save screenshot to file, it save just empty png file with transparent background.
    How can I fix it?

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board