mirror of https://github.com/GNOME/gimp.git
plug-ins: port file-ps and file-svg to GimpVectorLoadProcedure.
This commit is contained in:
parent
a931f4c93e
commit
c22515e0b7
|
@ -104,8 +104,6 @@ static const gchar dversion[] = "v1.17 19-Sep-2004";
|
||||||
#define PLUG_IN_ROLE "gimp-file-ps"
|
#define PLUG_IN_ROLE "gimp-file-ps"
|
||||||
|
|
||||||
#define STR_LENGTH 64
|
#define STR_LENGTH 64
|
||||||
#define MIN_RESOLUTION 5
|
|
||||||
#define MAX_RESOLUTION 8192
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _PostScript PostScript;
|
typedef struct _PostScript PostScript;
|
||||||
|
@ -134,6 +132,10 @@ static GimpProcedure * ps_create_procedure (GimpPlugIn *plug_in,
|
||||||
static GimpValueArray * ps_load (GimpProcedure *procedure,
|
static GimpValueArray * ps_load (GimpProcedure *procedure,
|
||||||
GimpRunMode run_mode,
|
GimpRunMode run_mode,
|
||||||
GFile *file,
|
GFile *file,
|
||||||
|
gint width,
|
||||||
|
gint height,
|
||||||
|
gboolean preserve_ratio,
|
||||||
|
gboolean prefer_native_dimension,
|
||||||
GimpMetadata *metadata,
|
GimpMetadata *metadata,
|
||||||
GimpMetadataLoadFlags *flags,
|
GimpMetadataLoadFlags *flags,
|
||||||
GimpProcedureConfig *config,
|
GimpProcedureConfig *config,
|
||||||
|
@ -264,8 +266,6 @@ static gboolean load_dialog (GFile *file,
|
||||||
GimpProcedure *procedure,
|
GimpProcedure *procedure,
|
||||||
GObject *config);
|
GObject *config);
|
||||||
|
|
||||||
static gboolean resolution_change_callback (GtkWidget *adjustment,
|
|
||||||
gpointer data);
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -330,9 +330,9 @@ ps_create_procedure (GimpPlugIn *plug_in,
|
||||||
if (! strcmp (name, LOAD_PS_PROC) ||
|
if (! strcmp (name, LOAD_PS_PROC) ||
|
||||||
! strcmp (name, LOAD_EPS_PROC))
|
! strcmp (name, LOAD_EPS_PROC))
|
||||||
{
|
{
|
||||||
procedure = gimp_load_procedure_new (plug_in, name,
|
procedure = gimp_vector_load_procedure_new (plug_in, name,
|
||||||
GIMP_PDB_PROC_TYPE_PLUGIN,
|
GIMP_PDB_PROC_TYPE_PLUGIN,
|
||||||
ps_load, NULL, NULL);
|
ps_load, NULL, NULL);
|
||||||
|
|
||||||
if (! strcmp (name, LOAD_PS_PROC))
|
if (! strcmp (name, LOAD_PS_PROC))
|
||||||
{
|
{
|
||||||
|
@ -343,6 +343,8 @@ ps_create_procedure (GimpPlugIn *plug_in,
|
||||||
"Load PostScript documents",
|
"Load PostScript documents",
|
||||||
name);
|
name);
|
||||||
|
|
||||||
|
gimp_file_procedure_set_format_name (GIMP_FILE_PROCEDURE (procedure),
|
||||||
|
_("PostScript"));
|
||||||
gimp_file_procedure_set_mime_types (GIMP_FILE_PROCEDURE (procedure),
|
gimp_file_procedure_set_mime_types (GIMP_FILE_PROCEDURE (procedure),
|
||||||
"application/postscript");
|
"application/postscript");
|
||||||
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
|
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
|
||||||
|
@ -360,6 +362,8 @@ ps_create_procedure (GimpPlugIn *plug_in,
|
||||||
"load Encapsulated PostScript images",
|
"load Encapsulated PostScript images",
|
||||||
name);
|
name);
|
||||||
|
|
||||||
|
gimp_file_procedure_set_format_name (GIMP_FILE_PROCEDURE (procedure),
|
||||||
|
_("Encapsulated PostScript"));
|
||||||
gimp_file_procedure_set_mime_types (GIMP_FILE_PROCEDURE (procedure),
|
gimp_file_procedure_set_mime_types (GIMP_FILE_PROCEDURE (procedure),
|
||||||
"image/x-eps");
|
"image/x-eps");
|
||||||
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
|
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
|
||||||
|
@ -376,24 +380,6 @@ ps_create_procedure (GimpPlugIn *plug_in,
|
||||||
gimp_load_procedure_set_thumbnail_loader (GIMP_LOAD_PROCEDURE (procedure),
|
gimp_load_procedure_set_thumbnail_loader (GIMP_LOAD_PROCEDURE (procedure),
|
||||||
LOAD_PS_THUMB_PROC);
|
LOAD_PS_THUMB_PROC);
|
||||||
|
|
||||||
GIMP_PROC_ARG_INT (procedure, "resolution",
|
|
||||||
_("Resol_ution"),
|
|
||||||
_("Resolution to interpret image (dpi)"),
|
|
||||||
MIN_RESOLUTION, MAX_RESOLUTION, 100,
|
|
||||||
GIMP_PARAM_READWRITE);
|
|
||||||
|
|
||||||
GIMP_PROC_ARG_INT (procedure, "width",
|
|
||||||
_("_Width"),
|
|
||||||
_("Desired width"),
|
|
||||||
1, GIMP_MAX_IMAGE_SIZE, 826,
|
|
||||||
GIMP_PARAM_READWRITE);
|
|
||||||
|
|
||||||
GIMP_PROC_ARG_INT (procedure, "height",
|
|
||||||
_("_Height"),
|
|
||||||
_("Desired height"),
|
|
||||||
1, GIMP_MAX_IMAGE_SIZE, 1170,
|
|
||||||
GIMP_PARAM_READWRITE);
|
|
||||||
|
|
||||||
GIMP_PROC_ARG_BOOLEAN (procedure, "check-bbox",
|
GIMP_PROC_ARG_BOOLEAN (procedure, "check-bbox",
|
||||||
_("Try _Bounding Box"),
|
_("Try _Bounding Box"),
|
||||||
_("FALSE: Use width/height, TRUE: Use BoundingBox"),
|
_("FALSE: Use width/height, TRUE: Use BoundingBox"),
|
||||||
|
@ -573,6 +559,10 @@ static GimpValueArray *
|
||||||
ps_load (GimpProcedure *procedure,
|
ps_load (GimpProcedure *procedure,
|
||||||
GimpRunMode run_mode,
|
GimpRunMode run_mode,
|
||||||
GFile *file,
|
GFile *file,
|
||||||
|
gint width,
|
||||||
|
gint height,
|
||||||
|
gboolean preserve_ratio,
|
||||||
|
gboolean prefer_native_dimension,
|
||||||
GimpMetadata *metadata,
|
GimpMetadata *metadata,
|
||||||
GimpMetadataLoadFlags *flags,
|
GimpMetadataLoadFlags *flags,
|
||||||
GimpProcedureConfig *config,
|
GimpProcedureConfig *config,
|
||||||
|
@ -586,6 +576,14 @@ ps_load (GimpProcedure *procedure,
|
||||||
|
|
||||||
l_run_mode = run_mode;
|
l_run_mode = run_mode;
|
||||||
|
|
||||||
|
/* Why these values? No idea, they were the default until now, I just reuse
|
||||||
|
* them. XXX
|
||||||
|
*/
|
||||||
|
if (width == 0)
|
||||||
|
g_object_set (config, "width", 826, NULL);
|
||||||
|
if (height == 0)
|
||||||
|
g_object_set (config, "height", 1170, NULL);
|
||||||
|
|
||||||
switch (run_mode)
|
switch (run_mode)
|
||||||
{
|
{
|
||||||
case GIMP_RUN_INTERACTIVE:
|
case GIMP_RUN_INTERACTIVE:
|
||||||
|
@ -1054,7 +1052,7 @@ load_image (GFile *file,
|
||||||
const gchar *filename;
|
const gchar *filename;
|
||||||
gint width;
|
gint width;
|
||||||
gint height;
|
gint height;
|
||||||
guint resolution;
|
gdouble resolution;
|
||||||
gboolean use_bbox;
|
gboolean use_bbox;
|
||||||
gint pnm_type;
|
gint pnm_type;
|
||||||
gint text_alpha;
|
gint text_alpha;
|
||||||
|
@ -1072,7 +1070,7 @@ load_image (GFile *file,
|
||||||
if (config)
|
if (config)
|
||||||
{
|
{
|
||||||
g_object_get (config,
|
g_object_get (config,
|
||||||
"resolution", &resolution,
|
"pixel-density", &resolution,
|
||||||
"width", &width,
|
"width", &width,
|
||||||
"height", &height,
|
"height", &height,
|
||||||
"pages", &pages,
|
"pages", &pages,
|
||||||
|
@ -1088,7 +1086,7 @@ load_image (GFile *file,
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PS_DEBUG
|
#ifdef PS_DEBUG
|
||||||
g_print ("load_image:\n resolution = %d\n", resolution);
|
g_print ("load_image:\n resolution = %f\n", resolution);
|
||||||
g_print (" %dx%d pixels\n", width, height);
|
g_print (" %dx%d pixels\n", width, height);
|
||||||
g_print (" BoundingBox: %d\n", use_bbox);
|
g_print (" BoundingBox: %d\n", use_bbox);
|
||||||
g_print (" Coloring: %d\n", pnm_type);
|
g_print (" Coloring: %d\n", pnm_type);
|
||||||
|
@ -1163,9 +1161,7 @@ load_image (GFile *file,
|
||||||
if (! image)
|
if (! image)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
gimp_image_set_resolution (image,
|
gimp_image_set_resolution (image, resolution, resolution);
|
||||||
(gdouble) resolution,
|
|
||||||
(gdouble) resolution);
|
|
||||||
|
|
||||||
if (n_images == max_images)
|
if (n_images == max_images)
|
||||||
{
|
{
|
||||||
|
@ -1389,9 +1385,9 @@ export_image (GFile *file,
|
||||||
static void
|
static void
|
||||||
check_load_vals (GObject *config)
|
check_load_vals (GObject *config)
|
||||||
{
|
{
|
||||||
gint resolution = MIN_RESOLUTION;
|
gdouble resolution = GIMP_MIN_RESOLUTION;
|
||||||
gdouble width = 2;
|
gint width = 2;
|
||||||
gdouble height = 2;
|
gint height = 2;
|
||||||
gboolean use_bbox = FALSE;
|
gboolean use_bbox = FALSE;
|
||||||
gint pnm_type = 6;
|
gint pnm_type = 6;
|
||||||
gint text_alpha = 1;
|
gint text_alpha = 1;
|
||||||
|
@ -1401,7 +1397,7 @@ check_load_vals (GObject *config)
|
||||||
if (config)
|
if (config)
|
||||||
{
|
{
|
||||||
g_object_get (config,
|
g_object_get (config,
|
||||||
"resolution", &resolution,
|
"pixel-density", &resolution,
|
||||||
"width", &width,
|
"width", &width,
|
||||||
"height", &height,
|
"height", &height,
|
||||||
"check_bbox", &use_bbox,
|
"check_bbox", &use_bbox,
|
||||||
|
@ -1412,10 +1408,10 @@ check_load_vals (GObject *config)
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resolution < MIN_RESOLUTION)
|
if (resolution < GIMP_MIN_RESOLUTION)
|
||||||
resolution = MIN_RESOLUTION;
|
resolution = GIMP_MIN_RESOLUTION;
|
||||||
else if (resolution > MAX_RESOLUTION)
|
else if (resolution > GIMP_MAX_RESOLUTION)
|
||||||
resolution = MAX_RESOLUTION;
|
resolution = GIMP_MAX_RESOLUTION;
|
||||||
|
|
||||||
if (width < 2)
|
if (width < 2)
|
||||||
width = 2;
|
width = 2;
|
||||||
|
@ -1436,7 +1432,7 @@ check_load_vals (GObject *config)
|
||||||
if (config)
|
if (config)
|
||||||
{
|
{
|
||||||
g_object_set (config,
|
g_object_set (config,
|
||||||
"resolution", resolution,
|
"pixel-density", resolution,
|
||||||
"width", width,
|
"width", width,
|
||||||
"height", height,
|
"height", height,
|
||||||
"check_bbox", use_bbox ? 1 : 0,
|
"check_bbox", use_bbox ? 1 : 0,
|
||||||
|
@ -1757,7 +1753,7 @@ ps_open (GFile *file,
|
||||||
FILE *fd_popen = NULL;
|
FILE *fd_popen = NULL;
|
||||||
FILE *eps_file;
|
FILE *eps_file;
|
||||||
gint width, height;
|
gint width, height;
|
||||||
gint resolution;
|
gdouble resolution;
|
||||||
gboolean use_bbox;
|
gboolean use_bbox;
|
||||||
gint pnm_type;
|
gint pnm_type;
|
||||||
gint text_alpha;
|
gint text_alpha;
|
||||||
|
@ -1775,7 +1771,7 @@ ps_open (GFile *file,
|
||||||
g_object_get (config,
|
g_object_get (config,
|
||||||
"width", &width,
|
"width", &width,
|
||||||
"height", &height,
|
"height", &height,
|
||||||
"resolution", &resolution,
|
"pixel-density", &resolution,
|
||||||
"check-bbox", &use_bbox,
|
"check-bbox", &use_bbox,
|
||||||
"coloring", &pnm_type,
|
"coloring", &pnm_type,
|
||||||
"text-alpha-bits", &text_alpha,
|
"text-alpha-bits", &text_alpha,
|
||||||
|
@ -1786,7 +1782,7 @@ ps_open (GFile *file,
|
||||||
{
|
{
|
||||||
width = 256;
|
width = 256;
|
||||||
height = 256;
|
height = 256;
|
||||||
resolution = 256 / 4;
|
resolution = 256.0 / 4.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
*llx = *lly = 0;
|
*llx = *lly = 0;
|
||||||
|
@ -1901,7 +1897,7 @@ ps_open (GFile *file,
|
||||||
|
|
||||||
g_ptr_array_add (cmdA, g_strdup (g_get_prgname ()));
|
g_ptr_array_add (cmdA, g_strdup (g_get_prgname ()));
|
||||||
g_ptr_array_add (cmdA, g_strdup_printf ("-sDEVICE=%s", driver));
|
g_ptr_array_add (cmdA, g_strdup_printf ("-sDEVICE=%s", driver));
|
||||||
g_ptr_array_add (cmdA, g_strdup_printf ("-r%d", resolution));
|
g_ptr_array_add (cmdA, g_strdup_printf ("-r%d", (gint) resolution));
|
||||||
|
|
||||||
if (is_pdf)
|
if (is_pdf)
|
||||||
{
|
{
|
||||||
|
@ -3648,7 +3644,6 @@ load_dialog (GFile *file,
|
||||||
GtkListStore *store;
|
GtkListStore *store;
|
||||||
GtkWidget *hbox;
|
GtkWidget *hbox;
|
||||||
GtkWidget *vbox;
|
GtkWidget *vbox;
|
||||||
GtkWidget *spinbutton;
|
|
||||||
GtkWidget *target = NULL;
|
GtkWidget *target = NULL;
|
||||||
GtkWidget *selector = NULL;
|
GtkWidget *selector = NULL;
|
||||||
gint32 page_count;
|
gint32 page_count;
|
||||||
|
@ -3659,9 +3654,9 @@ load_dialog (GFile *file,
|
||||||
|
|
||||||
gimp_ui_init (PLUG_IN_BINARY);
|
gimp_ui_init (PLUG_IN_BINARY);
|
||||||
|
|
||||||
dialog = gimp_procedure_dialog_new (GIMP_PROCEDURE (procedure),
|
dialog = gimp_vector_load_procedure_dialog_new (GIMP_VECTOR_LOAD_PROCEDURE (procedure),
|
||||||
GIMP_PROCEDURE_CONFIG (config),
|
GIMP_PROCEDURE_CONFIG (config),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
gimp_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
gimp_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
||||||
GTK_RESPONSE_OK,
|
GTK_RESPONSE_OK,
|
||||||
|
@ -3687,35 +3682,6 @@ load_dialog (GFile *file,
|
||||||
dialog);
|
dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Rendering */
|
|
||||||
/* Resolution / Width / Height */
|
|
||||||
gimp_procedure_dialog_fill_box (GIMP_PROCEDURE_DIALOG (dialog),
|
|
||||||
"rendering-options",
|
|
||||||
"resolution",
|
|
||||||
"width",
|
|
||||||
"height",
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
spinbutton =
|
|
||||||
gimp_procedure_dialog_get_scale_entry (GIMP_PROCEDURE_DIALOG (dialog),
|
|
||||||
"resolution", 1.0);
|
|
||||||
gimp_procedure_dialog_get_scale_entry (GIMP_PROCEDURE_DIALOG (dialog),
|
|
||||||
"width", 1.0);
|
|
||||||
gimp_procedure_dialog_get_scale_entry (GIMP_PROCEDURE_DIALOG (dialog),
|
|
||||||
"height", 1.0);
|
|
||||||
|
|
||||||
g_signal_connect (spinbutton, "value-changed",
|
|
||||||
G_CALLBACK (resolution_change_callback),
|
|
||||||
config);
|
|
||||||
|
|
||||||
gimp_procedure_dialog_get_label (GIMP_PROCEDURE_DIALOG (dialog),
|
|
||||||
"rendering-title", _("Rendering"),
|
|
||||||
FALSE, FALSE);
|
|
||||||
|
|
||||||
gimp_procedure_dialog_fill_frame (GIMP_PROCEDURE_DIALOG (dialog),
|
|
||||||
"rendering-frame", "rendering-title",
|
|
||||||
FALSE, "rendering-options");
|
|
||||||
|
|
||||||
/* Coloring */
|
/* Coloring */
|
||||||
store = gimp_int_store_new (_("B/W"), 4,
|
store = gimp_int_store_new (_("B/W"), 4,
|
||||||
_("Gray"), 5,
|
_("Gray"), 5,
|
||||||
|
@ -3743,7 +3709,6 @@ load_dialog (GFile *file,
|
||||||
|
|
||||||
vbox = gimp_procedure_dialog_fill_box (GIMP_PROCEDURE_DIALOG (dialog),
|
vbox = gimp_procedure_dialog_fill_box (GIMP_PROCEDURE_DIALOG (dialog),
|
||||||
"rendering-box",
|
"rendering-box",
|
||||||
"rendering-frame",
|
|
||||||
"check-bbox",
|
"check-bbox",
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
@ -3780,7 +3745,6 @@ load_dialog (GFile *file,
|
||||||
hbox = gimp_procedure_dialog_fill_box (GIMP_PROCEDURE_DIALOG (dialog),
|
hbox = gimp_procedure_dialog_fill_box (GIMP_PROCEDURE_DIALOG (dialog),
|
||||||
"ps-top-row",
|
"ps-top-row",
|
||||||
"rendering-box",
|
"rendering-box",
|
||||||
"coloring",
|
|
||||||
NULL);
|
NULL);
|
||||||
gtk_box_set_spacing (GTK_BOX (hbox), 12);
|
gtk_box_set_spacing (GTK_BOX (hbox), 12);
|
||||||
gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
|
gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
|
||||||
|
@ -3790,6 +3754,7 @@ load_dialog (GFile *file,
|
||||||
|
|
||||||
hbox = gimp_procedure_dialog_fill_box (GIMP_PROCEDURE_DIALOG (dialog),
|
hbox = gimp_procedure_dialog_fill_box (GIMP_PROCEDURE_DIALOG (dialog),
|
||||||
"ps-bottom-row",
|
"ps-bottom-row",
|
||||||
|
"coloring",
|
||||||
"text-alpha-bits",
|
"text-alpha-bits",
|
||||||
"graphoc-alpha-bits",
|
"graphoc-alpha-bits",
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -3985,35 +3950,3 @@ save_unit_toggle_update (GtkWidget *widget,
|
||||||
"y-offset", y_offset * factor,
|
"y-offset", y_offset * factor,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
resolution_change_callback (GtkWidget *adjustment,
|
|
||||||
gpointer data)
|
|
||||||
{
|
|
||||||
GimpProcedureConfig *config = GIMP_PROCEDURE_CONFIG (data);
|
|
||||||
gdouble ratio = 1.0;
|
|
||||||
gint old_resolution;
|
|
||||||
gdouble resolution;
|
|
||||||
gint width;
|
|
||||||
gint height;
|
|
||||||
|
|
||||||
g_object_get (config,
|
|
||||||
"resolution", &old_resolution,
|
|
||||||
"width", &width,
|
|
||||||
"height", &height,
|
|
||||||
NULL);
|
|
||||||
resolution = gimp_label_spin_get_value (GIMP_LABEL_SPIN (adjustment));
|
|
||||||
|
|
||||||
if (old_resolution)
|
|
||||||
ratio = resolution / old_resolution;
|
|
||||||
|
|
||||||
width *= ratio;
|
|
||||||
height *= ratio;
|
|
||||||
|
|
||||||
g_object_set (config,
|
|
||||||
"width", width,
|
|
||||||
"height", height,
|
|
||||||
NULL);
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -78,6 +78,10 @@ static GimpProcedure * svg_create_procedure (GimpPlugIn *plug_in,
|
||||||
static GimpValueArray * svg_load (GimpProcedure *procedure,
|
static GimpValueArray * svg_load (GimpProcedure *procedure,
|
||||||
GimpRunMode run_mode,
|
GimpRunMode run_mode,
|
||||||
GFile *file,
|
GFile *file,
|
||||||
|
gint width,
|
||||||
|
gint height,
|
||||||
|
gboolean preserve_ratio,
|
||||||
|
gboolean prefer_native_dimension,
|
||||||
GimpMetadata *metadata,
|
GimpMetadata *metadata,
|
||||||
GimpMetadataLoadFlags *flags,
|
GimpMetadataLoadFlags *flags,
|
||||||
GimpProcedureConfig *config,
|
GimpProcedureConfig *config,
|
||||||
|
@ -156,9 +160,9 @@ svg_create_procedure (GimpPlugIn *plug_in,
|
||||||
|
|
||||||
if (! strcmp (name, LOAD_PROC))
|
if (! strcmp (name, LOAD_PROC))
|
||||||
{
|
{
|
||||||
procedure = gimp_load_procedure_new (plug_in, name,
|
procedure = gimp_vector_load_procedure_new (plug_in, name,
|
||||||
GIMP_PDB_PROC_TYPE_PLUGIN,
|
GIMP_PDB_PROC_TYPE_PLUGIN,
|
||||||
svg_load, NULL, NULL);
|
svg_load, NULL, NULL);
|
||||||
|
|
||||||
gimp_procedure_set_menu_label (procedure, _("SVG image"));
|
gimp_procedure_set_menu_label (procedure, _("SVG image"));
|
||||||
|
|
||||||
|
@ -172,6 +176,8 @@ svg_create_procedure (GimpPlugIn *plug_in,
|
||||||
"Dom Lachowicz <cinamod@hotmail.com>",
|
"Dom Lachowicz <cinamod@hotmail.com>",
|
||||||
SVG_VERSION);
|
SVG_VERSION);
|
||||||
|
|
||||||
|
gimp_file_procedure_set_format_name (GIMP_FILE_PROCEDURE (procedure),
|
||||||
|
_("SVG"));
|
||||||
gimp_file_procedure_set_mime_types (GIMP_FILE_PROCEDURE (procedure),
|
gimp_file_procedure_set_mime_types (GIMP_FILE_PROCEDURE (procedure),
|
||||||
"image/svg+xml");
|
"image/svg+xml");
|
||||||
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
|
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
|
||||||
|
@ -182,28 +188,6 @@ svg_create_procedure (GimpPlugIn *plug_in,
|
||||||
gimp_load_procedure_set_thumbnail_loader (GIMP_LOAD_PROCEDURE (procedure),
|
gimp_load_procedure_set_thumbnail_loader (GIMP_LOAD_PROCEDURE (procedure),
|
||||||
LOAD_THUMB_PROC);
|
LOAD_THUMB_PROC);
|
||||||
|
|
||||||
GIMP_PROC_ARG_DOUBLE (procedure, "resolution",
|
|
||||||
_("Resolu_tion"),
|
|
||||||
_("Resolution to use for rendering the SVG"),
|
|
||||||
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION, 300,
|
|
||||||
GIMP_PARAM_READWRITE);
|
|
||||||
|
|
||||||
GIMP_PROC_ARG_INT (procedure, "width",
|
|
||||||
_("_Width"),
|
|
||||||
_("Width (in pixels) to load the SVG in. "
|
|
||||||
"(0 for original width, a negative width to "
|
|
||||||
"specify a maximum width)"),
|
|
||||||
-GIMP_MAX_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE, 0,
|
|
||||||
GIMP_PARAM_READWRITE);
|
|
||||||
|
|
||||||
GIMP_PROC_ARG_INT (procedure, "height",
|
|
||||||
_("_Height"),
|
|
||||||
_("Height (in pixels) to load the SVG in. "
|
|
||||||
"(0 for original height, a negative height to "
|
|
||||||
"specify a maximum height)"),
|
|
||||||
-GIMP_MAX_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE, 0,
|
|
||||||
GIMP_PARAM_READWRITE);
|
|
||||||
|
|
||||||
GIMP_PROC_ARG_CHOICE (procedure, "paths",
|
GIMP_PROC_ARG_CHOICE (procedure, "paths",
|
||||||
_("_Paths"),
|
_("_Paths"),
|
||||||
_("Whether and how to import paths so that they can be used with the path tool"),
|
_("Whether and how to import paths so that they can be used with the path tool"),
|
||||||
|
@ -237,6 +221,10 @@ static GimpValueArray *
|
||||||
svg_load (GimpProcedure *procedure,
|
svg_load (GimpProcedure *procedure,
|
||||||
GimpRunMode run_mode,
|
GimpRunMode run_mode,
|
||||||
GFile *file,
|
GFile *file,
|
||||||
|
gint width,
|
||||||
|
gint height,
|
||||||
|
gboolean preserve_ratio,
|
||||||
|
gboolean prefer_native_dimension,
|
||||||
GimpMetadata *metadata,
|
GimpMetadata *metadata,
|
||||||
GimpMetadataLoadFlags *flags,
|
GimpMetadataLoadFlags *flags,
|
||||||
GimpProcedureConfig *config,
|
GimpProcedureConfig *config,
|
||||||
|
@ -248,8 +236,6 @@ svg_load (GimpProcedure *procedure,
|
||||||
RsvgHandleFlags rsvg_flags = RSVG_HANDLE_FLAGS_NONE;
|
RsvgHandleFlags rsvg_flags = RSVG_HANDLE_FLAGS_NONE;
|
||||||
GimpPDBStatusType status;
|
GimpPDBStatusType status;
|
||||||
gchar *import_paths;
|
gchar *import_paths;
|
||||||
gint width;
|
|
||||||
gint height;
|
|
||||||
gdouble resolution;
|
gdouble resolution;
|
||||||
|
|
||||||
gegl_init (NULL, NULL);
|
gegl_init (NULL, NULL);
|
||||||
|
@ -262,9 +248,9 @@ svg_load (GimpProcedure *procedure,
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_get (config,
|
g_object_get (config,
|
||||||
"width", &width,
|
"width", &width,
|
||||||
"height", &height,
|
"height", &height,
|
||||||
"resolution", &resolution,
|
"pixel-density", &resolution,
|
||||||
NULL);
|
NULL);
|
||||||
image = load_image (file, width, height, resolution, rsvg_flags, &error);
|
image = load_image (file, width, height, resolution, rsvg_flags, &error);
|
||||||
|
|
||||||
|
@ -815,16 +801,12 @@ load_dialog (GFile *file,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Scalable Vector Graphics is SVG, should perhaps not be translated */
|
/* Scalable Vector Graphics is SVG, should perhaps not be translated */
|
||||||
dialog = gimp_procedure_dialog_new (GIMP_PROCEDURE (procedure),
|
dialog = gimp_vector_load_procedure_dialog_new (GIMP_VECTOR_LOAD_PROCEDURE (procedure),
|
||||||
GIMP_PROCEDURE_CONFIG (config),
|
GIMP_PROCEDURE_CONFIG (config),
|
||||||
_("Render Scalable Vector Graphics"));
|
NULL);
|
||||||
|
|
||||||
gimp_procedure_dialog_fill_box (GIMP_PROCEDURE_DIALOG (dialog),
|
main_hbox = gimp_procedure_dialog_fill_box (GIMP_PROCEDURE_DIALOG (dialog),
|
||||||
"vbox-arguments",
|
"main-hbox", "paths", NULL);
|
||||||
"width", "height", "resolution", "paths",
|
|
||||||
NULL);
|
|
||||||
main_hbox = gimp_procedure_dialog_fill_box (GIMP_PROCEDURE_DIALOG (dialog), "main-hbox",
|
|
||||||
"vbox-arguments", NULL);
|
|
||||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (main_hbox), GTK_ORIENTATION_HORIZONTAL);
|
gtk_orientable_set_orientation (GTK_ORIENTABLE (main_hbox), GTK_ORIENTATION_HORIZONTAL);
|
||||||
|
|
||||||
/* The SVG preview */
|
/* The SVG preview */
|
||||||
|
@ -847,7 +829,7 @@ load_dialog (GFile *file,
|
||||||
gtk_widget_show (size_label);
|
gtk_widget_show (size_label);
|
||||||
|
|
||||||
/* query the initial size after the size label is created */
|
/* query the initial size after the size label is created */
|
||||||
g_object_get (config, "resolution", &vals.resolution, NULL);
|
g_object_get (config, "pixel-density", &vals.resolution, NULL);
|
||||||
|
|
||||||
load_rsvg_size (file, &vals, *rsvg_flags, NULL);
|
load_rsvg_size (file, &vals, *rsvg_flags, NULL);
|
||||||
g_object_set (config,
|
g_object_set (config,
|
||||||
|
|
Loading…
Reference in New Issue