Exemplo n.º 1
0
 function dumpContent($tagCode, $opts = array())
 {
     $isMorph = $tagCode == 46 || $tagCode == 84;
     if (is_null($this->_shapeId) === false) {
         echo "    ShapeId: {$this->_shapeId}\n";
     }
     $opts = array('tagCode' => $tagCode, 'isMorph' => $isMorph);
     if ($isMorph === false) {
         echo "    ShapeBounds: " . IO_SWF_Type_RECT::string($this->_shapeBounds) . "\n";
         echo "    FillStyles:\n";
         echo IO_SWF_Type_FILLSTYLEARRAY::string($this->_fillStyles, $opts);
         echo "    LineStyles:\n";
         echo IO_SWF_Type_LINESTYLEARRAY::string($this->_lineStyles, $opts);
         echo "    ShapeRecords:\n";
         echo IO_SWF_Type_SHAPE::string($this->_shapeRecords, $opts);
     } else {
         echo "    StartBounds: " . IO_SWF_Type_RECT::string($this->_startBounds) . "\n";
         echo "    EndBounds: " . IO_SWF_Type_RECT::string($this->_endBounds) . "\n";
         echo "    Offset:{$this->_offset}\n";
         echo "    FillStyles:\n";
         echo IO_SWF_Type_FILLSTYLEARRAY::string($this->_morphFillStyles, $opts);
         echo "    LineStyles:\n";
         echo IO_SWF_Type_LINESTYLEARRAY::string($this->_morphLineStyles, $opts);
         echo "    StartEdge:\n";
         echo IO_SWF_Type_SHAPE::string($this->_startEdge, $opts);
         echo "    endEdge:\n";
         echo IO_SWF_Type_SHAPE::string($this->_endEdge, $opts);
     }
 }
Exemplo n.º 2
0
 static function string($shapeRecords, $opts = array())
 {
     $tagCode = $opts['tagCode'];
     if (isset($opts['indent'])) {
         $indent_text = '';
         for ($i = 0; $i < $opts['indent']; $i++) {
             $indent_text .= "\t";
             // str_pad? str_repeat ?
         }
     } else {
         $indent_text = "\t";
     }
     $text = '';
     foreach ($shapeRecords as $shapeRecord) {
         $text .= $indent_text;
         $typeFlag = $shapeRecord['TypeFlag'];
         if ($typeFlag == 0) {
             if (isset($shapeRecord['EndOfShape'])) {
                 $text .= "EndOfShape";
             } else {
                 $moveX = $shapeRecord['MoveX'] / 20;
                 $moveY = $shapeRecord['MoveY'] / 20;
                 $text .= "ChangeStyle: MoveTo: ({$moveX}, {$moveY})";
                 $style_list = array('FillStyle0', 'FillStyle1', 'LineStyle');
                 $text .= "  FillStyle: " . $shapeRecord['FillStyle0'] . "|" . $shapeRecord['FillStyle1'];
                 $text .= "  LineStyle: " . $shapeRecord['LineStyle'];
                 if (isset($shapeRecord['FillStyles']) || isset($shapeRecord['LineStyles'])) {
                     // NewStyle
                     $text .= "\n";
                     if (isset($shapeRecord['FillStyles'])) {
                         $text .= "    FillStyles:\n";
                         $text .= IO_SWF_Type_FILLSTYLEARRAY::string($shapeRecord['FillStyles'], $opts);
                     }
                     if (isset($shapeRecord['LineStyles'])) {
                         $text .= "    LineStyles:\n";
                         $text .= IO_SWF_Type_LINESTYLEARRAY::string($shapeRecord['LineStyles'], $opts);
                     }
                 }
             }
         } else {
             $straightFlag = $shapeRecord['StraightFlag'];
             if ($straightFlag) {
                 $x = $shapeRecord['X'] / 20;
                 $y = $shapeRecord['Y'] / 20;
                 $text .= "StraightEdge: MoveTo: ({$x}, {$y})";
             } else {
                 $controlX = $shapeRecord['ControlX'] / 20;
                 $controlY = $shapeRecord['ControlY'] / 20;
                 $anchorX = $shapeRecord['AnchorX'] / 20;
                 $anchorY = $shapeRecord['AnchorY'] / 20;
                 $text .= "CurvedEdge: MoveTo: Control({$controlX}, {$controlY}) Anchor({$anchorX}, {$anchorY})";
             }
         }
         if (substr($text, -1) != PHP_EOL) {
             $text .= PHP_EOL;
         }
     }
     return $text;
 }