<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>> <span style="font-size: 12pt;">And maybe double-check with the specification: https://www.w3.org/Graphics/GIF/spec-gif89a.txt</span></p>
<div><br>
</div>
<p></p>
<div id="Signature">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div>
<div class="_rp_T4" id="Item.MessagePartBody">
<div class="_rp_U4 ms-font-weight-regular ms-font-color-neutralDark rpHighlightAllClass rpHighlightBodyClass" id="Item.MessageUniqueBody" style="font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont">
<div dir="ltr">
<div id="divtagdefaultwrapper"><font face="Calibri,Helvetica,sans-serif,EmojiFont,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols">
<div id="Signature">
<div style="margin:0px"><font style="font-family:Calibri,Arial,Helvetica,sans-serif,serif,EmojiFont"></font></div>
</div>
</font></div>
</div>
</div>
</div>
<div class="_rp_T4" id="Item.MessagePartBody">This looks less funny to me, but you are right of course. :-)</div>
<div class="_rp_T4" id="Item.MessagePartBody"><br>
</div>
<div class="_rp_T4" id="Item.MessagePartBody">Best,</div>
<div class="_rp_T4" id="Item.MessagePartBody">Christoph</div>
</div>
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>Von:</b> Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel<br>
<b>Gesendet:</b> Freitag, 9. Oktober 2020 16:53:44<br>
<b>An:</b> squeak-dev<br>
<b>Betreff:</b> Re: [squeak-dev] The Inbox: Graphics-ct.443.mcz</font>
<div> </div>
</div>
<div>
<div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000">
Hi Christoph.
<div><br>
</div>
<div>> <span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">For a potentially relevant reference implementtion ...</span></div>
<div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">And maybe double-check with the specification: </span><span style="font-size: 10pt"><a href="https://www.w3.org/Graphics/GIF/spec-gif89a.txt" style="font-size: 10pt">https://www.w3.org/Graphics/GIF/spec-gif89a.txt</a></span></div>
<div><br>
</div>
<div>Best,</div>
<div>Marcel</div>
<div class="mb_sig"></div>
<blockquote class="history_container" type="cite" style="border-left-style:solid;border-width:1px; margin-top:20px; margin-left:0px;padding-left:10px;">
<p style="color: #AAAAAA; margin-top: 10px;">Am 09.10.2020 16:15:36 schrieb commits@source.squeak.org <commits@source.squeak.org>:</p>
<div style="font-family:Arial,Helvetica,sans-serif">Christoph Thiede uploaded a new version of Graphics to project The Inbox:<br>
http://source.squeak.org/inbox/Graphics-ct.443.mcz<br>
<br>
==================== Summary ====================<br>
<br>
Name: Graphics-ct.443<br>
Author: ct<br>
Time: 9 October 2020, 4:15:09.97236 pm<br>
UUID: 897346b7-ceaa-1a43-874f-3571d893309c<br>
Ancestors: Graphics-pre.439<br>
<br>
Adds basic support for storing an animated GIF file via AnimatedGIFReadWriter.<br>
<br>
Note that this implementation indeed is very rudimentary only. I found several GIF files on my computer that cannot be saved as a GIF correctly (something is wrong with the encoding of the background/alpha color). But on the other hand, I also met a number
 of GIF files that cannot be read by the AnimatedGIFReadWriter ("error: improper store") ...<br>
For a potentially relevant reference implementtion, I found this one, but I did not yet find the time apply it: https://gist.github.com/JimBobSquarePants/cac72c4e7d9f05f13ac9<br>
<br>
Following the idea of "baby steps", I'd like to get this into the Trunk at this early state however. The motivation behind this is that I would like to use this concept from another project so establishing the protocol as soon as possible would be helpful for
 me to write tests.<br>
<br>
=============== Diff against Graphics-pre.439 ===============<br>
<br>
Item was added:<br>
+ ----- Method: AnimatedGIFReadWriter class>>exampleAnim (in category 'examples') -----<br>
+ exampleAnim<br>
+ "AnimatedGIFReadWriter exampleAnim"<br>
+ <br>
+ | extent center frames |<br>
+ extent := 42 @ 42.<br>
+ center := extent // 2.<br>
+ frames := (2 to: center x - 1 by: 2) collect: [:r |<br>
+ "Make a fancy anim without using Canvas - inefficient as hell"<br>
+ | image |<br>
+ image := ColorForm extent: extent depth: 8.<br>
+ 0.0 to: 359.0 do: [:theta |<br>
+ image<br>
+ colorAt: (center + (Point r: r degrees: theta)) rounded<br>
+ put: Color red].<br>
+ image].<br>
+ <br>
+ ^ FileStream newFileNamed: 'anim.gif' do: [:stream |<br>
+ self<br>
+ putForms: frames<br>
+ andDelays: (frames withIndexCollect: [:frame :index |<br>
+ 10 + (index / frames size * 100)]) "Start fast, end slow"<br>
+ onStream: stream]!<br>
<br>
Item was added:<br>
+ ----- Method: AnimatedGIFReadWriter class>>putForms:andDelays:onStream: (in category 'image reading/writing') -----<br>
+ putForms: forms andDelays: delays onStream: aWriteStream<br>
+ "Store the given form sequence as an animation on the given stream."<br>
+ <br>
+ | writer canvas |<br>
+ self assert: forms size = delays size.<br>
+ <br>
+ writer := self on: aWriteStream.<br>
+ canvas := Form extent: forms first extent depth: 32.<br>
+ [Cursor write showWhile: [<br>
+ writer loopCount: -1.<br>
+ forms with: delays do: [:form :delay |<br>
+ writer delay: delay; flag: #todo. "ct: Does not work"<br>
+ form displayOn: canvas at: 0 @ 0 rule: Form over.<br>
+ writer nextPutImage: canvas]]]<br>
+ ensure: [writer close].!<br>
<br>
Item was added:<br>
+ ----- Method: AnimatedGIFReadWriter class>>putForms:onFileNamed: (in category 'image reading/writing') -----<br>
+ putForms: formSequence onFileNamed: fileName<br>
+ "Store the given form sequence as an animation on a file of the given name."<br>
+ <br>
+ FileStream newFileNamed: fileName do: [:stream |<br>
+ self putForms: formSequence onStream: stream].!<br>
<br>
Item was added:<br>
+ ----- Method: AnimatedGIFReadWriter class>>putForms:onStream: (in category 'image reading/writing') -----<br>
+ putForms: forms onStream: aWriteStream<br>
+ "Store the given form sequence as an animation on the given stream."<br>
+ <br>
+ ^ self<br>
+ putForms: forms<br>
+ andDelays: ((1 to: forms size) collect: [:i | 20])<br>
+ onStream: aWriteStream!<br>
<br>
Item was changed:<br>
----- Method: BMPReadWriter class>>readAllFrom: (in category 'testing') -----<br>
readAllFrom: fd<br>
"MessageTally spyOn:[BMPReadWriter readAllFrom: FileDirectory default]"<br>
fd fileNames do:[:fName|<br>
(fName endsWith: '.bmp') ifTrue:[<br>
+ [Form fromBinaryStream: (fd readOnlyFileNamed: fName)] ifError: [].<br>
- [Form fromBinaryStream: (fd readOnlyFileNamed: fName)] on: Error do:[:nix].<br>
].<br>
].<br>
fd directoryNames do:[:fdName|<br>
self readAllFrom: (fd directoryNamed: fdName)<br>
].!<br>
<br>
Item was removed:<br>
- ----- Method: GIFReadWriter class>>exampleAnim (in category 'examples') -----<br>
- exampleAnim<br>
- "GIFReadWriter exampleAnim"<br>
- <br>
- | writer extent center |<br>
- writer := GIFReadWriter on: (FileStream newFileNamed: 'anim.gif').<br>
- writer loopCount: 20. "Repeat 20 times"<br>
- writer delay: 10. "Wait 10/100 seconds"<br>
- extent := 42@42.<br>
- center := extent / 2.<br>
- Cursor write showWhile: [<br>
- [2 to: center x - 1 by: 2 do: [:r |<br>
- "Make a fancy anim without using Canvas - inefficient as hell"<br>
- | image |<br>
- image := ColorForm extent: extent depth: 8.<br>
- 0.0 to: 359.0 do: [:theta | image colorAt: (center + (Point r: r degrees: theta)) rounded put: Color red].<br>
- writer nextPutImage: image]<br>
- ] ensure: [writer close]].!<br>
<br>
<br>
</div>
</blockquote>
</div>
</div>
</body>
</html>