cairo_bool_t cairocks_map_path_onto(cairo_t* cr, cairo_path_t* path) { cairo_path_t* cur_path = 0; parametrized_path_t param; if(cairo_status(cr) || !path) return FALSE; cur_path = cairo_copy_path(cr); param.path = path; param.parametrization = parametrize_path(path); cairo_new_path(cr); transform_path( cur_path, (transform_point_func_t)(point_on_path), ¶m ); cairo_append_path(cr, cur_path); free(param.parametrization); cairo_path_destroy(cur_path); return TRUE; }
/* Projects the current path of cr onto the provided path. */ static void map_path_onto (cairo_t *cr, cairo_path_t *path) { cairo_path_t *current_path; parametrized_path_t param; param.path = path; param.parametrization = parametrize_path (path); current_path = cairo_copy_path (cr); cairo_new_path (cr); transform_path (current_path, (transform_point_func_t) point_on_path, ¶m); cairo_append_path (cr, current_path); cairo_path_destroy (current_path); g_free (param.parametrization); }
void FlipLevelTransformer::transform_tilemap(float height, TileMap* tilemap) { for(size_t x = 0; x < tilemap->get_width(); ++x) { for(size_t y = 0; y < tilemap->get_height()/2; ++y) { // swap tiles int y2 = tilemap->get_height()-1-y; uint32_t t1 = tilemap->get_tile_id(x, y); uint32_t t2 = tilemap->get_tile_id(x, y2); tilemap->change(x, y, t2); tilemap->change(x, y2, t1); } } tilemap->set_drawing_effect(transform_drawing_effect(tilemap->get_drawing_effect())); Vector offset = tilemap->get_offset(); offset.y = height - offset.y - tilemap->get_bbox().get_height(); tilemap->set_offset(offset); Path* path = tilemap->get_path().get(); if (path) transform_path(height, tilemap->get_bbox().get_height(), *path); }
void FlipLevelTransformer::transform_tilemap(float height, TileMap& tilemap) { for(int x = 0; x < tilemap.get_width(); ++x) { for(int y = 0; y < tilemap.get_height()/2; ++y) { // swap tiles int y2 = tilemap.get_height()-1-y; uint32_t t1 = tilemap.get_tile_id(x, y); uint32_t t2 = tilemap.get_tile_id(x, y2); tilemap.change(x, y, t2); tilemap.change(x, y2, t1); } } tilemap.set_flip(transform_flip(tilemap.get_flip())); Vector offset = tilemap.get_offset(); offset.y = height - offset.y - tilemap.get_bbox().get_height(); tilemap.set_offset(offset); auto path = tilemap.get_path(); if (path) transform_path(height, tilemap.get_bbox().get_height(), *path); }
void FlipLevelTransformer::transform_platform(float height, Platform& platform) { transform_path(height, platform.get_bbox().get_height(), platform.get_path()); }