--- loncom/homework/randomlylabel.pm	2003/05/13 19:08:31	1.9
+++ loncom/homework/randomlylabel.pm	2003/11/10 23:29:27	1.10
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # randomlabel.png: composite together text and images into 1 image
 #
-# $Id: randomlylabel.pm,v 1.9 2003/05/13 19:08:31 albertel Exp $
+# $Id: randomlylabel.pm,v 1.10 2003/11/10 23:29:27 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -89,6 +89,23 @@ sub handler {
 	$image->string(gdGiantFont,$ENV{"form.X$i"},$ENV{"form.Y$i"}-$height,
 		       $ENV{"form.LB$i"},$black);
     }
+    for(my $i=0;$i<$ENV{"form.LINECOUNT"};$i++) {
+	my $x1=$ENV{"form.LINEX1$i"};
+	my $y1=$ENV{"form.LINEY1$i"};
+	my $x2=$ENV{"form.LINEX2$i"};
+	my $y2=$ENV{"form.LINEY2$i"};
+	my $width=$ENV{"form.LINEW$i"};
+	my $color=$ENV{"form.LINEC$i"};
+	my (undef,$red,undef,$green,undef,$blue)=split(/(..)/,$color);
+	$red=hex($red);$green=hex($green);$blue=hex($blue);
+	my $imcolor;
+	if (!($imcolor = $image->colorResolve($red,$green,$blue))) {
+	    $imcolor = $image->colorClosestHWB($red,$green,$blue);
+	}
+	$image->setThickness($width);
+       	$image->line($x1,$y1,$x2,$y2,$imcolor);
+    }
+    $image->setThickness(1);
     $r->print($image->png);
     return OK;
 }