A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: Perl Wrapper for SWF

  1. #1
    Junior Member
    Join Date
    Mar 2001
    Posts
    27
    Does anyone know if there's a perl interface to the SWF libraries? No luck on CPAN. I wondered if I could save myself a week or two if someone had already written one.

  2. #2
    Junior Member
    Join Date
    Jul 2001
    Posts
    2

    Perl SWF Modules

    Originally posted by IO_MCollins
    Does anyone know if there's a perl interface to the SWF libraries? No luck on CPAN. I wondered if I could save myself a week or two if someone had already written one.
    You're absolutely right: there's nothing checked into CPAN for SWF. However, Ming does have their Perl subtree; given Ming's popularity, I am going to put a bit of work into cleaning it up and getting it submitted to CPAN. Want to help?

  3. #3
    Junior Member
    Join Date
    Jul 2001
    Posts
    2

    perl::flash

    Originally posted by IO_MCollins
    Does anyone know if there's a perl interface to the SWF libraries? No luck on CPAN. I wondered if I could save myself a week or two if someone had already written one.
    BTW, I just found this: http://www.twoshortplanks.com/simon/flash/ - interesting! The final writeup he did is at http://www.twoshortplanks.com/simon/...al_project.pdf

    -david

  4. #4
    Junior Member
    Join Date
    Mar 2001
    Posts
    27

    Ming etc

    Just checked out the Ming site. It seems like there's only a wrapper for PHP,python, and Ruby. Do you think it's possible to translate these wrappers from say PHP to perl?

    Since Ming is a C lib, it would probably be easier to write a perlxs from scratch.

    I guess the question is which lib is best to write an extension from? Ming, Middlesoft, Virtuascape.

    Hey - I just got the Ming reference! Did you ever see Flash Gordon?

  5. #5
    Senior Member
    Join Date
    Jul 2000
    Posts
    503
    It depends what you want to do. Ming is specifically geared toward dynamic content generation, SWFSource is specifically geared toward application developement, Middlesoft's SDK is specifically geared toward people that like having lots of bugs in their code ;-).

    --Jesse

  6. #6
    Junior Member
    Join Date
    Mar 2001
    Posts
    27

    Actually...

    I just downloaded the Ming source and found it does have a perl wrapper. I'm not sure how the bitmapped graphics methods are going to work out. In order to create a lossless bitmapped fill you have to convert the graphics format to dbl.

    Jesse, how does SWFSource implement usage of lossless bitmap fill?

  7. #7

    Unhappy Re: Perl SWF Modules

    How are you wanting to implement this? Do you want to wrap en existing C library or reimplement things in pure perl?

    I have written the beginnings of a perl library (to support my jpg/gif/ppm to swf converter) which currently works something like:

    use Swf;
    my $swf = new Swf;
    $swf->movie_size((25 * 20 ),(25 * 20));
    $swf->frame_rate(12);

    # frame1
    $swf->bg_col(255,255,255);
    my $char = $swf->definebits_lossless2(\$argb_data_compressed, 25,25);

    # define shape to hold image
    $swf->defineshape(25,25, $char, (25 * 20), (25 * 20), 0);
    $swf->placechar($char);

    # fix up file size, end file etc
    my $outputref = $swf->create;

    #print finished swf to STDOUT
    print $$outputref;

    It's in pure perl. I have got a few actions defined (SetVariable and Stop), and definebits lossless and jpeg2 work OK. I stopped working on it as it meets my needs and implementing the complete swf format is a huge undertaking.

    Email me if you want it (assuming you intend to release any derivatives as open source, natch). It's currently a work in progress to pull out the swf functions from a fully working jpg2swf converter which generates a two frame movie (empty first frame, STOP on second frame). But the above code works, and generates valid, working flash movies.

    HTH!

  8. #8
    Senior Member
    Join Date
    Jul 2000
    Posts
    503
    >> I'm not sure how the bitmapped graphics methods are going to work out. In order to create a lossless bitmapped fill you have to convert the graphics format to dbl.

    Ming does that with a lot of things. It doesn't directly support much.

    >> SWFSource Lossless implemenation

    SWFSource is based on the file format and tries to replicate that as much as possible in its structure. The exact format of the data depends on the type of lossless image (16 bit, 24 bit, or indexed). Indexed data is simply passed as a pallete and then a byte for each pixel that is a pallete index. 24 bit is in the form of 32bit DWORDS for each pixel (XRGB).

    --Jesse


  9. #9
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi Jesse,

    the way it is written it would not be a big deal to add inline conversion. In the specific case of gif separating the conversion into a helper proram might have the benefit of making the main program independent of patent issues.

    Musicman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center