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 }
/** * Draw a pixel * * @param $color Pixel color * @param $p */ function point($color, $p) { if ($p->isHidden() === FALSE) { list($red, $green, $blue, $alpha) = $this->getColor($color); $point = new SWFShape(); $point->setLine(1, $red, $green, $blue, $alpha); $point->movePenTo($this->x + round($p->x), $this->y + round($p->y)); $point->drawLine(0.5, 0.5); $point->movePen(-0.5, 0); $point->drawLine(0.5, -0.5); $this->movie->add($point); } }
/* 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");
$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); } if (isset($devip[1])) {
#!/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");
#!/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 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 rectangle * * Parameter array: * 'x0' : int X start point * 'y0' : int Y start point * 'x1' : int X end point * 'y1' : int Y end point * 'fill' : The fill style * 'line' : The line style * 'url' : string [optional] Target URL * * @param array $params Parameter array * * @return void */ function rectangle($params) { $x0 = min($this->_getX($params['x0']), $this->_getX($params['x1'])); $y0 = min($this->_getY($params['y0']), $this->_getY($params['y1'])); $x1 = max($this->_getX($params['x0']), $this->_getX($params['x1'])); $y1 = max($this->_getY($params['y0']), $this->_getY($params['y1'])); $fillColor = isset($params['fill']) ? $params['fill'] : false; $lineColor = isset($params['line']) ? $params['line'] : false; $fillColor = $this->_getFillStyle($fillColor); $lineColor = $this->_getLineStyle($lineColor); // use fill color if no line color is set or transparent if (count($lineColor) === 0) { $lineColor = $fillColor; } $shape = new SWFShape(); $shape->setLine(1, $lineColor[0], $lineColor[1], $lineColor[2]); if (count($fillColor)) { $shape->setRightFill($fillColor[0], $fillColor[1], $fillColor[2]); } $shape->movePenTo($x0, $y0); $shape->drawLine($x1 - $x0, 0); $shape->drawLine(0, $y1 - $y0); $shape->drawLine($x0 - $x1, 0); $shape->drawLine(0, $y0 - $y1); 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); $this->_canvas->add($button); } else { $this->_canvas->add($shape); } parent::rectangle($params); }
$rm->drawLineTo(0, 1); $rm->setLine(5, 255, 200, 0); $rm->movePenTo(0, 1); $rm->drawLineTo(0, 50); // Draws the white line at the middle of the screen $wl = new SWFShape(); $wl->setLine(8, 255, 255, 255); $wl->drawLineTo(0, 480); // Draws the "grass" border $gm = new SWFShape(); $gm->setLine(100, 48, 96, 48); $gm->drawLine(640, 0); // Draws the ball $bm = new SWFShape(); $bm->setLine(12, 255, 200, 0); $bm->drawLine(1, 1); // Creates a font $f = new SWFFont("arial.fdb"); // Writes the score for player $sp = new SWFTextField(); $sp->setBounds(100, 30); $sp->setName("pScore"); $sp->setFont($f); $sp->setColor(255, 255, 255); $sp->addString("Player : 0"); // Writes the score for computer $sc = new SWFTextField(); $sc->setBounds(100, 30); $sc->setName("cScore"); $sc->setFont($f); $sc->setColor(255, 255, 255);
#!/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");
if (!dl('php_ming.so')) { exit; } } $m = new SWFMovie(); /* $fp = fopen("/tmp/debug.txt","w"); fputs($fp,"coid=$coid\ntype=$type\ntext=".($objs[$coid]->title)."\n"); fclose($fp); */ switch ($type) { case 'title': // Entire movie will get key events - make shape that covers the whole thing $s = new SWFShape(); $s->setRightFill($s->addFill(0, 0, 0)); $s->drawLine($dx, 0); $s->drawLine(0, $dy); $s->drawLine(-$dx, 0); $s->drawLine(0, -$dy); // Need a button to receive the key events - shape from above $b = new SWFButton(); $b->addShape($s, SWFBUTTON_KEYPRESS); // Space bar or Enter takes us to the next slide if ($slideNum < $maxSlideNum) { $next = $slideNum + 1; $b->addAction(new SWFAction("getURL('http://{$_SERVER['HTTP_HOST']}{$baseDir}{$showScript}/{$currentPres}/{$next}','_self');"), swfbutton_keypress(' ')); $b->addAction(new SWFAction("getURL('http://{$_SERVER['HTTP_HOST']}{$baseDir}{$showScript}/{$currentPres}/{$next}','_self');"), swfbutton_keypress(chr(13))); } // Backspace or DEL bar takes us to the previous slide if ($slideNum > 0) { $prev = $slideNum - 1;
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); }
if (isset($context['flash_height']) && $context['flash_height']) { $height = $context['flash_height']; } else { $height = 50; } $m->setDimension($width, $height); // assume a transparent background, except if explicitly configured if (isset($context['flash_background_r']) && isset($context['flash_background_g']) && isset($context['flash_background_b']) && $context['flash_background_r'] + $context['flash_background_g'] + $context['flash_background_b']) { $m->setBackground(intval($context['flash_background_r']), intval($context['flash_background_g']), intval($context['flash_background_b'])); } $m->setRate(24.0); // make a hit region for the button $hit = new SWFShape(); $hit->setRightFill($hit->addFill(0, 0, 0)); $hit->movePenTo(0, 0); $hit->drawLine($width, 0); $hit->drawLine(0, $height); $hit->drawLine(-$width, 0); $hit->drawLine(0, -$height); // actual transmission except on a HEAD request -- and on scripts/validate.php if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') { // load a font file -- still buggy http://bugs.php.net/bug.php?id=31047&edit=2 if (!isset($context['flash_font']) || !$context['flash_font']) { $context['flash_font'] = 'Bimini.fdb'; } if (@is_readable($context['flash_font'])) { $f = new SWFFont($context['flash_font']); } else { $f = new SWFFont("_sans"); } $font_height = 0;
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; }
$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/"; if ($status_symbol == 'yes') { $ex_clip = new SWFBitmap(fopen($ind_path . "icon_warning_sml.jpg", "r"));