本文整理汇总了PHP中Zone::writePBM方法的典型用法代码示例。如果您正苦于以下问题:PHP Zone::writePBM方法的具体用法?PHP Zone::writePBM怎么用?PHP Zone::writePBM使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zone
的用法示例。
在下文中一共展示了Zone::writePBM方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: count
echo "Rendering " . count($zones) . " zones\n";
$normx = $bounds->l / 2;
$normy = $bounds->t / 2;
$width = $bounds->r / 2 - $bounds->l / 2 + 1;
$height = $bounds->b / 2 - $bounds->t / 2 + 1;
$img = imagecreate($width, $height);
$white = imagecolorallocate($img, 255, 255, 255);
foreach ($zones as $_zid) {
$_zone = new Zone($_zid);
$ft = new EdgeTracer($_zone);
drawPoints($img, $ft->edges, allocateColor($img), $normx, $normy);
echo sprintf("Processing Zone %s (%d,%d) - (%d,%d)\n", $_zone->name, $_zone->halfbounds->l, $_zone->halfbounds->t, $_zone->halfbounds->r, $_zone->halfbounds->b);
$file = 'trace-' . $_zid;
//tempnam('./','trace');
echo sprintf("Write PBM (%d,%d)\n", $_zone->halfwidth, $_zone->halfheight);
$_zone->writePBM($file . '.pbm');
echo "Process PBM\n";
$polys = array();
exec(sprintf("potrace -b svg -W%d.pt -O1 -n -c -q -u1 -o %s.svg %s.pbm", $_zone->halfwidth, $file, $file));
echo "Parse SVG\n";
$polys = parsePolygonsFromSVG($file . '.svg', $_zone->halfbounds);
// exec(sprintf("potrace -b xfig -W%d.pt -o %s.fig %s.pbm", $_zone->halfwidth, $file, $file));
// $xf = new XFIGParser($file.'.fig');
// $xf->parse($_zone->halfbounds);
// $polys = $xf->polys;
writePolys($_zone, $polys, $file . '.poly');
foreach ($polys as $_poly) {
#var_dump($_poly);
echo "Rendering Poly for " . $_zid . " of size " . count($_poly) . "\n";
$color = allocateColor($img);
drawPoly($img, $_poly, $color, $normx, $normy);