/* Add a query object to this Layer's list of queries. @param (String) @return (Query) */ static VALUE add_query(VALUE self, VALUE query){ simplet_vector_layer_t *layer = get_layer(self); simplet_query_t *qry; Data_Get_Struct(query, simplet_query_t, qry); simplet_vector_layer_add_query_directly(layer, qry); VALUE circ_ref = self; simplet_query_set_user_data(qry, (void *)circ_ref); simplet_retain((simplet_retainable_t*) qry); return query; }
// Create and return a new layer instance. simplet_layer_t* simplet_layer_new(const char *datastring){ simplet_layer_t *layer; if(!(layer = malloc(sizeof(*layer)))) return NULL; memset(layer, 0, sizeof(*layer)); layer->source = simplet_copy_string(datastring); layer->status = SIMPLET_OK; if(!(layer->queries = simplet_list_new())){ free(layer); return NULL; } simplet_retain((simplet_retainable_t *)layer); return layer; }
// Create and return a new lithograph, returns NULL on failure. simplet_lithograph_t * simplet_lithograph_new(cairo_t *ctx){ simplet_lithograph_t *litho; if(!(litho = malloc(sizeof(*litho)))) return NULL; memset(litho, 0, sizeof(*litho)); if(!(litho->placements = simplet_list_new(litho))){ free(litho); return NULL; } litho->ctx = ctx; litho->pango_ctx = pango_cairo_create_context(ctx); cairo_reference(ctx); simplet_retain((simplet_retainable_t *)litho); return litho; }