[cairo] RFC: Shadow API v2

Bryce Harrington bryce at osg.samsung.com
Wed Oct 29 16:54:33 PDT 2014


This incorporate's Chris' feedback on the API.  It adds the get/set user
data routines and the get_reference_count routine.

There's still a lot I'm uncertain about, but this seems like a pretty
good starting point.   Any other comments or suggestions on this API?

Else, next step will be creating implementations of the functionality
for the image backend.  I will try to reuse henry's work as much as
possible, adapted to fit this interface.

Bryce


/*
 * Effect lifecycle management
 */
cairo_public cairo_effect_t *
cairo_effect_create_drop_shadow (double x_offset, double y_offset,
                                 double x_blur,   double y_blur);

cairo_public cairo_effect_t *
cairo_effect_create_inset_shadow (double x_offset, double y_offset,
                                  double x_blur,   double y_blur);

cairo_public cairo_status_t
cairo_effect_status (cairo_effect_t *effect);

cairo_public cairo_effect_t *
cairo_effect_reference (cairo_effect_t *effect);

cairo_public void
cairo_effect_destroy (cairo_effect_t *effect);

cairo_public unsigned int
cairo_effect_get_reference_count (cairo_pattern_t *pattern);

cairo_public void *
cairo_effect_get_user_data (cairo_effect_t              *effect,
                            const cairo_user_data_key_t *key);

cairo_public cairo_status_t
cairo_effect_set_user_data (cairo_effect_t              *effect,
                            const cairo_user_data_key_t *key,
                            void                        *user_data,
                            cairo_destroy_func_t         destroy);



/*
 * Effect properties
 */
typedef enum _cairo_effect_type {
    CAIRO_SHADOW_NONE = 0,
    CAIRO_SHADOW_DROP,
    CAIRO_SHADOW_INSET
} cairo_effect_type_t;

cairo_public cairo_effect_type_t
cairo_effect_get_type (cairo_effect_t *effect);

cairo_public void
cairo_effect_set_rgb (cairo_pattern_t *pattern,
                      double red, double green, double blue);

cairo_public void
cairo_effect_set_rgba (cairo_pattern_t *pattern,
                       double red, double green, double blue,
                       double alpha);


/*
 * Applying effects to the context
 */
cairo_public void
cairo_set_path_effect (cairo_t *cr, cairo_effect_t *source);

cairo_public cairo_effect_t *
cairo_get_path_effect (cairo_t *cr);



More information about the cairo mailing list