// 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->error.status = SIMPLET_OK; if(!(layer->filters = simplet_list_new())){ free(layer); return NULL; } return layer; }
// 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; }