Ejemplo n.º 1
0
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;
}
Ejemplo n.º 2
0
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
}
Ejemplo n.º 3
0
 /**
  * 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);
 }
Ejemplo n.º 4
0
#!/usr/bin/php
<?php 
$srcdir = $argv[1];
$mediadir = $srcdir . "/../Media";
$m = new SWFMovie(8);
ming_setscale(1.0);
/*Unknown block type 69*/
/* SWF_DEFINELOSSLESS */
/* Bitmap 1 (lossless). To extract:*/
/* 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);
Ejemplo n.º 5
0
            $button->addShape($squareshape, SWFBUTTON_HIT | SWFBUTTON_UP | SWFBUTTON_DOWN | SWFBUTTON_OVER);
            $button->addAction(new SWFAction("this.getURL('?m=nodeinfo&id=" . $nodeid . "');"), SWFBUTTON_MOUSEDOWN);
            // press
            $i = $m->add($button);
            $i->moveTo($px, $py);
            drawtext($px + 15, $py - 4, $n['ip'], 0, 0, 255);
            drawtext($px + 15, $py + 10, $n['name'], 0, 0, 0);
        }
    }
    $devices = $DB->GetAllByKey('SELECT n.id, n.name, n.location, MAX(lastonline) AS lastonline 
				    FROM netdevices n 
				    LEFT JOIN vnodes ON (n.id = netdev)
				    GROUP BY n.id, n.name, n.location', 'id');
    foreach ($devicemap as $deviceid => $device) {
        $button = new SWFButton();
        $squareshape = new SWFShape();
        $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);
Ejemplo n.º 6
0
<?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);
Ejemplo n.º 7
0
#!/usr/bin/php -c.
<?php 
$m = new SWFMovie(8);
$shape1 = new SWFShape();
$shape1->setLine2(1, SWF_LINESTYLE_FLAG_HINTING, 0, 25, 0, 0, 128);
$shape1->movePenTo(5, 5);
$shape1->drawLineTo(50, 30);
$item = $m->add($shape1);
$m->nextFrame();
$m->replace($item, $shape1);
$m->nextFrame();
$m->save("test02.swf");
Ejemplo n.º 8
0
$currentPres = $_SESSION['currentPres'];
if (!extension_loaded('ming')) {
    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
Ejemplo n.º 9
0
#!/usr/bin/php -c.
<?php 
$m = new SWFMovie(8);
$shape1 = new SWFShape();
$shape1->setLine2(1, SWF_LINESTYLE_FLAG_HINTING, 0, 25, 0, 0, 128);
$shape1->movePenTo(5, 5);
$shape1->drawLineTo(50, 30);
$shape2 = new SWFShape();
$shape2->setLine2(1, SWF_LINESTYLE_FLAG_HINTING, 0, 25, 100, 100, 255);
$shape2->movePenTo(5, 5);
$shape2->drawLineTo(50, 130);
$item = $m->add($shape1);
$m->nextFrame();
$m->replace($item, $shape2);
$m->nextFrame();
$m->save("test01.swf");
Ejemplo n.º 10
0
} else {
    $width = 500;
}
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 {
Ejemplo n.º 11
0
 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);
 }
Ejemplo n.º 12
0
#!/usr/bin/php -c.
<?php 
$m = new SWFMovie(8);
$shape1 = new SWFShape();
$shape2 = new SWFShape();
$shape2->useVersion(SWF_SHAPE4);
$m->add($shape1);
$m->add($shape2);
$m->save("test01.swf");
Ejemplo n.º 13
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;
 }
$y->moveTo($x_shift, $y_shift);
$y->setName('background');
$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;
Ejemplo n.º 15
0
<?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);
Ejemplo n.º 16
0
$rm = new SWFShape();
$rm->setLine(5, 207, 96, 0);
$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");
Ejemplo n.º 17
0
<?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();
Ejemplo n.º 18
0
#!/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");
Ejemplo n.º 19
0
Archivo: SWF.php Proyecto: roojs/pear
 /**
  * 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);
 }
Ejemplo n.º 20
0
#!/usr/bin/php -c.

<?php 
$m = new SWFMovie(7);
$s = new SWFShape();
$s->setLine(4, 25, 0, 0, 128);
$s->movePenTo(5, 5);
$s->drawLineTo(0, 10);
$bl = new SWFBlur(5, 5, 2);
$c = array();
$c["red"] = 0;
$c['green'] = 0;
$c['blue'] = 0;
$c['alpha'] = 0xff;
$f = new SWFFilter(SWFFILTER_TYPE_GLOW, $c, $bl, 1.0, SWFFILTER_MODE_INNER | SWFFILTER_MODE_KO);
$bu = new SWFButton();
$bu->addShape($s, SWFBUTTON_UP | SWFBUTTON_HIT | SWFBUTTON_OVER | SWFBUTTON_DOWN);
$item = $m->add($bu);
$item->addFilter($f);
$m->save("test03.swf");
Ejemplo n.º 21
0
#!/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");
?>
	
	

Ejemplo n.º 22
0
#!/usr/bin/php -c.
<?php 
$m = new SWFMovie(8);
$s = new SWFShape();
$f = $s->addSolidFill(255, 0, 0);
$s->setRightFill($f);
Ming_setCubicThreshold(10);
$s->movePenTo(167.0, 69.87504);
$s->drawCubicTo(198.796531, 69.87504, 224.62496, 95.703469, 224.62496, 127.5);
$s->drawCubicTo(224.62496, 159.296531, 198.796531, 185.12496, 167.0, 185.12496);
$s->drawCubicTo(135.203469, 185.12496, 109.37504, 159.296531, 109.37504, 127.5);
$s->drawCubicTo(109.37504, 95.703469, 135.203469, 69.87504, 167.0, 69.87504);
$m->add($s);
$m->save("test02.swf");
Ejemplo n.º 23
0
}
//while()
/* report the results (debugging) */
//echo "Processed $row_count rows<br>";
//echo "t_min=$t_min<br>";
//echo "t_max=$t_max<br>";
//echo "wndd_min=$wndd_min<br>";
//echo "wndd_max=$wndd_max<br>";
//echo "wnds_min=$wnds_min<br>";
//echo "wnds_max=$wnds_max<br>";
/* set the graph's x and y dimensions */
$gx = 800;
$gy = 240;
/* Time to create the $gx x $gy image */
/* first creat a blank image */
$im = new SWFShape();
/* use a 1 pixel width black pen */
$im->setLine(1, 0, 0, 0);
/* use a white background */
$mve = new SWFMovie();
$mve->setDimension($gx, $gy);
$mve->setBackground(255, 255, 255);
/* here's a small pallete to use for the graphs (RGB values) */
//black = (0,0,0);
//brown = (255,255,0);
//$red = (255,0,0);
//$yellow = (224,252,24);
//$green = (0,255,0);
//$drkGreen = (0,190,0);
//$blue = (0,0,255);
//$grey = (128,128,128);
Ejemplo n.º 24
0
 public function zeichneKoordinatenGitter($GridVisible = true, $XTickDistance = 40, $YTickDistance = 40)
 {
     $koord = new SWFShape();
     $koord->setLine(0, 212, 212, 212);
     $koord->movePenTo(0, 0);
     $koord->drawlineto($this->width - 1, 0);
     $koord->drawlineto($this->width, $this->height - 1);
     $koord->drawlineto(0, $this->height - 1);
     $koord->drawlineto(0, 0);
     $koordtext = new SWFText();
     $t = new SWFFont(dirname(__FILE__) . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . "fonts" . DIRECTORY_SEPARATOR . "FreeSans.fdb");
     $koordtext->setfont($t);
     $koordtext->setColor(212, 212, 212);
     // Skala Striche
     $i = $XTickDistance;
     while ($i < $this->width) {
         $koordtext->moveto($i, 20);
         $koordtext->addString($i);
         if ($GridVisible) {
             $koord->movePenTo($i, 0);
             $koord->drawlineto($i, $this->height);
         } else {
             $koord->movePenTo($i, 0);
             $koord->drawlineto($i, 20);
         }
         $i += $XTickDistance;
     }
     $i = $YTickDistance;
     while ($i < $this->height) {
         $koordtext->moveto(20, $i);
         $koordtext->addString($i);
         if ($GridVisible) {
             $koord->movePenTo(0, $i);
             $koord->drawlineto($this->width, $i);
         } else {
             $koord->movePenTo(0, $i);
             $koord->drawlineto(20, $i);
         }
         $i += $YTickDistance;
     }
     $this->SWFMovie->add($koordtext);
     $this->SWFMovie->add($koord);
     $this->SWFMovie->nextFrame();
 }
Ejemplo n.º 25
0
#!/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");
Ejemplo n.º 26
0
<?php

ming_useswfversion(4);
$s = new SWFShape();
$f = $s->addFill(0xff, 0, 0);
$s->setRightFill($f);
$s->movePenTo(-500, -500);
$s->drawLineTo(500, -500);
$s->drawLineTo(500, 500);
$s->drawLineTo(-500, 500);
$s->drawLineTo(-500, -500);
$p = new SWFSprite();
$i = $p->add($s);
$i->setDepth(1);
$p->nextFrame();
for ($n = 0; $n < 5; ++$n) {
    $i->rotate(-15);
    $p->nextFrame();
}
$m = new SWFMovie();
$m->setBackground(0xff, 0xff, 0xff);
$m->setDimension(6000, 4000);
$i = $m->add($p);
$i->setDepth(1);
$i->moveTo(-500, 2000);
$i->setName("box");
$m->add(new SWFAction("/box.x += 3;"));
$m->nextFrame();
$m->add(new SWFAction("gotoFrame(0); play();"));
$m->nextFrame();
header('Content-type: application/x-shockwave-flash');
Ejemplo n.º 27
0
 /**
  * Set the fill and line properties for a SWWFShape according to the 
  * given parameters.
  * 
  * @param SWFShape $shape
  * @param ezcGraphColor $color 
  * @param mixed $thickness 
  * @param mixed $filled 
  * @return void
  */
 protected function setShapeColor(SWFShape $shape, ezcGraphColor $color, $thickness, $filled)
 {
     if ($filled) {
         switch (true) {
             case $color instanceof ezcGraphLinearGradient:
                 $gradient = new SWFGradient();
                 $gradient->addEntry(0, $color->startColor->red, $color->startColor->green, $color->startColor->blue, 255 - $color->startColor->alpha);
                 $gradient->addEntry(1, $color->endColor->red, $color->endColor->green, $color->endColor->blue, 255 - $color->endColor->alpha);
                 $fill = $shape->addFill($gradient, SWFFILL_LINEAR_GRADIENT);
                 // Calculate desired length of gradient
                 $length = sqrt(pow($color->endPoint->x - $color->startPoint->x, 2) + pow($color->endPoint->y - $color->startPoint->y, 2));
                 $fill->scaleTo($this->modifyCoordinate($length) / 32768, $this->modifyCoordinate($length) / 32768);
                 $fill->rotateTo(rad2deg(asin(($color->endPoint->x - $color->startPoint->x) / $length) + 180));
                 $fill->moveTo($this->modifyCoordinate(($color->startPoint->x + $color->endPoint->x) / 2), $this->modifyCoordinate(($color->startPoint->y + $color->endPoint->y) / 2));
                 $shape->setLeftFill($fill);
                 break;
             case $color instanceof ezcGraphRadialGradient:
                 $gradient = new SWFGradient();
                 $gradient->addEntry(0, $color->startColor->red, $color->startColor->green, $color->startColor->blue, 255 - $color->startColor->alpha);
                 $gradient->addEntry(1, $color->endColor->red, $color->endColor->green, $color->endColor->blue, 255 - $color->endColor->alpha);
                 $fill = $shape->addFill($gradient, SWFFILL_RADIAL_GRADIENT);
                 $fill->scaleTo($this->modifyCoordinate($color->width) / 32768, $this->modifyCoordinate($color->height) / 32768);
                 $fill->moveTo($this->modifyCoordinate($color->center->x), $this->modifyCoordinate($color->center->y));
                 $shape->setLeftFill($fill);
                 break;
             default:
                 $fill = $shape->addFill($color->red, $color->green, $color->blue, 255 - $color->alpha);
                 $shape->setLeftFill($fill);
                 break;
         }
     } else {
         $shape->setLine($this->modifyCoordinate($thickness), $color->red, $color->green, $color->blue, 255 - $color->alpha);
     }
 }
Ejemplo n.º 28
0
#!/usr/bin/php
<?php 
$m = new SWFMovie(8);
ming_setscale(1.0);
/*Unknown block type 69*/
/* SWF_DEFINESHAPE3 */
/* Shape 1 (TYPE=3, RECT=0,0 0,0)*/
$character1 = new SWFShape();
/*2 fillstyle(s)*/
$character1_f0_red = 0x20;
$character1_f0_green = 0x40;
$character1_f0_blue = 0x80;
$character1_f0_alpha = 0xdf;
$character1_f0 = $character1->addSolidFill($character1_f0_red, $character1_f0_green, $character1_f0_blue, $character1_f0_alpha);
/*SWFFILL_SOLID*/
$character1_f1_red = 0x40;
$character1_f1_green = 0x80;
$character1_f1_blue = 0x20;
$character1_f1_alpha = 0x18;
$character1_f1 = $character1->addSolidFill($character1_f1_red, $character1_f1_green, $character1_f1_blue, $character1_f1_alpha);
/*SWFFILL_SOLID*/
/*0 linestyles(s)*/
/* SWF_PLACEOBJECT2 */
$i1 = $m->add($character1);
$i1->setDepth(1);
/* PlaceFlagHasMatrix */
/* SWF_SHOWFRAME */
$m->nextFrame();
/* end of frame 1 */
/* SWF_END */
$m->save("test01.swf");
Ejemplo n.º 29
0
 /**
  * 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);
     }
 }
Ejemplo n.º 30
0
#!/usr/bin/php
<?php 
$m = new SWFMovie(8);
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)*/
$character1_f0_red = 0xff;
$character1_f0_green = 0x80;
$character1_f0_blue = 0x0;
$character1_f0_alpha = 0xff;
$character1_f0 = $character1->addSolidFill($character1_f0_red, $character1_f0_green, $character1_f0_blue, $character1_f0_alpha);
/*SWFFILL_SOLID*/
/*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);