[squeak-dev] [Discussion] GIF and Animated GIF Refactoring

Eric Gade eric.gade at gmail.com
Sat Dec 4 18:18:43 UTC 2021


Hi Marcel (and others)

On Mon, Nov 29, 2021 at 5:45 AM Marcel Taeumel <marcel.taeumel at hpi.de>
wrote:

>
> Well, for the sake of backwards compatibility, maybe you could do instead:
>
> 1*) Improve GIFReadWriter while ensuring that the obviously public
> protocol stays functional. Empty out AnimatedGIFReadWriter but leave it
> there.
> 2*) Improve AnimatedImageMorph while ensuring that the obviously public
> protocol stays functional. No new class BetterAnimatedImageMorph.
>
> Regarding the process:
> - If single package: Inbox
> - If multiple packages: Change set via squeak-dev
>

After some wrangling between Squot and Changesets (yikes!), I was able to
come up with the following changeset (attached).

Here is what I did:
1) Updated AnimatedImageMorph to have the new/updated functionality from
BetterAnimatedImageMorph, while maintaining the same methods and
deprecating as needed;
2) Added the classes needed for new GIF parsing
3) Updated GIFReadWriter to use the new parsing methods
4) Deprecated the AnimatedGIFReadWriter class using the technique of adding
#deprecated: to #basicNew
5) I have added a GIFReadWriterTest class that tests both the regular and
animated GIF reading/writing at the same time. There are issues (see below).

If you would like to quickly test that things are working, do the following
in a workspace:
```
GIFReadWriter exampleAnim.
(AnimatedImageMorph new fromGIFFileNamed: 'anim.gif') openInHand.
```

You should see an animated, growing red circle on a while background. See
the class method comment.

Note on tests: I copied the GIFReadWriterTest class over from my Pharo
implementation with minimal (file api related) modification. The tests are
not passing and the reason is a bit confusing. Here's what's up: in these
tests I write out a Form that has different colors in each quadrant, read
it back in, and make sure the color values are the same. But apparently in
Squeak when you use `FormCanvas fillColor: Color black`, the color that is
put into the Form is not, in fact, equivalent to Color black. It is instead
something like rgb(0,0,0.04). Is this intentional? If so, do you recommend
that I simply update the tests to match on this specific color?

This is my first submission via changeset so definitely let me know if I
messed up. Thanks!
-- 
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20211204/709ad21e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Animated-GIF-Updates.cs
Type: text/x-csharp
Size: 58418 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20211204/709ad21e/attachment-0001.bin>


More information about the Squeak-dev mailing list