1
0
Fork 0
Commit graph

741 commits

Author SHA1 Message Date
Emmanuele Bassi
3f6ec0ba5a actor-box: Add setters for origin and size 2010-10-25 15:45:35 +01:00
Neil Roberts
e66c679e84 win32: Add a public clutter_win32_handle_event function
This function handles a single windows message. The idea is that it
could be used by clutter-gtk to forward on events from a
GdkEventFilter. The function replaces the old message_translate()
function. That function didn't translate the event anymore anyway and
instead it could generate multiple events so
clutter_win32_handle_event seems like a more appropriate name. The
function returns TRUE or FALSE depending on whether the event was
completely handled instead of setting call_window_proc.
2010-10-25 13:19:17 +01:00
Emmanuele Bassi
d5376bf317 color: Add Color.interpolate() method
The interpolate() method does what it says on the tin: it interpolates
between two colors using the given factor.

ClutterColor uses it to register a progress function for Intervals.
2010-10-11 15:39:19 +01:00
Emmanuele Bassi
7728ea951b docs: Add unused symbols to the Clutter API reference 2010-10-04 09:08:07 +01:00
Emmanuele Bassi
7ac84cf7a3 container: Add child_notify() wrapper
The child_notify() virtual function on ClutterContainer does not have a
wrapper for implementations to call.
2010-09-30 14:58:23 +01:00
Emmanuele Bassi
66b0c1969c Remove the internal copy of JSON-GLib
The internal copy of JSON-GLib was meant to go away right after the 1.0
release, given that JSON-GLib was still young and relatively unknown.

Nowadays, many projects started depending on this little library, and
distributions ship it and keep it up to date.

Keeping a copy of JSON-GLib means keeping it up to date; unfortunately,
this would also imply updating the code not just for the API but for the
internal implementations.

Starting with the 1.2 release, Clutter preferably dependend on the
system copy; with the 1.4 release we stopped falling back automatically.
The 1.6 cycle finally removes the internal copy and requires a copy of
JSON-GLib installed on the target system in order to compile Clutter.
2010-09-29 15:57:28 +01:00
Emmanuele Bassi
044809edb8 docs: Add PaintVolume to the API reference
And document the various related functions.
2010-09-29 15:12:57 +01:00
Robert Bragg
37d0dbe6b2 docs: Put deprecated Cogl symbols into new section
This adds a "Cogl deprecated API" chapter to the Cogl reference manual
so we can group all the documentation for deprecated symbols together
instead of having them clutter up the documentation of symbols we would
rather developers used.
2010-09-23 15:53:30 +01:00
Robert Bragg
779c780500 docs: update the overview paragraph for Cogl
Instead of describing OpenGL as "a low level OpenGL abstraction
library" it is now summarised as "modern 3D graphics API".
2010-09-23 15:53:30 +01:00
Robert Bragg
2bc739ab44 docs: cogl-texture-3d wasn't listed as experimental
The CoglTexture3D API is only available when defining
COGL_ENABLE_EXPERIMENTAL_API so it should be listed in the experimental
section of the API reference.
2010-09-23 15:53:30 +01:00
Robert Bragg
a89b8f4304 docs: Use "Cogl" not "COGL" in Cogl API reference
Cogl isn't an acronym so we should use "Cogl" instead of "COGL" in
our documentation.
2010-09-23 15:53:29 +01:00
Emmanuele Bassi
ce174654bf docs: API reference fixes 2010-09-20 13:15:44 +01:00
Robert Bragg
ff4c24f0a4 geometry: Adds a clutter_geometry_intersects API
This adds a public function named clutter_geometry_intersects which
determines if two geometries intersect or not returning TRUE if so else
FALSE.
2010-09-13 18:18:34 +01:00
Emmanuele Bassi
4ee05f8e21 keysyms: Update the macros to CLUTTER_KEY_*
The keysyms defines in clutter-keysyms.h are generated from the X11 key
symbols headers by doing the equivalent of a pass of sed from XK_* to
CLUTTER_*. This might lead to namespace collisions, down the road.
Instead, we should use the CLUTTER_KEY_* namespace.

This commit includes the script, taken from GDK, that parses the X11
key symbols and generates two headers:

  - clutter-keysyms.h: the default included header, with CLUTTER_KEY_*
  - clutter-keysyms-compat.h: the compatibility header, with CLUTTER_*

The compat.h header file is included if CLUTTER_DISABLE_DEPRECATED is
not defined - essentially deprecating all the old key symbols.

This does not change any ABI and, assuming that an application or
library is not compiling with CLUTTER_DISABLE_DEPRECATED, the source
compatibility is still guaranteed.
2010-09-10 17:54:52 +01:00
Emmanuele Bassi
01362effca actor: Add a method for querying key focus
A simple convenience method on Clutter.Actor for checking whether
it has key focus assigned on the Stage to which it belongs.
2010-09-10 11:42:11 +01:00
Emmanuele Bassi
71a4db6135 animation: Allow detaching an animation from an actor
When animating an actor through clutter_actor_animate() and friends we
might want forcibly detach the animation instance from the actor in
order to start a new one - for instance, in response to user
interaction.

Currently, there is no way to do that except in a very convoluted way,
by emitting the ::completed signal and adding a special case in the
signal handlers; this is due to the fact that clutter_actor_animate()
adds more logic than the one added by clutter_animation_set_object(),
so calling set_object(NULL) or unreferencing the animation instance
itself won't be enough.

The right way to approach this is to add a new method to Clutter.Actor
that detaches any eventual Animation currently referencing it.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2051
2010-09-10 11:18:53 +01:00
Emmanuele Bassi
070e239b6d docs: Fix up the Cogl API reference build 2010-09-03 17:15:22 +01:00
Emmanuele Bassi
0e2b0e496e docs: Add annotation glossary to the Cogl API reference
It's the only way to let gtk-doc know that we're using annotations in
the comments.
2010-09-03 16:52:06 +01:00
Emmanuele Bassi
0caef5c8aa docs: Fixes for gtk-doc 2010-09-03 16:12:24 +01:00
Damien Lespiau
0a0a59cf7b cex100: Add an API to configure the buffering mode of the GDL plane
GDL planes can be double or triple buffered. Let the user choose between
the two modes befored initalizing Clutter.
2010-09-03 11:13:35 +01:00
Damien Lespiau
01fcd11efd cex100: Add an API to configure the GDL plane to use
Intel CE3100 and CE4100 have several planes (framebuffers) and a
hardware blender to blend the planes togeteher to produce the final
image.

clutter_cex100_set_plane() lets you configure which framebuffer clutter
will use for its rendering.
2010-09-03 11:13:35 +01:00
Emmanuele Bassi
12a5bf2e06 offscreen-effect: Rename create_target to create_buffer
*** This is an API change ***

The create_target() virtual function should return a CoglHandle to a
texture; clutter_offscreen_effect_get_target(), instead, returns a
CoglMaterial to be painted in the implementation of the paint_target()
virtual function.

Instead of equating textures with materials, and confusing the user of
the API, we should mark the difference more prominently.

First of all, we should return a CoglMaterial* (now that we have that
as a public type) in get_target(); having handles all over the place
does not make it easier to distinguish the semantics of the virtual
functions.

Then we should rename create_target() to create_texture(), to make it
clear that what should be returned is a texture that is used as the
backing for the offscreen framebuffer.
2010-09-01 18:05:53 +01:00
Emmanuele Bassi
b369cb51dc docs: Pass -DCOGL_ENABLE_EXPERIMENTAL_API when scanning 2010-08-28 21:21:08 +01:00
Emmanuele Bassi
be9dd6e7da docs: Split x11-texture-pixmap in its own section 2010-08-28 21:18:12 +01:00
Emmanuele Bassi
a0c700b8d0 docs: Fix up the main index of the Clutter API reference 2010-08-28 21:17:52 +01:00
Emmanuele Bassi
36d45b660f click-action: Add get_button()
Allow retrieving the pointer button that caused the ::clicked signal to
be emitted.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2287
2010-08-26 16:39:39 +01:00
Emmanuele Bassi
459a6bb24c click-action: Add a method to force a release
It can be useful to be able to forcibly break the grab set up by the
ClickAction. The newly added release() method provides a mechanism to
release the grab and unset the :held state of the ClickAction.
2010-08-19 12:10:43 +01:00
Emmanuele Bassi
ad0c36e1a1 docs: Fixes to avoid gtk-doc warnings 2010-08-17 14:54:20 +01:00
Neil Roberts
12f2481462 docs: Update the build instructions in the reference
This removes all references to SDL in the build instructions as the
backend is no longer available.  The OpenGL version required is only
1.2 not 1.4. The Windows build instructions were out of date and have
been replaced with a link to the wiki instead.
2010-08-12 17:30:45 +01:00
Robert Bragg
f03037d580 cogl-program: Adds use_uniform_xyz methods
Instead of exposing an API that provides an OpenGL state machine style
where you first have to bind the program to the context using
cogl_program_use() followed by updating uniforms using
cogl_program_uniform_xyz we now have uniform setter methods that take an
explicit CoglHandle for the program.

This deprecates cogl_program_use and all the cogl_program_uniform
variants and provides the following replacements:
    cogl_program_set_uniform_1i
    cogl_program_set_uniform_1f
    cogl_program_set_uniform_int
    cogl_program_set_uniform_float
    cogl_program_set_uniform_matrix
2010-08-12 16:50:46 +01:00
José Dapena Paz
d14e294d86 Add ClutterTableLayout, a layout showing children in rows and columns
A TableLayout is a layout manager that allocates its children in rows
and columns. Each child is assigned to a cell (or more if a cell span
is set).

The supported child properties are:

  • x-expand and y-expand: if this cell with try to allocate the
    available extra space for the table.
  • x-fill and y-fill: if the child will get all the space available in
    the cell.
  • x-align and y-align: if the child does not fill the cell, then
    where the child will be aligned inside the cell.
  • row-span and col-span: number of cells the child will allocate for
    itself.

Also, the TableLayout has row-spacing and col-spacing for specifying
the space in pixels between rows and between columns.

We also include a simple test of the layout manager, and the
documentation updates.

The TableLayout was implemented starting from MxTable and
ClutterBoxLayout.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2038

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-08-10 23:20:06 +01:00
Emmanuele Bassi
07b01888ba actor: Add allocate_align_fill()
Layout managers are using the same code to allocate a child while taking
into consideration:

  • horizontal and vertical alignment
  • horizontal and vertical fill
  • the preferred minimum and natural size, depending
    on the :request-mode property
  • the text direction for the horizontal alignment
  • an offset given by the fixed position properties

Given the amount of code involved, and the amount of details that can go
horribly wrong while copy and pasting such code in various classes - let
alone various projects - Clutter should provide an allocate() variant
that does the right thing in the right way. This way, we have a single
point of failure.
2010-08-10 22:25:11 +01:00
Emmanuele Bassi
0cbfabcda4 stage: Add the NO_CLEAR_ON_PAINT hint
Some apps or some use cases don't need to clear the stage on immediate
rendering GPUs. A media player playing a fullscreen video or a
tile-based game, for instance.

These apps are redrawing the whole screen, so we can avoid clearing the
color buffer when preparing to paint the stage, since there is no
blending with the stage color being performed.

We can add an private set of hints to ClutterStage, and expose accessors
for each potential hint; the first hint is the 'no-clear' one.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2058
2010-07-13 14:57:48 +01:00
Neil Roberts
984e04cae8 Make the material functions for setting the p wrap mode public
Now that we have 3D texture support it makes sense to expose the wrap
mode for the p coordinate.
2010-07-13 14:29:07 +01:00
Neil Roberts
dfea57b45a Add a Cogl texture 3D backend
This adds a publicly exposed experimental API for a 3D texture
backend. There is a feature flag which can be checked for whether 3D
textures are supported. Although we require OpenGL 1.2 which has 3D
textures in core, GLES only provides them through an extension so the
feature can be used to detect that.

The textures can be created with one of two new API functions :-

cogl_texture_3d_new_with_size

 and

cogl_texture_3d_new_from_data

There is also internally a new_from_bitmap function. new_from_data is
implemented in terms of this function.

The two constructors are effectively the only way to upload data to a
3D texture. It does not work to call glTexImage2D with the
GL_TEXTURE_3D target so the virtual for cogl_texture_set_region does
nothing. It would be possible to make cogl_texture_get_data do
something sensible like returning all of the images as a single long
image but this is not currently implemented and instead the virtual
just always fails. We may want to add API specific to the 3D texture
backend to get and set a sub region of the texture.

All of those three functions can throw a GError. This will happen if
the GPU does not support 3D textures or it does not support NPOTs and
an NPOT size is requested. It will also fail if the FBO extension is
not supported and the COGL_TEXTURE_NO_AUTO_MIPMAP flag is not
given. This could be avoided by copying the code for the
GL_GENERATE_MIPMAP TexParameter fallback, but in the interests of
keeping the code simple this is not yet done.

This adds a couple of functions to cogl-texture-driver for uploading
3D data and querying the 3D proxy
texture. prep_gl_for_pixels_upload_full now also takes sets the
GL_UNPACK_IMAGE_HEIGHT parameter so that 3D textures can have padding
between the images. Whenever 3D texture is uploading, both the height
of the images and the height of all of the data is specified (either
explicitly or implicilty from the CoglBitmap) so that the image height
can be deduced by dividing by the depth.
2010-07-13 14:28:52 +01:00
Neil Roberts
8940c30681 Make a public CoglBitmapError enum
There are many places in the texture backend that need to do
conversion using the CoglBitmap code. Currently none of these
functions can throw an error but they do return a value to indicate
failure. In future it would make sense if new texture functions could
throw an error and in that case they would want to use a CoglBitmap
error if the failure was due to the conversion. This moves the
internal CoglBitmap error from the quartz backend to be public in
cogl-bitmap.h so that it can be used in this way.
2010-07-13 14:28:45 +01:00
Neil Roberts
0e839c3769 Add cogl_vertex_buffer_is_indices to the public headers
This function has always been defined in the shared library but it was
missed from the public headers.
2010-07-09 18:57:54 +01:00
Neil Roberts
ab05f6bfb1 cogl-material: Add support for point sprites
This adds a new API call to enable point sprite coordinate generation
for a material layer:

void
cogl_material_set_layer_point_sprite_coords_enabled (CoglHandle material,
                                                     int layer_index,
                                                     gboolean enable);

There is also a corresponding get function.

Enabling point sprite coords simply sets the GL_COORD_REPLACE of the
GL_POINT_SPRITE glTexEnv when flusing the material. There is no
separate application control for glEnable(GL_POINT_SPRITE). Instead it
is left permanently enabled under the assumption that it has no affect
unless GL_COORD_REPLACE is enabled for a texture unit.

http://bugzilla.openedhand.com/show_bug.cgi?id=2047
2010-07-08 16:34:30 +01:00
Neil Roberts
73642ac9c4 cogl-material: Add a property for setting the point size
This adds cogl_material_{get,set}_point_size. If the point size is not
1.0f then glPointSize will be called when the material is flushed.

http://bugzilla.openedhand.com/show_bug.cgi?id=2047
2010-07-08 16:34:30 +01:00
Øyvind Kolås
9e730727ca state: add clutter_state_set_state and clutter_state_warp_to_state
Replaced clutter_state_change with a boolean argument for animating the
transition or not with two separate argument-less methods.
2010-07-07 18:17:09 +01:00
Emmanuele Bassi
f87e4037a8 build: Distcheck fixes after the Cally merge 2010-07-07 16:30:31 +01:00
Emmanuele Bassi
e3a8ece54d Merge branch 'cally-merge'
* cally-merge:
  cally: Add introspection generation
  cally: Improving cally doc
  cally: Cleaning CallyText
  cally: Refactoring "window:create" and "window:destroy" emission code
  cally: Use proper backend information on CallyActor
  cally: Check HAVE_CONFIG_H on cally-util.c
  docs: Fix Cally documentation
  cally: Clean up the headers
  Add binaries of the Cally examples to the ignore file
  docs: Add Cally API reference
  Avoid to load cally module on a11y examples
  Add accessibility tests
  Initialize accessibility support on clutter_init
  Rename some methods and includes to avoid -Wshadow warnings
  Cally initialization code
  Add Cally
2010-07-07 16:06:30 +01:00
Alejandro Piñeiro
a2f8ce175f cally: Improving cally doc
* Add documentation for all undocumented symbols
  * Add an overview section
2010-07-07 15:48:08 +02:00
Øyvind Kolås
ec05230b97 state: added clutter_state_key_get_property_type
A function to retrieve the type of the value stored in a key, the
equivalent already exists for ClutterAnimator.
2010-07-06 14:14:34 +01:00
Emmanuele Bassi
09c6553f0d cally: Clean up the headers
Make Cally follow the single-include header file policy of Clutter and
Cogl; this means making cally.h the single include header, and requires
a new cally-main.h file for the functions defined by cally.h.

Also:

  • clean up the licensing notice and remove the FSF address;

  • document the object structures (instance and class);

  • G_GNUC_CONST-ify the get_type() functions;

  • reduce the padding for CallyActor sub-classes;

  • reduce the amount of headers included.
2010-07-05 16:45:43 +01:00
Emmanuele Bassi
e0a1f20ca2 docs: Add Cally API reference 2010-07-05 16:45:43 +01:00
Emmanuele Bassi
9313f44e67 docs: Add a cogl-paths section
The path primitives have a specific section, now, and gtk-doc is loudly
complaining about it being defined but not referenced.
2010-07-02 17:49:09 +01:00
Øyvind Kolås
38941372bf state: rename property "target-state" to "state"
This reduces the amount of typing, and should provide for more readable
code for most uses of ClutterState.
2010-07-02 17:41:33 +01:00
Neil Roberts
25509e6a7b Convert the ASCII art documentation in cogl-vertex-buffer to PNGs
The documentation for cogl_vertex_buffer_indices_get_for_quads was
using ugly ASCII art to draw the diagrams. These have now been
replaced with PNG figures.
2010-07-02 17:29:34 +01:00
Neil Roberts
86500cd3d5 Add CoglMaterialWrapMode to the Cogl docs and fix docs for the getters
CoglMaterialWrapMode was missing from the cogl-sections.txt file so it
wasn't getting displayed. There were also no documented return values
from the getters.
2010-07-02 17:29:34 +01:00
Emmanuele Bassi
4ed4e86e75 docs: Various fixes for gtk-doc 2010-06-30 15:51:12 +01:00
Emmanuele Bassi
286f307c10 docs: Various fixes 2010-06-30 11:32:15 +01:00
Neil Roberts
3a1456f34e cogl-path: Allow changing the fill rule
This adds two new API calls- cogl_path_set_fill_rule and
cogl_path_get_fill_rule. This allows modifying the fill rule of the
current path. In addition to the previous default fill rule of
'even-odd' it now supports the 'non-zero' rule. The fill rule is a
property of the path (not the Cogl context) so creating a new path or
preserving a path with cogl_path_get_handle affects the fill rule.
2010-06-29 20:37:14 +01:00
Emmanuele Bassi
cd8548fd6f docs: Add Settings to the API reference
And document properties.
2010-06-21 17:57:11 +01:00
Robert Bragg
d45ac12628 egl: Consolidates eglx and eglnative into one "egl" winsys
This remove quite a lot of redundant code by consolidating the eglx and
eglnative window system backends.
2010-06-18 17:38:41 +01:00
Robert Bragg
bf9d5f3949 build: distinguish CLUTTER_WINSYS and CLUTTER_SONAME_INFIX
This adds a separate variable name "CLUTTER_SONAME_INFIX" to define the
infix for the clutter library that gets linked. Currently the WINSYS
corresponds to the directory we enter when building to compile the
window system and input support, but it is desirable to be able to
define multiple flavours that use the same WINSYS but should result in
different library names.

For example we are planning to combine the eglx and eglnative window
systems into one "egl" winsys but we will need to preserve the current
library names for the eglx and eglnative flavours.
2010-06-18 17:38:40 +01:00
Emmanuele Bassi
77c63e0237 bind-constraint: Add accessor methods
ClutterBindConstraint should have accessor methods for its properties,
to allow direct manipulation instead of going through GObject's API.
2010-06-17 12:02:28 +01:00
Emmanuele Bassi
859d1f0792 align-constraint: Publish the properties accessors
The accessor methods for the AlignConstraint properties should be
public.
2010-06-16 12:47:56 +01:00
Robert Bragg
ff4d3e048b cogl docs: Improve documentation for cogl_ortho
cogl_ortho is one of those APIs whos style was, for better or worse,
copied from OpenGL and for some inexplicable reason the near and far
arguments are inconsistent with the left, right, top, bottom arguments
because they don't take z coordinates they take a "distance" which
should be negative for a plane behind the viewer.

This updates the documentation to explain this.
2010-06-15 15:26:28 +01:00
Emmanuele Bassi
b8b2a51d44 Merge branch 'wip/deform-effect'
* wip/deform-effect:
  docs: Add DeformEffect and PageTurnEffect to the API reference
  effect: Add PageTurnEffect
  effect: Add DeformEffect
  offscreen-effect: Traslate the modelview with the offsets
  docs: Fix Effect subclassing section
2010-06-11 18:12:54 +01:00
Dan Winship
f3f3b56742 actor: add clutter_actor_contains()
It is often useful to determine if one actor is an ancestor of
another. Add a method to do that.

http://bugzilla.openedhand.com/show_bug.cgi?id=2162

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-06-11 15:19:45 +01:00
Emmanuele Bassi
d816acd834 shader-effect: Allow creating vertex shaders
By default, ShaderEffect creates a fragment shader; in order to be able
to deprecate ClutterShader we need a way for ShaderEffect sub-classes to
create a vertex shader if needed - By using a write-only, constructor
only property.

ClutterShader has, internally, a ClutterShaderType enumeration that can
be used exactly for this. We just need to expose it and create a GObject
property for ClutterShaderEffect.
2010-06-11 14:47:48 +01:00
Damien Lespiau
e562ac20df cogl-color: Provide setters for all the channels
We only had getters for the red, green, blue and alpha channels of a
color. This meant that, if you wanted to change, say, the alpha
component of a color, one would need to query the red, green and blue
channels and use set_from_4ub() or set_from_4f().

Instead of this, just provide some setters for CoglColor, using the same
naming scheme than the existing getters.
2010-06-10 20:02:01 +01:00
Damien Lespiau
55be1a23c3 cogl-color: Add cogl_color_unpremultiply()
For some operations on pre-multiplied colors (say, replace the alpha
value), you need to unpremultiply the color.

This patch provides the counterpart to cogl_color_premultiply().
2010-06-10 20:01:48 +01:00
Emmanuele Bassi
7343c66482 docs: Add DeformEffect and PageTurnEffect to the API reference 2010-06-10 18:51:22 +01:00
Damien Lespiau
eb3017df7e doc: Some fixes for the Cogl documentation
• 3 general fixes (typos, copy/paste),
 • ignore cogl-object-private.h,
 • cogl_fixed_atani() was in reality cogl_fixed_atan(), fixed in commit
   43564f05.
 • Fix the cogl-vector section: sections must have a </SECTION> tag at
   the end. Also the cogl-vector section was added in the middle of the
   cogl-buffer one. Let's shiffle it out and add that </SECTION> tag.
2010-06-07 14:32:32 +01:00
Robert Bragg
e7c800dacc CoglObject: Adds cogl_object_{get,set}_user_data
This provides a mechanism for associating private data with any
CoglObject. We expect Clutter will use this to associate weak materials
with normal materials.
2010-06-04 14:44:15 +01:00
Robert Bragg
d131602a6d cogl-path: Adds missing cogl_is_path prototype
This adds a missing cogl_is_path prototype to the public cogl-path.h
header.
2010-06-04 14:44:15 +01:00
Robert Bragg
eca2634050 cogl-path: Renames cogl_path_get/set cogl_get/set_path
These aren't path methods so aren't consistent with the
cogl_object_method naming style we are aiming for.
2010-06-04 14:44:15 +01:00
Damien Lespiau
582f2ced5f build: Fix out of tree gtk-doc generation
Various headers are build in builddirs (clutter-marshal.h, mkenums
headers and cogl-define.h) so we need to add the corresponding include
paths for gtk-doc to build its scanner.
2010-06-03 15:14:08 +01:00
Emmanuele Bassi
23084b9768 docs: Effects fixes for the API reference 2010-06-03 14:34:41 +01:00
Emmanuele Bassi
f2caafa127 docs: Add Effects API to the reference 2010-06-03 14:10:55 +01:00
Emmanuele Bassi
91220c4b46 docs: Miscellaneous fixes to silence gtk-doc 2010-06-01 14:15:03 +01:00
Emmanuele Bassi
346ebce573 actor: Add accessors pair for :clip-to-allocation
We should have an accessors pair for the :clip-to-allocation property,
to avoid going through the generic GObject accessors.
2010-05-26 16:09:47 +01:00
Emmanuele Bassi
b0c0f24bd2 docs: Add ClickAction to the API reference
And clean up the reference index.
2010-05-25 11:53:59 +01:00
Emmanuele Bassi
4dd5088fe2 docs: Add Actor.get_accessible() to the API reference 2010-05-24 16:46:38 +01:00
Emmanuele Bassi
af84d97fca interval: Add a pointer variant to compute_value()
ClutterInterval.compute_value() computes the new value given a progress
and copies it to a given GValue. Since most of the time we want to pass
that very same value to another function that copies it again, we should
have a compute_value() variant that stores that computed value inside
ClutterInterval and returns a pointer to it. This way we initialize the
result GValue just once and we never copy it, as long as the Interval
instance is valid.
2010-05-24 15:06:14 +01:00
Emmanuele Bassi
489c16c6a6 docs: Align parameter names between header and source code 2010-05-24 14:20:23 +01:00
Emmanuele Bassi
07ffa015ab docs: Add ClutterState to the API reference 2010-05-24 12:00:43 +01:00
Emmanuele Bassi
5e3dc55666 Merge branch 'wip/constraints'
* wip/constraints: (24 commits)
  Add the Cogl API reference to the fixxref extra directories
  Document the internal MetaGroup class
  Remove the construct-only flag from ActorMeta:name
  doc: Remove gtk-doc annotations from the json-glib copy
  doc: Fix parameter documentation
  Add named modifiers for Action and Constraint
  Remove a redundant animation
  Set the stage resizable in test-constraints
  Use a 9 grid for the constraints test
  Miscellaneous documentation fixes
  docs: Document animating action and constraint properties
  docs: Document BindConstraint and AlignConstraint
  constraint: Rename BindConstraint:bind-axis
  constraints: Add AlignConstraint
  tests: Add a constraints interactive test
  constraint: Add BindConstraint
  actor: Implement Animatable
  animation: Use the new Animatable API for custom properties
  animatable: Add custom properties to Animatable
  constraint: Add ClutterConstraint base class
  ...

Conflicts:
	configure.ac
2010-05-21 10:55:09 +01:00
Robert Bragg
bb2d088cb1 math: Adds an experimental cogl_vector3_* API
This adds a math utility API for handling 3 component, single precision
float vectors with the following; mostly self explanatory functions:

cogl_vector3_init
cogl_vector3_init_zero
cogl_vector3_equal
cogl_vector3_equal_with_epsilon
cogl_vector3_copy
cogl_vector3_free
cogl_vector3_invert
cogl_vector3_add
cogl_vector3_subtract
cogl_vector3_multiply_scalar
cogl_vector3_divide_scalar
cogl_vector3_normalize
cogl_vector3_magnitude
cogl_vector3_cross_product
cogl_vector3_dot_product
cogl_vector3_distance

Since the API is experimental you will need to define
COGL_ENABLE_EXPERIMENTAL_API before including cogl.h if you want to use
the API.
2010-05-20 17:18:24 +01:00
Emmanuele Bassi
65678006a8 Add the Cogl API reference to the fixxref extra directories 2010-05-20 12:03:47 +01:00
Emmanuele Bassi
7ce2693944 Add named modifiers for Action and Constraint
The ClutterActor API should have modifier methods for adding, removing
and retrieving Actions and Constraints using the ClutterActorMeta:name
property - mostly, for convenience.
2010-05-20 11:19:51 +01:00
Emmanuele Bassi
6457f66976 Miscellaneous documentation fixes 2010-05-19 16:10:05 +01:00
Neil Roberts
7f2b2e1364 cogl-path: Document how a shape is filled
This adds some documentation to cogl_path_fill() describing the fill
rule Cogl uses.
2010-04-21 13:20:23 +01:00
Neil Roberts
75f1dc90b0 cogl-material: Add support for setting the wrap mode for a layer
Previously, Cogl's texture coordinate system was effectively always
GL_REPEAT so that if an application specifies coordinates outside the
range 0→1 it would get repeated copies of the texture. It would
however change the mode to GL_CLAMP_TO_EDGE if all of the coordinates
are in the range 0→1 so that in the common case that the whole texture
is being drawn with linear filtering it will not blend in edge pixels
from the opposite sides.

This patch adds the option for applications to change the wrap mode
per layer. There are now three wrap modes: 'repeat', 'clamp-to-edge'
and 'automatic'. The automatic map mode is the default and it
implements the previous behaviour. The wrap mode can be changed for
the s and t coordinates independently. I've tried to make the
internals support setting the r coordinate but as we don't support 3D
textures yet I haven't exposed any public API for it.

The texture backends still have a set_wrap_mode virtual but this value
is intended to be transitory and it will be changed whenever the
material is flushed (although the backends are expected to cache it so
that it won't use too many GL calls). In my understanding this value
was always meant to be transitory and all primitives were meant to set
the value before drawing. However there were comments suggesting that
this is not the expected behaviour. In particular the vertex buffer
drawing code never set a wrap mode so it would end up with whatever
the texture was previously used for. These issues are now fixed
because the material will always set the wrap modes.

There is code to manually implement clamp-to-edge for textures that
can't be hardware repeated. However this doesn't fully work because it
relies on being able to draw the stretched parts using quads with the
same values for tx1 and tx2. The texture iteration code doesn't
support this so it breaks. This is a separate bug and it isn't
trivially solved.

When flushing a material there are now extra options to set wrap mode
overrides. The overrides are an array of values for each layer that
specifies an override for the s, t or r coordinates. The primitives
use this to implement the automatic wrap mode. cogl_polygon also uses
it to set GL_CLAMP_TO_BORDER mode for its trick to render sliced
textures. Although this code has been added it looks like the sliced
trick has been broken for a while and I haven't attempted to fix it
here.

I've added a constant to represent the maximum number of layers that a
material supports so that I can size the overrides array. I've set it
to 32 because as far as I can tell we have that limit imposed anyway
because the other flush options use a guint32 to store a flag about
each layer. The overrides array ends up adding 32 bytes to each flush
options struct which may be a concern.

http://bugzilla.openedhand.com/show_bug.cgi?id=2063
2010-04-12 15:44:23 +01:00
Neil Roberts
9ee6dd240b cogl: Support retained paths
This adds three new API calls:

  CoglHandle cogl_path_get()
  void cogl_path_set(CoglHandle path)
  CoglHandle cogl_path_copy(CoglHandle path)

All of the fields relating to the path have been moved from the Cogl
context to a new CoglPath handle type. The cogl context now just
contains a CoglPath handle. All of the existing path commands
manipulate the data in the current path handle. cogl_path_new now just
creates a new path handle and unrefs the old one.

The path handle can be stored for later with cogl_path_get. The path
can then be copied with cogl_path_copy. Internally it implements
copy-on-write semantics with an extra optimisation that it will only
copy the data if the new path is modified, but not if the original
path is modified. It can do this because the only way to modify a path
is by appending to it so the copied path is able to store its own path
length and only render the nodes up to that length. For this to work
the copied path also needs to keep its own copies of the path extents
because the parent path may change these by adding nodes.

The clip stack now uses the cogl_path_copy mechanism to store paths in
the stack instead of directly copying the data. This should save some
memory and processing time.
2010-04-08 19:53:38 +01:00
Robert Bragg
45885850d2 cogl: renames cogl_multiply_matrix to cogl_transform
Although cogl_multiply_matrix was consistent with OpenGL, after further
consideration it was agreed that cogl_transform is a better name. Given
that it's in the global cogl_ namespace cogl_transform seems more self
documenting.
2010-04-08 14:37:01 +01:00
Owen W. Taylor
8df4a0b8fd actor: Add has_allocation() method
Add clutter_actor_has_allocation(), a method meant to be used when
deciding whether to call clutter_actor_get_allocation_box() or any
of its wrappers.

The get_allocation_box() method will, in case the allocation is invalid,
perform a costly re-allocation cycle to ensure that the returned box
is valid. The has_allocation() method is meant to be used if we have an
actor calling get_allocation_box() from outside the place where the
allocation is always guaranteed to be valid.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-03-26 00:46:31 +00:00
Emmanuele Bassi
7483f82566 docs: Add 1.4 index to the API references
Now that master has branched for the 1.3 development cycle.
2010-03-25 09:45:59 +00:00
Øyvind Kolås
09d8460a5c animator: s/clutter_animator_run/clutter_animator_start/
This is consistent with choice of words in clutter_timeline_start and
makes the API less surprising.
2010-03-02 17:03:03 +00:00
Emmanuele Bassi
74a27bbb1c docs: Documentation fixes
Let's see if we can get a 100% coverage for Clutter too.
2010-03-02 11:12:32 +00:00
Emmanuele Bassi
53eecb8469 docs: Add Animator.compute_value()
The clutter_animator_compute_value() has been added to the API, but it
is missing from the API reference.
2010-03-01 17:47:52 +00:00
Emmanuele Bassi
655cb966c0 docs: Add visual cue for Animator's key frames
We should explain what a "key frame" is for ClutterAnimator, possibly
with some sort of visual cue.

This allows me to demonstrate my poor skills at using Inkscape, as well
as my overall bad taste for graphics design.
2010-02-25 17:09:55 +00:00
Emmanuele Bassi
543e2d3f06 container: Expose create and destroy ChildMeta methods
It is conceivable that Container implementations might add children
outside of the Container::add() implementation - e.g. for packing at
a specific index. Since the addition (and removal) might happen outside
the common path we need to expose all the API that is implicitly called
by ClutterContainer when adding and removing a child - namely the
ChildMeta creation and destruction.
2010-02-25 12:55:12 +00:00
Emmanuele Bassi
8b040cac4d docs: Fixes for DeviceManager 2010-02-17 19:02:43 +00:00
Emmanuele Bassi
51a3e49c82 device: Allow updating devices from embedding toolkits
Embedding toolkits most likely will disable the event handling, so all
the input device code will not be executed. Unfortunately, the newly
added synthetic event generation of ENTER and LEAVE event pairs depends
on having input devices.

In order to unbreak things without reintroducing the madness of the
previous code we should allow embedding toolkits to just update the
state of an InputDevice by using the data contained inside the
ClutterEvent. This strategy has two obvious reasons:

  • the embedding toolkit is creating a ClutterEvent by translating
    a toolkit-native event anyway

  • this is exactly what ClutterStage does when processing events

We are, essentially, deferring input device handling to the embedding
toolkits, just like we're deferring event handling to them.
2010-02-17 18:21:50 +00:00
Damien Lespiau
262782feae docs: Add 2010 in COGL's Copyright notice
While at it, fix the usage of <year> in <copyright> to let the
stylesheet do the collation when having several years.
2010-02-12 17:29:51 +00:00
Emmanuele Bassi
124f30ccce docs: Fixes for Cogl 2010-02-12 15:52:07 +00:00
Emmanuele Bassi
f5d2f58b03 docs: Clean up the unused symbols for Cogl
Gtk-doc is reporting a lot of false positives in the unused text file,
mostly because of new private files that have been added to Cogl but not
to the gtk-doc ignore list for the Cogl API reference.

Once the false positives have been removed we have a couple of really
missing symbols that should be added to the cogl-sections.txt file.
2010-02-09 15:29:29 +00:00
Emmanuele Bassi
9aac36b47e docs: Move some Cogl defines in the private section
The PixelFormat bit and mask #defines should not be used and are there
mostly for convenience, so we can push them to the "private" sub-section
of the API reference.

This pushed Cogl's API reference coverage to 100%.
2010-02-09 14:48:11 +00:00
Emmanuele Bassi
7ebb1e7157 docs: Fixes for Cogl API reference
98% symbol docs coverage.
  335 symbols documented.
  0 symbols incomplete.
  8 not documented.

Not bad, if I may say so.
2010-02-09 14:41:37 +00:00
Emmanuele Bassi
d62ddc374f docs: Fixes for ClutterAnimator 2010-02-08 17:37:00 +00:00
Damien Lespiau
b7f049495b cogl-texture: Add a new constructor to turn CoglBuffers into textures
The only goal of using COGL buffers is to use them to create
textures. cogl_texture_new_from_buffer() is the new symbol to create
textures out of buffers.
2010-02-08 17:14:49 +00:00
Damien Lespiau
abbb668163 cogl-pixel-buffer: add a pixel buffer object class
This subclass of CoglBuffer aims at wrapping PBOs or other system
surfaces like DRM buffer objects. Two constructors are available:

cogl_pixel_buffer_new() with a size when you only care about the size of
the buffer (such a buffer can be used to store several texture data such
as the three planes of a I420 frame).

cogl_pixel_buffer_new_full() is more a 1:1 mapping between the data and
an underlying surface, with the possibility of having access to a low
level memory buffer that may have a stride.
2010-02-08 17:14:49 +00:00
Damien Lespiau
b5e9710cdf cogl-buffer: add an abstract class around openGL's buffer objects
Buffer objects are cool! This abstracts the buffer API first introduced
by GL_ARB_vertex_buffer_object and then extended to other objects.

The coglBuffer abstract class is intended to be the base class of all
the buffer objects, letting the user map() buffers. If the underlying
implementation does not support buffer objects (or only support VBO but
not FBO for instance), fallback paths should be provided.
2010-02-08 17:14:49 +00:00
Emmanuele Bassi
6106010b6f Merge remote branch 'origin/cwiiis-stage-resize'
* origin/cwiiis-stage-resize:
  [stage-x11] Set the default size differently
  [stage] Set default size correctly
  Revert "[x11] Don't set actor size on ConfigureNotify"
  [x11] Don't set actor size on ConfigureNotify
  [stage] Now that get_geometry works, use it
  [stage-x11] make get_geometry always get geometry
  [stage] Get the current size correctly
  [stage] Set minimum width/height to 1x1
  [stage] Add set/get_minumum_size
2010-02-08 10:34:22 +00:00
Øyvind Kolås
4cc269a468 Add ClutterAnimator
ClutterAnimator is a class for managing the animation of multiple
properties of multiple actors over time with keyframing of values.

The Animator class is meant to be used to effectively describe
animations using the ClutterScript definition format, and to construct
complex implicit animations from the ground up.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-02-07 18:25:19 +00:00
Chris Lord
fd11d3098f [stage] Add set/get_minumum_size
Add two functions to set/get the minimum stage size. This takes effect
when a stage is set to user resizable.
2010-02-06 11:23:37 +00:00
Neil Roberts
830f2402d4 Merge branch 'more-texture-backends'
This adds three new texture backends.

- CoglTexture2D: This is a trimmed down version of CoglTexture2DSliced
  which only supports a single texture and only works with the
  GL_TEXTURE_2D target. The code is a lot simpler so it has a less
  overheads than dealing with slices. Cogl will use this wherever
  possible.

- CoglSubTexture: This is used to get a CoglHandle to represent a
  subregion of another texture. The texture can be used as if it was a
  standalone texture but it does not need to copy the resources.

- CoglAtlasTexture: This collects RGB and RGBA textures into a single
  GL texture with the aim of reducing texture state changes and
  increasing batching. The backend will try to manage the atlas and
  may move the textures around to close gaps in the texture. By
  default all textures will be placed in the atlas.
2010-02-06 00:20:32 +00:00
Damien Lespiau
1b94cc9268 docs: fix new line in the cogl xml top level document
A comma in the FSF address is wrong. Supreme Offence.
2010-02-04 19:32:14 +00:00
Emmanuele Bassi
cb52581a24 text: Add :font-description
High level toolkits might wish to construct a PangoFontDescription and
then set it directly on a ClutterText actor proxy or sub-class.
ClutterText should have a :font-description property to set (and get)
the PangoFontDescription.

http://bugzilla.openedhand.com/show_bug.cgi?id=1960
2010-02-03 14:38:13 +00:00
Neil Roberts
145cc9d3df Merge remote branch 'master' into texture-debugging
Conflicts:
	clutter/cogl/cogl/cogl-context.h
2010-02-01 13:37:19 +00:00
Emmanuele Bassi
5f1c8a17e4 Merge branch 'device-manager'
* device-manager: (37 commits)
  x11: Re-enable XI1 extension keyboards
  x11: Always handle core device events before XI events
  docs: Documentation fixes for DeviceManager
  device-manager: Fix the signals definition
  docs: Add sections for InputDevice and DeviceManager
  docs: Add clutter_input_device_get_device_name()
  tests: Print out the device details on motion
  Always register core devices
  device: Remove unused is_default member
  win32: Experimental implementation of device support
  tests: Print the device name, as well as its Id
  x11: Fill out the :name property of the InputDevices
  device: Add the :name property to InputDevice
  x11: Store core devices on the X11 Backend singleton
  device: Unset the cursor actor when leaving the stage
  device: Add pointer actor getter
  x11: Discard the LeaveNotify for off-stage ButtonRelease
  device: Do not overwrite the stage for an InputDevice
  event: Off-stage button releases have a click count of 1
  event: Scroll events do not have click count
  ...
2010-02-01 11:26:56 +00:00
Neil Roberts
da392e24a5 docs: Fix some of the examples for the animation docs
In the example for clutter_actor_animate the "x" and "y" properties
are floats so they need to be passed float values in the var args
otherwise it will crash. There was also a missing comma.

There were some other minor problems with the behaviours example which
would cause it not to compile.
2010-01-27 12:07:37 +00:00
Damien Lespiau
87d19b8d18 cogl: Fix gl equivalent of blend string
An example of what could be the equivalent of
    "RBG = REPLACE(TEXTURE)
     A   = MODULATE(PREVIOUS,TEXTURE)"
using the ARB_texture_env_combine extension was given, but it seems that
a few typo were left:
    * remove a spurius GL_COMBINE_ALPHA
    * use the _ALPHA variant of SRCN and OPERANDN when setting up the
      alpha combiner
2010-01-26 17:25:25 +00:00
Emmanuele Bassi
dc39e9eff9 docs: Documentation fixes for DeviceManager 2010-01-20 00:38:53 +00:00
Emmanuele Bassi
0b47acf60b docs: Add sections for InputDevice and DeviceManager 2010-01-20 00:38:53 +00:00
Emmanuele Bassi
8ead5abba0 docs: Add clutter_input_device_get_device_name() 2010-01-20 00:38:53 +00:00
Emmanuele Bassi
55e4315aa5 device: Add pointer actor getter
ClutterInputDevice should have a getter method for retrieving the
reactive actor underneath the pointer.
2010-01-20 00:38:09 +00:00
Emmanuele Bassi
b3a42c3b09 docs: Update the API reference
Add the new symbols for InputDevice and DeviceManager
2010-01-20 00:38:08 +00:00
Emmanuele Bassi
ea662b9eca docs: Display the features section
The features section of the API reference is built but not used, and it
has some copy-and-paste errors.
2010-01-15 17:06:56 +00:00
Emmanuele Bassi
148145ea1a docs: Ignore clutter-profile.h 2010-01-15 14:47:20 +00:00
Neil Roberts
ead4399536 Merge branch 'master' into more-texture-backends 2010-01-15 12:15:46 +00:00
Damien Lespiau
4c1231c7fe media: Add an API to specify which font should be used for subtitles
Allow the user of the ClutterMedia interface to specify a Pango font
description to display subtitles. Even if the underlying implementation
of the interface does not natively use Pange, it must be capable of
parsing the grammar that pango_font_description_from_string() accepts.
2010-01-11 13:04:16 +00:00
Emmanuele Bassi
5157da9fc8 x11: Switch back to RGB visuals by default
Since asking for ARGB by default is still somewhat experimental on X11
and not every toolkit or complex widgets (like WebKit) still do not like
dealing with ARGB visuals, we should switch back to RGB by default - now
that at least we know it works.

For applications (and toolkit integration libraries) that want to enable
the ClutterStage:use-alpha property there is a new function:

  void clutter_x11_set_use_argb_visual (gboolean use_argb);

which needs to be called before clutter_init().

The CLUTTER_DISABLE_ARGB_VISUAL environment variable can still be used
to force this value off at run-time.
2010-01-08 15:09:21 +00:00
Damien Lespiau
9599adbd82 doc: Fix media::{get,set}_subtitle_uri() symbol names
At first, those symbols were called {get,set}_subtitles_uri() but were
renamed to {get,set}_subtitle_uri() without updating the
clutter-section.txt file.

This fix makes gtk-doc document those symbols again.
2010-01-08 11:36:58 +00:00
Damien Lespiau
10963d1ae0 [media] Add an API to play a subtitle file along with the media
Allow the user of the ClutterMedia interface to specify an external (as
in not multiplexed with the audio/video streams) location of a subtitle
stream.
2010-01-04 16:25:48 +01:00
Emmanuele Bassi
3d350078a8 Merge branch 'animate-layout-manager' into ebassi-next
* animate-layout-manager:
  layout-manager: Document the animation support
  layout-manager: Rewind the timeline in begin_animation()
  box-layout: Remove the allocations hash table
  docs: Clean up the README file
  layout: Let begin_animation() return the Alpha
  box-layout: Add knobs for controlling animations
  box-layout: Animate layout properties
  layout: Add animation support to LayoutManager
  Add ActorBox animation methods
2009-12-23 10:38:02 +00:00
Emmanuele Bassi
a09ac0b27c Merge branch 'stage-use-alpha' into ebassi-next
* stage-use-alpha:
  tests: Use accessor methods for :use-alpha
  stage: Add accessors for :use-alpha
  tests: Allow setting the stage opacity in test-paint-wrapper
  stage: Premultiply the stage color
  stage: Composite the opacity with the alpha channel
  glx: Always request an ARGB visual
  stage: Add :use-alpha property
  materials: Get the right blend function for alpha
2009-12-20 17:39:12 +00:00
Emmanuele Bassi
b6bd8be6cb Merge branch 'internal-flag' into ebassi-next
* internal-flag:
  conform: Add test unit for the destruction of Containers
  actor: Add internal child flag
  Clean up whitespace, indentation and comments
2009-12-20 17:33:51 +00:00
Emmanuele Bassi
1520ba6190 actor: Add internal child flag
ClutterActor checks, when destroying and reparenting, if the parent
actor implements the Container interface, and automatically calls the
remove() method to perform a clean removal.

Actors implementing Container, though, might have internal children;
that is, children that are not added through the Container API. It is
already possible to iterate through them using the Container API to
avoid breaking invariants - but calling clutter_actor_destroy() on
these children (even from the Container implementation, and thus outside
of Clutter's control) will either lead to leaks or to segmentation
faults.

Clutter needs a way to distinguish a clutter_actor_set_parent() done on
an internal child from one done on a "public" child; for this reason, a
push/pop pair of functions should be available to Actor implementations
to mark the section where they wish to add internal children:

  ➔ clutter_actor_push_internal ();
    ...
    clutter_actor_set_parent (child1, parent);
    clutter_actor_set_parent (child2, parent);
    ...
  ➔ clutter_actor_pop_internal ();

The set_parent() call will automatically set the newly added
INTERNAL_CHILD private flag on each child, and both
clutter_actor_destroy() and clutter_actor_unparent() will check for the
flag before deciding whether to call the Container's remove method.
2009-12-18 23:33:14 +00:00
Emmanuele Bassi
2e6397c391 box-layout: Add knobs for controlling animations
ClutterLayoutManager does not have any state associated with it, and
defers all the state to its sub-classes.

The BoxLayout is thus in charge of controlling:

  • whether or not animations should be used
  • the duration of the animation
  • the easing mode of the animation

By adding three new properties:

  • ClutterBoxLayout:use-animations
  • ClutterBoxLayout:easing-duration
  • ClutterBoxLayout:easing-mode

And their relative accessors pairs we can make BoxLayout decide whether
or not, and with which parameters, call the begin_animation() method of
ClutterLayoutManager.

The test-box-layout has been modified to reflect this new functionality,
by checking the key-press event for the 'a' key symbol to toggle the use
of animations.
2009-12-13 01:15:02 +00:00
Emmanuele Bassi
f94a903d9e layout: Add animation support to LayoutManager
In order to animate a fluid layout we cannot use the common animation
code paths as they will override the size request and allocation paths
that are handled by the layout manager itself.

One way to introduce animations in the allocation sequence is to use a
Timeline and an Alpha to compute a progress value and then use that
value to interpolate an ActorBox between the initial and final states of
the animation - with the initial state being the last allocation of the
child prior to the animation start, and the final state the allocation
of the child at the end; for every frame of the Timeline we then queue a
relayout on the layout manager's container, which will result in an
animation.

ClutterLayoutManager is the most likely place to add a generic API for
beginning and ending an animation, as well as the place to provide a
default code path to create the ancillary Timeline and Alpha instances
needed to drive the animation.

A LayoutManager sub-class will need to:

  • call clutter_layout_manager_begin_animation() whenever it should
    animate between two states, for instance: whenever a layout property
    changes value;
  • eventually override begin_animation() and end_animation() in case
    further state needs to be set up, and then chain up to the default
    implementation provided by LayoutManager;
  • if a completely different implementation is required, the layout
    manager sub-class should override begin_animation(), end_animation()
    and get_animation_progress().

Inside the allocate() implementation the sub-class should also
interpolate between the last known allocation of a child and the newly
computed allocation.
2009-12-13 01:13:42 +00:00
Emmanuele Bassi
999359d64c Add ActorBox animation methods
ClutterActorBox should have an interpolate() method that allows to
compute the intermediate values between two states, given a progress
value, e.g.:

        clutter_actor_box_interpolate (start, end, alpha, &result);

Another utility method, useful for layout managers, is a modifier
that clamps the members of the actor box to the nearest integer
value.
2009-12-11 23:48:58 +00:00
Colin Walters
1374b5aac9 Add clutter_get_current_event
When getting signals from higher level toolkits, occasionally
one wants access to the underlying event; say for a Button
widget's "clicked" signal, to get the keyboard state.

Rather than having all of the highlevel widgets emit
ClutterEvent just for the more unusual use cases,
add a global function to access the event state.

http://bugzilla.openedhand.com/show_bug.cgi?id=1888

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-12-10 22:20:36 +00:00
Emmanuele Bassi
1208e47198 stage: Add accessors for :use-alpha
Use real accessors for the :use-alpha property.
2009-12-09 02:05:24 +00:00
Emmanuele Bassi
28cb2cdab5 Remove clutter_set_default_text_direction()
Setting the default text direction programmatically is wrong: it is a
value dependent on the locale or by the environment.
2009-12-07 19:00:55 +00:00
Emmanuele Bassi
9ccdf2eb02 box: Add relative packing methods
ClutterBox should provide some convenience functions to pack a new child
at a given position, either an absolute index or relative to a sibling.
2009-12-04 16:54:22 +00:00
Neil Roberts
9752493272 cogl: Add a sub texture backend
This adds a new texture backend which represents a sub texture of a
larger texture. The texture is created with a reference to the full
texture and a set of coordinates describing the region. The backend
simply defers to the full texture for all operations and maps the
coordinates to the other range. You can also use coordinates outside
the range [0,1] to create a repeated version of the full texture.

A new public API function called cogl_texture_new_from_sub_texture is
available to create the sub texture.
2009-12-02 22:03:08 +00:00
Emmanuele Bassi
1c47638db4 docs: Add missing symbols to clutter-sections.txt 2009-12-01 14:59:44 +00:00
Emmanuele Bassi
586750751a Merge branch 'text-direction'
* text-direction:
  docs: Add text-direction accessors
  Set the default language on the Pango context
  actor: Set text direction on parenting
  tests: Display the index inside text-box-layout
  box-layout: Honour :text-direction
  text: Dirty layout cache on text direction changes
  actor: Add :text-direction property
  Use the newly added ClutterTextDirection enumeration
  Add ClutterTextDirection enumeration
2009-12-01 14:55:19 +00:00
Emmanuele Bassi
6e99c1aefe docs: Add text-direction accessors 2009-12-01 14:55:01 +00:00
Emmanuele Bassi
15a04a1dd3 layout-manager: Create LayoutMeta on demand
The ClutterLayoutMeta instances should be created on demand, whenever
the layout manager needs them - if the layout manager supports layout
properties.

This removes the requirement to call add_child_meta() and
remove_child_meta() on add and remove respectively; it also simplifies
the implementation of LayoutManager sub-classes since we can add
fallback code in the base abstract class.

Eventually, this will also lead to an easier to implement ClutterScript
parser for layout properties.

With the new scheme, the ClutterLayoutMeta instance is created whenever
the layout manager tries to access it; if there isn't an instance
already attached to the container's child, one is created -- assuming
that the LayoutManager sub-class has overridden the
get_child_meta_type() virtual function and it's returning a valid GType.

We can also provide a default implementation for create_child_meta(),
by getting the GType and instantiating a ClutterLayoutMeta with all the
fields already set. If the layout manager requires more work then it can
obviously override the default implementation (and even chain up to it).

The ClutterBox actor has been updated, as well as the ClutterBoxLayout
layout manager, to take advantage of the changes of LayoutManager.
2009-11-30 19:11:00 +00:00
Robert Bragg
439f8c62b0 cogl: deprecate cogl_draw_buffer API and replace with a cogl_framebuffer API
cogl_push_draw_buffer, cogl_set_draw_buffer and cogl_pop_draw_buffer are now
deprecated and new code should use the new cogl_framebuffer_* API instead.

Code that previously did:
    cogl_push_draw_buffer ();
    cogl_set_draw_buffer (COGL_OFFSCREEN_BUFFER, buffer);
    /* draw */
    cogl_pop_draw_buffer ();
should now be re-written as:
    cogl_push_framebuffer (buffer);
    /* draw */
    cogl_pop_framebuffer ();

As can be seen from the example above the rename has been used as an
opportunity to remove the redundant target argument from
cogl_set_draw_buffer; it now only takes one call to redirect to an offscreen
buffer, and finally the term framebuffer may be a bit more familiar to
anyone coming from an OpenGL background.
2009-11-26 19:33:14 +00:00
Robert Bragg
4a63af0c63 docs: Don't document cogl_flush_gl_state as public API
This function was #if 0'd before we released Clutter 1.0 so there's no
implementation of it.  At some point we thought it might assist with
developers breaking out into raw OpenGL.  Breaking out to raw GL is a
difficult problem though so we decided instead we will wait for a specific
use case to arrise before trying to support it.
2009-11-24 17:58:22 +00:00
Emmanuele Bassi
6fd80ffbd9 docs: Add indices to the Cogl API reference
The Clutter API reference has an index of the symbols for each minor
version, and a list of deprecated symbols. The Cogl API reference
should have the same layout.
2009-11-19 14:30:01 +00:00
Emmanuele Bassi
1bf8db9e75 docs: Fix Cogl API reference build
• Ignore all the private header files

• Add all missing/unused symbols

• Remove deprecated symbols from 0.*
2009-11-19 13:56:42 +00:00
Emmanuele Bassi
4734b7be41 docs: Detail the Clutter debugging flags 2009-11-14 13:03:59 +00:00
Joshua Lock
58f1dfcf35 docs: Fix OS X docs to install Ports in correct order
The order in which the MacPorts are installed is important otherwise we open
the user up to a world of pain.
This patch also tweaks the OS X docs to follow the formatting of the rest of
the docs and to discuss the option of GtkDoc.

http://bugzilla.openedhand.com/show_bug.cgi?id=1865
2009-11-06 11:48:08 +00:00
Robert Bragg
272e227109 [cogl-clip] deprecate parts and cleanup the API
cogl_clip_push() which accepts a rectangle in model space shouldn't have
been defined to take x,y,width,height arguments because this isn't consistant
with other Cogl API dealing with model space rectangles.  If you are using a
coordinate system with the origin at the center and the y+ extending up,
then x,y,width,height isn't as natural as (x0,y0)(x1,y1). This API has
now been replace with cogl_clip_push_rectangle()

(As a general note: the Cogl API should only use the x,y,width,height style
when the appropriate coordinate space is defined by Cogl to have a top left
origin.  E.g.  window coordinates, or potentially texture coordinates)

cogl_clip_push_window_rect() shouldn't have been defined to take float
arguments since we only clip with integral pixel precision. We also
shouldn't have abbreviated "rectangle". This API has been replaced with
cogl_clip_push_window_rectangle()

cogl_clip_ensure() wasn't documented at all in Clutter 1.0 and probably
no one even knew it existed. This API isn't useful, and so it's now
deprecated. If no one complains we may remove the API altogether for
Clutter 1.2.

cogl_clip_stack_save() and cogl_clip_stack_restore() were originally added
to allow us to save/restore the clip when switching to/from offscreen
rendering.  Now that offscreen draw buffers are defined to own their clip
state and the state will be automatically saved and restored this API is now
redundant and so deprecated.
2009-11-05 21:10:17 +00:00
Emmanuele Bassi
f551cbfb61 Add run-time version checks
Just like CLUTTER_CHECK_VERSION does version checking at compile
time, we need a way to verify the version of the library that we
are linking against. This is mostly needed for language bindings
and for run-time loadable modules -- when we'll get those.
2009-10-30 11:02:35 +00:00
Emmanuele Bassi
f0b434918b docs: Add images for layout managers
It's easier to show the layout manager policy with a simple
screen shot coming from our interactive tests.
2009-10-23 17:32:18 +01:00
Emmanuele Bassi
4996b2224a docs: Rename the Shader and StageManager sections 2009-10-21 17:43:34 +01:00
Robert Bragg
5e5d94dfbe [cogl] Removes the cogl-current-matrix abstraction
The indirection through this API isn't necessary since we no longer
arbitrate between the OpenGL matrix API and Cogl's client side API.  Also it
doesn't help to maintain an OpenGL style matrix mode API for internal use
since it's awkward to keep restoring the MODELVIEW mode and easy enough to
directly work with the matrix stacks of interest.

This replaces use of the _cogl_current_matrix API with direct use of the
_cogl_matrix_stack API.  All the unused cogl_current_matrix API is removed
and the matrix utility code left in cogl-current-matrix.c was moved to
cogl.c.
2009-10-20 12:32:50 +01:00
Emmanuele Bassi
23cd0b7925 docs: Documentation fixes
• Fix list_stages() and peek_stages() documentation

 • Fix clutter_text_set_preedit_string() arguments in the header
   to match source and documentation

 • Add clutter_units_cm() to the private section for Units

 • Rename the LayoutManager section

 • Add FlowLayout:homogeneous accessors
2009-10-19 12:01:38 +01:00
Emmanuele Bassi
ba25571c8e Merge branch 'layout-manager'
* layout-manager: (50 commits)
  docs: Reword a link
  layout, docs: Add more documentation to LayoutManager
  layout, docs: Fix description of Bin properties
  layout, bin: Use ceilf() instead of casting to int
  layout, docs: Add long description for FlowLayout
  layout, box: Clean up
  layout, box: Write long description for Box
  layout, docs: Remove unused functions
  layout: Document BoxLayout
  layout: Add BoxLayout, a single line layout manager
  layout: Report the correct size of FlowLayout
  layout: Resizing the stage resizes the FlowLayout box
  layout: Use the get_request_mode() getter in BinLayout
  layout: Change the request-mode along with the orientation
  actor: Add set_request_mode() method
  [layout] Remove FlowLayout:wrap
  [layout] Rename BinLayout and FlowLayout interactive tests
  [layout] Skip invisible children in FlowLayout
  [layout] Clean up and document FlowLayout
  [layout] Snap children of FlowLayout to column/row
  ...
2009-10-19 11:45:15 +01:00
Robert Bragg
43efab46bc Intial Re-layout of the Cogl source code and introduction of a Cogl Winsys
As part of an incremental process to have Cogl be a standalone project we
want to re-consider how we organise the Cogl source code.

Currently this is the structure I'm aiming for:
cogl/
    cogl/
	<put common source here>
	winsys/
	   cogl-glx.c
	   cogl-wgl.c
	driver/
	    gl/
	    gles/
	os/ ?
    utils/
	cogl-fixed
	cogl-matrix-stack?
        cogl-journal?
        cogl-primitives?
    pango/

The new winsys component is a starting point for migrating window system
code (i.e.  x11,glx,wgl,osx,egl etc) from Clutter to Cogl.

The utils/ and pango/ directories aren't added by this commit, but they are
noted because I plan to add them soon.

Overview of the planned structure:

* The winsys/ API is the API that binds OpenGL to a specific window system,
  be that X11 or win32 etc.  Example are glx, wgl and egl. Much of the logic
  under clutter/{glx,osx,win32 etc} should migrate here.

* Note there is also the idea of a winsys-base that may represent a window
  system for which there are multiple winsys APIs.  An example of this is
  x11, since glx and egl may both be used with x11.  (currently only Clutter
  has the idea of a winsys-base)

* The driver/ represents a specific varient of OpenGL. Currently we have "gl"
  representing OpenGL 1.4-2.1 (mostly fixed function) and "gles" representing
  GLES 1.1 (fixed funciton) and 2.0 (fully shader based)

* Everything under cogl/ should fundamentally be supporting access to the
  GPU.  Essentially Cogl's most basic requirement is to provide a nice GPU
  Graphics API and drawing a line between this and the utility functionality
  we add to support Clutter should help keep this lean and maintainable.

* Code under utils/ as suggested builds on cogl/ adding more convenient
  APIs or mechanism to optimize special cases. Broadly speaking you can
  compare cogl/ to OpenGL and utils/ to GLU.

* clutter/pango will be moved to clutter/cogl/pango

How some of the internal configure.ac/pkg-config terminology has changed:
backendextra -> CLUTTER_WINSYS_BASE # e.g. "x11"
backendextralib -> CLUTTER_WINSYS_BASE_LIB # e.g. "x11/libclutter-x11.la"
clutterbackend -> {CLUTTER,COGL}_WINSYS # e.g. "glx"
CLUTTER_FLAVOUR -> {CLUTTER,COGL}_WINSYS
clutterbackendlib -> CLUTTER_WINSYS_LIB
CLUTTER_COGL -> COGL_DRIVER # e.g. "gl"

Note: The CLUTTER_FLAVOUR and CLUTTER_COGL defines are kept for apps

As the first thing to take advantage of the new winsys component in Cogl;
cogl_get_proc_address() has been moved from cogl/{gl,gles}/cogl.c into
cogl/common/cogl.c and this common implementation first trys
_cogl_winsys_get_proc_address() but if that fails then it falls back to
gmodule.
2009-10-16 18:58:50 +01:00
Emmanuele Bassi
2883728387 [text] Add pre-edit string to ClutterText
Input Methods require to be able to set a "pre-edit string", that is
a string that it's just displayed into the Text actor without being
committed to the actor's buffer. The string might require custom Pango
attributes, and an update of the cursor position.
2009-10-16 12:45:29 +01:00
Emmanuele Bassi
9f06f726d4 layout, docs: Remove unused functions
The :wrap property and its accessor functions were removed from
ClutterFlowLayout.
2009-10-14 11:31:48 +01:00
Emmanuele Bassi
cd3dce1d5d layout: Document BoxLayout
Add BoxLayout to the API reference.
2009-10-14 11:31:48 +01:00
Emmanuele Bassi
b5895335ab actor: Add set_request_mode() method
We should not require the use g_object_set()/_get() for accessing
the :request-mode property. A proper accessors pair should be
preferred.
2009-10-14 11:31:30 +01:00
Emmanuele Bassi
5737cf869f [layout] Initial implementation of FlowLayout
FlowLayout is a layout manager that arranges its children in a
reflowing line; the orientation controls the major axis for the
layout: horizontal, for reflow on the Y axis, and vertical, for
reflow on the X axis.
2009-10-14 11:31:30 +01:00
Emmanuele Bassi
c98388bb01 [layout, box] Add Box:color
Allow setting the background color of a ClutterBox
2009-10-14 11:31:29 +01:00
Emmanuele Bassi
431a63d04a [layout] Store and use the container inside BinLayout
The BinLayout should store a pointer to the Container that it is
using it as the layout manager.

This allows us to fix the API and drop the additional Container
arguments from set_alignment() and get_alignment().

This also allows us to add a ClutterBinLayout::add() method which
adds an actor and sets the alignment policies without dealing with
variadic arguments functions and GValue (de)marshalling.
2009-10-14 11:31:29 +01:00
Emmanuele Bassi
755896664f [layout] Set a back pointer to Box inside the layout
Use the LayoutManager API to set a back pointer to the Box actor
inside the LayoutManager used by the box.

This also allows us to replace the LayoutManager on a Box, since
the LayoutManager will be able to replace all the metadata if
needed.
2009-10-14 11:31:29 +01:00
Emmanuele Bassi
9117ee2056 [layout] Allow taking a back pointer to the Container
The LayoutManager implementation might opt to take a back pointer
to the Container that is using the layout instance; this allows
direct access to the container itself from within the implementation.
2009-10-14 11:31:29 +01:00
Emmanuele Bassi
f58bdbad15 [layout] Rename Box::add to Box::pack
Since ClutterBox is a ClutterContainer we should avoid naming
collisions between methods.
2009-10-14 11:31:29 +01:00
Emmanuele Bassi
aaae60e178 [layout] Implement ClutterBox::add
The ClutterBox::add method is a simple wrapper around the Container
add_actor() method and the LayoutManager layout properties API. It
allows adding an actor to a Box and setting the layout properties in
one call.

If the LayoutManager used by the Box does not support layout properties
then the add() method short-circuits out.

Along with the varargs version of the method there's also a vector-based
variant, for language bindings to use.
2009-10-14 11:31:29 +01:00
Emmanuele Bassi
a2086f1178 [layout] Add LayoutMeta
Instead of overloading ClutterChildMeta with both container and layout
metadata and delegate to every LayoutManager implementation to keep a
backpointer to the layout manager instance, we can simply subclass
ChildMeta into LayoutMeta and presto! everything works out pretty well
for everyone.
2009-10-14 11:31:26 +01:00
Emmanuele Bassi
899db6f226 [layout, docs] Add layout managers sections
Add LayoutManager and its subclasses, and the Box actor to the
gtk-doc machinery needed to generate the API reference.
2009-10-14 11:30:43 +01:00
Emmanuele Bassi
0e33c10048 docs: Allow XInclude fallback for the annotation glossary 2009-10-14 09:07:11 +01:00
Emmanuele Bassi
a99f693c85 docs: Make StageManager a public class
The StageManager API is useful to track the stages of an application.
It will also be useful when we land the modules API.
2009-10-14 09:07:11 +01:00
Emmanuele Bassi
1f207c00d9 docs: Add the "clipping" section to the COGL API reference
All the clip-related API in COGL is missing from the API reference
because the cogl-clipping section is not included inside the main
index file.
2009-10-07 17:41:54 +01:00
Damien Lespiau
8605073edb [units] Add support for centimeters
The only tricky part of the patch is to remember that 1cm is 10mm.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-10-07 16:06:26 +01:00
Emmanuele Bassi
6ddffac935 [docs] Update the "Subclassing Actor" chapter
The chapter on how to subclass ClutterActor inside the API reference for
Clutter is still using ClutterUnit and referencing to concepts that have
been changed since the document was written.
2009-09-27 11:39:25 +01:00
Emmanuele Bassi
c5195dda15 [docs] Add fixxref for Cairo symbols
Let gtk-doc resolve the Cairo types and symbols to the installed
Cairo documentation.
2009-09-09 16:15:54 +01:00
Emmanuele Bassi
f4e272ee9b [docs] Add a Path migration guide
ClutterBehaviourPath has been changed and ClutterBehaviourBspline has
been removed; now we use ClutterPath everywhere we need to describe a
path. This warrants a chapter in the migration guide.
2009-09-09 16:01:07 +01:00
Emmanuele Bassi
7783635af3 [docs] Add more collateral documentation
* Add the main Glossary for Clutter terms

* Add the annotation glossary, as generated by gtk-doc

* Add the objects index and tree
2009-09-03 16:51:14 +01:00
Emmanuele Bassi
d8d344f529 [docs] Add Interval get_type function
The get_type() function for ClutterInterval is missing from the
known GObject types, so gtk-doc doesn't know that it has to
introspect it for hierarchy, properties and signals.
2009-08-25 12:39:40 +01:00
Emmanuele Bassi
899f051cd9 [animation] Add Animation::update()
Currently, to update a property inside an animation you have to
get the interval for that property and then call the set_final_value()
method.

We can provide a simpler, bind()-like method for the convenience of
the developers that just validates everything and then calls the
Interval.set_final_value().
2009-08-25 12:16:41 +01:00
Emmanuele Bassi
6e1f9ad9b6 [docs] Remove the version number from the title
The version number in the title made sense when we were breaking
API with every minor release. Now that we're API stable we can
drop that and make the output in Devhelp and on the website slightly
more good looking.
2009-08-13 16:15:04 +01:00
Emmanuele Bassi
7963254c23 [docs] Close a tag 2009-08-04 11:39:09 +01:00
Emmanuele Bassi
f8a964b422 [cogl] Expose cogl_is_vertex_buffer()
The function is public and available in the shared object, but
it's not present in the header, so this is not an API/ABI change.
2009-08-04 11:15:05 +01:00
Joshua Lock
abdcf4debb [docs] Update building instructions for OS X
Recommend OS X users install the dependencies using MacPorts and build
Clutter themselves.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-07-31 10:28:50 +01:00
Emmanuele Bassi
a5d6b23308 [units] Add binding-friendly initializers
We should follow the convention for boxed types initializers of:

  <type_name>_from_<another_type> (boxed, value)

For ClutterUnits as well; so:

  clutter_units_pixels -> clutter_units_from_pixels
  clutter_units_em     -> clutter_units_from_em
  ...

We should still keep the short-hand version as a macro, though.
2009-07-28 13:46:11 +01:00
Emmanuele Bassi
76140c5f52 [build] Use API_VERSION, not MAJORMINOR
The correct macro for Clutter's API version is CLUTTER_API_VERSION,
not CLUTTER_MAJORMINOR anymore.
2009-07-28 11:42:58 +01:00
Emmanuele Bassi
29d8d60487 [docs] Fix wrong XML elements 2009-07-21 16:35:50 +01:00
Emmanuele Bassi
2e38730eb1 [docs] Update the Actor subclassing documentation
Mention map/unmap and fix the examples code.

Update the Container virtual functions.
2009-07-21 14:13:31 +01:00
Emmanuele Bassi
ed005685c9 [docs] Update the "creating new behaviours" chapter
The signature of the ::alpha_notify virtual function has been
changed with the switch to float ClutterAlpha.
2009-07-21 11:51:20 +01:00
Emmanuele Bassi
c87fea6cf1 [docs] Update the building instructions
New configure script command line switches have been added since
the last time we updated the documentation.
2009-07-21 11:50:08 +01:00
Emmanuele Bassi
78773ab6fe [docs] Update the animations tutorial
Bring the Animation framework introduction/tutorial up to the 1.0
API for timelines and animations.
2009-07-21 11:29:52 +01:00
Emmanuele Bassi
605927db5b [docs] Fix typo in the effects migration guide
Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1706
2009-07-21 09:20:16 +01:00
Emmanuele Bassi
b1d98c25f4 [doc] Miscellaneous documentation fixes
Remove private symbols, and add missing public ones.
2009-07-20 12:49:35 +01:00
Emmanuele Bassi
56ef6727b5 Allow disabling motion event throttling
It might be desirable for some applications and/or platforms to get
every motion event that was delivered to Clutter from the windowing
backend. By adding a per-stage flag we can bypass the throttling
done when processing the events.

  http://bugzilla.openedhand.com/show_bug.cgi?id=1665
2009-07-20 11:44:52 +01:00
Robert Bragg
da37e1e27d [doc] Remove references to cogl_vertex_buffer_delete_indices
These referencese were left over from before indices got CoglHandles to
uniquely identify them.  cogl_handle_unref can be used to delete indices
now.
2009-07-19 10:23:00 +01:00
Emmanuele Bassi
af5e432ba9 [actor] Allow querying whether we are painted by a Clone
It would be useful inside a custom actor's paint function to be able to
tell if this is a primary paint call, or if we are in fact painting on
behalf of a clone.

In Mutter we have an optimization not to paint occluded windows; this is
desirable for the windows per se, to conserve bandwith to the card, but
if something like an application switcher is using clones of these windows,
they will not get painted either; currently we have no way of
differentiating between the two.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1685
2009-07-13 16:18:27 +01:00
Emmanuele Bassi
37bd35f592 [actor] Allow changing the transformations matrix
Currently, the transformation matrix for an actor is constructed
from scenegraph-related accessors. An actor, though, can call COGL
API to add new transformations inside the paint() implementation,
for instance:

  static void
  my_foo_paint (ClutterActor *a)
  {
    ...
    cogl_translate (-scroll_x, -scroll_y, 0);
    ...
  }

Unfortunately these transformations will be completely ignored by
the scenegraph machinery; for instance, getting the actor-relative
coordinates from event coordinates is going to break badly because
of this.

In order to make the scenegraph aware of the potential of additional
transformations, we need a ::apply_transform() virtual function. This
vfunc will pass a CoglMatrix which can be used to apply additional
operations:

  static void
  my_foo_apply_transform (ClutterActor *a, CoglMatrix *m)
  {
    CLUTTER_ACTOR_CLASS (my_foo_parent_class)->apply_transform (a, m);
    ...
    cogl_matrix_translate (m, -scroll_x, -scroll_y, 0);
    ...
  }

The ::paint() implementation will be called with the actor already
using the newly applied transformation matrix, as expected:

  static void
  my_foo_paint (ClutterActor *a)
  {
    ...
  }

The ::apply_transform() implementations *must* chain up, so that the
various transformations of each class are preserved. The default
implementation inside ClutterActor applies all the transformations
defined by the scenegraph-related accessors.

Actors performing transformations inside the paint() function will
continue to work as previously.
2009-07-01 15:30:21 +01:00
Robert Bragg
33400c0aae [cogl] Improve ability to break out into raw OpenGL via begin/end mechanism
Although we wouldn't recommend developers try and interleve OpenGL drawing
with Cogl drawing - we would prefer patches that improve Cogl to avoid this
if possible - we are providing a simple mechanism that will at least give
developers a fighting chance if they find it necissary.

Note: we aren't helping developers change OpenGL state to modify the
behaviour of Cogl drawing functions - it's unlikley that can ever be
reliably supported - but if they are trying to do something like:

   - setup some OpenGL state.
   - draw using OpenGL (e.g. glDrawArrays() )
   - reset modified OpenGL state.
   - continue using Cogl to draw

They should surround their blocks of raw OpenGL with cogl_begin_gl() and
cogl_end_gl():

   cogl_begin_gl ();
   - setup some OpenGL state.
   - draw using OpenGL (e.g. glDrawArrays() )
   - reset modified OpenGL state.
   cogl_end_gl ();
   - continue using Cogl to draw

Again; we aren't supporting code like this:
   - setup some OpenGL state.
   - use Cogl to draw
   - reset modified OpenGL state.
When the internals of Cogl evolves, this is very liable to break.

cogl_begin_gl() will flush all internally batched Cogl primitives, and emit
all internal Cogl state to OpenGL as if it were going to draw something
itself.

The result is that the OpenGL modelview matrix will be setup; the state
corresponding to the current source material will be setup and other world
state such as backface culling, depth and fogging enabledness will be also
be sent to OpenGL.

Note: no special material state is flushed, so if developers want Cogl to setup
a simplified material state it is the their responsibility to set a simple
source material before calling cogl_begin_gl. E.g. by calling
cogl_set_source_color4ub().

Note: It is the developers responsibility to restore any OpenGL state that they
modify to how it was after calling cogl_begin_gl() if they don't do this then
the result of further Cogl calls is undefined.
2009-06-30 17:13:38 +01:00
Robert Bragg
6d9498da7c Adds a cogl_flush() to give developers breaking into raw GL a fighting chance
This function should only need to be called in exceptional circumstances
since Cogl can normally determine internally when a flush is necessary.

As an optimization Cogl drawing functions may batch up primitives
internally, so if you are trying to use raw GL outside of Cogl you stand a
better chance of being successful if you ask Cogl to flush any batched
geometry before making your state changes.

cogl_flush() ensures that the underlying driver is issued all the commands
necessary to draw the batched primitives.  It provides no guarantees about
when the driver will complete the rendering.

This provides no guarantees about the GL state upon returning and to avoid
confusing Cogl you should aim to restore any changes you make before
resuming use of Cogl.

If you are making state changes with the intention of affecting Cogl drawing
primitives you are 100% on your own since you stand a good chance of
conflicting with Cogl internals.  For example clutter-gst which currently
uses direct GL calls to bind ARBfp programs will very likely break when Cogl
starts to use ARBfb programs internally for the material API, but for now it
can use cogl_flush() to at least ensure that the ARBfp program isn't applied
to additional primitives.

This does not provide a robust generalized solution supporting safe use of
raw GL, its use is very much discouraged.
2009-06-30 17:13:38 +01:00