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); }
/** * 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); }
#!/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");
$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) { if (strlen($rgb) == 6) { $r = hexdec(substr($rgb, 0, 2)); $g = hexdec(substr($rgb, 2, 2));
// 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(); $srp_shape = $srp->add($rm);
#!/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("1234567890"); $tf = new SWFTextField(); $tf->setFont($f); $tf->setHeight(20); $tf->setColor(0xff, 0x0, 0x0); $tf->addString("1234567890"); $m->add($t); $it = $m->add($tf); $it->moveTo(100, 120); $m->nextFrame(); /* end of frame 1 */ $m->save("test04.swf");
#!/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");
$equipment_type_image_id = $symbol_pointers['equipment_type_image_id'][$i]; //$mfile = $path."/usr/".$account_id."/merchandising/" . $filename; $mfile = $filename; $source_file = new SWFBitmap(fopen($mfile, 'r')); $icon_id = "icon_" . $id; $my_y_pos = 25 + 22 * $i; $container = new SWFSprite(); $container->add($source_file); $container->nextFrame(); $m->addExport($container, $icon_id); $icon_as .= "Object.registerClass('{$icon_id}', createIcon);\n\t\t\tattachMovie('{$icon_id}','bitmap_{$icon_id}',1,\n\t\t\t\t{_y:{$my_y_pos},equipment_type_symbol:'equipment_type_{$icon_id}',equipment_type_id:{$id},equipment_type_image_id:'{$equipment_type_image_id}'});\n\t\t\t"; $kt = new SWFTextField(); $kt->setFont($f); $kt->setHeight(11); $kt->setBounds(170, 25); $kt->addString("{$name}"); $kt2 = $entire_key->add($kt); $kt2->moveto(37, 11 + $my_y_pos); unset($container); } } } unset($kt); unset($kt2); unset($name); unset($symbol_pointers); if ($_GET['key'] == 'yes' || $_GET['key'] == '') { $entire_key->nextFrame(); $i = $m->add($entire_key); $i->setName('entire_key'); $i->moveTo($key_x_position, $key_y_position);
#!/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); $tf->setFlags(SWFTEXTFIELD_NOEDIT); $tf->addString("The quick brown fox jumps over the lazy dog. 1234567890"); $m->add($tf); $m->nextFrame(); /* end of frame 1 */ $m->save("test01.swf");
/** * 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); }