本文整理汇总了PHP中SWFMovie::add方法的典型用法代码示例。如果您正苦于以下问题:PHP SWFMovie::add方法的具体用法?PHP SWFMovie::add怎么用?PHP SWFMovie::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SWFMovie
的用法示例。
在下文中一共展示了SWFMovie::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _flash
private function _flash()
{
$spacing = 5;
$codewidth = ($this->width - $spacing * 5) / 4;
$strforswdaction = '';
for ($i = 0; $i <= 3; $i++) {
$strforswdaction .= $this->swfcode($codewidth, $spacing, $this->_code[$i], $i + 1);
}
ming_setScale(20.0);
ming_useswfversion(6);
$movie = new SWFMovie();
$movie->setDimension($this->width, $this->height);
$movie->setBackground(255, 255, 255);
$movie->setRate(31);
$fontcolor = '0x' . sprintf('%02s', dechex(mt_rand(0, 255))) . sprintf('%02s', dechex(mt_rand(0, 128))) . sprintf('%02s', dechex(mt_rand(0, 255)));
$strAction = "\n\t\t_root.createEmptyMovieClip ( 'triangle', 1 );\n\t\twith ( _root.triangle ) {\n\t\tlineStyle( 3, {$fontcolor}, 100 );\n\t\t{$strforswdaction}\n\t\t}\n\t\t";
$movie->add(new SWFAction(str_replace("\r", "", $strAction)));
header('Content-type: application/x-shockwave-flash');
$movie->output();
}
示例2: drawImage
/**
* Draw an image
*
* The image will be inlined in the SVG document using data URL scheme. For
* this the mime type and base64 encoded file content will be merged to
* URL.
*
* @param mixed $file Image file
* @param ezcGraphCoordinate $position Top left position
* @param float $width Width of image in destination image
* @param float $height Height of image in destination image
* @return void
*/
public function drawImage($file, ezcGraphCoordinate $position, $width, $height)
{
$movie = $this->getDocument();
$imageData = getimagesize($file);
if ($imageData[2] !== IMAGETYPE_JPEG && $imageData[2] !== IMAGETYPE_PNG) {
throw new ezcGraphFlashBitmapTypeException($imageData[2]);
}
// Try to create a new SWFBitmap object from provided file
$bitmap = new SWFBitmap(fopen($file, 'rb'));
// Add the image to the movie
$object = $this->movie->add($bitmap);
// Image size is calculated on the base of a tick size of 20, so
// that we need to transform this, to our tick size.
$factor = $this->modifyCoordinate(1) / 20;
$object->scale($factor, $factor);
// Scale by ratio of requested and original image size
$object->scale($width / $imageData[0], $height / $imageData[1]);
// Move object to the right position
$object->moveTo($this->modifyCoordinate($position->x), $this->modifyCoordinate($position->y));
// Create, set and return unique ID
$object->setName($id = 'ezcGraphImage_' . $this->id++);
return $id;
}
示例3: SWFMovie
#!/usr/bin/php -c.
<?php
$srcdir = $argv[1];
$m = new SWFMovie(7);
$stream1 = new SWFVideoStream();
$m->add($stream1);
$stream2 = new SWFVideoStream();
$m->add($stream2);
$m->save("test02.swf");
示例4: SWFMovie
#!/usr/bin/php -c.
<?php
$m = new SWFMovie();
/* SWF_SETBACKGROUNDCOLOR */
$m->setBackground(0xff, 0xff, 0xff);
/* SWF_DEFINESPRITE */
/* MovieClip 1 */
$character1 = new SWFMovieClip();
/* 1 frames */
/* SWF_SHOWFRAME */
$character1->nextFrame();
/* end of clip frame 1 */
/* SWF_END */
/* SWF_PLACEOBJECT2 */
/* PlaceFlagHasCharacter */
$m->add($character1);
/* PlaceFlagHasMatrix */
/* outputSWF_MATRIX is broken, so it is being skipped.. */
/* SWF_SHOWFRAME */
$m->nextFrame();
/* end of frame 1 */
/* SWF_END */
$m->save("test02.swf");
示例5: SWFBitmap
/* 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");
示例6: SWFMovie
#!/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");
示例7:
/* wind direction can only go from 0 to 360 degrees */
/* use a 1 pixel width red pen */
$im->setLine(1, 255, 0, 0);
for ($i = 0; $i + 1 < $row_count; $i++) {
$x1 = $i * $gxb / $row_count + $dx;
$y1 = $gyb + $dy - $windd[$i] * $scale;
$x2 = ($i + 1) * $gxb / $row_count + $dx;
$y2 = $gyb + $dy - $windd[$i + 1] * $scale;
$im->movePenTo($x1, $y1);
$im->drawLineTo($x1, $y1);
$im->drawLineTo($x2, $y2);
}
/* draw the wind speed graph */
$scale = $gyb / ($wnds_max - $wnds_min);
/* use a 1 pixel width blue pen */
$im->setLine(1, 0, 0, 255);
for ($i = 0; $i + 1 < $row_count; $i++) {
$x1 = $i * $gxb / $row_count + $dx;
$y1 = $gyb + $dy - ($winds[$i] - $wnds_min) * $scale;
$x2 = ($i + 1) * $gxb / $row_count + $dx;
$y2 = $gyb + $dy - ($winds[$i + 1] - $wnds_min) * $scale;
$im->movePenTo($x1, $y1);
$im->drawLineTo($x1, $y1);
$im->drawLineTo($x2, $y2);
}
/* add our swf shape to the swf movie */
$i1 = $mve->add($im);
$i2 = $mve->add($txt);
/* output the flash content */
header('Content-type: application/x-shockwave-flash');
$mve->output(0);
示例8: SWFMovie
#!/usr/bin/php -c.
<?php
$m = new SWFMovie(8);
$morph = new SWFMorph();
$shape1 = $morph->getShape1();
$shape2 = $morph->getShape2();
$shape1->setLine(4, 25, 0, 0, 128);
$shape1->movePenTo(5, 5);
$shape1->drawLineTo(50, 30);
$shape2->setLine(4, 25, 0, 0, 128);
$shape2->movePenTo(5, 5);
$shape2->drawLineTo(50, 130);
$item = $m->add($morph);
for ($i = 0; $i < 10; $i++) {
$item->setRatio(0.1 * $i);
$m->nextFrame();
}
$m->save("test01.swf");
示例9: SWFMovie
#!/usr/bin/php -c.
<?php
$srcdir = $argv[1];
$m = new SWFMovie(7);
$stream = new SWFVideoStream($srcdir . "/../Media/video01.flv");
$stream->setDimension(200, 200);
$stream->setFrameMode(SWF_VIDEOSTREAM_MODE_MANUAL);
$m->add($stream);
$numFrames = $stream->getNumFrames();
for ($i = 0; $i < $numFrames; $i++) {
if ($i % 2) {
$stream->nextFrame();
}
$m->nextFrame();
}
$m->save("test04.swf");
示例10: SWFMovie
<?php
$m = new SWFMovie();
$m->setDimension(400, 100);
$m->setBackground(0xff, 0xff, 0xff);
$logo = new SWFSprite();
$j = $m->add($logo);
$j->setName("logo");
$m->add(new SWFAction("loadMovie('splash-logo.php','logo');"));
$step = 0.1;
for ($i = 0;; $i += $step) {
if ($i > 100) {
$i = 100;
}
$x = 400 - 400 * $i / 200 - 200;
$y = 100 - 100 * $i / 200 - 50;
$s = $i;
$m->add(new SWFAction("logo._rotation = {$i}; logo._xScale={$s}; logo._yScale={$s}; logo._x= {$x}; logo._y={$y};"));
$m->nextFrame();
$step *= 1.2;
if ($i == 100) {
break;
}
}
header('Content-type: application/x-shockwave-flash');
$m->output();
示例11: SWFMovie
<?php
Ming_setScale(20.0);
ming_useswfversion(7);
$movie = new SWFMovie();
$movie->setRate(31);
$movie->setDimension(400, 300);
$movie->setBackground(0xcc, 0xcc, 0xcc);
$filesrc1 = "jpg.jpg";
$filesrc2 = "png.png";
$filesrc3 = "gif.gif";
$filecontents1 = file_get_contents($filesrc1);
$img = new SWFBitmap($filecontents1);
$f1 = $movie->add($img);
$f1->moveto(90, 50);
$filecontents2 = file_get_contents($filesrc2);
$img = new SWFBitmap($filecontents2);
$f1 = $movie->add($img);
$f1->moveto(10, 10);
$filecontents3 = file_get_contents($filesrc3);
$img = new SWFBitmap($filecontents3);
$f1 = $movie->add($img);
$f1->moveto(170, 80);
header('Content-Type: application/x-shockwave-flash');
$movie->output(0);
示例12: SWFMovie
#!/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");
示例13: SWFText
// 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);
// make a button
$b[$x] = new SWFButton();
$b[$x]->addShape($hit, SWFBUTTON_HIT);
$b[$x]->addShape($t, SWFBUTTON_OVER | SWFBUTTON_UP | SWFBUTTON_DOWN);
$b[$x++]->addAction(new SWFAction("getURL('{$link}','_new');"), SWFBUTTON_MOUSEUP);
}
// display them
for ($x = 0; $x < $itemCount; $x++) {
$i = $m->add($b[$x]);
$i->moveTo($width / 2, 30);
for ($j = 0; $j <= 30; ++$j) {
$i->scaleTo(sqrt(sqrt($j / 30)));
$i->multColor(1.0, 1.0, 1.0, $j / 30);
$m->nextFrame();
}
for ($j = 0; $j <= 30; ++$j) {
$i->scaleTo(sqrt(sqrt(1 + $j / 30)));
$i->multColor(1.0, 1.0, 1.0, (30 - $j) / 30);
$m->nextFrame();
}
$m->remove($i);
}
header('Content-type: application/x-shockwave-flash');
$m->output();
示例14: text
$s->drawLineTo($w, -$h);
$s->drawLineTo(0, -$h);
$s->drawLineTo(0, 0);
return $s;
}
function text($string)
{
global $font;
$t = new SWFText();
$t->setFont($font);
$t->setColor(255, 255, 255);
$t->setHeight(20);
$t->addString($string);
return $t;
}
$t = $m->add(text("Balkendiagramm mit PHP und Ming"));
$t->moveTo(30, 40);
$i = 0;
reset($values);
while (list($key, $value) = each($values)) {
$text[$i] = $m->add(text($key));
$text[$i]->moveTo(50 + $i * 60, 50);
$box[$i] = $m->add(box(50, 1));
$box[$i]->moveTo(30 + $i * 60, $height - 20);
$box[$i]->setName("box" . $i);
$i++;
}
for ($f = 0; $f <= $max; $f += 5) {
$i = 0;
reset($values);
while (list($key, $value) = each($values)) {
示例15: explode
<?php
include_once '../init_constants.php';
// this can stay since it's only called via web
ming_useswfversion(6);
$parts = explode('/', $_SERVER['REDIRECT_URL']);
$swf = $parts[count($parts) - 1];
$swfBase = basename($swf, '.swf');
$swfParts = explode('_', $swfBase);
$height = array_pop($swfParts);
$width = array_pop($swfParts);
$m = new SWFMovie();
$m->setDimension($width, $height);
$m->setrate(30);
$m->add(new SWFAction('this.createEmptyMovieClip("container_mc", 1);'));
$m->add(new SWFAction('__d = new Date();'));
$m->add(new SWFAction('loadMovie("http://' . FF_SERVER_NAME . '/swf/slideshow/slide_show_prototype.swf?__dynTS="+__d.getTime(),"container_mc");'));
$m->setBackground(0, 0, 0);
$m->save($finalPath = PATH_HOMEROOT . PATH_SWF . '/container/dynamic/' . $swf);
echo $finalPath . ' was created. <a href="javascript:history.go(-1);">Go back</a>.';