mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-04 09:53:25 +00:00
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).
This commit is contained in:
parent
b8b5d7834d
commit
9dd1c38b7f
32 changed files with 319 additions and 143 deletions
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
||||||
|
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>
|
Sat Nov 14 20:15:46 CET 1998 Marc Lehmann <pcg@goof.com>
|
||||||
|
|
||||||
* plug-ins/script-fu/scripts/*: removed the image
|
* plug-ins/script-fu/scripts/*: removed the image
|
||||||
|
|
|
@ -155,7 +155,8 @@ static void gimp_image_init (GimpImage *gimage)
|
||||||
gimage->comp_preview = NULL;
|
gimage->comp_preview = NULL;
|
||||||
gimage->parasites = parasite_list_new();
|
gimage->parasites = parasite_list_new();
|
||||||
gimp_matrix_identity(gimage->transform);
|
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;
|
gimage->save_proc= NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,15 +302,22 @@ gimp_image_set_filename (GimpImage *gimage, char *filename)
|
||||||
|
|
||||||
|
|
||||||
void
|
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
|
void
|
||||||
gimp_image_get_resolution (GimpImage *gimage)
|
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
|
void
|
||||||
|
|
|
@ -104,8 +104,10 @@ GtkType gimp_image_get_type(void);
|
||||||
|
|
||||||
GimpImage * gimp_image_new (int, int, int);
|
GimpImage * gimp_image_new (int, int, int);
|
||||||
void gimp_image_set_filename (GimpImage *, char *);
|
void gimp_image_set_filename (GimpImage *, char *);
|
||||||
void gimp_image_set_resolution (GimpImage *, float);
|
void gimp_image_set_resolution (GimpImage *, float, float);
|
||||||
float gimp_image_get_resolution (GimpImage *);
|
void gimp_image_get_resolution (GimpImage *,
|
||||||
|
float *,
|
||||||
|
float *);
|
||||||
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);
|
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);
|
||||||
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
|
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
|
||||||
void gimp_image_resize (GimpImage *, int, int, int, int);
|
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->comp_preview = NULL;
|
||||||
gimage->parasites = parasite_list_new();
|
gimage->parasites = parasite_list_new();
|
||||||
gimp_matrix_identity(gimage->transform);
|
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;
|
gimage->save_proc= NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,15 +302,22 @@ gimp_image_set_filename (GimpImage *gimage, char *filename)
|
||||||
|
|
||||||
|
|
||||||
void
|
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
|
void
|
||||||
gimp_image_get_resolution (GimpImage *gimage)
|
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
|
void
|
||||||
|
|
|
@ -104,8 +104,10 @@ GtkType gimp_image_get_type(void);
|
||||||
|
|
||||||
GimpImage * gimp_image_new (int, int, int);
|
GimpImage * gimp_image_new (int, int, int);
|
||||||
void gimp_image_set_filename (GimpImage *, char *);
|
void gimp_image_set_filename (GimpImage *, char *);
|
||||||
void gimp_image_set_resolution (GimpImage *, float);
|
void gimp_image_set_resolution (GimpImage *, float, float);
|
||||||
float gimp_image_get_resolution (GimpImage *);
|
void gimp_image_get_resolution (GimpImage *,
|
||||||
|
float *,
|
||||||
|
float *);
|
||||||
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);
|
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);
|
||||||
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
|
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
|
||||||
void gimp_image_resize (GimpImage *, int, int, int, int);
|
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->comp_preview = NULL;
|
||||||
gimage->parasites = parasite_list_new();
|
gimage->parasites = parasite_list_new();
|
||||||
gimp_matrix_identity(gimage->transform);
|
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;
|
gimage->save_proc= NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,15 +302,22 @@ gimp_image_set_filename (GimpImage *gimage, char *filename)
|
||||||
|
|
||||||
|
|
||||||
void
|
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
|
void
|
||||||
gimp_image_get_resolution (GimpImage *gimage)
|
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
|
void
|
||||||
|
|
|
@ -104,8 +104,10 @@ GtkType gimp_image_get_type(void);
|
||||||
|
|
||||||
GimpImage * gimp_image_new (int, int, int);
|
GimpImage * gimp_image_new (int, int, int);
|
||||||
void gimp_image_set_filename (GimpImage *, char *);
|
void gimp_image_set_filename (GimpImage *, char *);
|
||||||
void gimp_image_set_resolution (GimpImage *, float);
|
void gimp_image_set_resolution (GimpImage *, float, float);
|
||||||
float gimp_image_get_resolution (GimpImage *);
|
void gimp_image_get_resolution (GimpImage *,
|
||||||
|
float *,
|
||||||
|
float *);
|
||||||
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);
|
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);
|
||||||
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
|
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
|
||||||
void gimp_image_resize (GimpImage *, int, int, int, int);
|
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->comp_preview = NULL;
|
||||||
gimage->parasites = parasite_list_new();
|
gimage->parasites = parasite_list_new();
|
||||||
gimp_matrix_identity(gimage->transform);
|
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;
|
gimage->save_proc= NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,15 +302,22 @@ gimp_image_set_filename (GimpImage *gimage, char *filename)
|
||||||
|
|
||||||
|
|
||||||
void
|
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
|
void
|
||||||
gimp_image_get_resolution (GimpImage *gimage)
|
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
|
void
|
||||||
|
|
|
@ -104,8 +104,10 @@ GtkType gimp_image_get_type(void);
|
||||||
|
|
||||||
GimpImage * gimp_image_new (int, int, int);
|
GimpImage * gimp_image_new (int, int, int);
|
||||||
void gimp_image_set_filename (GimpImage *, char *);
|
void gimp_image_set_filename (GimpImage *, char *);
|
||||||
void gimp_image_set_resolution (GimpImage *, float);
|
void gimp_image_set_resolution (GimpImage *, float, float);
|
||||||
float gimp_image_get_resolution (GimpImage *);
|
void gimp_image_get_resolution (GimpImage *,
|
||||||
|
float *,
|
||||||
|
float *);
|
||||||
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);
|
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);
|
||||||
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
|
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
|
||||||
void gimp_image_resize (GimpImage *, int, int, int, int);
|
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->comp_preview = NULL;
|
||||||
gimage->parasites = parasite_list_new();
|
gimage->parasites = parasite_list_new();
|
||||||
gimp_matrix_identity(gimage->transform);
|
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;
|
gimage->save_proc= NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,15 +302,22 @@ gimp_image_set_filename (GimpImage *gimage, char *filename)
|
||||||
|
|
||||||
|
|
||||||
void
|
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
|
void
|
||||||
gimp_image_get_resolution (GimpImage *gimage)
|
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
|
void
|
||||||
|
|
|
@ -104,8 +104,10 @@ GtkType gimp_image_get_type(void);
|
||||||
|
|
||||||
GimpImage * gimp_image_new (int, int, int);
|
GimpImage * gimp_image_new (int, int, int);
|
||||||
void gimp_image_set_filename (GimpImage *, char *);
|
void gimp_image_set_filename (GimpImage *, char *);
|
||||||
void gimp_image_set_resolution (GimpImage *, float);
|
void gimp_image_set_resolution (GimpImage *, float, float);
|
||||||
float gimp_image_get_resolution (GimpImage *);
|
void gimp_image_get_resolution (GimpImage *,
|
||||||
|
float *,
|
||||||
|
float *);
|
||||||
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);
|
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);
|
||||||
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
|
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
|
||||||
void gimp_image_resize (GimpImage *, int, int, int, int);
|
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->comp_preview = NULL;
|
||||||
gimage->parasites = parasite_list_new();
|
gimage->parasites = parasite_list_new();
|
||||||
gimp_matrix_identity(gimage->transform);
|
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;
|
gimage->save_proc= NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,15 +302,22 @@ gimp_image_set_filename (GimpImage *gimage, char *filename)
|
||||||
|
|
||||||
|
|
||||||
void
|
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
|
void
|
||||||
gimp_image_get_resolution (GimpImage *gimage)
|
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
|
void
|
||||||
|
|
|
@ -104,8 +104,10 @@ GtkType gimp_image_get_type(void);
|
||||||
|
|
||||||
GimpImage * gimp_image_new (int, int, int);
|
GimpImage * gimp_image_new (int, int, int);
|
||||||
void gimp_image_set_filename (GimpImage *, char *);
|
void gimp_image_set_filename (GimpImage *, char *);
|
||||||
void gimp_image_set_resolution (GimpImage *, float);
|
void gimp_image_set_resolution (GimpImage *, float, float);
|
||||||
float gimp_image_get_resolution (GimpImage *);
|
void gimp_image_get_resolution (GimpImage *,
|
||||||
|
float *,
|
||||||
|
float *);
|
||||||
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);
|
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);
|
||||||
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
|
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
|
||||||
void gimp_image_resize (GimpImage *, int, int, int, int);
|
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->comp_preview = NULL;
|
||||||
gimage->parasites = parasite_list_new();
|
gimage->parasites = parasite_list_new();
|
||||||
gimp_matrix_identity(gimage->transform);
|
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;
|
gimage->save_proc= NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,15 +302,22 @@ gimp_image_set_filename (GimpImage *gimage, char *filename)
|
||||||
|
|
||||||
|
|
||||||
void
|
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
|
void
|
||||||
gimp_image_get_resolution (GimpImage *gimage)
|
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
|
void
|
||||||
|
|
|
@ -104,8 +104,10 @@ GtkType gimp_image_get_type(void);
|
||||||
|
|
||||||
GimpImage * gimp_image_new (int, int, int);
|
GimpImage * gimp_image_new (int, int, int);
|
||||||
void gimp_image_set_filename (GimpImage *, char *);
|
void gimp_image_set_filename (GimpImage *, char *);
|
||||||
void gimp_image_set_resolution (GimpImage *, float);
|
void gimp_image_set_resolution (GimpImage *, float, float);
|
||||||
float gimp_image_get_resolution (GimpImage *);
|
void gimp_image_get_resolution (GimpImage *,
|
||||||
|
float *,
|
||||||
|
float *);
|
||||||
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);
|
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);
|
||||||
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
|
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
|
||||||
void gimp_image_resize (GimpImage *, int, int, int, int);
|
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);
|
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 */
|
/* Make the background (or first) layer */
|
||||||
layer = layer_new (gimage, gimage->width, gimage->height,
|
layer = layer_new (gimage, gimage->width, gimage->height,
|
||||||
|
@ -448,7 +451,7 @@ file_new_cmd_callback (GtkWidget *widget,
|
||||||
vals->width = gdisp->gimage->width;
|
vals->width = gdisp->gimage->width;
|
||||||
vals->height = gdisp->gimage->height;
|
vals->height = gdisp->gimage->height;
|
||||||
vals->type = gimage_base_type (gdisp->gimage);
|
vals->type = gimage_base_type (gdisp->gimage);
|
||||||
vals->resolution = gdisp->gimage->resolution;
|
vals->resolution = gdisp->gimage->xresolution;
|
||||||
vals->unit = last_unit;
|
vals->unit = last_unit;
|
||||||
vals->res_unit = 1.0;
|
vals->res_unit = 1.0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -199,7 +199,9 @@ info_window_update (InfoDialog *info_win,
|
||||||
(int) gdisp->gimage->width, (int) gdisp->gimage->height);
|
(int) gdisp->gimage->width, (int) gdisp->gimage->height);
|
||||||
|
|
||||||
/* image resolution */
|
/* 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 */
|
/* zoom ratio */
|
||||||
sprintf (iwd->scale_str, "%d:%d",
|
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);
|
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 */
|
/* Make the background (or first) layer */
|
||||||
layer = layer_new (gimage, gimage->width, gimage->height,
|
layer = layer_new (gimage, gimage->width, gimage->height,
|
||||||
|
@ -448,7 +451,7 @@ file_new_cmd_callback (GtkWidget *widget,
|
||||||
vals->width = gdisp->gimage->width;
|
vals->width = gdisp->gimage->width;
|
||||||
vals->height = gdisp->gimage->height;
|
vals->height = gdisp->gimage->height;
|
||||||
vals->type = gimage_base_type (gdisp->gimage);
|
vals->type = gimage_base_type (gdisp->gimage);
|
||||||
vals->resolution = gdisp->gimage->resolution;
|
vals->resolution = gdisp->gimage->xresolution;
|
||||||
vals->unit = last_unit;
|
vals->unit = last_unit;
|
||||||
vals->res_unit = 1.0;
|
vals->res_unit = 1.0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2783,25 +2783,32 @@ static Argument *
|
||||||
gimage_get_resolution_invoker (Argument *args)
|
gimage_get_resolution_invoker (Argument *args)
|
||||||
{
|
{
|
||||||
GImage *gimage;
|
GImage *gimage;
|
||||||
float resolution;
|
float xresolution;
|
||||||
|
float yresolution;
|
||||||
Argument *return_args;
|
Argument *return_args;
|
||||||
|
|
||||||
resolution = 0;
|
xresolution = 0.0;
|
||||||
|
yresolution = 0.0;
|
||||||
|
|
||||||
success = TRUE;
|
success = TRUE;
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
int_value = args[0].value.pdb_int;
|
int_value = args[0].value.pdb_int;
|
||||||
if ((gimage = gimage_get_ID (int_value)))
|
if ((gimage = gimage_get_ID (int_value))) {
|
||||||
resolution = gimage->resolution;
|
xresolution = gimage->xresolution;
|
||||||
else
|
yresolution = gimage->yresolution;
|
||||||
|
} else {
|
||||||
success = FALSE;
|
success = FALSE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return_args= procedural_db_return_args(&gimage_get_resolution_proc, success);
|
return_args= procedural_db_return_args(&gimage_get_resolution_proc, success);
|
||||||
|
|
||||||
if (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;
|
return return_args;
|
||||||
}
|
}
|
||||||
|
@ -2818,8 +2825,12 @@ ProcArg gimage_get_resolution_args[] =
|
||||||
ProcArg gimage_get_resolution_out_args[] =
|
ProcArg gimage_get_resolution_out_args[] =
|
||||||
{
|
{
|
||||||
{ PDB_FLOAT,
|
{ PDB_FLOAT,
|
||||||
"resolution",
|
"xresolution",
|
||||||
"the image's resolution, in dots per inch"
|
"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,
|
gimage_get_resolution_args,
|
||||||
|
|
||||||
/* Output arguments */
|
/* Output arguments */
|
||||||
1,
|
2,
|
||||||
gimage_get_resolution_out_args,
|
gimage_get_resolution_out_args,
|
||||||
|
|
||||||
/* Exec method */
|
/* Exec method */
|
||||||
|
@ -2866,7 +2877,9 @@ gimage_set_resolution_invoker (Argument *args)
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
float_value = args[1].value.pdb_float;
|
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);
|
return_args= procedural_db_return_args(&gimage_set_resolution_proc, success);
|
||||||
|
@ -2882,8 +2895,12 @@ ProcArg gimage_set_resolution_args[] =
|
||||||
"the image"
|
"the image"
|
||||||
},
|
},
|
||||||
{ PDB_FLOAT,
|
{ PDB_FLOAT,
|
||||||
"resolution",
|
"xresolution",
|
||||||
"resolution in dots per inch"
|
"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,
|
PDB_INTERNAL,
|
||||||
|
|
||||||
/* Input arguments */
|
/* Input arguments */
|
||||||
2,
|
3,
|
||||||
gimage_set_resolution_args,
|
gimage_set_resolution_args,
|
||||||
|
|
||||||
/* Output arguments */
|
/* Output arguments */
|
||||||
|
|
|
@ -155,7 +155,8 @@ static void gimp_image_init (GimpImage *gimage)
|
||||||
gimage->comp_preview = NULL;
|
gimage->comp_preview = NULL;
|
||||||
gimage->parasites = parasite_list_new();
|
gimage->parasites = parasite_list_new();
|
||||||
gimp_matrix_identity(gimage->transform);
|
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;
|
gimage->save_proc= NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,15 +302,22 @@ gimp_image_set_filename (GimpImage *gimage, char *filename)
|
||||||
|
|
||||||
|
|
||||||
void
|
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
|
void
|
||||||
gimp_image_get_resolution (GimpImage *gimage)
|
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
|
void
|
||||||
|
|
|
@ -104,8 +104,10 @@ GtkType gimp_image_get_type(void);
|
||||||
|
|
||||||
GimpImage * gimp_image_new (int, int, int);
|
GimpImage * gimp_image_new (int, int, int);
|
||||||
void gimp_image_set_filename (GimpImage *, char *);
|
void gimp_image_set_filename (GimpImage *, char *);
|
||||||
void gimp_image_set_resolution (GimpImage *, float);
|
void gimp_image_set_resolution (GimpImage *, float, float);
|
||||||
float gimp_image_get_resolution (GimpImage *);
|
void gimp_image_get_resolution (GimpImage *,
|
||||||
|
float *,
|
||||||
|
float *);
|
||||||
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);
|
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);
|
||||||
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
|
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
|
||||||
void gimp_image_resize (GimpImage *, int, int, int, int);
|
void gimp_image_resize (GimpImage *, int, int, int, int);
|
||||||
|
|
|
@ -22,7 +22,8 @@ struct _GimpImage
|
||||||
PlugInProcDef *save_proc; /* last PDB save proc used */
|
PlugInProcDef *save_proc; /* last PDB save proc used */
|
||||||
|
|
||||||
int width, height; /* width and height attributes */
|
int width, height; /* width and height attributes */
|
||||||
float resolution; /* image res, in dpi */
|
float xresolution; /* image x-res, in dpi */
|
||||||
|
float yresolution; /* image y-res, in dpi */
|
||||||
int base_type; /* base gimp_image type */
|
int base_type; /* base gimp_image type */
|
||||||
|
|
||||||
unsigned char * cmap; /* colormap--for indexed */
|
unsigned char * cmap; /* colormap--for indexed */
|
||||||
|
|
|
@ -118,7 +118,10 @@ file_new_ok_callback (GtkWidget *widget,
|
||||||
|
|
||||||
gimage = gimage_new (vals->width, vals->height, vals->type);
|
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 */
|
/* Make the background (or first) layer */
|
||||||
layer = layer_new (gimage, gimage->width, gimage->height,
|
layer = layer_new (gimage, gimage->width, gimage->height,
|
||||||
|
@ -448,7 +451,7 @@ file_new_cmd_callback (GtkWidget *widget,
|
||||||
vals->width = gdisp->gimage->width;
|
vals->width = gdisp->gimage->width;
|
||||||
vals->height = gdisp->gimage->height;
|
vals->height = gdisp->gimage->height;
|
||||||
vals->type = gimage_base_type (gdisp->gimage);
|
vals->type = gimage_base_type (gdisp->gimage);
|
||||||
vals->resolution = gdisp->gimage->resolution;
|
vals->resolution = gdisp->gimage->xresolution;
|
||||||
vals->unit = last_unit;
|
vals->unit = last_unit;
|
||||||
vals->res_unit = 1.0;
|
vals->res_unit = 1.0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -199,7 +199,9 @@ info_window_update (InfoDialog *info_win,
|
||||||
(int) gdisp->gimage->width, (int) gdisp->gimage->height);
|
(int) gdisp->gimage->width, (int) gdisp->gimage->height);
|
||||||
|
|
||||||
/* image resolution */
|
/* 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 */
|
/* zoom ratio */
|
||||||
sprintf (iwd->scale_str, "%d:%d",
|
sprintf (iwd->scale_str, "%d:%d",
|
||||||
|
|
|
@ -199,7 +199,9 @@ info_window_update (InfoDialog *info_win,
|
||||||
(int) gdisp->gimage->width, (int) gdisp->gimage->height);
|
(int) gdisp->gimage->width, (int) gdisp->gimage->height);
|
||||||
|
|
||||||
/* image resolution */
|
/* 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 */
|
/* zoom ratio */
|
||||||
sprintf (iwd->scale_str, "%d:%d",
|
sprintf (iwd->scale_str, "%d:%d",
|
||||||
|
|
|
@ -445,8 +445,11 @@ void gimp_image_attach_new_parasite (gint32 image_ID,
|
||||||
void gimp_image_detach_parasite (gint32 image_ID,
|
void gimp_image_detach_parasite (gint32 image_ID,
|
||||||
const char *name);
|
const char *name);
|
||||||
void gimp_image_set_resolution (gint32 image_ID,
|
void gimp_image_set_resolution (gint32 image_ID,
|
||||||
float resolution);
|
float xresolution,
|
||||||
float gimp_image_get_resolution (gint32 image_ID);
|
float yresolution);
|
||||||
|
void gimp_image_get_resolution (gint32 image_ID,
|
||||||
|
float *xresolution,
|
||||||
|
float *yresolution);
|
||||||
gint32 gimp_image_get_layer_by_tattoo (gint32 image_ID,
|
gint32 gimp_image_get_layer_by_tattoo (gint32 image_ID,
|
||||||
gint32 tattoo);
|
gint32 tattoo);
|
||||||
gint32 gimp_image_get_channel_by_tattoo (gint32 image_ID,
|
gint32 gimp_image_get_channel_by_tattoo (gint32 image_ID,
|
||||||
|
|
|
@ -982,30 +982,43 @@ gimp_image_detach_parasite (gint32 image_ID, const char *name)
|
||||||
gimp_destroy_params (return_vals, nreturn_vals);
|
gimp_destroy_params (return_vals, nreturn_vals);
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
void
|
||||||
gimp_image_get_resolution (gint32 image_ID)
|
gimp_image_get_resolution (gint32 image_ID,
|
||||||
|
float *xresolution,
|
||||||
|
float *yresolution)
|
||||||
{
|
{
|
||||||
GParam *return_vals;
|
GParam *return_vals;
|
||||||
int nreturn_vals;
|
int nreturn_vals;
|
||||||
float result;
|
float xres;
|
||||||
|
float yres;
|
||||||
|
|
||||||
|
g_return_if_fail(xresolution && yresolution);
|
||||||
|
|
||||||
return_vals = gimp_run_procedure ("gimp_image_get_resolution",
|
return_vals = gimp_run_procedure ("gimp_image_get_resolution",
|
||||||
&nreturn_vals,
|
&nreturn_vals,
|
||||||
PARAM_IMAGE, image_ID,
|
PARAM_IMAGE, image_ID,
|
||||||
PARAM_END);
|
PARAM_END);
|
||||||
|
|
||||||
result = 0.0; /* error return value */
|
/* error return values */
|
||||||
|
xres = 0.0;
|
||||||
|
yres = 0.0;
|
||||||
|
|
||||||
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
||||||
result = return_vals[1].data.d_float;
|
{
|
||||||
|
xres = return_vals[1].data.d_float;
|
||||||
|
yres = return_vals[2].data.d_float;
|
||||||
|
}
|
||||||
|
|
||||||
gimp_destroy_params (return_vals, nreturn_vals);
|
gimp_destroy_params (return_vals, nreturn_vals);
|
||||||
|
|
||||||
return result;
|
*xresolution = xres;
|
||||||
|
*yresolution = yres;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_image_set_resolution (gint32 image_ID,
|
gimp_image_set_resolution (gint32 image_ID,
|
||||||
float resolution)
|
float xresolution,
|
||||||
|
float yresolution)
|
||||||
{
|
{
|
||||||
GParam *return_vals;
|
GParam *return_vals;
|
||||||
int nreturn_vals;
|
int nreturn_vals;
|
||||||
|
@ -1013,7 +1026,8 @@ gimp_image_set_resolution (gint32 image_ID,
|
||||||
return_vals = gimp_run_procedure ("gimp_image_set_resolution",
|
return_vals = gimp_run_procedure ("gimp_image_set_resolution",
|
||||||
&nreturn_vals,
|
&nreturn_vals,
|
||||||
PARAM_IMAGE, image_ID,
|
PARAM_IMAGE, image_ID,
|
||||||
PARAM_FLOAT, resolution,
|
PARAM_FLOAT, xresolution,
|
||||||
|
PARAM_FLOAT, yresolution,
|
||||||
PARAM_END);
|
PARAM_END);
|
||||||
|
|
||||||
gimp_destroy_params (return_vals, nreturn_vals);
|
gimp_destroy_params (return_vals, nreturn_vals);
|
||||||
|
|
|
@ -982,30 +982,43 @@ gimp_image_detach_parasite (gint32 image_ID, const char *name)
|
||||||
gimp_destroy_params (return_vals, nreturn_vals);
|
gimp_destroy_params (return_vals, nreturn_vals);
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
void
|
||||||
gimp_image_get_resolution (gint32 image_ID)
|
gimp_image_get_resolution (gint32 image_ID,
|
||||||
|
float *xresolution,
|
||||||
|
float *yresolution)
|
||||||
{
|
{
|
||||||
GParam *return_vals;
|
GParam *return_vals;
|
||||||
int nreturn_vals;
|
int nreturn_vals;
|
||||||
float result;
|
float xres;
|
||||||
|
float yres;
|
||||||
|
|
||||||
|
g_return_if_fail(xresolution && yresolution);
|
||||||
|
|
||||||
return_vals = gimp_run_procedure ("gimp_image_get_resolution",
|
return_vals = gimp_run_procedure ("gimp_image_get_resolution",
|
||||||
&nreturn_vals,
|
&nreturn_vals,
|
||||||
PARAM_IMAGE, image_ID,
|
PARAM_IMAGE, image_ID,
|
||||||
PARAM_END);
|
PARAM_END);
|
||||||
|
|
||||||
result = 0.0; /* error return value */
|
/* error return values */
|
||||||
|
xres = 0.0;
|
||||||
|
yres = 0.0;
|
||||||
|
|
||||||
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
||||||
result = return_vals[1].data.d_float;
|
{
|
||||||
|
xres = return_vals[1].data.d_float;
|
||||||
|
yres = return_vals[2].data.d_float;
|
||||||
|
}
|
||||||
|
|
||||||
gimp_destroy_params (return_vals, nreturn_vals);
|
gimp_destroy_params (return_vals, nreturn_vals);
|
||||||
|
|
||||||
return result;
|
*xresolution = xres;
|
||||||
|
*yresolution = yres;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_image_set_resolution (gint32 image_ID,
|
gimp_image_set_resolution (gint32 image_ID,
|
||||||
float resolution)
|
float xresolution,
|
||||||
|
float yresolution)
|
||||||
{
|
{
|
||||||
GParam *return_vals;
|
GParam *return_vals;
|
||||||
int nreturn_vals;
|
int nreturn_vals;
|
||||||
|
@ -1013,7 +1026,8 @@ gimp_image_set_resolution (gint32 image_ID,
|
||||||
return_vals = gimp_run_procedure ("gimp_image_set_resolution",
|
return_vals = gimp_run_procedure ("gimp_image_set_resolution",
|
||||||
&nreturn_vals,
|
&nreturn_vals,
|
||||||
PARAM_IMAGE, image_ID,
|
PARAM_IMAGE, image_ID,
|
||||||
PARAM_FLOAT, resolution,
|
PARAM_FLOAT, xresolution,
|
||||||
|
PARAM_FLOAT, yresolution,
|
||||||
PARAM_END);
|
PARAM_END);
|
||||||
|
|
||||||
gimp_destroy_params (return_vals, nreturn_vals);
|
gimp_destroy_params (return_vals, nreturn_vals);
|
||||||
|
|
|
@ -1265,8 +1265,15 @@ newsprint_dialog (GDrawable *drawable)
|
||||||
gtk_container_add (GTK_CONTAINER (frame), table);
|
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||||
|
|
||||||
#ifdef GIMP_HAVE_RESOLUTION_INFO
|
#ifdef GIMP_HAVE_RESOLUTION_INFO
|
||||||
pvals_ui.input_spi =
|
{
|
||||||
gimp_image_get_resolution(gimp_drawable_image_id(drawable->id));
|
float xres, yres;
|
||||||
|
gimp_image_get_resolution(gimp_drawable_image_id(drawable->id),
|
||||||
|
&xres, &yres);
|
||||||
|
/* XXX hack: should really note both resolutions, and use
|
||||||
|
* rectangular cells, not square cells. But I'm being lazy,
|
||||||
|
* and the majority of the world works with xres == yres */
|
||||||
|
pvals_ui.input_spi = xres;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
st.input_spi = NULL;
|
st.input_spi = NULL;
|
||||||
|
|
|
@ -466,18 +466,11 @@ static gint32 load_image (char *filename) {
|
||||||
/* any resolution info in the file? */
|
/* any resolution info in the file? */
|
||||||
#ifdef GIMP_HAVE_RESOLUTION_INFO
|
#ifdef GIMP_HAVE_RESOLUTION_INFO
|
||||||
{
|
{
|
||||||
float xres=0, yres=0;
|
float xres=0.0, yres=0.0;
|
||||||
unsigned short units;
|
unsigned short units;
|
||||||
float res=0.0;
|
|
||||||
|
|
||||||
if (TIFFGetField (tif, TIFFTAG_XRESOLUTION, &xres)) {
|
if (TIFFGetField (tif, TIFFTAG_XRESOLUTION, &xres)) {
|
||||||
if (TIFFGetField (tif, TIFFTAG_YRESOLUTION, &yres)) {
|
if (TIFFGetField (tif, TIFFTAG_YRESOLUTION, &yres)) {
|
||||||
if (abs(xres - yres) > 1e-5)
|
|
||||||
g_message("TIFF warning: x resolution differs "
|
|
||||||
"from y resolution (%g != %g)\n"
|
|
||||||
"Using x resolution\n", xres, yres);
|
|
||||||
|
|
||||||
res = xres;
|
|
||||||
|
|
||||||
if (TIFFGetField (tif, TIFFTAG_RESOLUTIONUNIT, &units)) {
|
if (TIFFGetField (tif, TIFFTAG_RESOLUTIONUNIT, &units)) {
|
||||||
switch(units) {
|
switch(units) {
|
||||||
|
@ -485,14 +478,16 @@ static gint32 load_image (char *filename) {
|
||||||
/* ImageMagick writes files with this silly resunit */
|
/* ImageMagick writes files with this silly resunit */
|
||||||
g_message("TIFF warning: resolution units meaningless, "
|
g_message("TIFF warning: resolution units meaningless, "
|
||||||
"forcing 72 dpi\n");
|
"forcing 72 dpi\n");
|
||||||
res = 72.0;
|
xres = 72.0;
|
||||||
|
yres = 72.0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RESUNIT_INCH:
|
case RESUNIT_INCH:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RESUNIT_CENTIMETER:
|
case RESUNIT_CENTIMETER:
|
||||||
res = ((float)xres) * 2.54;
|
xres *= 2.54;
|
||||||
|
yres *= 2.54;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -506,16 +501,18 @@ static gint32 load_image (char *filename) {
|
||||||
}
|
}
|
||||||
} else { /* xres but no yres */
|
} else { /* xres but no yres */
|
||||||
g_message("TIFF warning: no y resolution info, assuming same as x\n");
|
g_message("TIFF warning: no y resolution info, assuming same as x\n");
|
||||||
|
yres = xres;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* sanity check, since division by zero later could be embarrassing */
|
/* sanity check, since division by zero later could be embarrassing */
|
||||||
if (res < 1e-5) {
|
if (xres < 1e-5 || yres < 1e-5) {
|
||||||
g_message("TIFF: image resolution is zero: forcing 72 dpi\n");
|
g_message("TIFF: image resolution is zero: forcing 72 dpi\n");
|
||||||
res = 72.0;
|
xres = 72.0;
|
||||||
|
yres = 72.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now set the new image's resolution info */
|
/* now set the new image's resolution info */
|
||||||
gimp_image_set_resolution (image, res);
|
gimp_image_set_resolution (image, xres, yres);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* no x res tag => we assume we have no resolution info, so we
|
/* no x res tag => we assume we have no resolution info, so we
|
||||||
|
@ -1133,11 +1130,15 @@ static gint save_image (char *filename, gint32 image, gint32 layer) {
|
||||||
#ifdef GIMP_HAVE_RESOLUTION_INFO
|
#ifdef GIMP_HAVE_RESOLUTION_INFO
|
||||||
/* resolution fields */
|
/* resolution fields */
|
||||||
{
|
{
|
||||||
float resolution = gimp_image_get_resolution(image);
|
float xresolution;
|
||||||
if (resolution)
|
float yresolution;
|
||||||
|
|
||||||
|
gimp_image_get_resolution (image, &xresolution, &yresolution);
|
||||||
|
|
||||||
|
if (xresolution > 1e-5 && yresolution > 1e-5)
|
||||||
{
|
{
|
||||||
TIFFSetField (tif, TIFFTAG_XRESOLUTION, resolution);
|
TIFFSetField (tif, TIFFTAG_XRESOLUTION, xresolution);
|
||||||
TIFFSetField (tif, TIFFTAG_YRESOLUTION, resolution);
|
TIFFSetField (tif, TIFFTAG_YRESOLUTION, yresolution);
|
||||||
TIFFSetField (tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH);
|
TIFFSetField (tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1265,8 +1265,15 @@ newsprint_dialog (GDrawable *drawable)
|
||||||
gtk_container_add (GTK_CONTAINER (frame), table);
|
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||||
|
|
||||||
#ifdef GIMP_HAVE_RESOLUTION_INFO
|
#ifdef GIMP_HAVE_RESOLUTION_INFO
|
||||||
pvals_ui.input_spi =
|
{
|
||||||
gimp_image_get_resolution(gimp_drawable_image_id(drawable->id));
|
float xres, yres;
|
||||||
|
gimp_image_get_resolution(gimp_drawable_image_id(drawable->id),
|
||||||
|
&xres, &yres);
|
||||||
|
/* XXX hack: should really note both resolutions, and use
|
||||||
|
* rectangular cells, not square cells. But I'm being lazy,
|
||||||
|
* and the majority of the world works with xres == yres */
|
||||||
|
pvals_ui.input_spi = xres;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
st.input_spi = NULL;
|
st.input_spi = NULL;
|
||||||
|
|
|
@ -466,18 +466,11 @@ static gint32 load_image (char *filename) {
|
||||||
/* any resolution info in the file? */
|
/* any resolution info in the file? */
|
||||||
#ifdef GIMP_HAVE_RESOLUTION_INFO
|
#ifdef GIMP_HAVE_RESOLUTION_INFO
|
||||||
{
|
{
|
||||||
float xres=0, yres=0;
|
float xres=0.0, yres=0.0;
|
||||||
unsigned short units;
|
unsigned short units;
|
||||||
float res=0.0;
|
|
||||||
|
|
||||||
if (TIFFGetField (tif, TIFFTAG_XRESOLUTION, &xres)) {
|
if (TIFFGetField (tif, TIFFTAG_XRESOLUTION, &xres)) {
|
||||||
if (TIFFGetField (tif, TIFFTAG_YRESOLUTION, &yres)) {
|
if (TIFFGetField (tif, TIFFTAG_YRESOLUTION, &yres)) {
|
||||||
if (abs(xres - yres) > 1e-5)
|
|
||||||
g_message("TIFF warning: x resolution differs "
|
|
||||||
"from y resolution (%g != %g)\n"
|
|
||||||
"Using x resolution\n", xres, yres);
|
|
||||||
|
|
||||||
res = xres;
|
|
||||||
|
|
||||||
if (TIFFGetField (tif, TIFFTAG_RESOLUTIONUNIT, &units)) {
|
if (TIFFGetField (tif, TIFFTAG_RESOLUTIONUNIT, &units)) {
|
||||||
switch(units) {
|
switch(units) {
|
||||||
|
@ -485,14 +478,16 @@ static gint32 load_image (char *filename) {
|
||||||
/* ImageMagick writes files with this silly resunit */
|
/* ImageMagick writes files with this silly resunit */
|
||||||
g_message("TIFF warning: resolution units meaningless, "
|
g_message("TIFF warning: resolution units meaningless, "
|
||||||
"forcing 72 dpi\n");
|
"forcing 72 dpi\n");
|
||||||
res = 72.0;
|
xres = 72.0;
|
||||||
|
yres = 72.0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RESUNIT_INCH:
|
case RESUNIT_INCH:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RESUNIT_CENTIMETER:
|
case RESUNIT_CENTIMETER:
|
||||||
res = ((float)xres) * 2.54;
|
xres *= 2.54;
|
||||||
|
yres *= 2.54;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -506,16 +501,18 @@ static gint32 load_image (char *filename) {
|
||||||
}
|
}
|
||||||
} else { /* xres but no yres */
|
} else { /* xres but no yres */
|
||||||
g_message("TIFF warning: no y resolution info, assuming same as x\n");
|
g_message("TIFF warning: no y resolution info, assuming same as x\n");
|
||||||
|
yres = xres;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* sanity check, since division by zero later could be embarrassing */
|
/* sanity check, since division by zero later could be embarrassing */
|
||||||
if (res < 1e-5) {
|
if (xres < 1e-5 || yres < 1e-5) {
|
||||||
g_message("TIFF: image resolution is zero: forcing 72 dpi\n");
|
g_message("TIFF: image resolution is zero: forcing 72 dpi\n");
|
||||||
res = 72.0;
|
xres = 72.0;
|
||||||
|
yres = 72.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now set the new image's resolution info */
|
/* now set the new image's resolution info */
|
||||||
gimp_image_set_resolution (image, res);
|
gimp_image_set_resolution (image, xres, yres);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* no x res tag => we assume we have no resolution info, so we
|
/* no x res tag => we assume we have no resolution info, so we
|
||||||
|
@ -1133,11 +1130,15 @@ static gint save_image (char *filename, gint32 image, gint32 layer) {
|
||||||
#ifdef GIMP_HAVE_RESOLUTION_INFO
|
#ifdef GIMP_HAVE_RESOLUTION_INFO
|
||||||
/* resolution fields */
|
/* resolution fields */
|
||||||
{
|
{
|
||||||
float resolution = gimp_image_get_resolution(image);
|
float xresolution;
|
||||||
if (resolution)
|
float yresolution;
|
||||||
|
|
||||||
|
gimp_image_get_resolution (image, &xresolution, &yresolution);
|
||||||
|
|
||||||
|
if (xresolution > 1e-5 && yresolution > 1e-5)
|
||||||
{
|
{
|
||||||
TIFFSetField (tif, TIFFTAG_XRESOLUTION, resolution);
|
TIFFSetField (tif, TIFFTAG_XRESOLUTION, xresolution);
|
||||||
TIFFSetField (tif, TIFFTAG_YRESOLUTION, resolution);
|
TIFFSetField (tif, TIFFTAG_YRESOLUTION, yresolution);
|
||||||
TIFFSetField (tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH);
|
TIFFSetField (tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue