示例#1
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);
 }
示例#2
0
            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])) {
                drawtext($px + 16, $py - 8, $devip[1], 0, 0, 255);
            }
            if (isset($devip[2])) {
                drawtext($px + 16, $py + 16, $devip[2], 0, 0, 255);
            }
示例#3
0
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)));
        // ? brings up the help page
        $b->addAction(new SWFAction("getURL('http://{$_SERVER['HTTP_HOST']}{$baseDir}{$helpPage}','_blank');"), swfbutton_keypress('?'));
        $f = new SWFFont($objs[$coid]->titleFont);
        $m->setBackground(0x66, 0x66, 0x99);
        $t = new SWFText();