本文整理匯總了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);