Commit Graph

1027 Commits

Author SHA1 Message Date
Joseph Scheuhammer
32f57595fe Add brightness/contrast effect
The ClutterBrightnessContrastEffect effect class allows changing the
brightness and contrast levels of an actor.

Modified-by: Emmanuele Bassi <ebassi@linux.intel.com>
Modified-by: Neil Roberts <neil@linux.intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=656156
2012-03-07 14:02:55 +00:00
Emmanuele Bassi
229607464b Improve repaint functions
It is sometimes useful to be able to have better control on when a
repaint function is called. Currently, all repaint functions are called
prior to the stages update phase of the frame processing.

We can introduce flags to represent the point in the frame update
process in which we wish Clutter called the repaint function.

As a bonus, we can also add a flag that causes adding a repaint function
to spin the master clock.
2012-03-06 12:09:00 +00:00
Emmanuele Bassi
a8d8005800 docs: Updates to the API reference 2012-03-05 23:45:40 +00:00
Neil Roberts
13e3f9e5f1 Add an input device function to convert keycodes to evdev codes
This adds a virtual function to ClutterInputDevice to translate a
keycode from the hardware_keycode member of ClutterKeyEvent to an
evdev keycode. The function can fail so that input backends that don't
have a sensible way to translate to evdev keycodes can return FALSE.
There are implementations for evdev, wayland and X. The X
implementation assumes that the X server is using an evdev driver in
which case the hardware keycodes are the evdev codes plus 8.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-01 11:41:51 +00:00
Emmanuele Bassi
c465881726 docs: Refresh the layout managers example image
Drop the window decoration and pointer; drop the double image for the
FlowLayout class; add an image for the TableLayout class.
2012-02-29 15:20:58 +00:00
Emmanuele Bassi
7713d3bbdc docs: Update the actor example image 2012-02-29 15:20:58 +00:00
Emmanuele Bassi
7d4fa54a4b docs: Add new macros to the sections file 2012-02-27 16:03:09 +00:00
Emmanuele Bassi
e4c948b150 actor: Add a method for computing the default paint volume
Now that ClutterActor has a default paint volume, subclasses may wish
to retrieve it without chaining up to the parent's implementation of
the get_paint_volume() function.

The get_default_paint_volume() returns a ClutterPaintVolume pointer
to the paint volume as computed by the default implementation of the
get_paint_volume() virtual function; it can only be used immediately,
as it's not guaranteed to survive across multiple frames.
2012-02-27 11:59:57 +00:00
Emmanuele Bassi
6a09bf5b52 paint-volume: Add a union method for boxes
Creating PaintVolume instances is not possible, and it's not recommended
anyway. It is, though, necessary to union paint volumes, especially with
2D boxes, in some cases.

Clutter should provide a simple convenience function that allows
unioning volumes to boxes in a moderately efficient way.

https://bugzilla.gnome.org/show_bug.cgi?id=670021
2012-02-27 11:24:08 +00:00
Emmanuele Bassi
618e04e9cc cookbook/examples: Modernize the code
Use new and non-deprecated methods.
2012-02-27 10:59:46 +00:00
Emmanuele Bassi
0099bbf7d9 docs: Fix unused symbols 2012-02-23 11:50:43 +00:00
Emmanuele Bassi
7ec975ed3d timeline: Add progress functions
The whole progress computation should not be done using a separate
class: it should be part of the Timeline class.
2012-02-23 11:23:15 +00:00
Neil Roberts
041ac40056 offscreen-effect: Add clutter_offscreen_effect_get_texture
Sometimes a subclass of ClutterOffscreenEffect wants to paint with a
completely custom material. In that case it is awkward to modify the
material returned owned by ClutterOffscreenEffect so it makes more
sense to just get the texture and manage its own material.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-02-14 12:09:18 +00:00
Emmanuele Bassi
3996ae4348 actor: Add destroy_all_children()
There are times when we don't want to remove all children and count of
the reference count to drop to 0 to ensure destruction; there are cases,
such as managed environments, where it's preferable to ensure that the
children of an actor get actually destroyed.
2012-02-13 17:42:07 +00:00
Emmanuele Bassi
d808367fe4 docs: Use ClutterTimeline:repeat-count instead of :loop 2012-02-13 17:30:22 +00:00
Emmanuele Bassi
657e0ce093 cookbook: Use clutter_timeline_set_repeat_count() 2012-02-13 17:30:22 +00:00
Emmanuele Bassi
97feb06a6f timeline: Add repeat-count
Being able to easily set the number of repeats has been a request for
the animation framework for some time now. The usual way to implement
this is: connect to the ::completed signal, use a static counter, and
stop the timeline when the counter hits a specific spot.

In the same light as the :auto-reverse property, we can make it easier
to implement this common functionality by adding a :repeat-count
property that, when set, limits the amount of loops that a Timeline can
perform before stopping itself.

In fact, we can implement the :loop property in terms of the
:repeat-count property just by using a sentinel value mapping to
"infinity", and map loop=FALSE to repeat-count=0, and loop=TRUE to
repeat-count=-1.
2012-02-13 17:30:22 +00:00
Emmanuele Bassi
7ba9774572 text: Add the coords_to_position() method
The reverse of position_to_coords().

While providing documentation on how to implement it using the
PangoLayout API, I realized that the verbosity of it all, plus the usage
of the Pango API, was not worth it, and decided to expose the method we
are using internally.
2012-02-06 18:27:58 +00:00
Emmanuele Bassi
242de47c03 docs: Update the actor invariants
• Clear up what's deprecated.
• Remove mentions of set_parent/unparent, and use add_child/remove_child
  instead.
• Clarify that reparent may not touch the MAPPED state.
2012-02-02 11:07:14 +00:00
Emmanuele Bassi
2475443a87 Clean up the clutter API reference Makefile.am 2012-01-31 17:03:14 +00:00
Emmanuele Bassi
bb2d807d2a docs: Add an image for the XIncluded code 2012-01-31 16:46:03 +00:00
Emmanuele Bassi
59f3488fa9 docs: Add private macro CLUTTER_PRIVATE_FIELD 2012-01-31 16:44:07 +00:00
Kerrick Staley
4360fcccf4 Fix spelling in Clutter Cookbook: ouest -> west 2012-01-27 12:17:08 +00:00
Emmanuele Bassi
58ffcfb10e actor: Add ClutterActorIter
Iterating over children and ancestors of an actor is a relatively common
operation. Currently, you only have one option: start a for() loop, get
the first child of the actor, and advance to the next sibling for the
list of children; or start a for() loop and advance to the parent of the
actor.

These operations can be easily done through the ClutterActor API, but
they all require going through the public API, and performing multiple
type checks on the arguments.

Along with the DOM API, it would be nice to have an ancillary, utility
API that uses an iterator structure to hold the state, and can be
advanced in a loop.

https://bugzilla.gnome.org/show_bug.cgi?id=668669
2012-01-27 11:55:39 +00:00
Emmanuele Bassi
54c9257f28 docs: Update to show the symbolic button names
https://bugzilla.gnome.org/show_bug.cgi?id=668692
2012-01-27 09:46:51 +00:00
Emmanuele Bassi
90397bf06c doc/cookbook: Remove dead link 2012-01-27 07:30:02 +00:00
Emmanuele Bassi
b2bf2dbb08 docs: Use symbolic constants for sources and events 2012-01-25 23:20:24 +00:00
Emmanuele Bassi
18ec12a3b7 cookbook: Start migrating to the new API
Drop mentions of deprecated classes and API, and update the inline
example code.

Still some way to go, and the cookbook would probably benefit from
having a recipe on how to use ClutterActor to build a scene.
2012-01-24 15:12:41 +00:00
Emmanuele Bassi
1c01554e6a cookbook: Begin porting examples to the new API
Start dropping the usage of deprecated classes and API.
2012-01-24 15:01:00 +00:00
Emmanuele Bassi
414f8c1a0f docs: Add missing function 2012-01-24 14:20:07 +00:00
Emmanuele Bassi
acf8aff6d5 docs: Add clutter_actor_set_allocation() 2012-01-19 13:14:47 +00:00
Emmanuele Bassi
5085c11bde Add ClutterTextBuffer to the API reference 2012-01-17 14:29:45 +00:00
Emmanuele Bassi
eb489a40de docs: Move deprecated sections to the proper location 2012-01-16 23:37:14 +00:00
Emmanuele Bassi
ad2cfc0150 docs: Fixes for the API reference 2012-01-16 23:37:14 +00:00
Emmanuele Bassi
86152f478d docs: Update the Actor API reference
Given the size and scope of the changes in ClutterActor, we ought to
rewrite the overall description of what an actor is, what it does, and
how are you supposed to use it and subclass it.
2012-01-16 23:37:11 +00:00
Emmanuele Bassi
88aaad9bdf docs: Add event propagation symbolic constants 2012-01-03 14:38:56 +00:00
Emmanuele Bassi
fd1196c7b5 docs/cookbook: Mention the event control macros
Now that we have symbolic names for event propagation values for signal
handlers, we ought to mention them in the cookbook.
2012-01-03 12:10:28 +00:00
Emmanuele Bassi
180eecbce6 docs: Document CLUTTER_ENABLE_DIAGNOSTIC
Add a note in the API reference.
2011-12-28 09:37:57 +00:00
Robert Bragg
16ed7677e0 Adds wayland-surface actor for wayland compositors
This adds a --enable-wayland-compositor configure option which will add
support for a ClutterWaylandSurface actor which can be used to aid in
writing Wayland compositors using Clutter by providing a ClutterActor to
represent Wayland client surfaces.

Notably this configure option isn't tied into any particular backend
since conceptually the compositor support can be used in conjunction
with any clutter backend that has corresponding Cogl support.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-12-08 16:13:37 +00:00
Robert Bragg
07c6f96cb4 wayland: Updates client side wayland support
This updates Wayland support in line with upstream changes to the Wayland
API and protocol.

This update means we no longer use the Cogl stub winsys so a lot of code
that had to manually interact with EGL and implement a swap_buffers
mechanism could be removed and instead we now depend on Cogl to handle
those things for us.

This update also adds an input device manager consistent with other
clutter backends.

Note: to use the client side "wayland" clutter backend you need to have
built Cogl with --enable-wayland-egl-platform. If Cogl has been built
with support for multiple winsys backends then you should run
applications with COGL_RENDERER=EGL in the environment.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-12-08 16:13:37 +00:00
Emmanuele Bassi
52ea1510a1 docs: Fixes for the API reference 2011-11-22 00:29:08 +00:00
Emmanuele Bassi
f5d011cb67 Merge branch 'deprecate-default-stage'
* deprecate-default-stage:
  evdev: do not associate device with stage
  evdev: don't even process events without a default stage
  docs: Note default stage deprecation in README
  docs: Remove clutter_stage_get_default()
  stage: Deprecate the default stage
  script: Do not use clutter_stage_get_default()
  cally/actor: Do not use the default stage as a fallback
  Try to mop up the default stage mess
  performance/*: Do not use clutter_stage_get_default()
  interactive/*: Do not use clutter_stage_get_default()
  Merge with a11y
  micro-bench/*: Do not use clutter_stage_get_default()
  accessibility/*: Do not use clutter_stage_get_default()
  conform/*: Do not use clutter_stage_get_default()
2011-11-14 11:07:54 +00:00
Rico Tzschichholz
b12a94dc27 docs: fix some headers paths 2011-11-10 19:05:39 +01:00
Emmanuele Bassi
26aa4b5290 docs: Remove clutter_stage_get_default()
A lot of the example code in the cookbook and the API reference still
uses the default stage — sometimes as if it were a non-default one,
which once again demonstrates how the default stage was a flawed concept
that just confused people.
2011-11-10 15:37:51 +00:00
Emmanuele Bassi
683642ba54 docs: Fixes for the API reference build 2011-11-03 16:05:36 +00:00
Emmanuele Bassi
7ab84f981c Remove CLUTTER_DISABLE_DEPRECATED from the build flags
We don't use it any more.
2011-11-03 15:35:01 +00:00
Emmanuele Bassi
a09bbffd92 Implement multi-backend support
The Clutter backend split is opaque enough that should allow us to just
build all possible backends inside the same shared object, and select
the wanted backend at initialization time.

This requires some work in the build system, as well as the
initialization code, to remove duplicate functions that might cause
conflicts at build and link time. We also need to defer all the checks
of the internal state of the platform-specific API to run-time type
checks.
2011-11-03 13:45:19 +00:00
Emmanuele Bassi
3cc62523e6 docs: Clean up the 'running Clutter apps' chapter 2011-10-17 10:25:20 +01:00
Emmanuele Bassi
31bee53eb7 docs: Fixes to build the API reference 2011-10-11 18:25:14 +01:00
Emmanuele Bassi
6c100e1513 docs: Move deprecated classes out of the way
The deprecated sections should be much more prominently separated from
the current API; we can use a new part inside the main reference index
for this.
2011-10-11 17:58:40 +01:00
Emmanuele Bassi
2d2046f962 docs: Document the settings.ini file
Describe the location, groups, and keys of the settings.ini file used by
Clutter.
2011-10-11 17:52:17 +01:00
Emmanuele Bassi
b1fbbe23b4 Revert "Add lightness, brightness, and contrast effects"
Discussed a bit with Neil, and I might have jumped the gun a little.
We might want a different API for 1.10. See comment 12 on:

https://bugzilla.gnome.org/show_bug.cgi?id=656156

This reverts commit 4829ae1c79.
2011-09-28 15:54:32 +01:00
Joseph Scheuhammer
4829ae1c79 Add lightness, brightness, and contrast effects
Added three classes for new clutter effects:  inverse lightness,
modify brightness, and modify contrast.

https://bugzilla.gnome.org/show_bug.cgi?id=656156
2011-09-28 10:32:15 -04:00
Emmanuele Bassi
a9a104e109 docs: Fixes for cross-references 2011-09-12 13:12:14 +01:00
Emmanuele Bassi
2a56cc799a docs: Remove unused cogl-2.0 directory
The Cogl API reference has long since moved out of the Clutter tree.
2011-09-12 13:05:16 +01:00
Emmanuele Bassi
802b9d463c docs: Update the HACKING file 2011-09-09 12:17:03 +01:00
Emmanuele Bassi
9a78eacb72 build: Fix distcheck in cookbook/examples 2011-09-05 21:16:01 +01:00
Emmanuele Bassi
9c9926654c docs: Remove the 1.8 index for Cally
No new API has been added in during the 1.7 development cycle.
2011-09-02 14:53:56 +01:00
Emmanuele Bassi
4b7552f001 docs: Add missing clutter_backend_get_cogl_context symbol 2011-09-02 14:53:55 +01:00
Emmanuele Bassi
72caef0de0 cookbooks/examples: Use g_signal_handlers_disconnect_by_func()
The disconnect_matched() function is a bit too complicated, and its
simpler wrapper disconnect_by_func() is functionally equivalent in the
cases used by the cookbook examples.
2011-09-02 12:19:30 +01:00
Emmanuele Bassi
2557370445 docs/cookbook: Update the introduction
Clean up some wording.
2011-09-01 16:06:04 +01:00
Emmanuele Bassi
b0f868edfd build: Install the cookbook examples code
Use $(datadir)/clutter-1.0/cookbook/examples as the target directory.
2011-09-01 13:51:20 +01:00
Emmanuele Bassi
e03fb1e872 docs/cookbook: Update copyright 2011-08-31 12:27:30 +01:00
Emmanuele Bassi
3bdd49dc19 docs/cookbook: Add script->state connection recipe
Script definitions can connect a signal to a State transition; this is a
useful thing to document with a recipe in the cookbook.
2011-08-31 12:25:01 +01:00
Emmanuele Bassi
a661191b4b docs/cookbook: Point out that Cogl does not do AA drawing 2011-08-22 13:15:42 +01:00
Emmanuele Bassi
010fc072f9 docs/cookbook: Update the link to the GObject reference 2011-08-22 12:33:20 +01:00
Emmanuele Bassi
8ea6b7912e docs: Fix up the unused symbols warning 2011-08-15 14:08:57 +01:00
Emmanuele Bassi
aaa000acbf docs: Fix up warnings in Cally's reference API 2011-08-15 14:08:28 +01:00
Emmanuele Bassi
fe66575a2c docs: Update with the newly added Animatable symbol 2011-07-29 11:53:16 +01:00
Emmanuele Bassi
7f8838d7cc cairo-texture: Add the :auto-resize property
Keeping the backing Cairo surface of a CairoTexture canvas in sync with
the actor's allocation is tedious and prone to mistakes. We can
definitely do better by simply exposing a property that does the surface
resize and invalidation automagically on ::allocate.
2011-07-26 14:55:19 +01:00
Emmanuele Bassi
2f445682b1 cairo-texture: Use signal-based drawing
The current "create context/draw/destroy context" pattern presents
various problems. The first issue is that it defers memory management to
the caller of the create() or create_region() methods, which makes
bookkeeping of the cairo_t* harder for language bindings and third party
libraries. The second issue is that, while it's easier for
draw-and-forget texturs, this API is needlessly complicated for contents
that have to change programmatically - and it introduces constraints
like calling the drawing code explicitly after a surface resize (e.g.
inside an allocate() implementation).

By using a signal-based approach we can make the CairoTexture actor
behave like other actors, and like other libraries using Cairo as their
2D drawing API.

The semantics of the newly-introduced ::draw signal are the same as the
one used by GTK+:

  - the signal is emitted on invalidation;
  - the cairo_t* context is owned by the actor;
  - it is safe to have multiple callbacks attached to the same
    signal, to allow composition;
  - the cairo_t* is already clipped to the invalidated area, so
    that Cairo can discard geometry immediately before we upload
    the texture data.

There are possible future improvements, like coalescing multiple
invalidations inside regions, and performing clipped draws during
the paint cycle; we could even perform clipped redraws if we know the
extent of the invalidated area.
2011-07-26 12:40:52 +01:00
Emmanuele Bassi
c89de4324e docs: Remove manual/
The programmers manual never materialized, and its role has been taken
by both the cookbook and the API reference.
2011-07-20 11:32:15 +01:00
Emmanuele Bassi
5cc5e566e6 docs: Add fixed size and constraints to the size negotiation docs 2011-07-19 14:11:11 +01:00
Emmanuele Bassi
48a2b3a654 docs: Rename the invariants documentation 2011-07-19 14:02:59 +01:00
Emmanuele Bassi
c1951ab17a docs: Add a simple description of the size negotiation mechanism
Describe (with an example) the ordering and meaning of flags for the
size negotiation in ClutterActor.
2011-07-19 14:01:30 +01:00
Neil Roberts
a72237b876 clutter-stage: Add clutter_stage_get_redraw_clip_bounds
This adds a public function to get the bounds of the current clipped
redraw on a stage. This should only be called while the stage is being
painted. The function diverts to a virtual function on the
ClutterStageWindow implementation. If the function isn't implemented
or it returns FALSE then the entire stage is reported. The clip bounds
are in integer pixel coordinates in the stage's coordinate space.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2421
2011-07-13 13:54:50 +01:00
Neil Roberts
0a83e03afb doc/RELEASING: Fix the check for diffs from origin/master
The recommended command to check for differences from master to the
remote master was using git log with a range from the local master to
the remote master but this wouldn't work if the local master is ahead
of the remote master because the range is backwards. This patch
changes it to recommend git diff --stat instead because then the
command would work even if the two branches have diverged.
2011-06-29 16:16:25 +01:00
Emmanuele Bassi
0788c85df1 docs: Remove the in-tree cogl fixxref option
Cogl has been moved out of tree.
2011-06-21 10:52:44 +01:00
Emmanuele Bassi
459e1e7fc9 docs: Fix the GLX section
The whole thing should just go away.
2011-06-20 19:45:14 +01:00
Emmanuele Bassi
34cbc0e94c docs: Fix up labels in the constraint example image 2011-06-20 19:44:33 +01:00
Emmanuele Bassi
f971c2cb11 docs: Add the (now deprecated) GLX texture-pixmap
It was missing from the API reference.
2011-06-20 18:48:49 +01:00
Emmanuele Bassi
948461b8f2 docs: Fix duplicate symbol in the sections list 2011-06-20 18:40:31 +01:00
Emmanuele Bassi
e5641dabf8 docs: Document ClutterDropAction
And add it to the API reference.

https://bugzilla.gnome.org/show_bug.cgi?id=652842
2011-06-20 15:25:54 +01:00
Emmanuele Bassi
e4756fd764 docs: Fix up the API reference 2011-06-20 14:26:57 +01:00
Emmanuele Bassi
3861a1c3ba build: Update the API reference build
Add the Cogl prefix to the fix-cross-references script options, and
update the location of the extra headers.
2011-06-20 13:56:46 +01:00
Emmanuele Bassi
5ded02cd08 docs: Add symbols index for 1.8 2011-06-14 01:02:09 +01:00
Emmanuele Bassi
86d96dbcc1 build: Put back ChangeLog.pre-git-import to unbreak distcheck 2011-06-13 23:15:17 +01:00
Philippe Normand
494629d4b9 clutter-text: new clutter_text_get_layout_offsets API
This new function can be used to retrieve the coordinates where the
ClutterText will draw the PangoLayout representing the text.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2553
2011-06-13 16:15:22 +01:00
Emmanuele Bassi
165b2f9599 docs: Fix Clutter API reference 2011-06-13 15:36:07 +01:00
Emmanuele Bassi
cd2b36ed91 Merge branch 'swipe-action'
* swipe-action:
  test-swipe-action: Clean up the test code
  docs: Add the new actions to the API reference
  gesture-action: Remove the multi-device entry points
  swipe-action: Remove the required devices call
  swipe-action: Clean up
  gesture-action: Clean up
  Add ClutterSwipeAction and ClutterGestureAction
2011-06-13 14:39:03 +01:00
Emmanuele Bassi
4f0769d69d docs: Update missing documentation 2011-06-13 13:47:09 +01:00
Emmanuele Bassi
9b4ad40f04 docs: Add the new actions to the API reference
http://bugzilla.clutter-project.org/show_bug.cgi?id=2585
2011-06-10 15:15:15 +01:00
Emmanuele Bassi
7d1d1acbbb docs: Update the releasing checklist 2011-06-09 15:58:34 +01:00
Emmanuele Bassi
4944a5e7d1 Move some old doc files under doc/
ChangeLog.pre-git-import is useless since the Git log contains the
pre-Git history anyway.

AUTHORS is not really useful, as many more people have been committing
to Clutter for a while now.
2011-06-09 15:53:29 +01:00
Emmanuele Bassi
9636a4f125 docs: Fix up new symbols for the API reference 2011-06-09 15:40:57 +01:00
Emmanuele Bassi
2b81d90dd7 Eliminate G_CONST_RETURN
The G_CONST_RETURN define in GLib is, and has always been, a bit fuzzy.

We always used it to conform to the platform, at least for public-facing
API.

At first I assumed it has something to do with brain-damaged compilers
or with weird platforms where const was not really supported; sadly,
it's something much, much worse: it's a define that can be toggled at
compile-time to remove const from the signature of public API. This is a
truly terrifying feature that I assume was added in the past century,
and whose inception clearly had something to do with massive doses of
absynthe and opium — because any other explanation would make the
existence of such a feature even worse than assuming drugs had anything
to do with it.

Anyway, and pleasing the gods, this dubious feature is being
removed/deprecated in GLib; see bug:

  https://bugzilla.gnome.org/show_bug.cgi?id=644611

Before deprecation, though, we should just remove its usage from the
whole API. We should especially remove its usage from Cally's internals,
since there it never made sense in the first place.
2011-06-07 16:06:24 +01:00
Neil Roberts
7d233241f1 Fix include location for cogl-pango.h
In Cogl, cogl-pango.h has moved to <cogl-pango/cogl-pango.h>. When
using the experimental 2.0 API (which Clutter does) it is no longer
possible to include it under the old name of <cogl/cogl-pango.h> so we
need to update the include location.
2011-05-16 16:04:27 +01:00
Neil Roberts
701440efd8 clutter-actor: Add a 'has_overlaps' virtual
This adds a virtual to ClutterActor so that an actor subclass can
report whether it has overlapping primitives. ClutterActor uses this
to determine whether it needs to use ClutterFlattenEffect to implement
the opacity property. The default implementation of the virtual
returns TRUE which means that most actors will end up being redirected
offscreen when the opacity != 255. ClutterTexture and ClutterRectangle
override this to return FALSE because they should never need to be
redirected. ClutterClone overrides it to divert to the source.

The values for the ClutterOffscreenRedirect enum have changed to:

AUTOMATIC_FOR_OPACITY

 The actor will only be redirected if has_overlaps returns TRUE and
 the opacity is < 255

ALWAYS_FOR_OPACITY

 The actor will always be redirected if the opacity < 255 regardless
 of the return value of has_overlaps

ALWAYS

 The actor will always be redirected offscreen.

This means that the property can't be used to prevent the actor from
being redirected but only to increase the likelihood that it will be
redirected.

ClutterActor now adds and removes the flatten effect depending on
whether flattening is needed directly in clutter_actor_paint(). There
are new internal versions of add/remove_effect that don't queue a
redraw. This means that ClutterFlattenEffect is now just a no-op
subclass of ClutterOffscreen. It is only needed because
ClutterOffscreen is abstract. Removing the effect also makes it so
that the cached image will be freed as soon as an actor is repainted
without being flattened.
2011-05-13 01:46:32 +01:00
Neil Roberts
7f78237ee5 clutter-actor: Add an 'offscreen-redirect' property
This adds a property which can be used to redirect the actor through
an FBO before painting so that it becomes flattened in an image. The
image can be used as a cache to avoid having to repaint the actor if
something unrelated in the scene changes. It can also be used to
implement correct opacity even if the actor has overlapping
primitives. The property is an enum that takes three values:

CLUTTER_OFFSCREEN_REDIRECT_NEVER: The default behaviour which is to
  never flatten the actor.

CLUTTER_OFFSCREEN_REDIRECT_ALWAYS: The actor is always redirected
  through an FBO.

CLUTTER_OFFSCREEN_REDIRECT_ONLY_FOR_OPACITY: The actor is only
  redirected through an FBO if the paint opacity is not 255. This
  value would be used if the actor wants correct opacity. It will
  avoid the overhead of using an FBO whenever the actor is fully
  opaque.

The property is implemented by installing a ClutterFlattenEffect.
ClutterFlattenEffect is a new internal class which subclasses
ClutterOffscreen to redirect the painting to an FBO. When
ClutterOffscreen paints, the effect sets an opacity override on the
actor so that the image will always contain the actor at full
opacity. The opacity is then applied to the resulting image before
painting it to the stage. This means the actor does not need to be
redrawn while the opacity is being animated.

The effect has a high internal priority so that it will always occur
before any other effects and it gets hidden from the application.
2011-05-13 01:46:32 +01:00
Neil Roberts
00b733a85a clutter-effect: Add clutter_effect_queue_rerun
This adds a new public function to queue a rerun of an effect. If
nothing else queues a redraw then when the effect's actor is painted
the effect will be run without the CLUTTER_EFFECT_RUN_ACTOR_DIRTY
flag. This allows parametrised offscreen effects to report that they
need to redraw the image without having to redraw the underlying
actor. This will be used to implement the 'transparency' effect of
ClutterActor.

If multiple redraws are queued with different effects then redrawing
is started from the one that occurs last in the list of effects.

Internally the function is a wrapper around the new function
_clutter_actor_queue_redraw_full. This is intended to be the sole
point of code for queuing redraws on an actor. It has parameters for
the clip and the effect. The other two existing functions to queue a
redraw (one with a clip and one without) now wrap around this function
by passing a NULL effect.
2011-05-13 01:46:32 +01:00