Commit 9dd1c38b authored by GMT 1998  Austin Donnelly's avatar GMT 1998 Austin Donnelly Committed by Austin Donnelly
Browse files

app/gimpimage.h app/gimpimageP.h app/gimpimage.c app/gimage_cmds.c

Sat Nov 14 23:16:55 GMT 1998  Austin Donnelly  <austin@greenend.org.uk>

	* app/gimpimage.h
	* app/gimpimageP.h
	* app/gimpimage.c
	* app/gimage_cmds.c
	* app/file_new_dialog.c
	* app/info_window.c
	* libgimp/gimp.h
	* libgimp/gimpimage.c
	* plug-ins/newsprint/newsprint.c
	* plug-ins/tiff/tiff.c: gimp_image_{get,set}_resolution() calls
	now get and set both X and Y resolutions.  Gimp image struct now
	has two resolution fields, one for each direction.  I've updated
	the two plugins which used the info (TIFF and newsprint).
parent b8b5d783
Sat Nov 14 23:16:55 GMT 1998 Austin Donnelly <austin@greenend.org.uk>
* app/gimpimage.h
* app/gimpimageP.h
* app/gimpimage.c
* app/gimage_cmds.c
* app/file_new_dialog.c
* app/info_window.c
* libgimp/gimp.h
* libgimp/gimpimage.c
* plug-ins/newsprint/newsprint.c
* plug-ins/tiff/tiff.c: gimp_image_{get,set}_resolution() calls
now get and set both X and Y resolutions. Gimp image struct now
has two resolution fields, one for each direction. I've updated
the two plugins which used the info (TIFF and newsprint).
Sat Nov 14 20:15:46 CET 1998 Marc Lehmann <pcg@goof.com>
* plug-ins/script-fu/scripts/*: removed the image
......
......@@ -155,7 +155,8 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview = NULL;
gimage->parasites = parasite_list_new();
gimp_matrix_identity(gimage->transform);
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
gimage->xresolution = 72.0; /* maybe should be rc-supplied default? */
gimage->yresolution = 72.0;
gimage->save_proc= NULL;
}
......@@ -301,15 +302,22 @@ gimp_image_set_filename (GimpImage *gimage, char *filename)
void
gimp_image_set_resolution (GimpImage *gimage, float resolution)
gimp_image_set_resolution (GimpImage *gimage,
float xresolution,
float yresolution)
{
gimage->resolution = resolution;
gimage->xresolution = xresolution;
gimage->yresolution = yresolution;
}
float
gimp_image_get_resolution (GimpImage *gimage)
void
gimp_image_get_resolution (GimpImage *gimage,
float *xresolution,
float *yresolution)
{
return gimage->resolution;
g_return_if_fail(xresolution && yresolution);
*xresolution = gimage->xresolution;
*yresolution = gimage->yresolution;
}
void
......
......@@ -104,8 +104,10 @@ GtkType gimp_image_get_type(void);
GimpImage * gimp_image_new (int, int, int);
void gimp_image_set_filename (GimpImage *, char *);
void gimp_image_set_resolution (GimpImage *, float);
float gimp_image_get_resolution (GimpImage *);
void gimp_image_set_resolution (GimpImage *, float, float);
void gimp_image_get_resolution (GimpImage *,
float *,
float *);
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
void gimp_image_resize (GimpImage *, int, int, int, int);
......
......@@ -155,7 +155,8 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview = NULL;
gimage->parasites = parasite_list_new();
gimp_matrix_identity(gimage->transform);
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
gimage->xresolution = 72.0; /* maybe should be rc-supplied default? */
gimage->yresolution = 72.0;
gimage->save_proc= NULL;
}
......@@ -301,15 +302,22 @@ gimp_image_set_filename (GimpImage *gimage, char *filename)
void
gimp_image_set_resolution (GimpImage *gimage, float resolution)
gimp_image_set_resolution (GimpImage *gimage,
float xresolution,
float yresolution)
{
gimage->resolution = resolution;
gimage->xresolution = xresolution;
gimage->yresolution = yresolution;
}
float
gimp_image_get_resolution (GimpImage *gimage)
void
gimp_image_get_resolution (GimpImage *gimage,
float *xresolution,
float *yresolution)
{
return gimage->resolution;
g_return_if_fail(xresolution && yresolution);
*xresolution = gimage->xresolution;
*yresolution = gimage->yresolution;
}
void
......
......@@ -104,8 +104,10 @@ GtkType gimp_image_get_type(void);
GimpImage * gimp_image_new (int, int, int);
void gimp_image_set_filename (GimpImage *, char *);
void gimp_image_set_resolution (GimpImage *, float);
float gimp_image_get_resolution (GimpImage *);
void gimp_image_set_resolution (GimpImage *, float, float);
void gimp_image_get_resolution (GimpImage *,
float *,
float *);
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
void gimp_image_resize (GimpImage *, int, int, int, int);
......
......@@ -155,7 +155,8 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview = NULL;
gimage->parasites = parasite_list_new();
gimp_matrix_identity(gimage->transform);
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
gimage->xresolution = 72.0; /* maybe should be rc-supplied default? */
gimage->yresolution = 72.0;
gimage->save_proc= NULL;
}
......@@ -301,15 +302,22 @@ gimp_image_set_filename (GimpImage *gimage, char *filename)
void
gimp_image_set_resolution (GimpImage *gimage, float resolution)
gimp_image_set_resolution (GimpImage *gimage,
float xresolution,
float yresolution)
{
gimage->resolution = resolution;
gimage->xresolution = xresolution;
gimage->yresolution = yresolution;
}
float
gimp_image_get_resolution (GimpImage *gimage)
void
gimp_image_get_resolution (GimpImage *gimage,
float *xresolution,
float *yresolution)
{
return gimage->resolution;
g_return_if_fail(xresolution && yresolution);
*xresolution = gimage->xresolution;
*yresolution = gimage->yresolution;
}
void
......
......@@ -104,8 +104,10 @@ GtkType gimp_image_get_type(void);
GimpImage * gimp_image_new (int, int, int);
void gimp_image_set_filename (GimpImage *, char *);
void gimp_image_set_resolution (GimpImage *, float);
float gimp_image_get_resolution (GimpImage *);
void gimp_image_set_resolution (GimpImage *, float, float);
void gimp_image_get_resolution (GimpImage *,
float *,
float *);
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
void gimp_image_resize (GimpImage *, int, int, int, int);
......
......@@ -155,7 +155,8 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview = NULL;
gimage->parasites = parasite_list_new();
gimp_matrix_identity(gimage->transform);
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
gimage->xresolution = 72.0; /* maybe should be rc-supplied default? */
gimage->yresolution = 72.0;
gimage->save_proc= NULL;
}
......@@ -301,15 +302,22 @@ gimp_image_set_filename (GimpImage *gimage, char *filename)
void
gimp_image_set_resolution (GimpImage *gimage, float resolution)
gimp_image_set_resolution (GimpImage *gimage,
float xresolution,
float yresolution)
{
gimage->resolution = resolution;
gimage->xresolution = xresolution;
gimage->yresolution = yresolution;
}
float
gimp_image_get_resolution (GimpImage *gimage)
void
gimp_image_get_resolution (GimpImage *gimage,
float *xresolution,
float *yresolution)
{
return gimage->resolution;
g_return_if_fail(xresolution && yresolution);
*xresolution = gimage->xresolution;
*yresolution = gimage->yresolution;
}
void
......
......@@ -104,8 +104,10 @@ GtkType gimp_image_get_type(void);
GimpImage * gimp_image_new (int, int, int);
void gimp_image_set_filename (GimpImage *, char *);
void gimp_image_set_resolution (GimpImage *, float);
float gimp_image_get_resolution (GimpImage *);
void gimp_image_set_resolution (GimpImage *, float, float);
void gimp_image_get_resolution (GimpImage *,
float *,
float *);
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
void gimp_image_resize (GimpImage *, int, int, int, int);
......
......@@ -155,7 +155,8 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview = NULL;
gimage->parasites = parasite_list_new();
gimp_matrix_identity(gimage->transform);
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
gimage->xresolution = 72.0; /* maybe should be rc-supplied default? */
gimage->yresolution = 72.0;
gimage->save_proc= NULL;
}
......@@ -301,15 +302,22 @@ gimp_image_set_filename (GimpImage *gimage, char *filename)
void
gimp_image_set_resolution (GimpImage *gimage, float resolution)
gimp_image_set_resolution (GimpImage *gimage,
float xresolution,
float yresolution)
{
gimage->resolution = resolution;
gimage->xresolution = xresolution;
gimage->yresolution = yresolution;
}
float
gimp_image_get_resolution (GimpImage *gimage)
void
gimp_image_get_resolution (GimpImage *gimage,
float *xresolution,
float *yresolution)
{
return gimage->resolution;
g_return_if_fail(xresolution && yresolution);
*xresolution = gimage->xresolution;
*yresolution = gimage->yresolution;
}
void
......
......@@ -104,8 +104,10 @@ GtkType gimp_image_get_type(void);
GimpImage * gimp_image_new (int, int, int);
void gimp_image_set_filename (GimpImage *, char *);
void gimp_image_set_resolution (GimpImage *, float);
float gimp_image_get_resolution (GimpImage *);
void gimp_image_set_resolution (GimpImage *, float, float);
void gimp_image_get_resolution (GimpImage *,
float *,
float *);
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
void gimp_image_resize (GimpImage *, int, int, int, int);
......
......@@ -155,7 +155,8 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview = NULL;
gimage->parasites = parasite_list_new();
gimp_matrix_identity(gimage->transform);
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
gimage->xresolution = 72.0; /* maybe should be rc-supplied default? */
gimage->yresolution = 72.0;
gimage->save_proc= NULL;
}
......@@ -301,15 +302,22 @@ gimp_image_set_filename (GimpImage *gimage, char *filename)
void
gimp_image_set_resolution (GimpImage *gimage, float resolution)
gimp_image_set_resolution (GimpImage *gimage,
float xresolution,
float yresolution)
{
gimage->resolution = resolution;
gimage->xresolution = xresolution;
gimage->yresolution = yresolution;
}
float
gimp_image_get_resolution (GimpImage *gimage)
void
gimp_image_get_resolution (GimpImage *gimage,
float *xresolution,
float *yresolution)
{
return gimage->resolution;
g_return_if_fail(xresolution && yresolution);
*xresolution = gimage->xresolution;
*yresolution = gimage->yresolution;
}
void
......
......@@ -104,8 +104,10 @@ GtkType gimp_image_get_type(void);
GimpImage * gimp_image_new (int, int, int);
void gimp_image_set_filename (GimpImage *, char *);
void gimp_image_set_resolution (GimpImage *, float);
float gimp_image_get_resolution (GimpImage *);
void gimp_image_set_resolution (GimpImage *, float, float);
void gimp_image_get_resolution (GimpImage *,
float *,
float *);
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
void gimp_image_resize (GimpImage *, int, int, int, int);
......
......@@ -155,7 +155,8 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview = NULL;
gimage->parasites = parasite_list_new();
gimp_matrix_identity(gimage->transform);
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
gimage->xresolution = 72.0; /* maybe should be rc-supplied default? */
gimage->yresolution = 72.0;
gimage->save_proc= NULL;
}
......@@ -301,15 +302,22 @@ gimp_image_set_filename (GimpImage *gimage, char *filename)
void
gimp_image_set_resolution (GimpImage *gimage, float resolution)
gimp_image_set_resolution (GimpImage *gimage,
float xresolution,
float yresolution)
{
gimage->resolution = resolution;
gimage->xresolution = xresolution;
gimage->yresolution = yresolution;
}
float
gimp_image_get_resolution (GimpImage *gimage)
void
gimp_image_get_resolution (GimpImage *gimage,
float *xresolution,
float *yresolution)
{
return gimage->resolution;
g_return_if_fail(xresolution && yresolution);
*xresolution = gimage->xresolution;
*yresolution = gimage->yresolution;
}
void
......
......@@ -104,8 +104,10 @@ GtkType gimp_image_get_type(void);
GimpImage * gimp_image_new (int, int, int);
void gimp_image_set_filename (GimpImage *, char *);
void gimp_image_set_resolution (GimpImage *, float);
float gimp_image_get_resolution (GimpImage *);
void gimp_image_set_resolution (GimpImage *, float, float);
void gimp_image_get_resolution (GimpImage *,
float *,
float *);
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
void gimp_image_resize (GimpImage *, int, int, int, int);
......
......@@ -118,7 +118,10 @@ file_new_ok_callback (GtkWidget *widget,
gimage = gimage_new (vals->width, vals->height, vals->type);
gimp_image_set_resolution(gimage, vals->resolution);
/* XXX for the moment, we set both x and y resolution to the same,
* since we don't have the UI to get both values from the user, and
* besides, that's what PhotoShop seems to do. */
gimp_image_set_resolution(gimage, vals->resolution, vals->resolution);
/* Make the background (or first) layer */
layer = layer_new (gimage, gimage->width, gimage->height,
......@@ -448,7 +451,7 @@ file_new_cmd_callback (GtkWidget *widget,
vals->width = gdisp->gimage->width;
vals->height = gdisp->gimage->height;
vals->type = gimage_base_type (gdisp->gimage);
vals->resolution = gdisp->gimage->resolution;
vals->resolution = gdisp->gimage->xresolution;
vals->unit = last_unit;
vals->res_unit = 1.0;
}
......
......@@ -199,7 +199,9 @@ info_window_update (InfoDialog *info_win,
(int) gdisp->gimage->width, (int) gdisp->gimage->height);
/* image resolution */
sprintf (iwd->resolution_str, "%g dpi", gdisp->gimage->resolution);
sprintf (iwd->resolution_str, "%g x %g dpi",
gdisp->gimage->xresolution,
gdisp->gimage->yresolution);
/* zoom ratio */
sprintf (iwd->scale_str, "%d:%d",
......
......@@ -118,7 +118,10 @@ file_new_ok_callback (GtkWidget *widget,
gimage = gimage_new (vals->width, vals->height, vals->type);
gimp_image_set_resolution(gimage, vals->resolution);
/* XXX for the moment, we set both x and y resolution to the same,
* since we don't have the UI to get both values from the user, and
* besides, that's what PhotoShop seems to do. */
gimp_image_set_resolution(gimage, vals->resolution, vals->resolution);
/* Make the background (or first) layer */
layer = layer_new (gimage, gimage->width, gimage->height,
......@@ -448,7 +451,7 @@ file_new_cmd_callback (GtkWidget *widget,
vals->width = gdisp->gimage->width;
vals->height = gdisp->gimage->height;
vals->type = gimage_base_type (gdisp->gimage);
vals->resolution = gdisp->gimage->resolution;
vals->resolution = gdisp->gimage->xresolution;
vals->unit = last_unit;
vals->res_unit = 1.0;
}
......
......@@ -2783,25 +2783,32 @@ static Argument *
gimage_get_resolution_invoker (Argument *args)
{
GImage *gimage;
float resolution;
float xresolution;
float yresolution;
Argument *return_args;
resolution = 0;
xresolution = 0.0;
yresolution = 0.0;
success = TRUE;
if (success)
{
int_value = args[0].value.pdb_int;
if ((gimage = gimage_get_ID (int_value)))
resolution = gimage->resolution;
else
if ((gimage = gimage_get_ID (int_value))) {
xresolution = gimage->xresolution;
yresolution = gimage->yresolution;
} else {
success = FALSE;
}
}
return_args= procedural_db_return_args(&gimage_get_resolution_proc, success);
if (success)
return_args[1].value.pdb_float = resolution;
{
return_args[1].value.pdb_float = xresolution;
return_args[2].value.pdb_float = yresolution;
}
return return_args;
}
......@@ -2818,8 +2825,12 @@ ProcArg gimage_get_resolution_args[] =
ProcArg gimage_get_resolution_out_args[] =
{
{ PDB_FLOAT,
"resolution",
"the image's resolution, in dots per inch"
"xresolution",
"the image's resolution in the x-axis, in dots per inch"
},
{ PDB_FLOAT,
"yresolution",
"the image's resolution in the y-axis, in dots per inch"
}
};
......@@ -2838,7 +2849,7 @@ ProcRecord gimage_get_resolution_proc =
gimage_get_resolution_args,
/* Output arguments */
1,
2,
gimage_get_resolution_out_args,
/* Exec method */
......@@ -2866,7 +2877,9 @@ gimage_set_resolution_invoker (Argument *args)
if (success)
{
float_value = args[1].value.pdb_float;
gimage->resolution = float_value;
gimage->xresolution = float_value;
float_value = args[2].value.pdb_float;
gimage->yresolution = float_value;
}
return_args= procedural_db_return_args(&gimage_set_resolution_proc, success);
......@@ -2882,8 +2895,12 @@ ProcArg gimage_set_resolution_args[] =
"the image"
},
{ PDB_FLOAT,
"resolution",
"resolution in dots per inch"
"xresolution",
"resolution in x-axis, in dots per inch"
},
{ PDB_FLOAT,
"yresolution",
"resolution in y-axis, in dots per inch"
}
};
......@@ -2898,7 +2915,7 @@ ProcRecord gimage_set_resolution_proc =
PDB_INTERNAL,
/* Input arguments */
2,
3,
gimage_set_resolution_args,
/* Output arguments */
......
......@@ -155,7 +155,8 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview = NULL;
gimage->parasites = parasite_list_new();
gimp_matrix_identity(gimage->transform);
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
gimage->xresolution = 72.0; /* maybe should be rc-supplied default? */
gimage->yresolution = 72.0;
gimage->save_proc= NULL;
}
......@@ -301,15 +302,22 @@ gimp_image_set_filename (GimpImage *gimage, char *filename)
void
gimp_image_set_resolution (GimpImage *gimage, float resolution)
gimp_image_set_resolution (GimpImage *gimage,
float xresolution,
float yresolution)
{
gimage->resolution = resolution;
gimage->xresolution = xresolution;
gimage->yresolution = yresolution;
}
float
gimp_image_get_resolution (GimpImage *gimage)
void
gimp_image_get_resolution (GimpImage *gimage,
float *xresolution,
float *yresolution)
{
return gimage->resolution;
g_return_if_fail(xresolution && yresolution);
*xresolution = gimage->xresolution;
*yresolution = gimage->yresolution;
}
void
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment