Пример #1
0
function drawtext($x, $y, $text, $r, $g, $b)
{
    global $m, $font;
    if (!$text) {
        return;
    }
    // remove special characters because we haven't got proper font
    // or something else. I don't know why, but we have a problem with
    // that characters on flash map.
    $text = clear_utf($text);
    $t = new SWFTextField(SWFTEXTFIELD_NOEDIT | SWFTEXTFIELD_NOSELECT);
    $t->setFont($font);
    $t->setHeight(8);
    $t->setColor($r, $g, $b);
    $t->addString($text);
    $i = $m->add($t);
    $i->moveTo($x, $y);
}
Пример #2
0
 /**
  * Render text depending of font type and available font extensions
  * 
  * @param string $id 
  * @param string $text 
  * @param string $chars 
  * @param int $type 
  * @param string $path 
  * @param ezcGraphColor $color 
  * @param ezcGraphCoordinate $position 
  * @param float $size 
  * @param float $rotation 
  * @return void
  */
 protected function renderText($id, $text, $chars, $type, $path, ezcGraphColor $color, ezcGraphCoordinate $position, $size, $rotation = null)
 {
     $movie = $this->getDocument();
     $tb = new SWFTextField(SWFTEXTFIELD_NOEDIT);
     $tb->setFont(new SWFFont($path));
     $tb->setHeight($size);
     $tb->setColor($color->red, $color->green, $color->blue, 255 - $color->alpha);
     $tb->addString($text);
     $tb->addChars($chars);
     $object = $movie->add($tb);
     $object->rotate($rotation !== null ? -$rotation->getRotation() : 0);
     $object->moveTo($position->x + ($rotation === null ? 0 : $this->modifyCoordinate($rotation->get(0, 2))), $position->y - $size * (1 + $this->options->lineSpacing) + ($rotation === null ? 0 : $this->modifyCoordinate($rotation->get(1, 2))));
     $object->setName($id);
 }
Пример #3
0
#!/usr/bin/php -c.

<?php 
$srcdir = $argv[1];
$mediadir = $srcdir . "/../Media";
$m = new SWFMovie();
$f = new SWFFont($mediadir . "/test.ttf");
$tf = new SWFTextField();
$tf->setFont($f);
$tf->setColor(0x0, 0x0, 0x0, 0xff);
$tf->setHeight(20);
$m->add($tf);
$m->nextFrame();
/* end of frame 1 */
$m->save("test02.swf");
Пример #4
0
#!/usr/bin/php -c.

<?php 
$srcdir = $argv[1];
$mediadir = $srcdir . "/../Media";
$m = new SWFMovie();
$f = new SWFFont($mediadir . "/font01.fdb");
$t = new SWFText(1);
$t->setFont($f);
$t->setHeight(20);
$t->setColor(0x0, 0x0, 0xff);
$t->moveTo(100, 100);
$t->addString("Static Text");
$tf = new SWFTextField(SWFTEXTFIELD_NOEDIT);
$tf->setFont($f);
$tf->setHeight(20);
$tf->setColor(0xff, 0x0, 0x0);
$tf->addString("Readonly Textfield");
$m->add($t);
$it = $m->add($tf);
$it->moveTo(100, 120);
$m->nextFrame();
/* end of frame 1 */
$m->save("test05.swf");
Пример #5
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");
$sc->setFont($f);
$sc->setColor(255, 255, 255);
$sc->addString("Computer : 0");
// Write the "signature"
$signature = new SWFText();
$signature->setFont($f);
$signature->setColor(150, 150, 255);
$signature->setHeight(9);
$signature->addString("(c) Armel GRIGNON, october 2001 - See this script at mingshop.arpane.net");
// Now adds the objects to the movie
// Creates the movie and the main sprite
$m = new SWFMovie();
$m->setRate(96);
$m->setBackground(207, 96, 0);
$m->setDimension(640, 480);
// Adds the two rackets (within sprites)
$srp = new SWFSprite();
Пример #6
0
            $rgb = rgb($objs[$coid]->titleColor);
            $t->setColor($rgb[0], $rgb[1], $rgb[2]);
            $t = new SWFText();
            $f = new SWFFont($objs[$coid]->font);
            $t->setFont($f);
            $t->setHeight(flash_fixsize($objs[$coid]->titleSize));
            $t->addString($objs[$coid]->title);
            $i = $m->add($t);
            if ($in == 0) {
                $i->moveTo(5, 0);
            }
        }
        foreach ($el['text'] as $in => $val) {
            if (!empty($el['text'][$in]['data'])) {
                $t = new SWFTextField();
                $t->setColor($defaultColor[0], $defaultColor[1], $defaultColor[2]);
                $t->align(SWFTEXTFIELD_ALIGN_LEFT);
                $t->setFont($f);
                $t->setHeight((int) ($_GET['h'] / 5));
                $t->addString($el['text'][$in]['data']);
                $i = $m->add($t);
                if ($in == 0) {
                    $i->moveTo(15, 5);
                }
            }
        }
        break;
}
header('Content-type: application/x-shockwave-flash');
$m->output();
function rgb($rgb)
Пример #7
0
#!/usr/bin/php -c.

<?php 
$m = new SWFMovie();
$tf = new SWFTextField();
$font = new SWFBrowserFont("_sans");
$tf->setFont($font);
$tf->setColor(0, 0, 0);
$tf->setHeight(20);
$tf->addString("abc");
$m->add($tf);
$m->nextFrame();
$m->save("test01.swf");
    $jpg_file = $file . '.png';
}
$sp_clip = new SWFBitmap(fopen($jpg_file, 'r'));
$fpbk = new SWFSprite();
$fpbk->add($sp_clip);
$fpbk->nextFrame();
$y = $m->add($fpbk);
$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();
Пример #9
0
 /**
  * Draws a text string on the image in a specified location, with the
  * specified style information.
  *
  * @param string $text        The text to draw.
  * @param integer $x          The left x coordinate of the start of the
  *                            text string.
  * @param integer $y          The top y coordinate of the start of the text
  *                            string.
  * @param string $font        The font identifier you want to use for the
  *                            text.
  * @param string $color       The color that you want the text displayed in.
  * @param integer $direction  An integer that specifies the orientation of
  *                            the text.
  * @param string $fontsize    Size of the font (small, medium, large, giant)
  */
 public function text($string, $x, $y, $font = 'monospace', $color = 'black', $direction = 0)
 {
     $color = $this->allocateColor($color);
     $text = new SWFTextField(SWFTEXTFIELD_NOEDIT);
     $text->setColor($color['red'], $color['green'], $color['blue'], $color['alpha']);
     $text->setFont(new SWFBrowserFont($this->getFont($font)));
     $text->addString($string);
     $t = $this->_movie->add($text);
     $t->moveTo($x, $y);
     $t->rotate($direction);
 }