636 into:data |
634 into:data |
637 startingAt:1 |
635 startingAt:1 |
638 codeLen:(codeLen + 1). |
636 codeLen:(codeLen + 1). |
639 |
637 |
640 interlaced ifTrue:[ |
638 interlaced ifTrue:[ |
641 "/ 'GIFREADER: deinterlacing ...' infoPrintCR. |
639 "/ 'GIFREADER: deinterlacing ...' infoPrintCR. |
642 tmp := ByteArray new:(data size). |
640 tmp := ByteArray new:(data size). |
643 |
641 |
644 "phase 1: 0, 8, 16, 24, ..." |
642 "phase 1: 0, 8, 16, 24, ..." |
645 |
643 |
646 srcOffset := 1. |
644 srcOffset := 1. |
964 |bitsPerPixel t1| |
962 |bitsPerPixel t1| |
965 |
963 |
966 bitsPerPixel := image bitsPerPixel. |
964 bitsPerPixel := image bitsPerPixel. |
967 |
965 |
968 outStream nextPutAll: 'GIF89a' asByteArray. |
966 outStream nextPutAll: 'GIF89a' asByteArray. |
969 self writeShort:width. "/ screen size |
967 |
970 self writeShort:height. |
968 "/ local screen descriptor |
|
969 outStream nextPutInt16:width MSB:(byteOrder ~~ #lsb). "/ screen size |
|
970 outStream nextPutInt16:height MSB:(byteOrder ~~ #lsb). |
971 t1 := 128. |
971 t1 := 128. |
972 t1 := t1 bitOr:(bitsPerPixel - 1 bitShift:5). |
972 t1 := t1 bitOr:(bitsPerPixel - 1 bitShift:5). |
973 t1 := t1 bitOr:(bitsPerPixel - 1). |
973 t1 := t1 bitOr:(bitsPerPixel - 1). |
974 outStream nextPut:t1. "/ flag |
974 outStream nextPut:t1. "/ flag |
975 outStream nextPut:0. "/ background (not used) |
975 outStream nextPut:0. "/ background (not used) |
976 outStream nextPut:0. "/ aspect ratio |
976 outStream nextPut:0. "/ aspect ratio |
977 |
977 |
978 0 to:(1 bitShift:bitsPerPixel)-1 do:[:pixel | |
978 0 to:(1 bitShift:bitsPerPixel)-1 do:[:pixel | |
979 |clr red green blue| |
979 |clr red green blue| |
980 |
980 |
981 clr := image colorFromValue:pixel. |
981 clr := image colorFromValue:pixel. |
982 clr isNil ifTrue:[ |
982 clr isNil ifTrue:[ |
983 "/ unused colorMap slot |
983 "/ unused colorMap slot |
984 red := green := blue := 0. |
984 red := green := blue := 0. |
985 ] ifFalse:[ |
985 ] ifFalse:[ |
986 red := (clr redByte). |
986 red := (clr redByte). |
987 green := (clr greenByte). |
987 green := (clr greenByte). |
988 blue := (clr blueByte). |
988 blue := (clr blueByte). |
989 ]. |
989 ]. |
990 outStream |
990 outStream |
991 nextPut:red; nextPut:green; nextPut:blue. |
991 nextPut:red; nextPut:green; nextPut:blue. |
992 ]. |
992 ]. |
993 |
993 |
994 "Created: / 14.10.1997 / 17:41:28 / cg" |
994 "Created: / 14.10.1997 / 17:41:28 / cg" |
995 "Modified: / 31.10.1997 / 16:12:13 / cg" |
995 "Modified: / 31.10.1997 / 16:12:13 / cg" |
996 ! |
996 ! |