Re: For fun : Flipping a view widget-like !
Re: For fun : Flipping a view widget-like !
- Subject: Re: For fun : Flipping a view widget-like !
- From: John Pannell <email@hidden>
- Date: Wed, 31 Aug 2005 11:20:04 -0600
Hi Eric-
I have no idea if this is best practice or not, but I do know it
would work...
1. Capture imageRep of view, perhaps with
bitmapImageRepForCachingDisplayInRect:
2. Using NSOpenGLView (or a subclass); bring in the imageRep as a
texture.
3. Replace your view with the openGL view, and then use GL
transformations to rotate the texture. There will be issues here (as
there is with Dashboard) of what the background should look like. I
believe this would be even more problematic in an application, as a
window with "holes" in it would look weird.
4. After flip is done, replace openGL view with desired "new" view.
That is a *very* broad outline - and assumes an understanding of
openGL. Some good places to look at example code:
http://www.boredastronaut.com/software/files/GLCubes.zip
A spinning cubes example that uses openGL transforms to spin a cube.
http://developer.apple.com/samplecode/NSGLImage/NSGLImage.html
Apple sample code for import and draw of texture in openGL view.
As Todd mentioned there is also the NSAnimation class. You would be
responsible for achieving the drawing yourself as you are with openGL
(I am simply more familiar with openGL than Quartz drawing). There
is also a subclass, NSViewAnimation, that will take care of the
drawing for you, but only supports frame changes and fade-in/out effect.
Finally, I have an app that does a flip of a texture in an openGL
view - if you go down this road, I could send you the code that
animates the flip transform. App at:
http://www.positivespinmedia.com/shareware/NetScrape/
Check out the preferences for the slide show.
HTH!
John Pannell
Positive Spin Media
http://www.positivespinmedia.com
On Aug 31, 2005, at 10:46 AM, Eric Morand wrote:
Hi list !
I'd like to test a strange idea, for fun (and maybe use it later if
I can make it work properly). I'd like to be able to flip an NSView
just like the Dashboard widgets are flipped when the user clicks on
the "i" button to change preferences !
The problem is : I don't have a clue about how to achieve this and
I don't even where to start searching ! Should I use Quartz ? Or
should I take a screenshot of my view and apply the rotation to the
resulting image ?
Any tip will be appreciated !
Eric.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40positivespinmedia.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden