mirror of https://github.com/GNOME/gimp.git
Bill Skaggs <weskaggs@primate.ucdavis.edu>
* app/xcf/xcf-private.h * app/xcf/xcf-load.c * app/xcf/xcf-save.c: save sample points in xcf files, and load them. Fixes bug #342480.
This commit is contained in:
parent
92a323256c
commit
8e67a0649f
|
@ -1,3 +1,10 @@
|
|||
2006-08-10 Bill Skaggs <weskaggs@primate.ucdavis.edu>
|
||||
|
||||
* app/xcf/xcf-private.h
|
||||
* app/xcf/xcf-load.c
|
||||
* app/xcf/xcf-save.c: save sample points in xcf files,
|
||||
and load them. Fixes bug #342480.
|
||||
|
||||
2006-08-10 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/file/file-utils.c: added a copy of g_unescape_uri_string()
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-grid.h"
|
||||
#include "core/gimpimage-guides.h"
|
||||
#include "core/gimpimage-sample-points.h"
|
||||
#include "core/gimplayer.h"
|
||||
#include "core/gimplayer-floating-sel.h"
|
||||
#include "core/gimplayermask.h"
|
||||
|
@ -416,6 +417,22 @@ xcf_load_image_props (XcfInfo *info,
|
|||
}
|
||||
break;
|
||||
|
||||
case PROP_SAMPLE_POINTS:
|
||||
{
|
||||
gint32 x, y;
|
||||
gint i, n_sample_points;
|
||||
|
||||
n_sample_points = prop_size / (4 + 4);
|
||||
for (i = 0; i < n_sample_points; i++)
|
||||
{
|
||||
info->cp += xcf_read_int32 (info->fp, (guint32 *) &x, 1);
|
||||
info->cp += xcf_read_int32 (info->fp, (guint32 *) &y, 1);
|
||||
|
||||
gimp_image_add_sample_point_at_pos (image, x, y, FALSE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_RESOLUTION:
|
||||
{
|
||||
gfloat xres, yres;
|
||||
|
|
|
@ -48,7 +48,8 @@ typedef enum
|
|||
PROP_PATHS = 23,
|
||||
PROP_USER_UNIT = 24,
|
||||
PROP_VECTORS = 25,
|
||||
PROP_TEXT_LAYER_FLAGS = 26
|
||||
PROP_TEXT_LAYER_FLAGS = 26,
|
||||
PROP_SAMPLE_POINTS = 27
|
||||
} PropType;
|
||||
|
||||
typedef enum
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-grid.h"
|
||||
#include "core/gimpimage-guides.h"
|
||||
#include "core/gimpimage-sample-points.h"
|
||||
#include "core/gimplayer.h"
|
||||
#include "core/gimplayer-floating-sel.h"
|
||||
#include "core/gimplayermask.h"
|
||||
|
@ -456,6 +457,10 @@ xcf_save_image_props (XcfInfo *info,
|
|||
xcf_check_error (xcf_save_prop (info, image, PROP_GUIDES,
|
||||
error, image->guides));
|
||||
|
||||
if (image->sample_points)
|
||||
xcf_check_error (xcf_save_prop (info, image, PROP_SAMPLE_POINTS,
|
||||
error, image->sample_points));
|
||||
|
||||
xcf_check_error (xcf_save_prop (info, image, PROP_RESOLUTION, error,
|
||||
image->xresolution, image->yresolution));
|
||||
|
||||
|
@ -889,6 +894,33 @@ xcf_save_prop (XcfInfo *info,
|
|||
}
|
||||
break;
|
||||
|
||||
case PROP_SAMPLE_POINTS:
|
||||
{
|
||||
GList *sample_points;
|
||||
gint n_sample_points;
|
||||
|
||||
sample_points = va_arg (args, GList *);
|
||||
n_sample_points = g_list_length (sample_points);
|
||||
|
||||
size = n_sample_points * (4 + 4);
|
||||
|
||||
xcf_write_prop_type_check_error (info, prop_type);
|
||||
xcf_write_int32_check_error (info, &size, 1);
|
||||
|
||||
for (; sample_points; sample_points = g_list_next (sample_points))
|
||||
{
|
||||
GimpSamplePoint *sample_point = sample_points->data;
|
||||
gint32 x, y;
|
||||
|
||||
x = sample_point->x;
|
||||
y = sample_point->y;
|
||||
|
||||
xcf_write_int32_check_error (info, (guint32 *) &x, 1);
|
||||
xcf_write_int32_check_error (info, (guint32 *) &y, 1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_RESOLUTION:
|
||||
{
|
||||
gfloat xresolution, yresolution;
|
||||
|
|
Loading…
Reference in New Issue