Exemple #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;
}
Exemple #2
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");
Exemple #3
0
 /**
  * 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);
 }
Exemple #4
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);
Exemple #5
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();
Exemple #6
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);
$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;
if ($display_eqp_icons) {
    $ind_path = $path . "/htdocs/resources/img/style-1.1/images/";
    if ($status_symbol == 'yes') {
Exemple #8
0
 if ($links) {
     foreach ($links as $link) {
         if (!isset($devicemap[$link['src']]['x']) || !isset($devicemap[$link['dst']]['x'])) {
             continue;
         }
         $src_celx = $devicemap[$link['src']]['x'];
         $src_cely = $devicemap[$link['src']]['y'];
         $dst_celx = $devicemap[$link['dst']]['x'];
         $dst_cely = $devicemap[$link['dst']]['y'];
         $src_px = $src_celx * $cellw + $celllmargin;
         $src_py = $src_cely * $cellh + $celltmargin;
         $dst_px = $dst_celx * $cellw + $celllmargin;
         $dst_py = $dst_cely * $cellh + $celltmargin;
         if (!$link['type']) {
             $connections->setLine(1, 0, 128, 0);
             $connections->movePenTo($src_px + 8, $src_py + 8);
             $connections->drawLineTo($dst_px + 8, $dst_py + 8);
         } else {
             $connections->setLine(1, 0, 200, 255);
             $connections->movePenTo($src_px + 8, $src_py + 8);
             $connections->drawLineTo($dst_px + 8, $dst_py + 8);
         }
     }
 }
 if ($nodemap) {
     foreach ($nodemap as $node) {
         $src_celx = $node['x'];
         $src_cely = $node['y'];
         $dst_celx = $devicemap[$node['device']]['x'];
         $dst_cely = $devicemap[$node['device']]['y'];
         $src_px = $src_celx * $cellw + $celllmargin;
Exemple #9
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");
Exemple #10
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");
Exemple #11
0
<?php

// Scaling
Ming_setScale(20);
srand(time());
// Creates the racket model
$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);
Exemple #12
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");
Exemple #13
0
}
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");
    }
Exemple #14
0
 public function MakeRect()
 {
     // 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();
     $squareshape->setRightFill(255, 255, 255);
     $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);
     $squaresprite->nextFrame();
     //$f1->moveTo(0,0);
     //$squaresymbol=$this->m_oMovie->add->add($squaresprite);
     //$squaresymbol->moveTo(0,0);
     //$this->m_oMovie->add($squaresprite);
     return $squaresprite;
 }
Exemple #15
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();
 }
Exemple #16
0
//$blue = (0,0,255);
//$grey = (128,128,128);
//$ltGrey = (192,192,192);
//$ltrGrey = (224,224,224);
/* For a 100 x 100 image:
     (0,0) is the upper left hand corner,
     (100,100) is the lower right hand corner.
*/
/* keep the data within a bounding box */
$gxb = $gx * 0.8;
$dx = ($gx - $gxb) / 2;
$gyb = $gy * 0.8;
$dy = ($gy - $gyb) / 2;
//imageRectangle($im,$dx,$dy,$dx+$gxb,$dy+$gyb,$ltGrey);
/* draw the x axis */
$im->movePenTo($dx, $gyb + $dy);
$im->drawLineTo($dx, $gyb + $dy);
$im->drawLineTo($dx + $gxb, $gyb + $dy);
/* draw the y axis */
$im->movePenTo($dx, $gyb + $dy);
$im->drawLineTo($dx, $gyb + $dy);
$im->drawLineTo($dx, $dy);
/* generate the graph's title */
/* first get the font */
$fontsize = 18;
/* set the distance, from the left, where the title will begin */
$dist_x = $dx + 30;
/* set the distance, from the top, where the title will begin */
$dist_y = 15;
/* create the font object and text object */
//$fnt=new SWFFont("Courier_New.fdb");
Exemple #17
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');
Exemple #18
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);
     }
 }
Exemple #19
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);
 }