Diff for /loncom/homework/drawimage.pm between versions 1.1 and 1.5

version 1.1, 2003/11/15 06:33:39 version 1.5, 2004/03/16 23:08:23
Line 38  BEGIN { Line 38  BEGIN {
   
 sub start_drawimage {  sub start_drawimage {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
     &Apache::lonxml::register('Apache::drawimage',('line','rectangle','arc','fill'));      &Apache::lonxml::register('Apache::drawimage',('text','line','rectangle','arc','fill'));
     if ($target eq 'web' || $target eq 'tex') {      if ($target eq 'web' || $target eq 'tex') {
  $cgi_id=&Apache::loncommon::get_cgi_id();   $cgi_id=&Apache::loncommon::get_cgi_id();
  %args=();   %args=();
Line 72  sub end_drawimage { Line 72  sub end_drawimage {
     return $result;      return $result;
 }  }
   
   sub start_text {
       my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
       my $result;
       if ($target eq 'web' || $target eq 'tex') {
           my $x     = &Apache::lonxml::get_param('x',$parstack,$safeeval);
           my $y     = &Apache::lonxml::get_param('y',$parstack,$safeeval);
           my $font  = &Apache::lonxml::get_param('font',$parstack,$safeeval);
           my $color = &Apache::lonxml::get_param('color',$parstack,$safeeval);
           my $direction = &Apache::lonxml::get_param('direction',$parstack,$safeeval);
    my $text  = &Apache::lonxml::get_all_text("/text",$parser);
           $text = &Apache::lonnet::escape($text);
           $args{"cgi.$cgi_id.OBJTYPE"}.='LABEL:';
    my $i=$args{"cgi.$cgi_id.OBJCOUNT"}++;
    $args{"cgi.$cgi_id.OBJ$i"}=join(':',($x,$y,$text,$font,$color,$direction));
       }
       return $result;
   }
   
   sub end_text {
       my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
       my $result;
       return $result;
   }
   
 sub start_line {  sub start_line {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
     my $result;      my $result;
Line 82  sub start_line { Line 106  sub start_line {
  my $y2 = &Apache::lonxml::get_param('y2',$parstack,$safeeval);   my $y2 = &Apache::lonxml::get_param('y2',$parstack,$safeeval);
  my $color = &Apache::lonxml::get_param('color',$parstack,$safeeval);   my $color = &Apache::lonxml::get_param('color',$parstack,$safeeval);
  my $thickness = &Apache::lonxml::get_param('thickness',$parstack,$safeeval);   my $thickness = &Apache::lonxml::get_param('thickness',$parstack,$safeeval);
  my $i=(++$args{"cgi.$cgi_id.OBJCOUNT"})-1;   my $i=$args{"cgi.$cgi_id.OBJCOUNT"}++;
  $args{"cgi.$cgi_id.OBJ$i"}=join(':',($x1,$y1,$x2,$y2,$color,$thickness));   $args{"cgi.$cgi_id.OBJ$i"}=join(':',($x1,$y1,$x2,$y2,$color,$thickness));
  $args{"cgi.$cgi_id.OBJTYPE"}.='LINE:';   $args{"cgi.$cgi_id.OBJTYPE"}.='LINE:';
     }      }
Line 108  sub start_rectangle { Line 132  sub start_rectangle {
    $safeeval);     $safeeval);
  my $filled = &Apache::lonxml::get_param('filled',$parstack,   my $filled = &Apache::lonxml::get_param('filled',$parstack,
  $safeeval);   $safeeval);
  my $i=(++$args{"cgi.$cgi_id.OBJCOUNT"})-1;   my $i=$args{"cgi.$cgi_id.OBJCOUNT"}++;
  $args{"cgi.$cgi_id.OBJ$i"}=   $args{"cgi.$cgi_id.OBJ$i"}=
     join(':',($x1,$y1,$x2,$y2,$color,$thickness,$filled));      join(':',($x1,$y1,$x2,$y2,$color,$thickness,$filled));
  $args{"cgi.$cgi_id.OBJTYPE"}.='RECTANGLE:';   $args{"cgi.$cgi_id.OBJTYPE"}.='RECTANGLE:';
Line 135  sub start_arc { Line 159  sub start_arc {
  my $color = &Apache::lonxml::get_param('color',$parstack,$safeeval);   my $color = &Apache::lonxml::get_param('color',$parstack,$safeeval);
  my $thickness = &Apache::lonxml::get_param('thickness',$parstack,$safeeval);   my $thickness = &Apache::lonxml::get_param('thickness',$parstack,$safeeval);
  my $filled = &Apache::lonxml::get_param('filled',$parstack,$safeeval);   my $filled = &Apache::lonxml::get_param('filled',$parstack,$safeeval);
  my $i=(++$args{"cgi.$cgi_id.OBJCOUNT"})-1;   my $i=$args{"cgi.$cgi_id.OBJCOUNT"}++;
  $args{"cgi.$cgi_id.OBJ$i"}=   $args{"cgi.$cgi_id.OBJ$i"}=
     join(':',($x,$y,$width,$height,$start,$end,$color,$thickness,      join(':',($x,$y,$width,$height,$start,$end,$color,$thickness,
       $filled));        $filled));
Line 150  sub end_arc { Line 174  sub end_arc {
     return $result;      return $result;
 }  }
   
 sub start_arc {  sub start_fill {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
     my $result;      my $result;
     if ($target eq 'web' || $target eq 'tex') {      if ($target eq 'web' || $target eq 'tex') {
  my $x = &Apache::lonxml::get_param('x',$parstack,$safeeval);   my $x = &Apache::lonxml::get_param('x',$parstack,$safeeval);
  my $y = &Apache::lonxml::get_param('y',$parstack,$safeeval);   my $y = &Apache::lonxml::get_param('y',$parstack,$safeeval);
  my $color = &Apache::lonxml::get_param('color',$parstack,$safeeval);   my $color = &Apache::lonxml::get_param('color',$parstack,$safeeval);
  my $i=(++$args{"cgi.$cgi_id.OBJCOUNT"})-1;   my $i=$args{"cgi.$cgi_id.OBJCOUNT"}++;
  $args{"cgi.$cgi_id.OBJ$i"}=join(':',($x,$y,$color));   $args{"cgi.$cgi_id.OBJ$i"}=join(':',($x,$y,$color));
  $args{"cgi.$cgi_id.OBJTYPE"}.='FILL:';   $args{"cgi.$cgi_id.OBJTYPE"}.='FILL:';
     }      }
     return $result;      return $result;
 }  }
   
 sub end_arc {  sub end_fill {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
     my $result;      my $result;
     return $result;      return $result;

Removed from v.1.1  
changed lines
  Added in v.1.5


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>