int close_plot(struct plot *plot) { close_svg(plot->fd); if (plot->direction == PLOT_DOWN) plot->start_y_offset += plot->total_height; else if (plot->direction == PLOT_ACROSS) plot->start_x_offset += plot->total_width; return 0; }
/* Add the savepoint element. */ static void add_savepoint (gint index) { gint width = gdk_screen_width (); gint height = gdk_screen_height (); gchar *id = g_strdup_printf ("id%d", index +1); gchar *file = g_strdup_printf ("images/%s_%d_vellum.png", PACKAGE_NAME, index); open_svg (); fprintf (fp, "\t\t<svg:image id=\"%s\" xlink:href=\"%s\" x=\"0\" y=\"0\" width=\"%d\" height=\"%d\"/>\n", id, file, width, height); g_free (file); file = NULL; g_free (id); close_svg (); }
/* Add the background element. */ static void add_background (gchar *img_dir_path, gchar *background_image) { gint width = gdk_screen_width (); gint height = gdk_screen_height (); gchar *image_destination_path = (gchar *) NULL; image_destination_path = g_build_filename (img_dir_path, "ardesia_0_vellum.png", (gchar *) 0); /* Background image valid and set to image type */ if ((background_image) && (get_background_type ()==2)) { /* if the background is oupdated */ if (g_strcmp0 (background_image, image_destination_path) != 0) { /* copy the file in ardesia_0_vellum.png under image_path overriding it */ GFile *image_destination = g_file_new_for_path(image_destination_path); GFile *image_source = g_file_new_for_path(background_image); g_file_copy (image_source, image_destination, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, NULL); g_object_unref (image_source); g_object_unref (image_destination); } add_savepoint (0); } else { gchar *color = get_background_color(); /* Initialize the rgba components to transparent */ guint r = 0; guint g = 0; guint b = 0; guint a = 0; /* If the background type is colour then parse it */ if ((color!=NULL) && (get_background_type ()!=0)) { sscanf (color, "%02X%02X%02X%02X", &r, &g, &b, &a); } gchar *rgb = g_strdup_printf ("rgb(%d,%d,%d)", r, g, b); open_svg (); fprintf (fp, "\t\t<svg:rect id=\"id1\" x=\"0\" y=\"0\" width=\"%d\" height=\"%d\" fill=\"%s\" fill-opacity=\"%d\"/>\n", width, height, rgb, a); close_svg (); g_free(rgb); } g_free(image_destination_path); }