discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GSoC 2012 and QuartzCore


From: Ivan Vučica
Subject: GSoC 2012 and QuartzCore
Date: Mon, 20 Aug 2012 03:56:05 +0200

Hi all!

I ended up not posting too many reports, because there was always "the next thing" I wanted to implement. But here's a few words on how things are. August 20, 2012 at 19:00 GMT is the Google-proscribed deadline for me to wrap up the GSoC-related contributions, so considering that's so close, here's a few notes on "GSoC Special Edition" of QuartzCore. I'll probably tag it 1.0, since it's already useful.

A bird's-eye overview of what we do support:
- CABasicAnimations are supported, with support for CGPoints, CGRects, CATransform3Ds and CGColorRefs. 
- Implicit animations are supported, with all the aforementioned types being automatically animated.
- CALayers are the only layer class supported.
- Layers can have a background colors - yay! - as well as contents provided through delegate (via an opal CGBitmapContext) and via CGImageRef.
- We have shadows, although shadowRadius is ignored. (Still looks neat!)
- Offscreen rendering of layers to texture is supported -- so we can have shadows.
- CAMediaTiming functions (various cubic Bezier functions used for timing)
- rendering through CARenderer into an NSOpenGLContext
- CATransform3D functions, for setting up transformation matrices for layers
- Did I mention CATransform3D is animatable? Oh, I did! Well, it's worth mentioning this again, because it IS a big deal: matrices have to be decomposed into translation, scaling and rotation. If you want to play around with testing this code, please do!

What we don't support:
- masking
- corner radius (that means no rounded rectangles yet!)
- keyframe animations (no more than one from and to value) or transitions (no animated setting of contents)
- rendering through a NSView (that means no NSView-hosted layers)
- multithreading (everything is rendered on the main thread, and no multithreading was planned for - although it shouldn't be too hard to retrofit)
- no other subclasses of CALayers

A few demos exist.
- hello just tests whether OpenGL works at all, and hello_opal tests whether we can correctly load an image from Opal's bitmap context.
- hello_carenderer demonstrates a few basic rendering features, all done through CARenderer.
- hello_animation demonstrates functionality of animation and tests various media timing tricks, as well as 
- offscreen_render primarily demonstrates offscreen rendering and dependent functionality (e.g. shadows).
- @dynamically runtime-"synthesized" properties created by CALayer subclasses. David's last post in the related thread has provided the same solution as the reference code I studied to see how to do such runtime-synthesized properties. And I love it (especially the fact that David's mail basically gave me permission to use blocks :-)) -- except I never got around to finishing this piece of code. I may end up doing it tomorrow prior to the deadline!

Note that a lot of things highly depend on Opal functioning correctly. Anyone who can and wants to work on Opal is invited to do so.

QuartzCore comes with a hack for Opal which makes it use NSFont from AppKit instead its own semi-stub. This is completely untested and CoreText in Opal may be completely broken by these hacks. One of the Opal tests that deal with text works, however, so that's a good sign. Unfortunately, I never got around to branching Opal and applying the patch in the branch, so you'll have to apply it yourself.

What are the requirements? Since offscreen rendering (including shadows) uses framebuffers, and since shadows use shaders, you'll most definitely need OpenGL 2.0 - at the very least. You could go and disable the codepaths that use these features, but going around framebuffers and shaders is something to be done in the future. It'll be needed if we want to support OpenGL ES 1.1 hardware, and the other extreme (complete use of shaders) will be needed if we want to support OpenGL ES 2.0 hardware. You'll also need Opal (as mentioned, patched Opal!), which in turn means you'll need cairo. AppKit is used for getting a NSOpenGLContext, and demos use it for NSWindow, NSMenus and NSOpenGLView.

Triggering implicit animations uses KVO. If something is broken with KVO, implicit animations won't work. There are a couple of workarounds in place; any Opal data type (pointer) isn't KVO observable under Cocoa, so we handle that, and structs are not KVO observable under GNUstep. Or at least that was the case the last time I tested. Workaround works, so I didn't get around to removing it and testing whether structs can be observed.

Some ideas for making use of GSQuartzCore's Core Animation:
- presentation software - for all those who consider OpenOffice.org's Impress to be slow!
- image editor - which'll actually make sense only once we add Core Image filters
- UIKit - now it's possible to start implementing UIKit, aside from a few blockers such as requiring AppKit and NSOpenGLContext

Whatever doesn't work -- I hope to fix that after Aug20th 19:00GMT. Whatever doesn't work and *is* critical -- I hope to fix that prior to Aug20th 19:00GMT. In any case, I (naturally) intend to continue work on QuartzCore after GSoC. I'm stating it just in case someone thought otherwise :-)

Is that all? I think that's all. If you want to play with QuartzCore (and pretty please - do want to play with QuartzCore!), I've also taken some time to write most of the above (and more) info in the README. There's even a mini-tutorial for those who never used Core Animation, and for those who used it, but not with CARenderer. It'd be great if someone apart from Fred would try out code and report on any issues you may experience... or perhaps if someone would try and hack together a small demo.

Oh, speaking of Fred -- big thanks to him for watching me stumble a hundred times during GSoC, as well as providing advice on how to fix things :-)

So -- comments, suggestions, angry rants?

--
Ivan



--
Ivan Vučica - ivan@vucica.net



reply via email to

[Prev in Thread] Current Thread [Next in Thread]