示例#1
0
            $squareshape->drawLine(0, -15);
            $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);
        }
示例#2
0
文件: test05.php 项目: mgorny/libming
#!/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");
示例#3
0
文件: test02.php 项目: mgorny/libming
#!/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");
?>
	
	

示例#4
0
文件: SWF.php 项目: 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);
 }
示例#5
0
文件: test03.php 项目: mgorny/libming
#!/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");
示例#6
0
/*
$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;
            $b->addAction(new SWFAction("getURL('http://{$_SERVER['HTTP_HOST']}{$baseDir}{$showScript}/{$currentPres}/{$prev}','_self');"), swfbutton_keypress(chr(8)));
            $b->addAction(new SWFAction("getURL('http://{$_SERVER['HTTP_HOST']}{$baseDir}{$showScript}/{$currentPres}/{$prev}','_self');"), swfbutton_keypress(chr(127)));
        }
        // ESC reloads the current slide
        $b->addAction(new SWFAction("getURL('http://{$_SERVER['HTTP_HOST']}{$baseDir}{$showScript}/{$currentPres}/{$slideNum}','_self');"), swfbutton_keypress(chr(27)));