[Tkabber-dev] r1239 - in trunk/tkabber-plugins: . aniemoticons

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sun Sep 23 23:11:59 MSD 2007


Author: sergei
Date: 2007-09-23 23:11:58 +0400 (Sun, 23 Sep 2007)
New Revision: 1239

Modified:
   trunk/tkabber-plugins/ChangeLog
   trunk/tkabber-plugins/aniemoticons/anigif.tcl
Log:
	* aniemoticons/anigif.tcl: Fixed some GIF images processing (thanks
	  to Ruslan Rakhmanin).


Modified: trunk/tkabber-plugins/ChangeLog
===================================================================
--- trunk/tkabber-plugins/ChangeLog	2007-09-21 17:29:59 UTC (rev 1238)
+++ trunk/tkabber-plugins/ChangeLog	2007-09-23 19:11:58 UTC (rev 1239)
@@ -1,3 +1,8 @@
+2007-09-23  Sergei Golovan <sgolovan at nes.ru>
+
+	* aniemoticons/anigif.tcl: Fixed some GIF images processing (thanks
+	  to Ruslan Rakhmanin).
+
 2007-09-21  Sergei Golovan <sgolovan at nes.ru>
 
 	* georoster/georoster.tcl: Use separated public XML storage interface.

Modified: trunk/tkabber-plugins/aniemoticons/anigif.tcl
===================================================================
--- trunk/tkabber-plugins/aniemoticons/anigif.tcl	2007-09-21 17:29:59 UTC (rev 1238)
+++ trunk/tkabber-plugins/aniemoticons/anigif.tcl	2007-09-23 19:11:58 UTC (rev 1239)
@@ -53,27 +53,36 @@
 	    ::anigif::stop $img
 	    return
 	}
-    } 
-    set dispflag [lindex $::anigif::img(disposal,$img) $idx]
+    }
+    set disposal_idx $idx 
+    incr disposal_idx -1
+    if {$disposal_idx <= 0} {
+	set disposal_idx 0
+    }
+    if {$idx == 0} {
+	set dispflag "010"
+    } else {
+	set dispflag [lindex $::anigif::img(disposal,$img) $disposal_idx]
+    }
     switch -- "$dispflag" {
 	"000" {
 	    # Do nothing
 	}
-	"001" {
+	"100" {
 	    # Do not dispose
 	}
-	"100" {
+	"010" {
 	    # Restore to background
 	    $::anigif::img(curimage,$img) blank
 	}
-	"101" {
+	"110" {
 	    # Restore to previous - not supported
 	    # As recommended, since this is not supported, it is set to blank
-	    #### [set ::anigif::img(curimage,$img)] blank
+	    [set ::anigif::img(curimage,$img)] blank
 	}
 	default { puts "no match: $dispflag" }
     }
-    $::anigif::img(curimage,$img) copy [lindex $list $idx] ;# -subsample 2 2
+    $::anigif::img(curimage,$img) copy [lindex $list $idx]
     if {[lindex $delay $idx] == 0} {
 	::anigif::stop $img
 	return
@@ -95,6 +104,7 @@
     set images {}
     set delay {}
     set disposal {}
+    set reserved {}
     #set img anigifimage[incr image_number]
     #set img [image create photo]
 
@@ -109,31 +119,27 @@
     set start [string first "\x21\xFF\x0B" $data]
 
     if {$start < 0} {
-        set repeat 0
+	set repeat 0
     } else {
-        set repeat 1
+	set repeat 1
     }
 
     # Find Control Records
     set start [string first "\x21\xF9\x04" $data]
     while {![catch {image create photo xpic$n$img \
-			  -file $fnam \
-			  -format [list gif89 -index $n]}]} {
-        set stop [string first "\x00" $data [expr {$start + 1}]]
-        if {$stop < $start} {
-	   break
-        }
-        set record [string range $data $start $stop]
-        binary scan $record @4c1 thisdelay
-        if {[info exists thisdelay]} {
+			    -file $fnam \
+			    -format [list gif89 -index $n]}]} {
+	set stop [expr $start + 7]
+	set record [string range $data $start $stop]
+	binary scan $record @4s thisdelay
+	if {[info exists thisdelay]} {
 	    # Change to unsigned integer
-	    set thisdelay [expr {$thisdelay & 0xFF}];
-
-	    binary scan $record @2b3b3b1b1 -> disposalval userinput transflag
-
+	    #set thisdelay [expr {$thisdelay & 0xFF}];
+	    binary scan $record @3b5 disposalval
+	    set disposalval [string range $disposalval 2 end]
 	    lappend images pic$n$img
 	    image create photo pic$n$img
-	    pic$n$img copy xpic$n$img ;# -zoom 2 2
+	    pic$n$img copy xpic$n$img
 	    image delete xpic$n$img
 	    lappend disposal $disposalval
 
@@ -160,7 +166,7 @@
     set ::anigif::img(disposal,$img) $disposal
     set ::anigif::img(curimage,$img) $img
     $img blank
-    $img copy pic0${img} ;# -subsample 2 2
+    $img copy pic0${img}
     #$img configure -image [set ::anigif::img(curimage,$img)]
 
     anigif2 $img $images $delay $idx



More information about the Tkabber-dev mailing list