Lines Matching refs:this

82         $this->style['ttfont'] = dirname(__FILE__).'/Vera.ttf';
110 $this->Lexer->addSpecialPattern('<go>.*?</go>',$mode,'plugin_godiag');
128 $map_id = 'godiag__' . $this->seqno++ . $md5hash_png;
146 … $renderer->doc .= '<a href="'.$sgf_href.'" title="'.$this->getLang('sgfdownload').'">[SGF]</a>';
168 $this->dgm = array (
200 $this->dgm['imappings'][$matches[1]]=$matches[2];
204 ksort($this->dgm['imappings']);
205 foreach($this->dgm['imappings'] as $symb => $href) {
220 $this->dgm['black_first'] = false;
223 $this->dgm['break'] = 'true';
226 $this->dgm['coord_markers'] = true;
229 $this->dgm['divclass'] = 'left';
232 $this->dgm['divclass'] = 'right';
235 $this->dgm['board_size'] = $matches[1];
237 $this->dgm['title'] = $heading;
241 $this->dgm['edge_bottom']=true;
246 $this->dgm['edge_top']=true;
254 if(preg_match('/^(\s|\$)*\|/', $source_line)) { $this->dgm['edge_left']=true; }
255 if(preg_match('/\|\s*$/', $source_line)) { $this->dgm['edge_right']=true; }
261 if(array_key_exists($symb, $this->dgm['imappings'])) {
262 … $this->dgm['imap_html'] .= $this->imap_area($bx, $row, $this->dgm['imappings'][$symb]);
265 if($len>$this->dgm['gridh']) { $this->dgm['gridh']=$len; }
266 $this->dgm['dia'][$row++]=$as_array;
268 $this->dgm['gridv']=$row;
271 $dimh=($this->dgm['gridh']-1)*$this->style['line_sp']+$this->style['edge_sp']*2+1;
272 $dimv=($this->dgm['gridv']-1)*$this->style['line_sp']+$this->style['edge_sp']*2+1;
273 if($this->dgm['coord_markers']) {
274 $dimh += $this->style['coord_sp'];
275 $dimv += $this->style['coord_sp'];
277 if(($offs_sz_arr=$this->calc_offsets_and_size())===false) {
278 return $this->error_box('non-square board');
280 list($this->dgm['board_size'], //this will be overwritten if it conflicts with other input
281 $this->dgm['offset_x'],
282 $this->dgm['offset_y']) = $offs_sz_arr;
284 if($this->dgm['board_size'] > $this->style['board_max'])
285 return $this->error_box('board too large (max is ' . $this->style['board_max'] . ')');
288 if($this->dgm['gridv'] >= $this->dgm['board_size'] - 1) {
289 $this->dgm['edge_top'] = true;
290 if($this->dgm['gridv'] == $this->dgm['board_size'])
291 $this->dgm['edge_bottom']=true;
293 if($this->dgm['gridh'] >= $this->dgm['board_size'] - 1) {
294 $this->dgm['edge_left']=true;
295 if($this->dgm['gridh'] == $this->dgm['board_size'])
296 $this->dgm['edge_right']=true;
301 $str_for_hash .= '!' . $this->dgm['black_first']
302 . '!' . $this->dgm['edge_top']
303 . '!' . $this->dgm['edge_bottom']
304 . '!' . $this->dgm['edge_left']
305 . '!' . $this->dgm['edge_right'];
308 . '!' . $this->dgm['board_size']
309 . '!' . $this->dgm['title'];
312 . '!' . ($this->dgm['coord_markers'] ? $this->dgm['board_size'] : false);
314 $md5hash_png=md5($str_for_hash_img . '!' . serialize($this->style));
323 $draw_result = $this->save_diagram($dimh, $dimv, $filename_png);
329 if(!io_saveFile($filename_sgf,$this->SGF())){
330 return $this->error_box("Cannot create SGF file.");
338 'imap_html' => $this->dgm['imap_html'],
339 'divclass' => $this->dgm['divclass'],
340 'break' => $this->dgm['break'],
410 $coords=$this->get_coords($bx, $by);
411 …$this->circ($im, $coords[0], $coords[1], $this->style['hoshi_radius'], $this->style['line_acolor']…
415 $coords=$this->get_coords($bx, $by);
416 …$this->circ($im, $coords[0], $coords[1], $this->style['stone_radius'], $this->style['white_rim_aco…
417 …$this->circ($im, $coords[0], $coords[1], $this->style['stone_radius']-1, $this->style['white_acolo…
421 $coords=$this->get_coords($bx, $by);
422 …$this->circ($im, $coords[0], $coords[1], $this->style['stone_radius'], $this->style['black_acolor'…
426 $coords=$this->get_coords($bx, $by);
427 $this->draw_white($im, $bx, $by);
428 …$this->circ($im, $coords[0], $coords[1], $this->style['mark_radius'], $this->style['mark_acolor']);
429 …$this->circ($im, $coords[0], $coords[1], $this->style['mark_radius']-2, $this->style['white_acolor…
433 $coords=$this->get_coords($bx, $by);
434 $this->draw_black($im, $bx, $by);
435 …$this->circ($im, $coords[0], $coords[1], $this->style['mark_radius'], $this->style['mark_acolor']);
436 …$this->circ($im, $coords[0], $coords[1], $this->style['mark_radius']-2, $this->style['black_acolor…
440 $coords=$this->get_coords($bx, $by);
441 list($x, $y) = $coords=$this->get_coords($bx, $by);
442 $r=$this->style['mark_radius'];
443 $sim = $this->style['circle_mark_img']['im'];
444 $dim = $this->style['circle_mark_img']['dim'];
449 list($x, $y) = $coords=$this->get_coords($bx, $by);
450 $x1=$x-($this->style['mark_sqheight']/2);
451 $x2=$x+($this->style['mark_sqheight']/2);
452 $y1=$y-($this->style['mark_sqheight']/2);
453 $y2=$y+($this->style['mark_sqheight']/2);
454 imagefilledrectangle($im, $x1, $y1, $x2, $y2, $this->dgm['mark_color']);
457 list($x, $y) = $coords=$this->get_coords($bx, $by);
458 $x1=$x-($this->style['link_sqheight']/2);
459 $x2=$x+($this->style['link_sqheight']/2);
460 $y1=$y-($this->style['link_sqheight']/2);
461 $y2=$y+($this->style['link_sqheight']/2);
462 imagefilledrectangle($im, $x1, $y1, $x2, $y2, $this->dgm['link_color']);
465 $this->draw_white($im, $bx, $by);
466 $this->draw_square($im, $bx, $by);
469 $this->draw_black($im, $bx, $by);
470 $this->draw_square($im, $bx, $by);
473 $str=$this->dgm['dia'][$by][$bx];
475 $blacks_turn = intval($str) % 2 == ($this->dgm['black_first'] ? 1 : 0);
477 $this->draw_black($im, $bx, $by);
479 $this->draw_white($im, $bx, $by);
480 list($x, $y) = $coords=$this->get_coords($bx, $by);
481 $col=$blacks_turn ? $this->dgm['white_color'] : $this->dgm['black_color'];
482 $box = imagettfbbox($this->style['ttfont_sz'], 0, $this->style['ttfont'], $str);
484 …imagettftext($im, $this->style['ttfont_sz'], 0, $basex, $y+$this->style['majusc_voffs'], $col, $th…
488 list($x, $y) = $coords=$this->get_coords($bx, $by);
489 $str = $this->dgm['dia'][$by][$bx];
490 $box = imagettfbbox($this->style['ttfont_sz'], 0, $this->style['ttfont'], $str);
492 $r = $this->style['stone_radius']-3;
493 imagefilledrectangle($im, $x-$r, $y-$r, $x+$r, $y+$r, $this->dgm['goban_color']);
494 …imagettftext($im, $this->style['ttfont_sz'], 0, $basex, $y+$this->style['minusc_voffs'], $this->dg…
498 list($x, $y) = $coords=$this->get_coords($bx, $by);
500 $str = $this->dgm['board_size'] - $this->dgm['offset_y'] - $by;
502 $bx2 = $this->dgm['offset_x'] + $bx;
505 $box = imagettfbbox($this->style['ttfont_sz'], 0, $this->style['ttfont'], $str);
507 $basex=$x - $this->style['stone_radius']+($str<10?$this->style['sm_offs']:0);
511 …imagettftext($im, $this->style['ttfont_sz'], 0, $basex, $y+$this->style['majusc_voffs'], $this->dg…
515 list($x, $y) = $coords=$this->get_coords($bx, $by);
516 …ngle($im, $x-$this->style['line_sp']/2+1, $y-$this->style['line_sp']/2+1, $x+$this->style['line_sp…
525 return($this->error_box("Cannot initialize GD image stream."));
528 if(!array_key_exists('sm_offs', $this->style)) {
530 $box = imagettfbbox($this->style['ttfont_sz'], 0, $this->style['ttfont'], '1');
531 $box2 = imagettfbbox($this->style['ttfont_sz'], 0, $this->style['ttfont'], '11');
532 $this->style['sm_offs'] = ($box2[2]-$box[1]) - ($box[2]-$box[0]) - 1;
534 $box = imagettfbbox($this->style['ttfont_sz'], 0, $this->style['ttfont'], 'a');
535 $this->style['minusc_voffs'] = (-$box[5])/2+1;
536 $box = imagettfbbox($this->style['ttfont_sz'], 0, $this->style['ttfont'], 'A');
537 $this->style['majusc_voffs'] = (-$box[5])/2;
539 if(!array_key_exists('circle_mark_img', $this->style)) {
540 $r=$this->style['mark_radius'];
543 $gc = $this->style['goban_acolor'];
547 $this->circ($xim, $r+1, $r+1, $r, $this->style['mark_acolor']);
548 $this->circ($xim, $r+1, $r+1, $r-2, $this->style['goban_acolor']);
549 $this->style['circle_mark_img']['im'] = $xim;
550 $this->style['circle_mark_img']['dim'] = $dim;
553 $this->dgm['line_color'] = $this->acolor2color($im, $this->style['line_acolor']);
554 $this->dgm['mark_color'] = $this->acolor2color($im, $this->style['mark_acolor']);
555 … $this->dgm['link_color'] = $this->acolor2color($im, $this->style['link_acolor_alpha'], true);
556 $this->dgm['goban_color'] = $this->acolor2color($im, $this->style['goban_acolor']);
557 $this->dgm['black_color'] = $this->acolor2color($im, $this->style['black_acolor']);
558 $this->dgm['white_color'] = $this->acolor2color($im, $this->style['white_acolor']);
559 $this->dgm['string_color'] = $this->acolor2color($im, $this->style['string_acolor']);
561 imagefill($im, 0, 0, $this->dgm['goban_color']);
564 $beginv=$this->dgm['edge_top'] ? $this->style['edge_sp'] : $this->style['line_begin'];
565 $beginh=$this->dgm['edge_left'] ? $this->style['edge_sp'] : $this->style['line_begin'];
566 …$endv=$dimv - ($this->dgm['edge_bottom'] ? $this->style['edge_sp'] : $this->style['line_begin']) -…
567 …$endh=$dimh - ($this->dgm['edge_right'] ? $this->style['edge_sp'] : $this->style['line_begin']) - …
568 if($this->dgm['coord_markers']) {
569 $beginv += $this->style['coord_sp'];
570 $beginh += $this->style['coord_sp'];
574 for($i=0; $i<$this->dgm['gridv']; $i+=1) {
575 $coords=$this->get_coords($i, $i);
576 imageline($im, $beginh, $coords[0], $endh, $coords[0], $this->dgm['line_color']);
579 for($i=0; $i<$this->dgm['gridh']; $i+=1) {
580 $coords=$this->get_coords($i, $i);
581 imageline($im, $coords[0], $beginv, $coords[0], $endv, $this->dgm['line_color']);
585 if($this->dgm['coord_markers']) {
586 $this->draw_coord($im, -1, 2);
587 for($i=0; $i<$this->dgm['gridv']; $i++)
588 $this->draw_coord($im, -1, $i);
589 for($i=0; $i<$this->dgm['gridh']; $i++)
590 $this->draw_coord($im, $i, -1);
594 foreach($this->dgm['dia'] as $by => $row) {
597 $this->draw_num($im, $bx, $by);
599 $this->draw_let($im, $bx, $by);
601 if(!array_key_exists($symb, $this->functab)) {
604 return $this->error_box($oopshtml);
606 call_user_func(array($this, $this->functab[$symb]), $im, $bx, $by);
609 if(array_key_exists($symb, $this->dgm['imappings'])) {
610 $this->draw_link($im, $bx, $by);
620 return $this->error_box("Cannot output diagram to file.");
629 if($this->dgm['coord_markers'])
630 $additional_sp+=$this->style['coord_sp'];
631 return array($bx*$this->style['line_sp']+$this->style['edge_sp']+$additional_sp,
632 $by*$this->style['line_sp']+$this->style['edge_sp']+$additional_sp);
641 list($x, $y) = $coords=$this->get_coords($bx, $by);
642 $x1=$x-$this->style['line_sp']/2;
643 $y1=$y-$this->style['line_sp']/2;
644 $x2=$x+$this->style['line_sp']/2;
645 $y2=$y+$this->style['line_sp']/2;
680 $sizex = $this->dgm['gridh'];
681 $sizey = $this->dgm['gridv'];
682 $heightdefined = $this->dgm['edge_top'] && $this->dgm['edge_bottom'];
683 $widthdefined = $this->dgm['edge_left'] && $this->dgm['edge_right'];
692 if ($this->dgm['edge_right']) $offset_x = $size-$sizex;
693 elseif (!$this->dgm['edge_left']) $offset_x = ($size-$sizex)/2;
700 if ($this->dgm['edge_bottom']) $offset_y = $size-$sizey;
701 elseif (!$this->dgm['edge_top']) $offset_y = ($size-$sizey)/2;
705 $size = max($sizex, $sizey, $this->dgm['board_size']);
707 if ($this->dgm['edge_right']) $offset_x = $size-$sizex;
708 elseif (!$this->dgm['edge_left']) $offset_x = ($size-$sizex)/2;
710 if ($this->dgm['edge_bottom']) $offset_y = $size-$sizey;
711 elseif (!$this->dgm['edge_top']) $offset_y = ($size-$sizey)/2;
720 $rows = $this->dgm['dia'];
721 $title = str_replace(']', '\]', $this->dgm['title']);
722 $comment = str_replace(']', '\]', $this->style['sgf_comment']);
723 $sizex = $this->dgm['gridh'];
724 $sizey = $this->dgm['gridv'];
725 $size = $this->dgm['board_size'];
726 $offset_x = $this->dgm['offset_x'];
727 $offset_y = $this->dgm['offset_y'];
729 $firstcolor = $this->dgm['black_first'] ? 'B' : 'W';
743 if (!$this->dgm['black_first']) {
792 if ($cnt = preg_match_all($this->hintre, $title, $match)) {