[comp.sys.next] help requested with finishing touches on animation program

mark@apple3.cis.ohio-state.edu (Mark Jansen) (08/16/89)

Hello, I have been programming an animation sequencer programmer on the
Next machine using release version 0.9.  I can now draw images into bitmaps 
or onto a window and transfer bitmaps to and from files.  I realize that the
answers to some of the following questions may be somwhere in the technical 
manual set or in some example codes but I could use some help finding the
right places or the right answers.

1) I am using the bitmap method composite:toPoint: and trying to seqeuence
	thru a series of bitmaps onto a window but I am getting blocking 
	of those composites into very fast sequences of images that then
	hesitate.  I would prefer, a smoother animation and am aware of the
	animation timer method found in the example BreakApp.  Will that 
	method smooth it out.  Am I using the wrong flushing mechanism
	to composite the bitmaps to screen?  What would be the proper one?
	By the way, the bitmaps are currently 256 by 256, what is the
	aspect ratio of the Megadisplay.

2) I draw to both window directly and to bitmap, yet when I composite from
	bitmap to window the y axis is reversed running from the upper
	left corner rather then the lower left corner, yet I draw with the
	same code.  Thats curious. Less curious but still to fix is that
	the text letters printed using postscript are also reversed and
	look correct only in the upsidedown bitmap. I assume that in some
	way I should be flipping the axis but where?

3) To draw the bitmap to screen I find when it is inverted it is also 
	clipping off the top part as if it was drawing to window and not 
	to the content view. Should I pad for known boundaries and/or 
	can I compensate for this so I see it all.

4) My application has three windows.  One of which I want to resize upon
	initialization.  I have an init() function I call from either a 
	button press or from my application method new+.  Yet their behavior
	is very different.  When done from new, nothing seems to happen.
	What am I doing wrong here?

5) When I was using Interface Builder I found that I needed more or less
	outlets and action/target routines after my initial creation of 
	the project file. I realize that the dreaded UNPARSE button can
	only be pressed once but it would seem that there should be ways
	to add more outlets and action/targets within IB.  Is there?
	If not, I assume correct programming practice would be to make a
	messa outlets and target methods and save em for a rainy day.

Any help on this will be appreciated, Thanks,

	Mark

-=-
Mark Jansen, Department of Computer and Information Science
The Ohio State University; 2036 Neil Ave., Columbus, OH USA 43210-1277
mark@cis.ohio-state.edu

ali@polya.Stanford.EDU (Ali T. Ozer) (08/17/89)

In article <57670@tut.cis.ohio-state.edu> Mark Jansen writes:
>1) I am using the bitmap method composite:toPoint: and trying to seqeuence
>	thru a series of bitmaps onto a window but I am getting blocking 
>	of those composites into very fast sequences of images that then
>	hesitate.  I would prefer, a smoother animation and am aware of the
>	animation timer method found in the example BreakApp.  

BreakApp is smooth because of the call to NXPing(), not because of the timer.
PostScript to the server is normally buffered and might be sent in clumps.
BreakApp calls NXPing() after every frame is drawn; the pinging assures
that all PostScript is sent down to the server. Calling a PS wrap that
returns a value (such as PScurrentgray() or PScurrentmouse()) also causes all
buffered PostScript to be sent down.

>2) I draw to both window directly and to bitmap, yet when I composite from
>	bitmap to window the y axis is reversed running from the upper
>	left corner rather then the lower left corner, yet I draw with the
>	same code.

Bitmaps are flipped by default; the origin is at the upper left corner and
grows downward. Call setFlip:NO after you create a bitmap if you don't want
it flipped.

>4) My application has three windows.  One of which I want to resize upon
>	initialization.  I have an init() function I call from either a 
>	button press or from my application method new+.  Yet their behavior
>	is very different.  When done from new, nothing seems to happen.
>	What am I doing wrong here?

Perhaps the window isn't created yet at [Application new] time? If the
window is connected to an outlet it probably isn't; the outlets are assigned
during loadNibSection: (or loadNibFile:) time, after all objects are
instantiated.

If you want to do something to that window at "application init" time, 
consider doing either when the setXXX: method (to assign the outlet to the
window) is called, or give your application's delegate an "appDidInit:"
method and do it there. This method gets called after all initialization,
right at the beginning of the "run" method. 

>5) When I was using Interface Builder I found that I needed more or less
>	outlets and action/target routines after my initial creation of 
>	the project file. I realize that the dreaded UNPARSE button can
>	only be pressed once but it would seem that there should be ways
>	to add more outlets and action/targets within IB.  Is there?

No. However, if you create many new outlets and need to create the setXXX:
code, it might be worthwhile to rename the original .h and .m files, 
unparse the new skeleton .h and .m files, do some cut-n-pasting to bring
the new code from the new .h & .m files to the saved ones, and rename the saved
ones back. 

Ali Ozer, NeXT Developer Support
aozer@NeXT.com