function box($w, $h) { global $g; $s = new SWFShape(); $f = $s->addFill($g, SWFFILL_LINEAR_GRADIENT); $f->scaleTo(0.05); $s->setRightFill($f); //$s->setRightFill($s->addFill(255,255,255)); $s->movePenTo(0, 0); $s->drawLineTo($w, 0); $s->drawLineTo($w, -$h); $s->drawLineTo(0, -$h); $s->drawLineTo(0, 0); return $s; }
function makeImgMovie($imgFile) { //Make sure this file is an actual jpg file if (is_file($imgFile) && ereg("\\.jpg\$", $imgFile)) { //Launch Flash $movie = new swfMovie(); $movie->setBackground(255, 255, 255); //Import a bitmap $b = new SWFBitmap(fOpen($imgFile, "rb")); //Get it's width and height $w = $b->getWidth(); $h = $b->getHeight(); //Make stage as big as the width and height of our bitmap $movie->setDimension($w, $h); //Convert Bitmap to a shape for Flash. //This process is automated upon import in Flash, but with //Ming we have have to do it ourselves. I see it as more control:) $s = new SWFShape(); $f = $s->addFill($b); $s->setRightFill($f); //draw corners for the bitmap shape $s->drawLine($w, 0); $s->drawLine(0, $h); $s->drawLine(-$w, 0); $s->drawLine(0, -$h); //CreateEmptyMovieclip $p = new SWFSprite(); //add our bitmap shape to this movieclip $p->add($s); $p->nextFrame(); //Add this movieclip to our main movie's timeline //Much like dragging a symbol from the library in Flash. $i = $movie->add($p); //Give this instance a name.. let's call it mImg as in movie image $i->setName("mImg"); //Output the movie.. Ctrl+Enter! // header("Content-Type:application/x-shockwave-flash"); $movie->output(); } //End if }
$celx = $device['x']; $cely = $device['y']; $px = $celx * $cellw + $celllmargin; $py = $cely * $cellh + $celltmargin; $d = $devices[$deviceid]; if ($d['lastonline']) { if (time() - $d['lastonline'] > ConfigHelper::getConfig('phpui.lastonline_limit')) { $myfill = $squareshape->addFill($im_d_off, SWFFILL_TILED_BITMAP); } else { $myfill = $squareshape->addFill($im_d_on, SWFFILL_TILED_BITMAP); } } else { $myfill = $squareshape->addFill($im_d_unk, SWFFILL_TILED_BITMAP); } $myfill->scaleto(9, 9); $squareshape->setRightFill($myfill); $squareshape->drawLine(15, 0); $squareshape->drawLine(0, 15); $squareshape->drawLine(-15, 0); $squareshape->drawLine(0, -15); $button->addShape($squareshape, SWFBUTTON_HIT | SWFBUTTON_UP | SWFBUTTON_DOWN | SWFBUTTON_OVER); $button->addAction(new SWFAction("this.getURL('?m=netdevinfo&id=" . $deviceid . "');"), SWFBUTTON_MOUSEDOWN); // press $i = $m->add($button); $i->moveTo($px, $py); if ($devip = $DB->GetCol('SELECT INET_NTOA(ipaddr) FROM vnodes WHERE ownerid = 0 AND netdev = ? ORDER BY ipaddr LIMIT 4', array($deviceid))) { if (isset($devip[0])) { drawtext($px + 16, $py - (isset($devip[1]) ? 16 : 8), $devip[0], 0, 0, 255); }
#!/usr/bin/php -c. <?php $srcdir = $argv[1]; $m = new SWFMovie(9); $m->setBackground(0xcc, 0xcc, 0xcc); $s = new SWFShape(); $img = new SWFBitmap($srcdir . "/../Media/image01.dbl"); $fill = $s->addFill($img, SWFFILL_TILED_BITMAP); $s->setRightFill($fill); $w = $img->getWidth(); $h = $img->getHeight(); $s->drawLine($w, 0); $s->drawLine(0, $h); $s->drawLine(-$w, 0); $s->drawLine(0, -$h); $cm = array(); for ($i = 0; $i < 20; $i++) { $cm[$i] = 0.1; } $cmf = new SWFFilterMatrix(5, 4, $cm); $filter = new SWFFilter(SWFFILTER_TYPE_COLORMATRIX, $cmf); $bu = new SWFButton(); $bu->addCharacter($s, SWFBUTTON_UP | SWFBUTTON_HIT | SWFBUTTON_OVER | SWFBUTTON_DOWN); $item = $m->add($bu); $item->addFilter($filter); $m->save("test05.swf");
/** * Draw an ellipse * * Parameter array: * 'x' : int X center point * 'y' : int Y center point * 'rx' : int X radius * 'ry' : int Y radius * 'fill' : mixed [optional] The fill color * 'line' : mixed [optional] The line color * 'url' : string [optional] Target URL * * @param array $params Parameter array * * @return void */ function ellipse($params) { $x = $this->_getX($params['x']); $y = $this->_getY($params['y']); $rx = $this->_getX($params['rx']); $ry = $this->_getY($params['ry']); // calculate scale factors $scaleX = 1.0; $scaleY = 1.0; $moveX = 0; $moveY = 0; if ($rx > $ry) { $scaleY = $ry / $rx; $moveY = $ry * (1 - $scaleY); } elseif ($rx < $ry) { $scaleX = $rx / $ry; $moveX = $rx * (1 - $scaleX); } $fillColor = isset($params['fill']) ? $params['fill'] : false; $lineColor = isset($params['line']) ? $params['line'] : false; $fillColor = $this->_getFillStyle($fillColor); $lineColor = $this->_getLineStyle($lineColor); $shape = new SWFShape(); $shape->setRightFill($fillColor[0], $fillColor[1], $fillColor[2]); $shape->movePenTo($x, $y); $shape->setLine(1, $lineColor[0], $lineColor[1], $lineColor[2]); if (count($fillColor)) { $shape->setRightFill($fillColor[0], $fillColor[1], $fillColor[2]); } $shape->drawCircle(max($rx, $ry)); if (isset($params['url'])) { $button = new SWFButton(); $button->addShape($shape, SWFBUTTON_HIT | SWFBUTTON_UP | SWFBUTTON_DOWN | SWFBUTTON_OVER); $button->addAction(new SWFAction("getURL('{$params['url']}');"), SWFBUTTON_MOUSEUP); $ellipse = $this->_canvas->add($button); } else { $ellipse = $this->_canvas->add($shape); } $ellipse->move($moveX, $moveY); $ellipse->scaleTo($scaleX, $scaleY); parent::ellipse($params); }
#!/usr/bin/php -c. <?php $m = new SWFMovie(); $s = new SWFShape(); $s->setLine(1, 255, 0, 0, 255); $s->setRightFill(255, 255, 0, 255); $s->drawLine(100, 0); $s->drawLine(0, 40); $s->drawLineTo(0, 0); $b = new SWFButton(); $br1 = $b->addCharacter($s, SWFBUTTON_HIT | SWFBUTTON_UP | SWFBUTTON_OVER | SWFBUTTON_DOWN); $br2 = $b->addCharacter($s, SWFBUTTON_OVER | SWFBUTTON_DOWN); $br2->rotate(10); $br2->move(20, 0); $br3 = $b->addCharacter($s, SWFBUTTON_DOWN); $br3->rotate(20); $br3->move(40, 0); $d = $m->add($b); $d->moveTo(50, 100); $m->addExport($b, "ButtonExport"); $m->writeExports(); $m->nextFrame; $m->save("test02.swf"); ?>
<?php $s = new SWFShape(); $s->setLine(4, 0x7f, 0, 0); $s->setRightFill($s->addFill(0xff, 0, 0)); $s->movePenTo(10, 10); $s->drawLineTo(310, 10); $s->drawLineTo(310, 230); $s->drawCurveTo(10, 230, 10, 10); $m = new SWFMovie(); $m->setDimension(320, 240); $m->setRate(12.0); $m->add($s); $m->nextFrame(); header('Content-type: application/x-shockwave-flash'); $m->output();
/** * Draw a rectangle filled with a gradient from $color1 to * $color2. * * @param integer $x The left x-coordinate of the rectangle. * @param integer $y The top y-coordinate of the rectangle. * @param integer $width The width of the rectangle. * @param integer $height The height of the rectangle. * @param string $color The outline color of the rectangle. * @param string $fill1 The name of the start color for the gradient. * @param string $fill2 The name of the end color for the gradient. */ function gradientRectangle($x, $y, $width, $height, $color = 'black', $fill1 = 'black', $fill2 = 'white') { $s = new SWFShape(); if ($color != 'none') { $color = $this->allocateColor($color); $s->setLine(1, $color['red'], $color['green'], $color['blue'], $color['alpha']); } $fill1 = $this->allocateColor($fill1); $fill2 = $this->allocateColor($fill2); $gradient = new SWFGradient(); $gradient->addEntry(0.0, $fill1['red'], $fill1['green'], $fill1['blue'], $fill1['alpha']); $gradient->addEntry(1.0, $fill2['red'], $fill2['green'], $fill2['blue'], $fill2['alpha']); $f = $s->addFill($gradient, SWFFILL_LINEAR_GRADIENT); $f->scaleTo($width / $this->_width); $f->moveTo($x, $y); $s->setRightFill($f); $verts[0] = array('x' => $x, 'y' => $y); $verts[1] = array('x' => $x + $width, 'y' => $y); $verts[2] = array('x' => $x + $width, 'y' => $y + $height); $verts[3] = array('x' => $x, 'y' => $y + $height); $first_done = false; foreach ($verts as $vert) { if (!$first_done) { $s->movePenTo($vert['x'], $vert['y']); $first_done = true; $first_x = $vert['x']; $first_y = $vert['y']; } $s->drawLineTo($vert['x'], $vert['y']); } $s->drawLineTo($first_x, $first_y); return $this->_movie->add($s); }
#!/usr/bin/php <?php $m = new SWFMovie(8); $shape = new SWFShape(); $gradient = new SWFGradient(); $gradient->addEntry(0, 255, 0, 0, 255); $gradient->addEntry(0.25, 0x80, 0x20, 0x20, 0xff); $gradient->addEntry(0.8, 0x40, 0x40, 0x40, 0xff); $fill = $shape->addGradientFill($gradient, SWFFILL_LINEAR_GRADIENT); #$fill->moveTo(-163, -163); # this is added by swftoscript, but is wrong $shape->setLine(1, 0, 0, 0, 255); $shape->setRightFill($fill); $shape->drawLine(100, 0); $shape->drawLine(0, 100); $shape->drawLine(-100, 0); $shape->drawLine(0, -100); $m->add($shape); $m->save("test08.swf");
<?php $s = new SWFShape(); $fp = fopen('../../intro/php-big.jpg', 'r'); $jpg = new SWFBitmap($fp); $w = $jpg->getWidth(); $h = $jpg->getHeight(); $f = $s->addFill($jpg); $f->moveTo(-$w / 2, -$h / 2); $s->setRightFill($f); $s->movePenTo(-$w / 2, -$h / 2); $s->drawLine($w, 0); $s->drawLine(0, $h); $s->drawLine(-$w, 0); $s->drawLine(0, -$h); $p = new SWFSprite(); $i = $p->add($s); for ($step = 0; $step < 360; $step += 2) { $p->nextFrame(); $i->rotate(-2); } $m = new SWFMovie(); $i = $m->add($p); $i->moveTo(230, 120); $m->setRate(100); $m->setDimension($w * 1.8, $h * 1.8); header('Content-type: application/x-shockwave-flash'); $m->output(6);
private static function _outFlash() { if (!class_exists('SWFBitmap')) { return false; } self::_getCodeLenth(); self::_creatImage(); self::_setRandBackground(); self::_creatBackground(); //self::_setPicBackground(); self::_setRandFont(); self::_setRandGraph(); self::_writeImage(); self::_setRandDistortion(); $_tmpPath = Wind::getRealDir('DATA:tmp.'); $_tmp = $_tmpPath . WindUtility::generateRandStr(8) . '.png'; imagepng(self::$_image, $_tmp); if (!WindFile::isFile($_tmp)) { return false; } imagedestroy(self::$_image); $bit = new SWFBitmap($_tmp); $shape = new SWFShape(); $shape->setRightFill($shape->addFill($bit)); $shape->drawLine($bit->getWidth(), 0); $shape->drawLine(0, $bit->getHeight()); $shape->drawLine(-$bit->getWidth(), 0); $shape->drawLine(0, -$bit->getHeight()); $movie = new SWFMovie(); $movie->setDimension($bit->getWidth(), $bit->getHeight()); $flash = $movie->add($shape); header("Pragma:no-cache"); header("Cache-control:no-cache"); header('Content-type: application/x-shockwave-flash'); $movie->output(); WindFolder::clear($_tmpPath); }
public function WhiteAndBlack($color) { // drawing a red square shape (registration point : centered) $width = $this->m_Width; $height = $this->m_Height; //echo "width : $width , height : $height <br>"; $squareshape = new SWFShape(); if ($color == "white") { $squareshape->setRightFill(255, 0, 0); } else { $squareshape->setRightFill(0, 0, 0); } //$squareshape->movePenTo(-$width/2,-$height/2); $squareshape->drawLine($width, 0); $squareshape->drawLine(0, $height); $squareshape->drawLine(-$width, 0); $squareshape->drawLine(0, -$height); $squaresprite = new SWFSprite(); $f1 = $squaresprite->add($squareshape); //$f1->moveTo(-$width/2,-$height/2); $squaresprite->nextFrame(); $disp = $this->m_oMovie->add($squaresprite); $disp->moveTo(-$width, -$height); $disp->setDepth($this->m_nColorDepth); $this->m_nColorDepth = $this->m_nColorDepth + 1; return $disp; }
$entire_key = new SWFSprite(); $key_label = new SWFTextField(SWFTEXTFIELD_NOSELECT); $key_label->setBounds(150, 25); $key_label->setFont($f); $key_label->setHeight(14); if ($space_plan_locked === false) { $key_label->setColor(0, 0, 0); $key_label_text = 'Merchandising Key'; } else { $key_label->setColor(255, 0, 0); $key_label_text = 'Plan Is Locked'; } $key_label->addString($key_label_text); $my_key_label_header = new SWFShape(); $my_key_label_header->setLine(1, 0, 0, 0); $my_key_label_header->setRightFill(240, 240, 240); $my_key_label_header->movePenTo(0, 5); $my_key_label_header->drawLine(150, 0); $my_key_label_header->drawLine(0, 25); $my_key_label_header->drawLine(-150, 0); $my_key_label_header->drawLine(0, -25); $my_key_label = new SWFSprite(); $my_key_label->add($my_key_label_header); $key_spr = $my_key_label->add($key_label); $key_spr->moveTo(5, 7); $my_key_label->nextFrame(); $my_key_label_sprite = $entire_key->add($my_key_label); $my_key_label_sprite->setName('my_key_label'); $display_eqp_icons = true; if ($display_eqp_icons) { $ind_path = $path . "/htdocs/resources/img/style-1.1/images/";
/* swfextract -p 1 -o character1.png $swf*/ $character1 = new SWFBitmap($mediadir . '/image01.png'); /* SWF_DEFINESHAPE3 */ /* Shape 2 (TYPE=3, RECT=-10,2010 -10,2010)*/ $character2 = new SWFShape(); /*1 fillstyle(s)*/ /* BitmapID: 1 */ $character2_f0 = $character2->addBitmapFill($character1, SWFFILL_CLIPPED_BITMAP); $character2_f0->scaleTo(20.0); /*1 linestyles(s)*/ $character2_l0_width = 20; $character2_l0_red = 0x0; $character2_l0_green = 0x0; $character2_l0_blue = 0x0; $character2_l0_alpha = 0xff; /* StateLineStyle: 1 */ $character2->setLine($character2_l0_width, $character2_l0_red, $character2_l0_green, $character2_l0_blue, $character2_l0_alpha); $character2->setRightFill($character2_f0); $character2->drawLine(2000, 0); $character2->drawLine(0, 2000); $character2->drawLine(-2000, 0); $character2->drawLine(0, -2000); /* SWF_PLACEOBJECT2 */ $i1 = $m->add($character2); $i1->setDepth(1); /* PlaceFlagHasMatrix */ /* SWF_SHOWFRAME */ $m->nextFrame(); /* end of frame 1 */ /* SWF_END */ $m->save("test05.swf");
<?php require 'XML/RSS.php'; $r =& new XML_RSS('slashdot.rdf'); $r->parse(); $allItems = $r->getItems(); $itemCount = count($allItems); $width = 1000; $m = new SWFMovie(); $m->setDimension($width, 70); $m->setBackground(0xcf, 0xcf, 0xcf); $f = new SWFFont("../../../fonts/Techno.fdb"); $hit = new SWFShape(); $hit->setRightFill($hit->addFill(0, 0, 0)); $hit->movePenTo(-($width / 2), -30); $hit->drawLine($width, 0); $hit->drawLine(0, 60); $hit->drawLine(-$width, 0); $hit->drawLine(0, -60); $x = 0; // build the buttons foreach ($allItems as $Item) { $title = $Item['title']; $link = $Item['link']; // get the text $t = new SWFText(); $t->setFont($f); $t->setHeight(50); $t->setColor(0, 0, 0); $t->moveTo(-$f->getWidth($title) / 2, 25); $t->addString($title);
/** * Draw a polygon with a background * * @param mixed $background Background (can be a color or a gradient) * @param Polygon A polygon */ function filledPolygon($background, &$polygon) { $shape = new SWFShape(); if (is_a($background, 'awColor')) { list($red, $green, $blue, $alpha) = $this->getColor($background); $shape->setRightFill($red, $green, $blue, $alpha); } elseif (is_a($background, 'awGradient')) { list($flashGradient, $style) = $this->getGradient($background); $fill = $shape->addFill($flashGradient, $style); list($xMin, $xMax) = $polygon->getBoxXRange(); list($yMin, $yMax) = $polygon->getBoxYRange(); if ($background->angle === 0) { $fill->scaleTo(($yMax - $yMin) / 1600); } else { $fill->scaleTo(($xMax - $xMin) / 1600); } $fill->moveTo($xMin + ($xMax - $xMin) / 2, $yMin + ($yMax - $yMin) / 2); $shape->setRightFill($fill); } $points = $polygon->all(); $count = count($points); if ($count > 1) { $prev = $points[0]; $shape->movePenTo($prev->x, $prev->y); for ($i = 1; $i < $count; $i++) { $current = $points[$i]; $shape->drawLineTo($current->x, $current->y); } // Close the polygon $shape->drawLineTo($prev->x, $prev->y); $this->movie->add($shape); } }
ming_setscale(1.0); /*Unknown block type 69*/ /* SWF_DEFINESHAPE3 */ /* Shape 1 (TYPE=3, RECT=-10,2010 -10,2010)*/ $character1 = new SWFShape(); /*1 fillstyle(s)*/ /* BitmapID: 65535 */ $character1_f0 = $character1->addBitmapFill($character65535, SWFFILL_CLIPPED_BITMAP); $character1_f0->scaleTo(20.0); /*1 linestyles(s)*/ $character1_l0_width = 20; $character1_l0_red = 0x0; $character1_l0_green = 0x0; $character1_l0_blue = 0x0; $character1_l0_alpha = 0xff; /* StateLineStyle: 1 */ $character1->setLine($character1_l0_width, $character1_l0_red, $character1_l0_green, $character1_l0_blue, $character1_l0_alpha); $character1->setRightFill($character1_f0); $character1->drawLine(2000, 0); $character1->drawLine(0, 2000); $character1->drawLine(-2000, 0); $character1->drawLine(0, -2000); /* SWF_PLACEOBJECT2 */ $i1 = $m->add($character1); $i1->setDepth(1); /* PlaceFlagHasMatrix */ /* SWF_SHOWFRAME */ $m->nextFrame(); /* end of frame 1 */ /* SWF_END */ $m->save("test07.swf");