Fading a PNG

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

Fading a PNG

Steven Greenberg
I have a PNG image that I'd like to display fading out.  I tried the BitBlt method suggested by "Team RAR" to fade the image, but I can't make it work.

The image loads properly from a file and displays fine as an ImageMorph.  I have been able to use a TransformationMorph to rotate and scale it, and PNG transparency is working properly.

Is the "Team RAR" BitBlt method the only way, or are there alternatives?

I'm running a 3.9 image, and my display depth is set to 32 bits.

    Thanks,
    Steve




_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Fading a PNG

Brad Fuller-3
Steven Greenberg wrote:

> I have a PNG image that I'd like to display fading out.  I tried the
> BitBlt method suggested by "Team RAR" to fade the image, but I can't
> make it work.
>
> The image loads properly from a file and displays fine as an
> ImageMorph.  I have been able to use a TransformationMorph to rotate
> and scale it, and PNG transparency is working properly.
>
> Is the "Team RAR" BitBlt method the only way, or are there alternatives?
>
> I'm running a 3.9 image, and my display depth is set to 32 bits.
>
along the same lines, how can one make an object disappear, or
invisible? I don't mean delete the morph, but just make it invisible and
make it visible again.

--
brad fuller
www.bradfuller.com
+1 (408) 799-6124

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Fading a PNG

Steven Greenberg

m := Morph new openInWorld.
m visible: false.
m visible: true.




On 4/22/07, Brad Fuller <[hidden email]> wrote:
Steven Greenberg wrote:

> I have a PNG image that I'd like to display fading out.  I tried the
> BitBlt method suggested by "Team RAR" to fade the image, but I can't
> make it work.
>
> The image loads properly from a file and displays fine as an
> ImageMorph.  I have been able to use a TransformationMorph to rotate
> and scale it, and PNG transparency is working properly.
>
> Is the "Team RAR" BitBlt method the only way, or are there alternatives?
>
> I'm running a 3.9 image, and my display depth is set to 32 bits.
>
along the same lines, how can one make an object disappear, or
invisible? I don't mean delete the morph, but just make it invisible and
make it visible again.

--
brad fuller
www.bradfuller.com
+1 (408) 799-6124

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Fading a PNG

Brad Fuller-3
Steven Greenberg wrote:
>
> m := Morph new openInWorld.
> m visible: false.
> m visible: true.

well.. that's easy!

I would like to know how to fade in and out. I read the BitBlt way, but
I haven't tried it yet.

>
>
>
>
> On 4/22/07, *Brad Fuller* <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Steven Greenberg wrote:
>     > I have a PNG image that I'd like to display fading out.  I tried
>     the
>     > BitBlt method suggested by "Team RAR" to fade the image, but I can't
>     > make it work.
>     >
>     > The image loads properly from a file and displays fine as an
>     > ImageMorph.  I have been able to use a TransformationMorph to
>     rotate
>     > and scale it, and PNG transparency is working properly.
>     >
>     > Is the "Team RAR" BitBlt method the only way, or are there
>     alternatives?
>     >
>     > I'm running a 3.9 image, and my display depth is set to 32 bits.
>     >
>     along the same lines, how can one make an object disappear, or
>     invisible? I don't mean delete the morph, but just make it
>     invisible and
>     make it visible again.
>
>     --
>

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Fading a PNG

Bert Freudenberg
In reply to this post by Steven Greenberg

On Apr 23, 2007, at 0:44 , Steven Greenberg wrote:

> I have a PNG image that I'd like to display fading out.  I tried  
> the BitBlt method suggested by "Team RAR" to fade the image, but I  
> can't make it work.
>
> The image loads properly from a file and displays fine as an  
> ImageMorph.  I have been able to use a TransformationMorph to  
> rotate and scale it, and PNG transparency is working properly.
>
> Is the "Team RAR" BitBlt method the only way, or are there  
> alternatives?
>
> I'm running a 3.9 image, and my display depth is set to 32 bits.
>

Normally you would just use an alpha-blending canvas. See HaloMorph  
fadeIn/fadeOut and draw methods. To try those halos, enable this:

        Preferences enable: #haloTransitions

Now when I tried then the halo icons do not actually show until alpha  
is one. No idea why that is.

- Bert -


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Fading a PNG

Steven Greenberg
Thanks for the pointer!  I didn't try that code in the workspace, but if you enable "haloTransitions" using the Preferences browser then the halos fade in and out.

    Thanks,
    Steve



On 4/22/07, Bert Freudenberg <[hidden email]> wrote:

On Apr 23, 2007, at 0:44 , Steven Greenberg wrote:

> I have a PNG image that I'd like to display fading out.  I tried
> the BitBlt method suggested by "Team RAR" to fade the image, but I
> can't make it work.

>
> The image loads properly from a file and displays fine as an
> ImageMorph.  I have been able to use a TransformationMorph to
> rotate and scale it, and PNG transparency is working properly.
>
> Is the "Team RAR" BitBlt method the only way, or are there
> alternatives?
>
> I'm running a 3.9 image, and my display depth is set to 32 bits.
>

Normally you would just use an alpha-blending canvas. See HaloMorph
fadeIn/fadeOut and draw methods. To try those halos, enable this:

        Preferences enable: #haloTransitions

Now when I tried then the halo icons do not actually show until alpha
is one. No idea why that is.

- Bert -


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Fading a PNG

Steven Greenberg
Following Bert's advice, I see that HaloMorph overrides #drawSubmorphsOn: and calls its Canvas using asAlphaBlendingCanvas.  That seems like a good place to start.

I tried subclassing ImageMorph and adding this method:

    drawOn: aCanvas
        ^ super drawOn: (aCanvas asAlphaBlendingCanvas: alphaValue).

Unfortunately, it didn't display anything at all.  I tried alpha values of 0.5 and 1.0.  If I remove the alpha blending stuff, and simply call:

    ^ super drawOn: aCanvas.

it works like a normal ImageMorph, so at least I know it isn't broken someplace else.

Any suggestions on how to get asAlphaBlendingCanvas to blend some alphas?




On 4/23/07, Steven Greenberg <[hidden email]> wrote:
Thanks for the pointer!  I didn't try that code in the workspace, but if you enable "haloTransitions" using the Preferences browser then the halos fade in and out.

    Thanks,
    Steve




On 4/22/07, Bert Freudenberg <[hidden email]> wrote:

On Apr 23, 2007, at 0:44 , Steven Greenberg wrote:

> I have a PNG image that I'd like to display fading out.  I tried
> the BitBlt method suggested by "Team RAR" to fade the image, but I
> can't make it work.

>
> The image loads properly from a file and displays fine as an
> ImageMorph.  I have been able to use a TransformationMorph to
> rotate and scale it, and PNG transparency is working properly.
>
> Is the "Team RAR" BitBlt method the only way, or are there
> alternatives?
>
> I'm running a 3.9 image, and my display depth is set to 32 bits.
>

Normally you would just use an alpha-blending canvas. See HaloMorph
fadeIn/fadeOut and draw methods. To try those halos, enable this:

        Preferences enable: #haloTransitions

Now when I tried then the halo icons do not actually show until alpha
is one. No idea why that is.

- Bert -


_______________________________________________
Beginners mailing list
[hidden email]
<a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://lists.squeakfoundation.org/mailman/listinfo/beginners



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Fading a PNG

Bert Freudenberg
Try drawing something other than an image. I have a hunch the alpha-
bitblt is wrong ...

Btw, which platform are you on? Which VM?

- Bert -

On Apr 23, 2007, at 9:32 , Steven Greenberg wrote:

> Following Bert's advice, I see that HaloMorph overrides  
> #drawSubmorphsOn: and calls its Canvas using  
> asAlphaBlendingCanvas.  That seems like a good place to start.
>
> I tried subclassing ImageMorph and adding this method:
>
>     drawOn: aCanvas
>         ^ super drawOn: (aCanvas asAlphaBlendingCanvas: alphaValue).
>
> Unfortunately, it didn't display anything at all.  I tried alpha  
> values of 0.5 and 1.0.  If I remove the alpha blending stuff, and  
> simply call:
>
>     ^ super drawOn: aCanvas.
>
> it works like a normal ImageMorph, so at least I know it isn't  
> broken someplace else.
>
> Any suggestions on how to get asAlphaBlendingCanvas to blend some  
> alphas?
>
>
>
>
> On 4/23/07, Steven Greenberg <[hidden email]> wrote:  
> Thanks for the pointer!  I didn't try that code in the workspace,  
> but if you enable "haloTransitions" using the Preferences browser  
> then the halos fade in and out.
>
>     Thanks,
>     Steve
>
>
>
>
> On 4/22/07, Bert Freudenberg <[hidden email] > wrote:
> On Apr 23, 2007, at 0:44 , Steven Greenberg wrote:
>
> > I have a PNG image that I'd like to display fading out.  I tried
> > the BitBlt method suggested by "Team RAR" to fade the image, but I
> > can't make it work.
> >
> > The image loads properly from a file and displays fine as an
> > ImageMorph.  I have been able to use a TransformationMorph to
> > rotate and scale it, and PNG transparency is working properly.
> >
> > Is the "Team RAR" BitBlt method the only way, or are there
> > alternatives?
> >
> > I'm running a 3.9 image, and my display depth is set to 32 bits.
> >
>
> Normally you would just use an alpha-blending canvas. See HaloMorph
> fadeIn/fadeOut and draw methods. To try those halos, enable this:
>
>         Preferences enable: #haloTransitions
>
> Now when I tried then the halo icons do not actually show until alpha
> is one. No idea why that is.
>
> - Bert -

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Fading a PNG

Steven Greenberg
I am able to draw morphic primitives with the alpha channel working properly by overriding #drawOn: in my subclass.  I am not able to make it work for an ImageMorph.

I'm running squeak 3.9-7067 on XP.

    Thanks again,
    Steve



On 4/23/07, Bert Freudenberg <[hidden email]> wrote:
Try drawing something other than an image. I have a hunch the alpha-
bitblt is wrong ...

Btw, which platform are you on? Which VM?

- Bert -

On Apr 23, 2007, at 9:32 , Steven Greenberg wrote:

> Following Bert's advice, I see that HaloMorph overrides

> #drawSubmorphsOn: and calls its Canvas using
> asAlphaBlendingCanvas.  That seems like a good place to start.
>
> I tried subclassing ImageMorph and adding this method:
>
>     drawOn: aCanvas
>         ^ super drawOn: (aCanvas asAlphaBlendingCanvas: alphaValue).
>
> Unfortunately, it didn't display anything at all.  I tried alpha
> values of 0.5 and 1.0.  If I remove the alpha blending stuff, and
> simply call:
>
>     ^ super drawOn: aCanvas.
>
> it works like a normal ImageMorph, so at least I know it isn't
> broken someplace else.
>
> Any suggestions on how to get asAlphaBlendingCanvas to blend some
> alphas?
>
>
>
>
> On 4/23/07, Steven Greenberg <[hidden email]> wrote:
> Thanks for the pointer!  I didn't try that code in the workspace,
> but if you enable "haloTransitions" using the Preferences browser
> then the halos fade in and out.
>

>     Thanks,
>     Steve
>
>
>
>
> On 4/22/07, Bert Freudenberg <[hidden email] > wrote:
> On Apr 23, 2007, at 0:44 , Steven Greenberg wrote:
>
> > I have a PNG image that I'd like to display fading out.  I tried
> > the BitBlt method suggested by "Team RAR" to fade the image, but I
> > can't make it work.
> >
> > The image loads properly from a file and displays fine as an
> > ImageMorph.  I have been able to use a TransformationMorph to
> > rotate and scale it, and PNG transparency is working properly.
> >
> > Is the "Team RAR" BitBlt method the only way, or are there
> > alternatives?
> >
> > I'm running a 3.9 image, and my display depth is set to 32 bits.
> >

>
> Normally you would just use an alpha-blending canvas. See HaloMorph
> fadeIn/fadeOut and draw methods. To try those halos, enable this:
>
>         Preferences enable: #haloTransitions
>
> Now when I tried then the halo icons do not actually show until alpha
> is one. No idea why that is.
>
> - Bert -

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Fading a PNG

Brad Fuller-3
In reply to this post by Steven Greenberg
Steven Greenberg wrote:
>
> m := Morph new openInWorld.
> m visible: false.
> m visible: true.
I didn't see this attribute in morph's that you make from, say, the
Objects flap. Is that true, or did I just miss it?


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Fading a PNG

Steven Greenberg

Are you trying to do this via eToys?  I don't know whether it's available that way.  Try typing that code into a workspace, though, and you should be able to make the Morph visible and invisible.  You can also do this in your programs.

On 4/23/07, Brad Fuller <[hidden email]> wrote:
Steven Greenberg wrote:
>
> m := Morph new openInWorld.
> m visible: false.
> m visible: true.



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Fading a PNG

Brad Fuller-3
Steven Greenberg wrote:
>
> Are you trying to do this via eToys?  I don't know whether it's
> available that way.  Try typing that code into a workspace, though,
> and you should be able to make the Morph visible and invisible.  You
> can also do this in your programs.
Right.
What I'm saying is that it is not available in the immediate halo menu
of a morph object. At least I didn't find it: you can't select the halo
menu and find "visible:" there.

But, it is in the miscellaneous category of a viewer of a morph. From
the halo menu select "halo actions...>>viewer", Select the miscellaneous
category and you'll see both "hide" and "show". So, it is available in a
script.


--
brad fuller
www.bradfuller.com
+1 (408) 799-6124

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners