The Trunk: MorphicExtras-kfr.275.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: MorphicExtras-kfr.275.mcz

commits-2
Karl Ramberg uploaded a new version of MorphicExtras to project The Trunk:
http://source.squeak.org/trunk/MorphicExtras-kfr.275.mcz

==================== Summary ====================

Name: MorphicExtras-kfr.275
Author: kfr
Time: 10 June 2020, 6:41:33.727777 pm
UUID: 26fa97c9-e242-8048-8c7c-53b2061c19f4
Ancestors: MorphicExtras-mt.274

Detect if animated image (eg. gif) has transparent color and use opaque background if so.

=============== Diff against MorphicExtras-mt.274 ===============

Item was changed:
  ----- Method: AnimatedImageMorph>>fromReader: (in category 'private') -----
  fromReader: reader
-
  images := reader forms.
  delays := reader delays.
+ images do:[: each | (each colors includes: Color transparent) ifTrue:[self isOpaque: true]].
- self isOpaque: true.
  self reset.!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: MorphicExtras-kfr.275.mcz

Karl Ramberg
I was afraid this would be a slow search, but its negligible.
Tested performance on a quite big gif* and it was only 1900 ms on my slow computer


Best,
Karl

On Sat, Jun 13, 2020 at 1:12 PM <[hidden email]> wrote:
Karl Ramberg uploaded a new version of MorphicExtras to project The Trunk:
http://source.squeak.org/trunk/MorphicExtras-kfr.275.mcz

==================== Summary ====================

Name: MorphicExtras-kfr.275
Author: kfr
Time: 10 June 2020, 6:41:33.727777 pm
UUID: 26fa97c9-e242-8048-8c7c-53b2061c19f4
Ancestors: MorphicExtras-mt.274

Detect if animated image (eg. gif) has transparent color and use opaque background if so.

=============== Diff against MorphicExtras-mt.274 ===============

Item was changed:
  ----- Method: AnimatedImageMorph>>fromReader: (in category 'private') -----
  fromReader: reader
-
        images := reader forms.
        delays := reader delays.
+       images do:[: each | (each colors includes: Color transparent) ifTrue:[self isOpaque: true]].
-       self isOpaque: true.
        self reset.!




Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: MorphicExtras-kfr.275.mcz

Christoph Thiede

Hi Karl,


what's your motivation for this commit? I think transparent gifs should be displayed transparently in Squeak. You can always add an opaque background in your application if it does not want this :-)


Apart from that: Why don't you use #detect:ifFound: here? There is no need to scan all images after one that contains transparency has been found. I guess.


Best,
Christoph

Von: Squeak-dev <[hidden email]> im Auftrag von karl ramberg <[hidden email]>
Gesendet: Samstag, 13. Juni 2020 13:33:01
An: The general-purpose Squeak developers list
Cc: [hidden email]
Betreff: Re: [squeak-dev] The Trunk: MorphicExtras-kfr.275.mcz
 
I was afraid this would be a slow search, but its negligible.
Tested performance on a quite big gif* and it was only 1900 ms on my slow computer


Best,
Karl

On Sat, Jun 13, 2020 at 1:12 PM <[hidden email]> wrote:
Karl Ramberg uploaded a new version of MorphicExtras to project The Trunk:
http://source.squeak.org/trunk/MorphicExtras-kfr.275.mcz

==================== Summary ====================

Name: MorphicExtras-kfr.275
Author: kfr
Time: 10 June 2020, 6:41:33.727777 pm
UUID: 26fa97c9-e242-8048-8c7c-53b2061c19f4
Ancestors: MorphicExtras-mt.274

Detect if animated image (eg. gif) has transparent color and use opaque background if so.

=============== Diff against MorphicExtras-mt.274 ===============

Item was changed:
  ----- Method: AnimatedImageMorph>>fromReader: (in category 'private') -----
  fromReader: reader
-
        images := reader forms.
        delays := reader delays.
+       images do:[: each | (each colors includes: Color transparent) ifTrue:[self isOpaque: true]].
-       self isOpaque: true.
        self reset.!




Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: MorphicExtras-kfr.275.mcz

Stéphane Rollandin
> what's your motivation for this commit? I think transparent gifs should
> be displayed transparently in Squeak. You can always add an opaque
> background in your application if it does not want this :-)

Indeed.

+1

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: MorphicExtras-kfr.275.mcz

Karl Ramberg
Most GIFs use transparenty for  compression. So the general use case is that you want it opaque. You can turn off transparency in the menu

Best,
Karl

On Sat, 13 Jun 2020 at 15:26, Stéphane Rollandin <[hidden email]> wrote:
> what's your motivation for this commit? I think transparent gifs should
> be displayed transparently in Squeak. You can always add an opaque
> background in your application if it does not want this :-)

Indeed.

+1



Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: MorphicExtras-kfr.275.mcz

Jakob Reschke
I don't understand. I thought most gifs used transparency for transparency and compression is independent from that. 


karl ramberg <[hidden email]> schrieb am Sa., 13. Juni 2020, 18:28:
Most GIFs use transparenty for  compression. So the general use case is that you want it opaque. You can turn off transparency in the menu

Best,
Karl

On Sat, 13 Jun 2020 at 15:26, Stéphane Rollandin <[hidden email]> wrote:
> what's your motivation for this commit? I think transparent gifs should
> be displayed transparently in Squeak. You can always add an opaque
> background in your application if it does not want this :-)

Indeed.

+1




Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: MorphicExtras-kfr.275.mcz

Karl Ramberg
Look at this gif:
Try toggling transparency on and off in the menu

Best,
Karl




On Sat, Jun 13, 2020 at 11:06 PM Jakob Reschke <[hidden email]> wrote:
I don't understand. I thought most gifs used transparency for transparency and compression is independent from that. 


karl ramberg <[hidden email]> schrieb am Sa., 13. Juni 2020, 18:28:
Most GIFs use transparenty for  compression. So the general use case is that you want it opaque. You can turn off transparency in the menu

Best,
Karl

On Sat, 13 Jun 2020 at 15:26, Stéphane Rollandin <[hidden email]> wrote:
> what's your motivation for this commit? I think transparent gifs should
> be displayed transparently in Squeak. You can always add an opaque
> background in your application if it does not want this :-)

Indeed.

+1





Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: MorphicExtras-kfr.275.mcz

Nicolas Cellier
Ah you mean first image is opaque, then following ones use transparency for non moving parts?

Le sam. 13 juin 2020 à 23:31, karl ramberg <[hidden email]> a écrit :
Look at this gif:
Try toggling transparency on and off in the menu

Best,
Karl




On Sat, Jun 13, 2020 at 11:06 PM Jakob Reschke <[hidden email]> wrote:
I don't understand. I thought most gifs used transparency for transparency and compression is independent from that. 


karl ramberg <[hidden email]> schrieb am Sa., 13. Juni 2020, 18:28:
Most GIFs use transparenty for  compression. So the general use case is that you want it opaque. You can turn off transparency in the menu

Best,
Karl

On Sat, 13 Jun 2020 at 15:26, Stéphane Rollandin <[hidden email]> wrote:
> what's your motivation for this commit? I think transparent gifs should
> be displayed transparently in Squeak. You can always add an opaque
> background in your application if it does not want this :-)

Indeed.

+1






Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: MorphicExtras-kfr.275.mcz

Christoph Thiede
In reply to this post by commits-2
This is interesting! Looks like you can control this mode of compression via so-called "graphics extension blocks". Maybe we should respect this directly in the GIF reader?



Von: Squeak-dev <[hidden email]> im Auftrag von Nicolas Cellier <[hidden email]>
Gesendet: Samstag, 13. Juni 2020, 23:39
An: The general-purpose Squeak developers list
Betreff: Re: [squeak-dev] The Trunk: MorphicExtras-kfr.275.mcz

Ah you mean first image is opaque, then following ones use transparency for non moving parts?

Le sam. 13 juin 2020 à 23:31, karl ramberg <[hidden email]> a écrit :
Look at this gif:
Try toggling transparency on and off in the menu

Best,
Karl




On Sat, Jun 13, 2020 at 11:06 PM Jakob Reschke <[hidden email]> wrote:
I don't understand. I thought most gifs used transparency for transparency and compression is independent from that. 


karl ramberg <[hidden email]> schrieb am Sa., 13. Juni 2020, 18:28:
Most GIFs use transparenty for  compression. So the general use case is that you want it opaque. You can turn off transparency in the menu

Best,
Karl

On Sat, 13 Jun 2020 at 15:26, Stéphane Rollandin <[hidden email]> wrote:
> what's your motivation for this commit? I think transparent gifs should
> be displayed transparently in Squeak. You can always add an opaque
> background in your application if it does not want this :-)

Indeed.

+1







Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: MorphicExtras-kfr.275.mcz

Levente Uzonyi
In reply to this post by Karl Ramberg
Hi Karl,

A potential speedup is to use #anySatisfy: instead of #do: to stop when
the first image that satisfies the condition is detected.


Levente

On Sat, 13 Jun 2020, karl ramberg wrote:

> I was afraid this would be a slow search, but its negligible.
> Tested performance on a quite big gif* and it was only 1900 ms on my slow computer
>
> *https://web.archive.org/web/20140209162456/http://www.majhost.com/gallery/NoBullet/TF2/t2.gif
>
> Best,
> Karl
>
> On Sat, Jun 13, 2020 at 1:12 PM <[hidden email]> wrote:
>       Karl Ramberg uploaded a new version of MorphicExtras to project The Trunk:
>       http://source.squeak.org/trunk/MorphicExtras-kfr.275.mcz
>
>       ==================== Summary ====================
>
>       Name: MorphicExtras-kfr.275
>       Author: kfr
>       Time: 10 June 2020, 6:41:33.727777 pm
>       UUID: 26fa97c9-e242-8048-8c7c-53b2061c19f4
>       Ancestors: MorphicExtras-mt.274
>
>       Detect if animated image (eg. gif) has transparent color and use opaque background if so.
>
>       =============== Diff against MorphicExtras-mt.274 ===============
>
>       Item was changed:
>         ----- Method: AnimatedImageMorph>>fromReader: (in category 'private') -----
>         fromReader: reader
>       -
>               images := reader forms.
>               delays := reader delays.
>       +       images do:[: each | (each colors includes: Color transparent) ifTrue:[self isOpaque: true]].
>       -       self isOpaque: true.
>               self reset.!
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: MorphicExtras-kfr.275.mcz

Karl Ramberg
In reply to this post by Nicolas Cellier
Yes.
But other animated gifs may use transparency for transparency.
Like this:

I guess one could guess that if the first image does not  contain transparent colors but a later one does, all images should draw opaque.

Best,
Karl

On Sat, Jun 13, 2020 at 11:39 PM Nicolas Cellier <[hidden email]> wrote:
Ah you mean first image is opaque, then following ones use transparency for non moving parts?

Le sam. 13 juin 2020 à 23:31, karl ramberg <[hidden email]> a écrit :
Look at this gif:
Try toggling transparency on and off in the menu

Best,
Karl




On Sat, Jun 13, 2020 at 11:06 PM Jakob Reschke <[hidden email]> wrote:
I don't understand. I thought most gifs used transparency for transparency and compression is independent from that. 


karl ramberg <[hidden email]> schrieb am Sa., 13. Juni 2020, 18:28:
Most GIFs use transparenty for  compression. So the general use case is that you want it opaque. You can turn off transparency in the menu

Best,
Karl

On Sat, 13 Jun 2020 at 15:26, Stéphane Rollandin <[hidden email]> wrote:
> what's your motivation for this commit? I think transparent gifs should
> be displayed transparently in Squeak. You can always add an opaque
> background in your application if it does not want this :-)

Indeed.

+1







Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: MorphicExtras-kfr.275.mcz

Karl Ramberg
In reply to this post by Levente Uzonyi
See my reply to Nicolas.
The algorithm could be refined a bit to cover other cases.

Best,
Karl


On Sun, Jun 14, 2020 at 12:24 AM Levente Uzonyi <[hidden email]> wrote:
Hi Karl,

A potential speedup is to use #anySatisfy: instead of #do: to stop when
the first image that satisfies the condition is detected.


Levente

On Sat, 13 Jun 2020, karl ramberg wrote:

> I was afraid this would be a slow search, but its negligible.
> Tested performance on a quite big gif* and it was only 1900 ms on my slow computer
>
> *https://web.archive.org/web/20140209162456/http://www.majhost.com/gallery/NoBullet/TF2/t2.gif
>
> Best,
> Karl
>
> On Sat, Jun 13, 2020 at 1:12 PM <[hidden email]> wrote:
>       Karl Ramberg uploaded a new version of MorphicExtras to project The Trunk:
>       http://source.squeak.org/trunk/MorphicExtras-kfr.275.mcz
>
>       ==================== Summary ====================
>
>       Name: MorphicExtras-kfr.275
>       Author: kfr
>       Time: 10 June 2020, 6:41:33.727777 pm
>       UUID: 26fa97c9-e242-8048-8c7c-53b2061c19f4
>       Ancestors: MorphicExtras-mt.274
>
>       Detect if animated image (eg. gif) has transparent color and use opaque background if so.
>
>       =============== Diff against MorphicExtras-mt.274 ===============
>
>       Item was changed:
>         ----- Method: AnimatedImageMorph>>fromReader: (in category 'private') -----
>         fromReader: reader
>       -
>               images := reader forms.
>               delays := reader delays.
>       +       images do:[: each | (each colors includes: Color transparent) ifTrue:[self isOpaque: true]].
>       -       self isOpaque: true.
>               self reset.!
>
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: MorphicExtras-kfr.275.mcz

Karl Ramberg
In reply to this post by Christoph Thiede
Cool reference.
I don't really understand the reader code so I guess I'll pass on that.

Best,
Karl

On Sat, Jun 13, 2020 at 11:47 PM Christoph Thiede <[hidden email]> wrote:
This is interesting! Looks like you can control this mode of compression via so-called "graphics extension blocks". Maybe we should respect this directly in the GIF reader?



Von: Squeak-dev <[hidden email]> im Auftrag von Nicolas Cellier <[hidden email]>
Gesendet: Samstag, 13. Juni 2020, 23:39
An: The general-purpose Squeak developers list
Betreff: Re: [squeak-dev] The Trunk: MorphicExtras-kfr.275.mcz

Ah you mean first image is opaque, then following ones use transparency for non moving parts?

Le sam. 13 juin 2020 à 23:31, karl ramberg <[hidden email]> a écrit :
Look at this gif:
Try toggling transparency on and off in the menu

Best,
Karl




On Sat, Jun 13, 2020 at 11:06 PM Jakob Reschke <[hidden email]> wrote:
I don't understand. I thought most gifs used transparency for transparency and compression is independent from that. 


karl ramberg <[hidden email]> schrieb am Sa., 13. Juni 2020, 18:28:
Most GIFs use transparenty for  compression. So the general use case is that you want it opaque. You can turn off transparency in the menu

Best,
Karl

On Sat, 13 Jun 2020 at 15:26, Stéphane Rollandin <[hidden email]> wrote:
> what's your motivation for this commit? I think transparent gifs should
> be displayed transparently in Squeak. You can always add an opaque
> background in your application if it does not want this :-)

Indeed.

+1








Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: MorphicExtras-kfr.275.mcz

Jakob Reschke
Now the change you made is in AnimatedImageMorph, so way past the gif. How do we pass this image composition on? Create altered forms with the background or previous pixels filled in, or support the same composition in the morph? Somehow this couples the image format decoding and the morph implementation...


karl ramberg <[hidden email]> schrieb am So., 14. Juni 2020, 00:34:
Cool reference.
I don't really understand the reader code so I guess I'll pass on that.

Best,
Karl

On Sat, Jun 13, 2020 at 11:47 PM Christoph Thiede <[hidden email]> wrote:
This is interesting! Looks like you can control this mode of compression via so-called "graphics extension blocks". Maybe we should respect this directly in the GIF reader?



Von: Squeak-dev <[hidden email]> im Auftrag von Nicolas Cellier <[hidden email]>
Gesendet: Samstag, 13. Juni 2020, 23:39
An: The general-purpose Squeak developers list
Betreff: Re: [squeak-dev] The Trunk: MorphicExtras-kfr.275.mcz

Ah you mean first image is opaque, then following ones use transparency for non moving parts?

Le sam. 13 juin 2020 à 23:31, karl ramberg <[hidden email]> a écrit :
Look at this gif:
Try toggling transparency on and off in the menu

Best,
Karl




On Sat, Jun 13, 2020 at 11:06 PM Jakob Reschke <[hidden email]> wrote:
I don't understand. I thought most gifs used transparency for transparency and compression is independent from that. 


karl ramberg <[hidden email]> schrieb am Sa., 13. Juni 2020, 18:28:
Most GIFs use transparenty for  compression. So the general use case is that you want it opaque. You can turn off transparency in the menu

Best,
Karl

On Sat, 13 Jun 2020 at 15:26, Stéphane Rollandin <[hidden email]> wrote:
> what's your motivation for this commit? I think transparent gifs should
> be displayed transparently in Squeak. You can always add an opaque
> background in your application if it does not want this :-)

Indeed.

+1









Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: MorphicExtras-kfr.275.mcz

marcel.taeumel
Somehow this couples the image format decoding and the morph implementation...

We could benefit from something like a "FormArray" ... which would be not part of Morphic?

Best,
Marcel

Am 14.06.2020 09:37:50 schrieb Jakob Reschke <[hidden email]>:

Now the change you made is in AnimatedImageMorph, so way past the gif. How do we pass this image composition on? Create altered forms with the background or previous pixels filled in, or support the same composition in the morph? Somehow this couples the image format decoding and the morph implementation...


karl ramberg <[hidden email]> schrieb am So., 14. Juni 2020, 00:34:
Cool reference.
I don't really understand the reader code so I guess I'll pass on that.

Best,
Karl

On Sat, Jun 13, 2020 at 11:47 PM Christoph Thiede <[hidden email]> wrote:
This is interesting! Looks like you can control this mode of compression via so-called "graphics extension blocks". Maybe we should respect this directly in the GIF reader?



Von: Squeak-dev <[hidden email]> im Auftrag von Nicolas Cellier <[hidden email]>
Gesendet: Samstag, 13. Juni 2020, 23:39
An: The general-purpose Squeak developers list
Betreff: Re: [squeak-dev] The Trunk: MorphicExtras-kfr.275.mcz

Ah you mean first image is opaque, then following ones use transparency for non moving parts?

Le sam. 13 juin 2020 à 23:31, karl ramberg <[hidden email]> a écrit :
Look at this gif:
Try toggling transparency on and off in the menu

Best,
Karl




On Sat, Jun 13, 2020 at 11:06 PM Jakob Reschke <[hidden email]> wrote:
I don't understand. I thought most gifs used transparency for transparency and compression is independent from that. 


karl ramberg <[hidden email]> schrieb am Sa., 13. Juni 2020, 18:28:
Most GIFs use transparenty for  compression. So the general use case is that you want it opaque. You can turn off transparency in the menu

Best,
Karl

On Sat, 13 Jun 2020 at 15:26, Stéphane Rollandin <[hidden email]> wrote:
> what's your motivation for this commit? I think transparent gifs should
> be displayed transparently in Squeak. You can always add an opaque
> background in your application if it does not want this :-)

Indeed.

+1









Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: MorphicExtras-kfr.275.mcz

Jakob Reschke
Or animations in the Graphics package (that is where Form currently lives, right?), so it would be responsible for drawing the frames in a timely manner (interface) and subclasses could hide different ways of doing that.



Marcel Taeumel <[hidden email]> schrieb am So., 14. Juni 2020, 10:24:
Somehow this couples the image format decoding and the morph implementation...

We could benefit from something like a "FormArray" ... which would be not part of Morphic?

Best,
Marcel

Am 14.06.2020 09:37:50 schrieb Jakob Reschke <[hidden email]>:

Now the change you made is in AnimatedImageMorph, so way past the gif. How do we pass this image composition on? Create altered forms with the background or previous pixels filled in, or support the same composition in the morph? Somehow this couples the image format decoding and the morph implementation...


karl ramberg <[hidden email]> schrieb am So., 14. Juni 2020, 00:34:
Cool reference.
I don't really understand the reader code so I guess I'll pass on that.

Best,
Karl

On Sat, Jun 13, 2020 at 11:47 PM Christoph Thiede <[hidden email]> wrote:
This is interesting! Looks like you can control this mode of compression via so-called "graphics extension blocks". Maybe we should respect this directly in the GIF reader?



Von: Squeak-dev <[hidden email]> im Auftrag von Nicolas Cellier <[hidden email]>
Gesendet: Samstag, 13. Juni 2020, 23:39
An: The general-purpose Squeak developers list
Betreff: Re: [squeak-dev] The Trunk: MorphicExtras-kfr.275.mcz

Ah you mean first image is opaque, then following ones use transparency for non moving parts?

Le sam. 13 juin 2020 à 23:31, karl ramberg <[hidden email]> a écrit :
Look at this gif:
Try toggling transparency on and off in the menu

Best,
Karl




On Sat, Jun 13, 2020 at 11:06 PM Jakob Reschke <[hidden email]> wrote:
I don't understand. I thought most gifs used transparency for transparency and compression is independent from that. 


karl ramberg <[hidden email]> schrieb am Sa., 13. Juni 2020, 18:28:
Most GIFs use transparenty for  compression. So the general use case is that you want it opaque. You can turn off transparency in the menu

Best,
Karl

On Sat, 13 Jun 2020 at 15:26, Stéphane Rollandin <[hidden email]> wrote:
> what's your motivation for this commit? I think transparent gifs should
> be displayed transparently in Squeak. You can always add an opaque
> background in your application if it does not want this :-)

Indeed.

+1