cairo-surface-observer

3 CAIRO Library

cairo-surface-observer

## Functions

cairo_surface_t * | cairo_surface_create_observer ()
cairo_status_t | cairo_surface_observer_add_fill_callback ()
cairo_status_t | cairo_surface_observer_add_finish_callback ()
cairo_status_t | cairo_surface_observer_add_flush_callback ()
cairo_status_t | cairo_surface_observer_add_glyphs_callback ()
cairo_status_t | cairo_surface_observer_add_mask_callback ()
cairo_status_t | cairo_surface_observer_add_paint_callback ()
cairo_status_t | cairo_surface_observer_add_stroke_callback ()
void | (*cairo_surface_observer_callback_t) ()
double | cairo_surface_observer_elapsed ()
cairo_status_t | cairo_surface_observer_print ()

## Types and Values

#define | CAIRO_HAS_OBSERVER_SURFACE
enum | cairo_surface_observer_mode_t

## Object Hierarchy

## Description

## Functions

### cairo_surface_create_observer ()

    cairo_surface_t *
    cairo_surface_create_observer (cairo_surface_t *target,
                                   cairo_surface_observer_mode_t mode);

Create a new surface that exists solely to watch another is doing. In the process it will log operations and times, which are fast, which are slow, which are frequent, etc.

The `mode` parameter can be set to either CAIRO_SURFACE_OBSERVER_NORMAL or CAIRO_SURFACE_OBSERVER_RECORD_OPERATIONS, to control whether or not the internal observer should record operations.

#### Parameters

target | an existing surface for which the observer will watch |
mode | sets the mode of operation (normal vs. record) |

#### Returns

a pointer to the newly allocated surface. The caller owns the surface and should call `cairo_surface_destroy()` when done with it.

This function always returns a valid pointer, but it will return a pointer to a "nil" surface if `other` is already in an error state or any other error occurs.

Since 1.12

### cairo_surface_observer_add_fill_callback ()

    cairo_status_t
    cairo_surface_observer_add_fill_callback
                                   (cairo_surface_t *abstract_surface,
                                    cairo_surface_observer_callback_t func,
                                    void *data);

#### Returns

### cairo_surface_observer_add_finish_callback ()

    cairo_status_t
    cairo_surface_observer_add_finish_callback
                                   (cairo_surface_t *abstract_surface,
                                    cairo_surface_observer_callback_t func,
                                    void *data);

#### Returns

### cairo_surface_observer_add_flush_callback ()

    cairo_status_t
    cairo_surface_observer_add_flush_callback
                                   (cairo_surface_t *abstract_surface,
                                    cairo_surface_observer_callback_t func,
                                    void *data);

#### Returns

### cairo_surface_observer_add_glyphs_callback ()

    cairo_status_t
    cairo_surface_observer_add_glyphs_callback
                                   (cairo_surface_t *abstract_surface,
                                    cairo_surface_observer_callback_t func,
                                    void *data);

#### Returns

### cairo_surface_observer_add_mask_callback ()

    cairo_status_t
    cairo_surface_observer_add_mask_callback
                                   (cairo_surface_t *abstract_surface,
                                    cairo_surface_observer_callback_t func,
                                    void *data);

#### Returns

### cairo_surface_observer_add_paint_callback ()

    cairo_status_t
    cairo_surface_observer_add_paint_callback
                                   (cairo_surface_t *abstract_surface,
                                    cairo_surface_observer_callback_t func,
                                    void *data);

#### Returns

### cairo_surface_observer_add_stroke_callback ()

    cairo_status_t
    cairo_surface_observer_add_stroke_callback
                                   (cairo_surface_t *abstract_surface,
                                    cairo_surface_observer_callback_t func,
                                    void *data);

#### Returns

### cairo_surface_observer_callback_t ()

    void
    (*cairo_surface_observer_callback_t) (cairo_surface_t *observer,
                                          cairo_surface_t *target,
                                          void *data);

### cairo_surface_observer_elapsed ()

    double
    cairo_surface_observer_elapsed (cairo_surface_t *surface);

#### Returns

### cairo_surface_observer_print ()

    cairo_status_t
    cairo_surface_observer_print (cairo_surface_t *surface,
                                  cairo_write_func_t write_func,
                                  void *closure);

#### Returns

## Types and Values

### CAIRO_HAS_OBSERVER_SURFACE

    #define CAIRO_HAS_OBSERVER_SURFACE 1

### enum cairo_surface_observer_mode_t

Whether operations should be recorded.

#### Members

CAIRO_SURFACE_OBSERVER_NORMAL | no recording is done |
CAIRO_SURFACE_OBSERVER_RECORD_OPERATIONS | operations are recorded |

Since 1.12