SWFShape::setLine
(PHP 4 >= 4.0.5)
SWFShape::setLine — Sets the shape's line style
Описание
$width
, int $red
, int $green
, int $blue
[, int $a
] )Эта функция является ЭКСПЕРИМЕНТАЛЬНОЙ. Поведение этой функции, ее имя и относящаяся к ней документация могут измениться в последующих версиях PHP без уведомления. Используйте эту функцию на свой страх и риск.
swfshape::setline() sets the shape's line style.
width
is the line's width. If width
is 0, the line's style is removed (then, all other arguments are ignored).
If width
> 0, then line's color is set to
red
, green
, blue
.
Last parameter a
is optional.
You must declare all line styles before you use them (see example).
Возвращаемые значения
Эта функция не возвращает значения после выполнения.
Примеры
This simple example will draw a big "!#%*@", in funny colors and gracious style.
Пример #1 swfshape::setline() example
<?php
$s = new SWFShape();
$f1 = $s->addFill(0xff, 0, 0);
$f2 = $s->addFill(0xff, 0x7f, 0);
$f3 = $s->addFill(0xff, 0xff, 0);
$f4 = $s->addFill(0, 0xff, 0);
$f5 = $s->addFill(0, 0, 0xff);
// bug: have to declare all line styles before you use them
$s->setLine(40, 0x7f, 0, 0);
$s->setLine(40, 0x7f, 0x3f, 0);
$s->setLine(40, 0x7f, 0x7f, 0);
$s->setLine(40, 0, 0x7f, 0);
$s->setLine(40, 0, 0, 0x7f);
$f = new SWFFont('Techno.fdb');
$s->setRightFill($f1);
$s->setLine(40, 0x7f, 0, 0);
$s->drawGlyph($f, '!');
$s->movePen($f->getWidth('!'), 0);
$s->setRightFill($f2);
$s->setLine(40, 0x7f, 0x3f, 0);
$s->drawGlyph($f, '#');
$s->movePen($f->getWidth('#'), 0);
$s->setRightFill($f3);
$s->setLine(40, 0x7f, 0x7f, 0);
$s->drawGlyph($f, '%');
$s->movePen($f->getWidth('%'), 0);
$s->setRightFill($f4);
$s->setLine(40, 0, 0x7f, 0);
$s->drawGlyph($f, '*');
$s->movePen($f->getWidth('*'), 0);
$s->setRightFill($f5);
$s->setLine(40, 0, 0, 0x7f);
$s->drawGlyph($f, '@');
$m = new SWFMovie();
$m->setDimension(3000,2000);
$m->setRate(12.0);
$i = $m->add($s);
$i->moveTo(1500-$f->getWidth("!#%*@")/2, 1000+$f->getAscent()/2);
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
Возвращаемые значения
Эта функция не возвращает значения после выполнения.
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Генерация нетекстовых MIME форматов
- Ming (flash)
- Функция SWFShape::addFill() - Adds a solid fill to the shape
- Функция SWFShape::__construct() - Creates a new shape object
- Функция SWFShape::drawArc() - Draws an arc of radius r centered at the current location, from angle startAngle to angle endAngle measured clockwise from 12 o'clock
- Функция SWFShape::drawCircle() - Draws a circle of radius r centered at the current location, in a counter-clockwise fashion
- Функция SWFShape::drawCubic() - Draws a cubic bezier curve using the current position and the three given points as control points
- Функция SWFShape::drawCubicTo() - Draws a cubic bezier curve using the current position and the three given points as control points
- Функция SWFShape::drawCurve() - Draws a curve (relative)
- Функция SWFShape::drawCurveTo() - Draws a curve
- Функция SWFShape::drawGlyph() - Draws the first character in the given string into the shape using the glyph definition from the given font
- Функция SWFShape::drawLine() - Draws a line (relative)
- Функция SWFShape::drawLineTo() - Draws a line
- Функция SWFShape::movePen() - Moves the shape's pen (relative)
- Функция SWFShape::movePenTo() - Moves the shape's pen
- Функция SWFShape::setLeftFill() - Sets left rasterizing color
- Функция SWFShape::setLine() - Sets the shape's line style
- Функция SWFShape::setRightFill() - Sets right rasterizing color
Коментарии
Just wanted to point out that a $width value of 0 does _not_ prevent the line from being drawn. It causes a non-scaling, single pixel line to be drawn. This is analogous to the way this is handled in ActionScript (see http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Graphics.html#lineStyle%28%29)
If you do not want a line to be drawn at all, use NAN for $width instead of zero.