Esempio n. 1
0
    $rgb = str_replace(")", "", $rgb);
    $rgbArray = explode(",", $rgb);
    return $rgbArray;
}
$totalSWFObjects = 0;
foreach ($xml->svg as $svg) {
    if ($svg['t'] != 'f') {
        if ($charid != null || $chardepth != null) {
            for ($p = 0; $p <= $totalSWFObjects - 1; $p++) {
                $swf->RemoveObjectFromLayer($charid[$p], $chardepth[$p]);
            }
        }
    }
    foreach ($svg->line as $line) {
        $linefillColor = rgbConvert($line['stroke']);
        $CharacterInfo = $swf->DefineStraightLine($line['x1'] * 20, $height * 20 - $line['y1'] * 20, $line['x2'] * 20, $height * 20 - $line['y2'] * 20, $line['stroke-width'] * 20, false, $linefillColor[0], $linefillColor[1], $linefillColor[2], 0);
        $CharacterDepth = $swf->EasyPlaceObject($CharacterInfo["CharacterID"]);
        $charid[$totalSWFObjects] = $CharacterInfo["CharacterID"];
        $chardepth[$totalSWFObjects] = $CharacterDepth;
        $totalSWFObjects++;
    }
    foreach ($svg->rect as $rect) {
        $rectfillColor = rgbConvert($rect['fill']);
        $rectlineColor = rgbConvert($rect['stroke']);
        $CharacterInfo = $swf->DefineRectangleSolid($rect['x'] * 20, $height * 20 - $rect['y'] * 20, $rect['x'] * 20 + $rect['width'] * 20, $height * 20 - ($rect['y'] * 20 + $rect['height'] * 20), $rect['stroke-width'] * 2, false, true, $rectlineColor[0], $rectlineColor[1], $rectlineColor[2], 255, true, $rectfillColor[0], $rectfillColor[1], $rectfillColor[2], 255);
        $CharacterDepth = $swf->EasyPlaceObject($CharacterInfo["CharacterID"]);
        $charid[$totalSWFObjects] = $CharacterInfo["CharacterID"];
        $chardepth[$totalSWFObjects] = $CharacterDepth;
        $totalSWFObjects++;
    }
    $swf->EndFrame();
Esempio n. 2
0
                $y2 = $cheight - ($shape["top"] + $shape["height"]);
                $lw = $shape["lineWidth"];
                $fillArray = sscanf($shape['fillColor'], '#%2x%2x%2x');
                $strokeArray = sscanf($shape['lineColor'], '#%2x%2x%2x');
                $CharacterInfo = $swf->DefineRectangleSolid($x1 * 20, $y1 * 20, $x2 * 20, $y2 * 20, $lw * 20, false, true, $strokeArray[0], $strokeArray[1], $strokeArray[2], 255, true, $fillArray[0], $fillArray[1], $fillArray[2], $fillArray[3]);
                //$CharacterInfo = $swf->DefineRectangle($x1*20, $y1*20, $x2*20, $y2*20, $lw*20, false, $strokeArray[0], $strokeArray[1], $strokeArray[2], 255);
                $CharacterDepth = $swf->EasyPlaceObject($CharacterInfo["CharacterID"]);
                array_push($previous_id_array, $CharacterInfo["CharacterID"]);
                array_push($previous_depth_array, $CharacterDepth);
                break;
            case "line":
                $x1 = $shape["left"];
                $y1 = $cheight - $shape["top"];
                $x2 = $shape["left"] + $shape["width"];
                $y2 = $cheight - ($shape["top"] + $shape["height"]);
                $strokeArray = sscanf($shape['lineColor'], '#%2x%2x%2x');
                $CharacterInfo = $swf->DefineStraightLine($x1 * 20, $y1 * 20, $x2 * 20, $y2 * 20, $shape["lineWidth"] * 20, false, $strokeArray[0], $strokeArray[1], $strokeArray[2], 0);
                $CharacterDepth = $swf->EasyPlaceObject($CharacterInfo["CharacterID"]);
                array_push($previous_id_array, $CharacterInfo["CharacterID"]);
                array_push($previous_depth_array, $CharacterDepth);
                break;
        }
    }
    $swf->EndFrame();
}
$swf->EndMovie();
$animation = $swf->GetMovie();
echo base64_encode($animation);
?>