[LON-CAPA-cvs] cvs: loncom /homework randomlylabel.pm

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 27 Feb 2003 21:36:27 -0000


albertel		Thu Feb 27 16:36:27 2003 EDT

  Modified files:              
    /loncom/homework	randomlylabel.pm 
  Log:
  - more resiliant about trying to find a good color to use when an indexed image is saturated
  
  
  
Index: loncom/homework/randomlylabel.pm
diff -u loncom/homework/randomlylabel.pm:1.7 loncom/homework/randomlylabel.pm:1.8
--- loncom/homework/randomlylabel.pm:1.7	Thu Feb 27 16:30:55 2003
+++ loncom/homework/randomlylabel.pm	Thu Feb 27 16:36:27 2003
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # randomlabel.png: composite together text and images into 1 image
 #
-# $Id: randomlylabel.pm,v 1.7 2003/02/27 21:30:55 albertel Exp $
+# $Id: randomlylabel.pm,v 1.8 2003/02/27 21:36:27 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -70,7 +70,10 @@
         return OK;
     }
     #binmode(STDOUT);
-    my $black = $image->colorAllocate(0,0,0);
+    my $black;
+    if (!($black=$image->colorResolve(0,0,0))) {
+	$black = $image->colorClosestHWB(0,0,0);
+    }
     for(my $i=0;$i<$ENV{"form.ICOUNT"};$i++) {
 	my $subimage=&get_image($ENV{"form.IMG$i"},1);
 	$image->copy($subimage,$ENV{"form.X$i"},$ENV{"form.Y$i"},