#!/usr/bin/perl -w # # Example 9-4. Reading in a bitmap image # use strict; use SWF qw(Movie Shape Bitmap); # Fill a Shape with a Bitmap. The .dbl file has been # previously created from a PNG file using the png2dbl tool. my $b = new SWF::Bitmap("bitmap.dbl"); # Fill must be created before the Shape is drawn my $s = new SWF::Shape(); my $f = $s->addFill($b); $s->setRightFill($f); # Get the dimensions of the bitmap and draw the Shape for the bounding box. # A smaller bounding shape would act as a clipping path. my $w = $b->getWidth(); my $h = $b->getHeight(); $s->drawLine($w, 0); $s->drawLine(0, $h); $s->drawLine(-$w, 0); $s->drawLine(0, -$h); my $m = new SWF::Movie(); $m->setDimension($w, $h); $m->add($s); $m->save("example9-4.swf");