Difference between revisions of "Swf.pl"

From Organic Design wiki
(Beginning Ming changeover)
(use Image::Magick;)
Line 1: Line 1:
 
use SWF qw(:ALL);
 
use SWF qw(:ALL);
#use SWF::Builder;
+
use Image::Magick;
  
# Process a message from SWF interface instance
+
# Process a message from SWF interface-instance
 +
# - requests can require rendering of layers from SVG source using PerlMagick
 
sub swfHandleRequest {
 
sub swfHandleRequest {
 
my $article = shift;
 
my $article = shift;

Revision as of 07:49, 17 February 2006

use SWF qw(:ALL); use Image::Magick;

  1. Process a message from SWF interface-instance
  2. - requests can require rendering of layers from SVG source using PerlMagick

sub swfHandleRequest { my $article = shift; return $article; }

  1. Compile a SWF interface for this peer

sub swfCompile {

my $output = ;

# Create new SWF movie instance SWF::setScale(1.0); SWF::setVersion(6); my $swf = new SWF::Movie(); $swf->setBackground( 0xcc, 0xcc, 0xcc ); $swf->setDimension( 1024, 768 ); $swf->setRate(50);

# Import peer.as my $file = 'peer.as'; my @stat = stat( $file ); $output = logAdd "Compiling \"$file\" ($stat[7] bytes)\n"; my $as = $swf->frame_action( 1 ); $as->load( $file );

# Frame 2: Nodal reduction (main) my $as = $swf->frame_action( 2 ); $as->compile( 'space.reduce();' );

# Frame 3: Loop back to frame 2 my $as = $swf->frame_action(3); $as->gotoAndPlay(2);

# Output resultant SWF file (compress) $swf->save( my $file = "$::peer.swf", 9 ); my @stat = stat( $file ); $output .= logAdd "\nSWF Instance compiled: $file ($stat[7] bytes)\n"; return $output; }