[comp.windows.news] TNT 2.0: Fade between two images

siegel@booga.Eng.Sun.COM (Josh Siegel) (05/01/91)

This programs fades between two images.  It is very CPU intensive
while generating the images when you first look at them.

==

% Written by Josh Siegel (siegel@sun.com)
%
% This is "slow" in some parts but compaired to what
% is really slowing us down...
%

/bf (OPENWINHOME) getenv (/demo/images/bf.im8) append readcanvas def
/lady (OPENWINHOME) getenv (/demo/images/mandrill.im8) append readcanvas def

/MyCanvas ClassCanvas 
dictbegin
    /tempcan null def
    /cans 11 array def
    /prev_value 0 def
dictend
classbegin
    /magiccan 256 256 1 [ 1.0 0 0 1.0 0 0 ] null buildimage def

    /minsize {256 256} def

    /Paint {
	prev_value /prev_value null def
	/Painter self send
    } def

    /Update_view {
	pop cvi /Painter self send
    } def

    /Painter { % val => -
	dup prev_value ne {
	    dup /prev_value exch def
	    gsave dup getcans not {
		% Set the filter
		magiccan setcanvas 
		10 div setgray
		clippath fill
		
		% Paint the first image on
		tempcan setcanvas initmatrix clippath pathbbox scale pop pop 
		lady imagecanvas
		
		initmatrix true magiccan imagepath currentpath
		clippath pathbbox scale pop pop setpath clip bf imagecanvas 
	    } if
	    can setcanvas
	    tempcan imagecanvas
	    grestore
	} {
	    pop
	} ifelse
    } def
    
    /getcans { % num => bool
	dup cans exch get dup null ne {
	    exch pop /tempcan exch store true
	} {
	    pop
	    gsave
	    framebuffer setcanvas initmatrix
	    
	    /tempcan framebuffer newcanvas store
	    tempcan /Retained true put
	    
	    [1 0 0 1 0 0 ] setmatrix
	    0 0 256 256 rectpath tempcan reshapecanvas
	    tempcan setcanvas
	    cans exch tempcan put false
	    grestore
	} ifelse
    } def
classend def

/can framebuffer /new MyCanvas send def

/win can framebuffer /new ClassBaseWindow send def
/place win send
/new ClassEventMgr send /activate win send
/map win send

/pan2 /Calculated framebuffer /new ClassPanel send def
/win2 pan2 framebuffer /new ClassBaseWindow send def
/slider2 framebuffer /new ClassHSlider send def

can /settarget slider2 send
/Update_view /setpreviewer slider2 send
/Update_view /setnotifier slider2 send

0 10 /setrange slider2 send
/minsize { 128 30 } /promote slider2 send
/preferredsize { 128 30 } /promote slider2 send
true /setendboxes slider2 send
1 /settickmarks slider2 send
{cvi} /setnormalizer slider2 send

/slider2 slider2 [/Center { /Center PARENT POSITION} ] /addclient pan2 send
/place win2 send
win2 /addsubwindow win send

/map win2 send

toms@fcs260c2.ncifcrf.gov (Tom Schneider) (05/03/91)

In article <12526@exodus.Eng.Sun.COM> siegel@booga.Eng.Sun.COM (Josh Siegel) writes:
>This programs fades between two images.

Howcome half or more of the programs posted here do nothing when
I psh them to OpenWindows?????? :-(  Then if I stick 'executive' in front,
I get a zillion error messages (undefined and typecheck in this case).

  Tom Schneider
  National Cancer Institute
  Laboratory of Mathematical Biology
  Frederick, Maryland  21702-1201
  toms@ncifcrf.gov

ks@cs.tut.fi (Syst{ Kari) (05/03/91)

In article <2143@fcs280s.ncifcrf.gov> toms@fcs260c2.ncifcrf.gov (Tom Schneider) writes:

   Howcome half or more of the programs posted here do nothing when
   I psh them to OpenWindows?????? :-(  Then if I stick 'executive' in front,
   I get a zillion error messages (undefined and typecheck in this case).

They all seem to be for TNT 2.0. OpenWindows has TNT 1.0 (which was not a
product).

Unfortunately only a very small minority of us have TNT 2.0.


 
--
% This article represents my personal views.
% NeWS flash: "X is the Fortran of windowing systems."
% Kari Systa, Tampere Univ. Technology, Box 527, 33101 Tampere, Finland
% work: +358 31 162585      fax: +358 31 162913      home: +358 31 177412

fischer@iesd.auc.dk (Lars P. Fischer) (05/04/91)

>>>>> On 3 May 91 11:58:38 GMT, ks@cs.tut.fi (Syst{ Kari) said:

Kari> Unfortunately only a very small minority of us have TNT 2.0.

Truly unfortunate. I've been experimenting with TNT-2.0 for a few
weeks now, and I must say that I am impressed. This is a very nice
toolkit, much better than TNT-1.0. It's a very complete OPEN LOOK
implementation, more so than XView 2. It is also a good NeWS toolkit,
using the high level of abstraction possible in NeWS to good
advantage.

TNT-2.0 blends nicely with the rest of the Open Windows environment
and is in general very nice to work with. To me, using this toolkit
has been a kind of "NeWS revival".

Buy, beg, steal, or convince your favorite Aunt to buy it for your
Birthday. Get TNT-2.0. I suspect we'll see much more TNT-2.0 software
in the future.

/Lars
--
Lars Fischer,  fischer@iesd.auc.dk   | Erst kommt das Fressen, dann die Moral
CS Dept., Univ. of Aalborg, DENMARK. |		- B. Brecht