mirror of
https://github.com/brl/mutter.git
synced 2025-08-06 16:44:40 +00:00
Bug 1172 - Disjoint paths and clip to path
* clutter/cogl/cogl-path.h: * clutter/cogl/common/cogl-primitives.c: * clutter/cogl/common/cogl-primitives.h: * clutter/cogl/gl/cogl-primitives.c: * clutter/cogl/gles/cogl-primitives.c: Changed the semantics of cogl_path_move_to. Previously this always started a new path but now it instead starts a new disjoint sub path. The path isn't cleared until you call either cogl_path_stroke, cogl_path_fill or cogl_path_new. There are also cogl_path_stroke_preserve and cogl_path_fill_preserve functions. * clutter/cogl/gl/cogl-context.c: * clutter/cogl/gl/cogl-context.h: * clutter/cogl/gles/cogl-context.c: * clutter/cogl/gles/cogl-context.h: Convert the path nodes array to a GArray. * clutter/cogl/gl/cogl-texture.c: * clutter/cogl/gles/cogl-texture.c: Call cogl_clip_ensure * clutter/cogl/common/cogl-clip-stack.c: * clutter/cogl/common/cogl-clip-stack.h: Simplified the clip stack code quite a bit to make it more maintainable. Previously whenever you added a new clip it would go through a separate route to immediately intersect with the current clip and when you removed it again it would immediately rebuild the entire clip. Now when you add or remove a clip it doesn't do anything immediately but just sets a dirty flag instead. * clutter/cogl/gl/cogl.c: * clutter/cogl/gles/cogl.c: Taken away the code to intersect stencil clips when there is exactly one stencil bit. It won't work with path clips and I don't know of any platform that doesn't have eight or zero stencil bits. It needs at least three bits to intersect a path with an existing clip. cogl_features_init now just decides you don't have a stencil buffer at all if you have less than three bits. * clutter/cogl/cogl.h.in: New functions and documentation. * tests/interactive/test-clip.c: Replaced with a different test that lets you add and remove clips. The three different mouse buttons add clips in different shapes. This makes it easier to test multiple levels of clipping. * tests/interactive/test-cogl-primitives.c: Use cogl_path_stroke_preserve when using the same path again. * doc/reference/cogl/cogl-sections.txt: Document the new functions.
This commit is contained in:
88
cogl-path.h
88
cogl-path.h
@@ -82,28 +82,60 @@ void cogl_rectanglex (CoglFixed x,
|
||||
/**
|
||||
* cogl_path_fill:
|
||||
*
|
||||
* Fills the constructed shape using the current drawing color.
|
||||
* Fills the constructed shape using the current drawing color. The
|
||||
* current path is then cleared. To use the path again, call
|
||||
* cogl_path_fill_preserve() instead.
|
||||
**/
|
||||
void cogl_path_fill (void);
|
||||
void cogl_path_fill (void);
|
||||
|
||||
/**
|
||||
* cogl_path_fill_preserve:
|
||||
*
|
||||
* Fills the constructed shape using the current drawing color and
|
||||
* preserves the path to be used again.
|
||||
*
|
||||
* Since: 1.0
|
||||
**/
|
||||
void cogl_path_fill_preserve (void);
|
||||
|
||||
/**
|
||||
* cogl_path_stroke:
|
||||
*
|
||||
* Strokes the constructed shape using the current drawing color
|
||||
* and a width of 1 pixel (regardless of the current transformation
|
||||
* matrix).
|
||||
* Strokes the constructed shape using the current drawing color and a
|
||||
* width of 1 pixel (regardless of the current transformation
|
||||
* matrix). To current path is then cleared. To use the path again,
|
||||
* call cogl_path_stroke_preserve() instead.
|
||||
**/
|
||||
void cogl_path_stroke (void);
|
||||
void cogl_path_stroke (void);
|
||||
|
||||
|
||||
/**
|
||||
* cogl_path_stroke_preserve:
|
||||
*
|
||||
* Strokes the constructed shape using the current drawing color and
|
||||
* preserves the path to be used again.
|
||||
*
|
||||
* Since: 1.0
|
||||
**/
|
||||
void cogl_path_stroke_preserve (void);
|
||||
|
||||
/**
|
||||
* cogl_path_new:
|
||||
*
|
||||
* Clears the current path and starts a new one.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
void cogl_path_new (void);
|
||||
|
||||
/**
|
||||
* cogl_path_move_to:
|
||||
* @x: X coordinate of the pen location to move to.
|
||||
* @y: Y coordinate of the pen location to move to.
|
||||
*
|
||||
* Clears the previously constructed shape and begins a new path
|
||||
* contour by moving the pen to the given coordinates.
|
||||
**/
|
||||
* Moves the pen to the given location. If there is an existing path
|
||||
* this will start a new disjoint subpath.
|
||||
**/
|
||||
void cogl_path_move_to (CoglFixed x,
|
||||
CoglFixed y);
|
||||
|
||||
@@ -113,9 +145,9 @@ void cogl_path_move_to (CoglFixed x,
|
||||
* @x: X offset from the current pen location to move the pen to.
|
||||
* @y: Y offset from the current pen location to move the pen to.
|
||||
*
|
||||
* Clears the previously constructed shape and begins a new path
|
||||
* contour by moving the pen to the given coordinates relative
|
||||
* to the current pen location.
|
||||
* Moves the pen to the given offset relative to the current pen
|
||||
* location. If there is an existing path this will start a new
|
||||
* disjoint subpath.
|
||||
**/
|
||||
void cogl_path_rel_move_to (CoglFixed x,
|
||||
CoglFixed y);
|
||||
@@ -222,8 +254,9 @@ void cogl_path_close (void);
|
||||
* @x2: X coordinate of the end line vertex
|
||||
* @y2: Y coordinate of the end line vertex
|
||||
*
|
||||
* Clears the previously constructed shape and constructs a straight
|
||||
* line shape start and ending at the given coordinates.
|
||||
* Constructs a straight line shape starting and ending at the given
|
||||
* coordinates. If there is an existing path this will start a new
|
||||
* disjoint sub-path.
|
||||
**/
|
||||
void cogl_path_line (CoglFixed x1,
|
||||
CoglFixed y1,
|
||||
@@ -236,10 +269,11 @@ void cogl_path_line (CoglFixed x1,
|
||||
* values that specify the vertex coordinates.
|
||||
* @num_points: The total number of vertices.
|
||||
*
|
||||
* Clears the previously constructed shape and constructs a series of straight
|
||||
* line segments, starting from the first given vertex coordinate. Each
|
||||
* subsequent segment stars where the previous one ended and ends at the next
|
||||
* given vertex coordinate.
|
||||
* Constructs a series of straight line segments, starting from the
|
||||
* first given vertex coordinate. If there is an existing path this
|
||||
* will start a new disjoint sub-path. Each subsequent segment starts
|
||||
* where the previous one ended and ends at the next given vertex
|
||||
* coordinate.
|
||||
*
|
||||
* The coords array must contain 2 * num_points values. The first value
|
||||
* represents the X coordinate of the first vertex, the second value
|
||||
@@ -257,8 +291,8 @@ void cogl_path_polyline (CoglFixed *coords,
|
||||
* values that specify the vertex coordinates.
|
||||
* @num_points: The total number of vertices.
|
||||
*
|
||||
* Clears the previously constructed shape and constructs a polygonal
|
||||
* shape of the given number of vertices.
|
||||
* Constructs a polygonal shape of the given number of vertices. If
|
||||
* there is an existing path this will start a new disjoint sub-path.
|
||||
*
|
||||
* The coords array must contain 2 * num_points values. The first value
|
||||
* represents the X coordinate of the first vertex, the second value
|
||||
@@ -276,8 +310,8 @@ void cogl_path_polygon (CoglFixed *coords,
|
||||
* @width: Rectangle width.
|
||||
* @height: Rectangle height.
|
||||
*
|
||||
* Clears the previously constructed shape and constructs a rectangular
|
||||
* shape at the given coordinates.
|
||||
* Constructs a rectangular shape at the given coordinates. If there
|
||||
* is an existing path this will start a new disjoint sub-path.
|
||||
**/
|
||||
void cogl_path_rectangle (CoglFixed x,
|
||||
CoglFixed y,
|
||||
@@ -291,8 +325,8 @@ void cogl_path_rectangle (CoglFixed x,
|
||||
* @radius_x: X radius of the ellipse
|
||||
* @radius_y: Y radius of the ellipse
|
||||
*
|
||||
* Clears the previously constructed shape and constructs an ellipse
|
||||
* shape.
|
||||
* Constructs an ellipse shape. If there is an existing path this will
|
||||
* start a new disjoint sub-path.
|
||||
**/
|
||||
void cogl_path_ellipse (CoglFixed center_x,
|
||||
CoglFixed center_y,
|
||||
@@ -309,9 +343,9 @@ void cogl_path_ellipse (CoglFixed center_x,
|
||||
* @arc_step: Angle increment resolution for subdivision of
|
||||
* the corner arcs.
|
||||
*
|
||||
* Clears the previously constructed shape and constructs a rectangular
|
||||
* shape with rounded corners.
|
||||
**/
|
||||
* Constructs a rectangular shape with rounded corners. If there is an
|
||||
* existing path this will start a new disjoint sub-path.
|
||||
**/
|
||||
void cogl_path_round_rectangle (CoglFixed x,
|
||||
CoglFixed y,
|
||||
CoglFixed width,
|
||||
|
Reference in New Issue
Block a user