1
1
mirror of https://gitlab.gnome.org/GNOME/gimp.git synced 2025-10-06 05:22:40 +02:00

Compare commits

...

80 Commits

Author SHA1 Message Date
Hartmut Kuhse
d687fa857a Restore GimpMetadata API - merge with Master 2016-11-13 07:41:37 +01:00
Hartmut Kuhse
2a5f27c406 plug-ins: remove channel attributes from attributes viewer 2016-11-13 07:39:46 +01:00
Hartmut Kuhse
31b8a78ec3 app: fix compiler warning for missing const 2016-11-13 07:15:40 +01:00
Hartmut Kuhse
b49e1a21f8 restore more old GimpMetadata API
restore xcf-functions
restore file-load/save functions
2016-11-13 07:14:23 +01:00
Hartmut Kuhse
2d7ebcadab fix behaviour after restoring old gimpmetadata api 2016-11-12 19:06:25 +01:00
Hartmut Kuhse
2564ddf217 Merge remote-tracking branch 'remotes/origin/master' into gimp-attributes-wip 2016-11-12 14:02:30 +01:00
Hartmut Kuhse
2c1540bca8 revert app: gdbus with windows 2016-11-12 14:02:02 +01:00
Hartmut Kuhse
2ad628d1d8 restore old metadata api function calls 2016-11-12 11:21:43 +01:00
Hartmut Kuhse
dbdc5de66a Merge remote-tracking branch 'remotes/origin/master' into gimp-attributes-wip 2016-11-12 07:22:31 +01:00
Hartmut Kuhse
7b43a1f46c icons: typo in iconlist 2016-11-05 11:55:40 +01:00
Hartmut Kuhse
57f75bbc2b add icons for metadata 2016-11-05 10:03:27 +01:00
Hartmut Kuhse
abf78ef364 Merge remote-tracking branch 'remotes/origin/master' into gimp-attributes-wip 2016-11-02 18:06:32 +01:00
Hartmut Kuhse
a652f63321 merge to master to be up to date
# Conflicts:
#	libgimp/gimp.def
#	libgimp/gimpitem_pdb.h
2016-11-02 17:39:35 +01:00
Hartmut Kuhse
15a838a612 Merge remote-tracking branch 'remotes/origin/master' into gimp-attributes-wip 2016-09-23 09:20:38 +02:00
Hartmut Kuhse
96c1ec3ff8 Merge remote-tracking branch 'remotes/origin/gimp-attributes-wip' into gimp-attributes-wip 2016-08-21 11:46:49 +02:00
Hartmut Kuhse
e91392c7bf Corrections after merge 2016-08-21 11:42:45 +02:00
Hartmut Kuhse
b870a67791 Merge remote-tracking branch 'remotes/origin/master' into gimp-attributes-wip
Conflicts:
	app/core/gimpimage.c
2016-08-21 08:47:46 +02:00
Hartmut Kuhse
2e06258d03 Merge remote-tracking branch 'remotes/origin/master' into gimp-attributes-wip 2016-07-03 12:14:26 +02:00
Hartmut Kuhse
41d382a147 Merge remote-tracking branch 'remotes/origin/master' into gimp-attributes-wip 2016-05-28 17:58:15 +02:00
Hartmut Kuhse
01a24a3ccb plug-ins: convert screenshot-win32 to gegl
and do some repairs.
2016-05-28 17:52:44 +02:00
Hartmut Kuhse
63a49a4def Merge remote-tracking branch 'remotes/origin/master' into gimp-attributes-wip 2016-05-28 11:45:25 +02:00
Hartmut Kuhse
910c385f49 repairs after merge 2016-05-28 11:44:34 +02:00
Hartmut Kuhse
617b90a40b repairs after merge 2016-05-27 18:28:53 +02:00
Hartmut Kuhse
55abb62159 Merge remote-tracking branch 'remotes/origin/master' into gimp-attributes-wip
Conflicts:
	app/core/core-enums.c
	app/core/core-enums.h
	app/core/core-types.h
	app/core/gimpimage-merge.c
	app/core/gimpimage-undo-push.c
	app/core/gimpimage-undo-push.h
	app/core/gimpimageundo.c
	app/core/gimpimageundo.h
	app/xcf/xcf-load.c
	configure.ac
	plug-ins/file-tiff/file-tiff.c
2016-05-27 08:28:02 +02:00
Hartmut Kuhse
0303bd2a1a Merge remote-tracking branch 'remotes/origin/master' into gimp-attributes-wip
Conflicts:
	plug-ins/file-tiff/file-tiff-load.c
	plug-ins/file-tiff/file-tiff-load.h
	plug-ins/file-tiff/file-tiff.c
2016-05-01 19:19:09 +02:00
Hartmut Kuhse
64ee853bf5 plug-ins: convert win-snap to screenshot
works as win-snap, lots of optimizing work to be done.
2016-05-01 19:02:05 +02:00
Hartmut Kuhse
57675e171c Merge remote-tracking branch 'remotes/origin/master' into gimp-attributes-wip 2016-04-02 21:46:00 +02:00
Hartmut Kuhse
41c129eb47 Merge remote-tracking branch 'remotes/origin/master' into gimp-attributes-wip 2016-04-02 21:40:19 +02:00
Hartmut Kuhse
2bd0b5c9a1 merge to stay up-to-date 2016-03-31 17:58:37 +02:00
Hartmut Kuhse
e01e826c99 libgimpbase: check for length of unusual attribute value.
If it is longer than 2048 bytes, the interpreted_value
is set to the length of value.
Those very long values may exist in some makernotes,
as in Exif.Pentax or Exif.PentaxDNG
2016-03-31 17:57:02 +02:00
Hartmut Kuhse
5976f98d1a merge to stay up-to-date 2016-03-24 08:04:00 +01:00
Hartmut Kuhse
b557263a81 Merge to stay up-to-date 2016-03-20 11:23:06 +01:00
Hartmut Kuhse
2d3a0560b4 Merge to stay up-to-date 2016-03-19 15:34:06 +01:00
Hartmut Kuhse
ae167888dd Merge to stay up-to-date 2016-03-13 10:47:48 +01:00
Hartmut Kuhse
db63b49c1b Merge with master to be up to date 2016-02-19 17:03:48 +01:00
Hartmut Kuhse
2aad13f89c Fixes after merge 2016-02-19 17:02:45 +01:00
Hartmut Kuhse
f26231df1c Merge remote-tracking branch 'remotes/origin/master' into gimp-attributes-wip
Conflicts:
	app/core/gimpimage.c
	app/pdb/internal-procs.c
	libgimp/gimpimagemetadata.c
	plug-ins/file-tiff/file-tiff-load.c
	plug-ins/file-tiff/file-tiff-save.c
2016-02-14 15:15:22 +01:00
Hartmut Kuhse
da35966162 some fixes after merge 2016-01-16 16:49:36 +01:00
Hartmut Kuhse
4b9cd2ce43 Merge remote-tracking branch 'remotes/origin/master' into gimp-attributes-wip
Conflicts:
	app/core/gimpimage.c
	app/pdb/internal-procs.c
	plug-ins/common/file-png.c
	plug-ins/common/file-tiff-load.c
2015-11-28 09:00:42 +01:00
Hartmut Kuhse
029eae21bb metadata/attributes corrections after merge 2015-10-18 17:33:28 +02:00
Hartmut Kuhse
078a9b5028 Merge remote-tracking branch 'remotes/origin/master' into gimp-attributes-wip
Conflicts:
	libgimp/gimpimagemetadata.c
	libgimpbase/gimpbase.def
	libgimpbase/gimpmetadata.c
	libgimpbase/gimpmetadata.h
2015-10-18 10:51:23 +02:00
Hartmut Kuhse
2bbd3f4567 Merge remote-tracking branch 'remotes/origin/master' into gimp-attributes-wip
Conflicts:
	plug-ins/common/file-tiff-load.c
2015-09-13 18:05:22 +02:00
Hartmut Kuhse
705643deba app: fix setting color profile to image after convert
While loading an image with color profile, gimp offers the possibility
to convert it to the builtin profile. Setting the new color profile
before converting, deletes the old one and results in a segmentation fault.
2015-09-06 11:35:12 +02:00
Hartmut Kuhse
e8c2acc35e internal correction of "internal-procs.c" 2015-09-06 11:32:45 +02:00
Hartmut Kuhse
3294b3e809 periodically merge with master to stay up to date
Conflicts:
	app/xcf/xcf-save.c
	configure.ac
	libgimp/gimpmetadata.c
	plug-ins/Makefile.am
	po-plug-ins/POTFILES.in
2015-09-05 18:53:14 +02:00
Hartmut Kuhse
c6e5391de5 Periodically merge with master to stay up-to-date
Conflicts:
	app/pdb/internal-procs.c
2015-08-10 19:21:16 +02:00
Hartmut Kuhse
23ac3d2ec1 plug-in: file-png: correct indentation 2015-08-10 19:19:55 +02:00
Hartmut Kuhse
5ef90edfa0 merge: corrections after merge 2015-06-28 17:27:13 +02:00
Hartmut Kuhse
79a2cfe13b periodically merge with master to stay up to date
Conflicts:
	app/pdb/internal-procs.c
	libgimp/Makefile.am
	libgimp/gimp.h
	libgimp/gimpimage_pdb.h
	libgimpbase/gimpmetadata.c
2015-06-28 07:52:21 +02:00
Hartmut Kuhse
8f2ffb24b4 periodically merge with master to be up to date 2015-05-30 17:22:07 +02:00
Hartmut Kuhse
21b7f5317b Periodically merge with master to be up to date
Conflicts:
	plug-ins/common/metadata.c
	plug-ins/file-psd/psd-save.c
2015-05-30 17:17:34 +02:00
Hartmut Kuhse
314abc4fad Revert "app: increasing paint stroke speed"
This reverts commit e5569c653e.
2015-05-10 11:02:45 +02:00
Hartmut Kuhse
6798cacf22 merged to master: GExiv2 0.10.3 is out - working branch
t"

This reverts commit 0c931858ad.

Conflicts:
	configure.ac
2015-04-12 10:30:20 +02:00
Hartmut Kuhse
1d7e002b6f Merge remote-tracking branch 'remotes/origin/master' into gimp-attributes-wip
Conflicts:
	configure.ac
2015-03-09 08:33:01 +01:00
Hartmut Kuhse
0c931858ad plug-in attributes: revert the useless xmp import
Importing xmp packet data is useless, because
setting the packet to the image will delete all
existing metadata, leaving those of the xmp packet
left. As xmp packet do not store all metadata, a lot
of metadata would be lost.
2015-02-22 17:39:35 +01:00
Hartmut Kuhse
b613084add app: unref attributes 2015-02-22 14:35:32 +01:00
Hartmut Kuhse
764708900d Merge remote-tracking branch 'remotes/origin/master' into gimp-attributes-wip 2015-02-07 14:20:18 +01:00
Hartmut Kuhse
bf9c4ceca0 libgimpbase/plug-ins: implement GPS show in Google Maps 2015-02-07 14:19:18 +01:00
Hartmut Kuhse
e5569c653e app: increasing paint stroke speed 2015-01-30 21:45:33 +01:00
Hartmut Kuhse
7c51a381b3 Merge remote-tracking branch 'remotes/origin/master' into gimp-attributes-wip
Conflicts:
	app/pdb/internal-procs.c
2015-01-25 12:16:58 +01:00
Hartmut Kuhse
e973b773ac Merge remote-tracking branch 'remotes/origin/master' into gimp-attributes-wip
Conflicts:
	app/pdb/internal-procs.c
	plug-ins/common/Makefile.am
	plug-ins/common/gimprc.common
	plug-ins/common/plugin-defs.pl
2014-12-06 17:36:10 +01:00
Hartmut Kuhse
3ab7e955bb merge corrections 2014-11-14 21:14:53 +01:00
Hartmut Kuhse
ac9e872576 Merge remote-tracking branch 'remotes/origin/master' into gimp-attributes-wip
Conflicts:
	app/pdb/internal-procs.c
	plug-ins/common/Makefile.am
	plug-ins/common/gimprc.common
2014-11-14 09:51:54 +01:00
Hartmut Kuhse
db980ff048 libgimpbase: rename constants to gexiv2 constants.
GExiv2 does rename the versions in a different manner, than gimp does.
If a new gexiv2 release is made, the version is altered and after that, the release is made.
So the git master is always the same version as the last release, until the next release is made.
This Gimp branch does compile with the current gexiv2 git master, but not with the current
gexiv2 release (0.10.2).
I expect the next release to be 0.10.3, so configure.ac needs version 0.10.3 of gexiv2.
2014-10-24 19:28:27 +02:00
Hartmut Kuhse
47af0fe62e Merge remote-tracking branch 'remotes/origin/master' into gimp-attributes-wip
Conflicts:
	app/file/file-open.c
	app/pdb/internal-procs.c
2014-10-23 17:20:29 +02:00
Hartmut Kuhse
b58b605621 libgimpbase: fixing gimpattributes
If the iterator for sorted attributes is just initialized,
the iterator returns the first element, next otherwise.
2014-10-19 11:18:34 +02:00
Hartmut Kuhse
c324d6ff5f plug-ins: attributes: handle locale<->utf-8 2014-10-10 09:58:28 +02:00
Hartmut Kuhse
fe0df91639 plug-ins: metainfo: fixes 2014-10-10 09:57:54 +02:00
Hartmut Kuhse
ae8c30ef70 plug-ins: metainfo - revert some changes from last commit 2014-10-09 15:13:05 +02:00
Hartmut Kuhse
4552a31b70 plug-ins: metainfo: don't internationalize ui elements in code.
Better internationalize the ui
2014-10-09 14:50:20 +02:00
Hartmut Kuhse
3bb19203a5 plug-ins: metainfo, show number in expander label 2014-10-09 14:30:41 +02:00
Hartmut Kuhse
90fc4a52df libgimpbase: fix compiler warning 2014-10-09 09:28:41 +02:00
Hartmut Kuhse
562e97d7b8 plug-ins: attributes - enhance ui 2014-10-09 09:25:15 +02:00
Hartmut Kuhse
2ffd28e391 plug-ins: metainfo: unref attributes 2014-10-07 19:47:27 +02:00
Hartmut Kuhse
dea69ce540 eek: should have added the class 2014-10-07 19:47:00 +02:00
Hartmut Kuhse
acdaf6694a plug-ins: enhance metainfo. The handler for data is now a general class,
which can read all defined metadata without modification.
2014-10-07 19:32:01 +02:00
Hartmut Kuhse
0d428b5b38 libgimpbase: fix removing attribute 2014-10-07 19:30:40 +02:00
Hartmut Kuhse
584e141ea6 libgimpbase: GimpAttributes sorting; Plug-ins: attributes fixed for new sorting.
Since GHashTable does not sort keys, a GList was necessary for sorting purposes.
But plain string sorting is not enough for structured tags, when I got an image
with 176(!) xmpMM.History elements. In string sorting, after 10 comes 100, so an
enhanced sorting was necessary.
2014-10-06 17:43:45 +02:00
Hartmut Kuhse
1e9ec01d30 configure: needed not existing gexiv2 version 0.10.3
Unfortunately, the new gimpattribute feature needs new gexiv2
functions. One is accepted and pushed to git, one is still waiting
for review.
Without these new functions, compiling will fail.
2014-09-30 20:56:36 +02:00
Hartmut Kuhse
6c0f0ad5c3 introducing gimp-attributes
Instead of gexiv2-metadata, two new classes are introduced, GimpAttribute
and GimpAttributes, which stores GimpAttribute objects.
The aim is more internal flexibility for metadata/attributes.

GimpMetadata still exist as an interface between GExiv2, reading the metadata
from an image, and GimpAttribute, storing the metadata and more.

GimpAttributes are stored for GimpImage (as the older metadata object)
and GimpItem (GimpLayer / GimpChannel)

A new dialog for attributes as a plug-in for images(<Image>/Image/Image Attributes),
layers (<Layers>/Layer Attributes) and channels (<Channels>/Channel Attributes).

A dialog for editing IPTC Attributes for images, layers and channel (at the same places).
This dialog is older and will not be enhanced.

A dialog for editing image copyright and description whats o ever.
As IPTC is (or will be) dead and xmp shall be the common standard, with the relevant
IPTC tags mapped in xmp, i decided to take the tags from Adobe Lightroom 's "IPTC Extension"
tags for dealing with digital rights (<Image>/Image/Digital Rights).
I am very proud of this dialog, it was very hard work and is still in progress.
2014-09-30 20:50:44 +02:00
123 changed files with 17787 additions and 1998 deletions

View File

@@ -284,6 +284,8 @@ libappcore_a_sources = \
gimpitem-exclusive.h \
gimpitem-linked.c \
gimpitem-linked.h \
gimpitem-metadata.c \
gimpitem-metadata.h \
gimpitem-preview.c \
gimpitem-preview.h \
gimpitempropundo.c \

View File

@@ -853,14 +853,15 @@ gimp_undo_type_get_type (void)
{ GIMP_UNDO_IMAGE_SIZE, "GIMP_UNDO_IMAGE_SIZE", "image-size" },
{ GIMP_UNDO_IMAGE_RESOLUTION, "GIMP_UNDO_IMAGE_RESOLUTION", "image-resolution" },
{ GIMP_UNDO_IMAGE_GRID, "GIMP_UNDO_IMAGE_GRID", "image-grid" },
{ GIMP_UNDO_IMAGE_METADATA, "GIMP_UNDO_IMAGE_METADATA", "image-metadata" },
{ GIMP_UNDO_IMAGE_COLORMAP, "GIMP_UNDO_IMAGE_COLORMAP", "image-colormap" },
{ GIMP_UNDO_IMAGE_COLOR_MANAGED, "GIMP_UNDO_IMAGE_COLOR_MANAGED", "image-color-managed" },
{ GIMP_UNDO_IMAGE_ATTRIBUTES, "GIMP_UNDO_IMAGE_ATTRIBUTES", "image-attributes" },
{ GIMP_UNDO_GUIDE, "GIMP_UNDO_GUIDE", "guide" },
{ GIMP_UNDO_SAMPLE_POINT, "GIMP_UNDO_SAMPLE_POINT", "sample-point" },
{ GIMP_UNDO_DRAWABLE, "GIMP_UNDO_DRAWABLE", "drawable" },
{ GIMP_UNDO_DRAWABLE_MOD, "GIMP_UNDO_DRAWABLE_MOD", "drawable-mod" },
{ GIMP_UNDO_MASK, "GIMP_UNDO_MASK", "mask" },
{ GIMP_UNDO_ITEM_ATTRIBUTES, "GIMP_UNDO_ITEM_ATTRIBUTES", "item-attributes" },
{ GIMP_UNDO_ITEM_REORDER, "GIMP_UNDO_ITEM_REORDER", "item-reorder" },
{ GIMP_UNDO_ITEM_RENAME, "GIMP_UNDO_ITEM_RENAME", "item-rename" },
{ GIMP_UNDO_ITEM_DISPLACE, "GIMP_UNDO_ITEM_DISPLACE", "item-displace" },
@@ -897,6 +898,7 @@ gimp_undo_type_get_type (void)
{ GIMP_UNDO_FOREGROUND_SELECT, "GIMP_UNDO_FOREGROUND_SELECT", "foreground-select" },
{ GIMP_UNDO_PARASITE_ATTACH, "GIMP_UNDO_PARASITE_ATTACH", "parasite-attach" },
{ GIMP_UNDO_PARASITE_REMOVE, "GIMP_UNDO_PARASITE_REMOVE", "parasite-remove" },
{ GIMP_UNDO_VIEWABLE_ATTRIBUTES, "GIMP_UNDO_VIEWABLE_ATTRIBUTES", "viewable-attributes" },
{ GIMP_UNDO_CANT, "GIMP_UNDO_CANT", "cant" },
{ 0, NULL, NULL }
};
@@ -946,14 +948,15 @@ gimp_undo_type_get_type (void)
{ GIMP_UNDO_IMAGE_SIZE, NC_("undo-type", "Image size"), NULL },
{ GIMP_UNDO_IMAGE_RESOLUTION, NC_("undo-type", "Image resolution change"), NULL },
{ GIMP_UNDO_IMAGE_GRID, NC_("undo-type", "Grid"), NULL },
{ GIMP_UNDO_IMAGE_METADATA, NC_("undo-type", "Change metadata"), NULL },
{ GIMP_UNDO_IMAGE_COLORMAP, NC_("undo-type", "Change indexed palette"), NULL },
{ GIMP_UNDO_IMAGE_COLOR_MANAGED, NC_("undo-type", "Change color managed state"), NULL },
{ GIMP_UNDO_IMAGE_ATTRIBUTES, "GIMP_UNDO_IMAGE_ATTRIBUTES", NULL },
{ GIMP_UNDO_GUIDE, NC_("undo-type", "Guide"), NULL },
{ GIMP_UNDO_SAMPLE_POINT, NC_("undo-type", "Sample Point"), NULL },
{ GIMP_UNDO_DRAWABLE, NC_("undo-type", "Layer/Channel"), NULL },
{ GIMP_UNDO_DRAWABLE_MOD, NC_("undo-type", "Layer/Channel modification"), NULL },
{ GIMP_UNDO_MASK, NC_("undo-type", "Selection mask"), NULL },
{ GIMP_UNDO_ITEM_ATTRIBUTES, "GIMP_UNDO_ITEM_ATTRIBUTES", NULL },
{ GIMP_UNDO_ITEM_REORDER, NC_("undo-type", "Reorder item"), NULL },
{ GIMP_UNDO_ITEM_RENAME, NC_("undo-type", "Rename item"), NULL },
{ GIMP_UNDO_ITEM_DISPLACE, NC_("undo-type", "Move item"), NULL },
@@ -990,6 +993,7 @@ gimp_undo_type_get_type (void)
{ GIMP_UNDO_FOREGROUND_SELECT, NC_("undo-type", "Select foreground"), NULL },
{ GIMP_UNDO_PARASITE_ATTACH, NC_("undo-type", "Attach parasite"), NULL },
{ GIMP_UNDO_PARASITE_REMOVE, NC_("undo-type", "Remove parasite"), NULL },
{ GIMP_UNDO_VIEWABLE_ATTRIBUTES, "GIMP_UNDO_VIEWABLE_ATTRIBUTES", NULL },
{ GIMP_UNDO_CANT, NC_("undo-type", "Not undoable"), NULL },
{ 0, NULL, NULL }
};

View File

@@ -425,14 +425,15 @@ typedef enum /*< pdb-skip >*/
GIMP_UNDO_IMAGE_SIZE, /*< desc="Image size" >*/
GIMP_UNDO_IMAGE_RESOLUTION, /*< desc="Image resolution change" >*/
GIMP_UNDO_IMAGE_GRID, /*< desc="Grid" >*/
GIMP_UNDO_IMAGE_METADATA, /*< desc="Change metadata" >*/
GIMP_UNDO_IMAGE_COLORMAP, /*< desc="Change indexed palette" >*/
GIMP_UNDO_IMAGE_COLOR_MANAGED, /*< desc="Change color managed state" >*/
GIMP_UNDO_IMAGE_ATTRIBUTES, /*< desc="Change attributes >*/
GIMP_UNDO_GUIDE, /*< desc="Guide" >*/
GIMP_UNDO_SAMPLE_POINT, /*< desc="Sample Point" >*/
GIMP_UNDO_DRAWABLE, /*< desc="Layer/Channel" >*/
GIMP_UNDO_DRAWABLE_MOD, /*< desc="Layer/Channel modification" >*/
GIMP_UNDO_MASK, /*< desc="Selection mask" >*/
GIMP_UNDO_ITEM_ATTRIBUTES, /*< desc="Change attributes >*/
GIMP_UNDO_ITEM_REORDER, /*< desc="Reorder item" >*/
GIMP_UNDO_ITEM_RENAME, /*< desc="Rename item" >*/
GIMP_UNDO_ITEM_DISPLACE, /*< desc="Move item" >*/
@@ -469,6 +470,7 @@ typedef enum /*< pdb-skip >*/
GIMP_UNDO_FOREGROUND_SELECT, /*< desc="Select foreground" >*/
GIMP_UNDO_PARASITE_ATTACH, /*< desc="Attach parasite" >*/
GIMP_UNDO_PARASITE_REMOVE, /*< desc="Remove parasite" >*/
GIMP_UNDO_VIEWABLE_ATTRIBUTES, /*< desc="Change attributes >*/
GIMP_UNDO_CANT /*< desc="Not undoable" >*/
} GimpUndoType;

View File

@@ -157,6 +157,7 @@ typedef struct _GimpGroupLayer GimpGroupLayer;
typedef struct _GimpUndo GimpUndo;
typedef struct _GimpUndoStack GimpUndoStack;
typedef struct _GimpUndoAccumulator GimpUndoAccumulator;
typedef struct _GimpViewableUndo GimpViewableUndo;
/* Symmetry transformations */

View File

@@ -38,6 +38,8 @@
#include "plug-in/gimppluginmanager.h"
#include "plug-in/gimppluginmanager-restore.h"
#include "gui/gimpdbusservice-generated.h"
#include "paint/gimp-paint.h"
#include "text/gimp-fonts.h"

View File

@@ -23,6 +23,7 @@
#include <gegl.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpmath/gimpmath.h"
#include "libgimpcolor/gimpcolor.h"
@@ -44,6 +45,7 @@
#include "gimpimage-quick-mask.h"
#include "gimpimage-undo.h"
#include "gimpimage-undo-push.h"
#include "gimpitem-metadata.h"
#include "gimpchannel.h"
#include "gimpchannel-select.h"
#include "gimpcontext.h"
@@ -538,6 +540,9 @@ gimp_channel_duplicate (GimpItem *item,
if (GIMP_IS_CHANNEL (new_item))
{
GimpAttributes *attributes;
GimpAttributes *new_attributes;
GimpChannel *channel = GIMP_CHANNEL (item);
GimpChannel *new_channel = GIMP_CHANNEL (new_item);
@@ -551,6 +556,15 @@ gimp_channel_duplicate (GimpItem *item,
new_channel->y1 = channel->y1;
new_channel->x2 = channel->x2;
new_channel->y2 = channel->y2;
attributes = gimp_item_get_attributes (item);
if (attributes)
{
new_attributes = gimp_attributes_duplicate (attributes);
gimp_item_set_attributes (new_item, new_attributes, FALSE);
g_object_unref (new_attributes);
}
}
return new_item;

View File

@@ -73,7 +73,7 @@ static void gimp_image_duplicate_sample_points (GimpImage *image,
GimpImage *new_image);
static void gimp_image_duplicate_grid (GimpImage *image,
GimpImage *new_image);
static void gimp_image_duplicate_metadata (GimpImage *image,
static void gimp_image_duplicate_attributes (GimpImage *image,
GimpImage *new_image);
static void gimp_image_duplicate_quick_mask (GimpImage *image,
GimpImage *new_image);
@@ -154,8 +154,8 @@ gimp_image_duplicate (GimpImage *image)
/* Copy the grid */
gimp_image_duplicate_grid (image, new_image);
/* Copy the metadata */
gimp_image_duplicate_metadata (image, new_image);
/* Copy the attributes */
gimp_image_duplicate_attributes (image, new_image);
/* Copy the quick mask info */
gimp_image_duplicate_quick_mask (image, new_image);
@@ -479,16 +479,16 @@ gimp_image_duplicate_grid (GimpImage *image,
}
static void
gimp_image_duplicate_metadata (GimpImage *image,
GimpImage *new_image)
gimp_image_duplicate_attributes (GimpImage *image,
GimpImage *new_image)
{
GimpMetadata *metadata = gimp_image_get_metadata (image);
GimpAttributes *attributes = gimp_image_get_attributes (image);
if (metadata)
if (attributes)
{
metadata = gimp_metadata_duplicate (metadata);
gimp_image_set_metadata (new_image, metadata, FALSE);
g_object_unref (metadata);
attributes = gimp_attributes_duplicate (attributes);
gimp_image_set_attributes (new_image, attributes, FALSE);
g_object_unref (attributes);
}
}

View File

@@ -40,8 +40,10 @@
#include "gimpgrouplayer.h"
#include "gimpimage.h"
#include "gimpimage-merge.h"
#include "gimpimage-metadata.h"
#include "gimpimage-undo.h"
#include "gimpitemstack.h"
#include "gimpitem-metadata.h"
#include "gimplayer-floating-selection.h"
#include "gimplayer-new.h"
#include "gimplayermask.h"
@@ -428,6 +430,7 @@ gimp_image_merge_layers (GimpImage *image,
GimpLayer *layer;
GimpLayer *bottom_layer;
GimpParasiteList *parasites;
GimpAttributes *attributes;
gint count;
gint x1, y1, x2, y2;
gint off_x, off_y;
@@ -522,8 +525,8 @@ gimp_image_merge_layers (GimpImage *image,
(gimp_drawable_is_indexed (GIMP_DRAWABLE (layer)) &&
! gimp_drawable_has_alpha (GIMP_DRAWABLE (layer))))
{
GeglColor *color;
GimpRGB bg;
GeglColor *color;
GimpRGB bg;
merge_layer = gimp_layer_new (image, (x2 - x1), (y2 - y1),
gimp_image_get_layer_format (image, FALSE),
@@ -585,6 +588,22 @@ gimp_image_merge_layers (GimpImage *image,
bottom_layer = layer;
/* Copy the attributes of the bottom layer to the new layer */
attributes = gimp_item_get_attributes (GIMP_ITEM (bottom_layer));
if (!attributes)
attributes = gimp_image_get_attributes (image);
if (attributes)
{
GimpAttributes *new_attributes;
new_attributes = gimp_attributes_duplicate (attributes);
gimp_item_set_attributes (GIMP_ITEM (merge_layer), new_attributes, TRUE);
g_object_unref (new_attributes);
}
/* Copy the tattoo and parasites of the bottom layer to the new layer */
gimp_item_set_tattoo (GIMP_ITEM (merge_layer),
gimp_item_get_tattoo (GIMP_ITEM (bottom_layer)));

View File

@@ -36,13 +36,20 @@
GimpMetadata *
gimp_image_get_metadata (GimpImage *image)
{
GimpImagePrivate *private;
GimpAttributes *attributes = NULL;
GimpMetadata *metadata = NULL;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
private = GIMP_IMAGE_GET_PRIVATE (image);
return private->metadata;
attributes = gimp_image_get_attributes (image);
if (attributes)
{
metadata = gimp_metadata_new ();
gimp_attributes_to_metadata (attributes,
metadata,
"image/any");
}
return metadata;
}
void
@@ -50,58 +57,85 @@ gimp_image_set_metadata (GimpImage *image,
GimpMetadata *metadata,
gboolean push_undo)
{
GimpImagePrivate *private;
GimpAttributes *attributes = NULL;
attributes = gimp_attributes_from_metadata (NULL, metadata);
gimp_image_set_attributes (image,
attributes,
push_undo);
g_object_unref (attributes);
}
void
gimp_image_set_attributes (GimpImage *image,
GimpAttributes *attributes,
gboolean push_undo)
{
GimpViewable *viewable;
gdouble xres, yres;
g_return_if_fail (GIMP_IS_IMAGE (image));
private = GIMP_IMAGE_GET_PRIVATE (image);
if (! attributes)
return;
if (metadata != private->metadata)
if (push_undo)
gimp_image_undo_push_image_attributes (image, NULL);
viewable = GIMP_VIEWABLE (image);
if (viewable)
{
if (push_undo)
gimp_image_undo_push_image_metadata (image, NULL);
if (private->metadata)
g_object_unref (private->metadata);
gimp_attributes_set_pixel_size (attributes,
gimp_image_get_width (image),
gimp_image_get_height (image));
private->metadata = metadata;
switch (gimp_image_get_component_type (image))
{
case GIMP_COMPONENT_TYPE_U8:
gimp_attributes_set_bits_per_sample (attributes, 8);
break;
if (private->metadata)
{
gdouble xres, yres;
case GIMP_COMPONENT_TYPE_U16:
case GIMP_COMPONENT_TYPE_HALF:
gimp_attributes_set_bits_per_sample (attributes, 16);
break;
g_object_ref (private->metadata);
case GIMP_COMPONENT_TYPE_U32:
case GIMP_COMPONENT_TYPE_FLOAT:
gimp_attributes_set_bits_per_sample (attributes, 32);
break;
gimp_metadata_set_pixel_size (metadata,
gimp_image_get_width (image),
gimp_image_get_height (image));
case GIMP_COMPONENT_TYPE_DOUBLE:
gimp_attributes_set_bits_per_sample (attributes, 64);
break;
}
switch (gimp_image_get_component_type (image))
{
case GIMP_COMPONENT_TYPE_U8:
gimp_metadata_set_bits_per_sample (metadata, 8);
break;
gimp_image_get_resolution (image, &xres, &yres);
gimp_attributes_set_resolution (attributes, xres, yres,
gimp_image_get_unit (image));
case GIMP_COMPONENT_TYPE_U16:
case GIMP_COMPONENT_TYPE_HALF:
gimp_metadata_set_bits_per_sample (metadata, 16);
break;
case GIMP_COMPONENT_TYPE_U32:
case GIMP_COMPONENT_TYPE_FLOAT:
gimp_metadata_set_bits_per_sample (metadata, 32);
break;
case GIMP_COMPONENT_TYPE_DOUBLE:
gimp_metadata_set_bits_per_sample (metadata, 64);
break;
}
gimp_image_get_resolution (image, &xres, &yres);
gimp_metadata_set_resolution (metadata, xres, yres,
gimp_image_get_unit (image));
}
g_object_notify (G_OBJECT (image), "metadata");
gimp_viewable_set_attributes (viewable, attributes);
}
}
GimpAttributes *
gimp_image_get_attributes (GimpImage *image)
{
GimpViewable *viewable;
GimpAttributes *attributes;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
viewable = GIMP_VIEWABLE (image);
if (viewable)
{
attributes = gimp_viewable_get_attributes (viewable);
return attributes;
}
return NULL;
}

View File

@@ -19,10 +19,14 @@
#define __GIMP_IMAGE_METADATA_H__
GimpMetadata * gimp_image_get_metadata (GimpImage *image);
void gimp_image_set_metadata (GimpImage *image,
GimpMetadata *metadata,
gboolean push_undo);
GimpMetadata * gimp_image_get_metadata (GimpImage *image);
void gimp_image_set_metadata (GimpImage *image,
GimpMetadata *metadata,
gboolean push_undo);
void gimp_image_set_attributes (GimpImage *image,
GimpAttributes *attributes,
gboolean push_undo);
GimpAttributes * gimp_image_get_attributes (GimpImage *image);
#endif /* __GIMP_IMAGE_METADATA_H__ */

View File

@@ -49,6 +49,8 @@
#include "gimpsamplepoint.h"
#include "gimpsamplepointundo.h"
#include "gimpselection.h"
#include "gimpviewable.h"
#include "gimpviewableundo.h"
#include "text/gimptextlayer.h"
#include "text/gimptextundo.h"
@@ -161,17 +163,32 @@ gimp_image_undo_push_image_color_managed (GimpImage *image,
}
GimpUndo *
gimp_image_undo_push_image_metadata (GimpImage *image,
gimp_image_undo_push_image_attributes (GimpImage *image,
const gchar *undo_desc)
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
return gimp_image_undo_push (image, GIMP_TYPE_IMAGE_UNDO,
GIMP_UNDO_IMAGE_METADATA, undo_desc,
GIMP_UNDO_IMAGE_ATTRIBUTES, undo_desc,
GIMP_DIRTY_IMAGE_META,
NULL);
}
GimpUndo *
gimp_image_undo_push_item_attributes (GimpImage *image,
const gchar *undo_desc,
GimpItem *item)
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
return gimp_image_undo_push (image, GIMP_TYPE_ITEM_UNDO,
GIMP_UNDO_ITEM_ATTRIBUTES, undo_desc,
GIMP_DIRTY_IMAGE_META,
"item", item,
NULL);
}
GimpUndo *
gimp_image_undo_push_image_parasite (GimpImage *image,
const gchar *undo_desc,

View File

@@ -40,7 +40,7 @@ GimpUndo * gimp_image_undo_push_image_colormap (GimpImage *image,
const gchar *undo_desc);
GimpUndo * gimp_image_undo_push_image_color_managed (GimpImage *image,
const gchar *undo_desc);
GimpUndo * gimp_image_undo_push_image_metadata (GimpImage *image,
GimpUndo * gimp_image_undo_push_image_attributes (GimpImage *image,
const gchar *undo_desc);
GimpUndo * gimp_image_undo_push_image_parasite (GimpImage *image,
const gchar *undo_desc,
@@ -118,6 +118,9 @@ GimpUndo * gimp_image_undo_push_item_parasite_remove(GimpImage *image,
const gchar *undo_desc,
GimpItem *item,
const gchar *name);
GimpUndo * gimp_image_undo_push_item_attributes (GimpImage *image,
const gchar *undo_desc,
GimpItem *item);
/* layer undos */
@@ -234,5 +237,4 @@ GimpUndo * gimp_image_undo_push_fs_to_layer (GimpImage *image,
GimpUndo * gimp_image_undo_push_cantundo (GimpImage *image,
const gchar *undo_desc);
#endif /* __GIMP_IMAGE_UNDO_PUSH_H__ */

View File

@@ -958,9 +958,6 @@ gimp_image_get_property (GObject *object,
case PROP_PRECISION:
g_value_set_enum (value, private->precision);
break;
case PROP_METADATA:
g_value_set_object (value, gimp_image_get_metadata (image));
break;
case PROP_BUFFER:
g_value_set_object (value, gimp_image_get_buffer (GIMP_PICKABLE (image)));
break;
@@ -1279,10 +1276,10 @@ gimp_image_get_size (GimpViewable *viewable,
static void
gimp_image_size_changed (GimpViewable *viewable)
{
GimpImage *image = GIMP_IMAGE (viewable);
GimpMetadata *metadata;
GList *all_items;
GList *list;
GimpImage *image = GIMP_IMAGE (viewable);
GimpAttributes *attributes;
GList *all_items;
GList *list;
if (GIMP_VIEWABLE_CLASS (parent_class)->size_changed)
GIMP_VIEWABLE_CLASS (parent_class)->size_changed (viewable);
@@ -1307,12 +1304,15 @@ gimp_image_size_changed (GimpViewable *viewable)
gimp_viewable_size_changed (GIMP_VIEWABLE (gimp_image_get_mask (image)));
metadata = gimp_image_get_metadata (image);
if (metadata)
gimp_metadata_set_pixel_size (metadata,
gimp_image_get_width (image),
gimp_image_get_height (image));
attributes = gimp_image_get_attributes (image);
if (attributes)
{
gimp_attributes_set_pixel_size (attributes,
gimp_image_get_width (image),
gimp_image_get_height (image));
}
gimp_projectable_structure_changed (GIMP_PROJECTABLE (image));
}
@@ -1339,31 +1339,32 @@ gimp_image_real_mode_changed (GimpImage *image)
static void
gimp_image_real_precision_changed (GimpImage *image)
{
GimpMetadata *metadata;
GimpAttributes *attributes;
metadata = gimp_image_get_metadata (image);
if (metadata)
attributes = gimp_image_get_attributes (image);
if (attributes)
{
switch (gimp_image_get_component_type (image))
{
{
case GIMP_COMPONENT_TYPE_U8:
gimp_metadata_set_bits_per_sample (metadata, 8);
gimp_attributes_set_bits_per_sample (attributes, 8);
break;
case GIMP_COMPONENT_TYPE_U16:
case GIMP_COMPONENT_TYPE_HALF:
gimp_metadata_set_bits_per_sample (metadata, 16);
gimp_attributes_set_bits_per_sample (attributes, 16);
break;
case GIMP_COMPONENT_TYPE_U32:
case GIMP_COMPONENT_TYPE_FLOAT:
gimp_metadata_set_bits_per_sample (metadata, 32);
gimp_attributes_set_bits_per_sample (attributes, 32);
break;
case GIMP_COMPONENT_TYPE_DOUBLE:
gimp_metadata_set_bits_per_sample (metadata, 64);
gimp_attributes_set_bits_per_sample (attributes, 64);
break;
}
}
}
gimp_projectable_structure_changed (GIMP_PROJECTABLE (image));
@@ -1372,16 +1373,17 @@ gimp_image_real_precision_changed (GimpImage *image)
static void
gimp_image_real_resolution_changed (GimpImage *image)
{
GimpMetadata *metadata;
GimpAttributes *attributes;
metadata = gimp_image_get_metadata (image);
if (metadata)
attributes = gimp_image_get_attributes (image);
if (attributes)
{
gdouble xres, yres;
gimp_image_get_resolution (image, &xres, &yres);
gimp_metadata_set_resolution (metadata, xres, yres,
gimp_image_get_unit (image));
gimp_attributes_set_resolution (attributes, xres, yres,
gimp_image_get_unit (image));
}
}
@@ -1402,16 +1404,17 @@ gimp_image_real_size_changed_detailed (GimpImage *image,
static void
gimp_image_real_unit_changed (GimpImage *image)
{
GimpMetadata *metadata;
GimpAttributes *attributes;
metadata = gimp_image_get_metadata (image);
if (metadata)
attributes = gimp_image_get_attributes (image);
if (attributes)
{
gdouble xres, yres;
gimp_image_get_resolution (image, &xres, &yres);
gimp_metadata_set_resolution (metadata, xres, yres,
gimp_image_get_unit (image));
gimp_attributes_set_resolution (attributes, xres, yres,
gimp_image_get_unit (image));
}
}

View File

@@ -192,9 +192,9 @@ gimp_image_undo_constructed (GObject *object)
image_undo->is_color_managed = gimp_image_get_is_color_managed (image);
break;
case GIMP_UNDO_IMAGE_METADATA:
image_undo->metadata =
gimp_metadata_duplicate (gimp_image_get_metadata (image));
case GIMP_UNDO_IMAGE_ATTRIBUTES:
image_undo->attributes =
gimp_attributes_duplicate (gimp_image_get_attributes (image));
break;
case GIMP_UNDO_PARASITE_ATTACH:
@@ -295,8 +295,8 @@ gimp_image_undo_get_memsize (GimpObject *object,
if (image_undo->colormap)
memsize += GIMP_IMAGE_COLORMAP_SIZE;
if (image_undo->metadata)
memsize += gimp_g_object_get_memsize (G_OBJECT (image_undo->metadata));
if (image_undo->attributes)
memsize += gimp_g_object_get_memsize (G_OBJECT (image_undo->attributes));
memsize += gimp_object_get_memsize (GIMP_OBJECT (image_undo->grid),
gui_size);
@@ -483,17 +483,17 @@ gimp_image_undo_pop (GimpUndo *undo,
}
break;
case GIMP_UNDO_IMAGE_METADATA:
case GIMP_UNDO_IMAGE_ATTRIBUTES:
{
GimpMetadata *metadata;
GimpAttributes *attributes;
metadata = gimp_metadata_duplicate (gimp_image_get_metadata (image));
attributes = gimp_attributes_duplicate (gimp_image_get_attributes (image));
gimp_image_set_metadata (image, image_undo->metadata, FALSE);
gimp_image_set_attributes (image, image_undo->attributes, FALSE);
if (image_undo->metadata)
g_object_unref (image_undo->metadata);
image_undo->metadata = metadata;
if (image_undo->attributes)
g_object_unref (image_undo->attributes);
image_undo->attributes = attributes;
}
break;
@@ -545,10 +545,10 @@ gimp_image_undo_free (GimpUndo *undo,
image_undo->colormap = NULL;
}
if (image_undo->metadata)
if (image_undo->attributes)
{
g_object_unref (image_undo->metadata);
image_undo->metadata = NULL;
g_object_unref (image_undo->attributes);
image_undo->attributes = NULL;
}
if (image_undo->parasite_name)

View File

@@ -53,6 +53,7 @@ struct _GimpImageUndo
guchar *colormap;
gboolean is_color_managed;
GimpMetadata *metadata;
GimpAttributes *attributes;
gchar *parasite_name;
GimpParasite *parasite;
};

View File

@@ -0,0 +1,73 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gegl.h>
#include "libgimpbase/gimpbase.h"
#include "core-types.h"
#include "gimpimage.h"
#include "gimpitem.h"
#include "gimpitem-metadata.h"
/* public functions */
void
gimp_item_set_attributes (GimpItem *item,
GimpAttributes *attributes,
gboolean push_undo)
{
GimpViewable *viewable;
g_return_if_fail (GIMP_IS_ITEM (item));
if (push_undo)
gimp_image_undo_push_item_attributes (gimp_item_get_image (item),
NULL,
item);
viewable = GIMP_VIEWABLE (item);
if (viewable)
{
gimp_viewable_set_attributes (viewable, attributes);
}
}
GimpAttributes *
gimp_item_get_attributes (GimpItem *item)
{
GimpViewable *viewable;
GimpAttributes *attributes;
g_return_val_if_fail (GIMP_IS_ITEM (item), NULL);
viewable = GIMP_VIEWABLE (item);
if (viewable)
{
attributes = gimp_viewable_get_attributes (viewable);
return attributes;
}
return NULL;
}

View File

@@ -0,0 +1,28 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GIMP_ITEM_METADATA_H__
#define __GIMP_ITEM_METADATA_H__
void gimp_item_set_attributes (GimpItem *item,
GimpAttributes *attributes,
gboolean push_undo);
GimpAttributes * gimp_item_get_attributes (GimpItem *item);
#endif /* __GIMP_ITEM_METADATA_H__ */

View File

@@ -22,8 +22,11 @@
#include "core-types.h"
#include "libgimpbase/gimpbase.h"
#include "gimpimage.h"
#include "gimpitem.h"
#include "gimpitem-metadata.h"
#include "gimpitemundo.h"
@@ -34,18 +37,21 @@ enum
};
static void gimp_item_undo_constructed (GObject *object);
static void gimp_item_undo_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_item_undo_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_item_undo_constructed (GObject *object);
static void gimp_item_undo_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_item_undo_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_item_undo_free (GimpUndo *undo,
GimpUndoMode undo_mode);
static void gimp_item_undo_free (GimpUndo *undo,
GimpUndoMode undo_mode);
static void gimp_item_undo_pop (GimpUndo *undo,
GimpUndoMode undo_mode,
GimpUndoAccumulator *accum);
G_DEFINE_TYPE (GimpItemUndo, gimp_item_undo, GIMP_TYPE_UNDO)
@@ -63,6 +69,7 @@ gimp_item_undo_class_init (GimpItemUndoClass *klass)
object_class->set_property = gimp_item_undo_set_property;
object_class->get_property = gimp_item_undo_get_property;
undo_class->pop = gimp_item_undo_pop;
undo_class->free = gimp_item_undo_free;
g_object_class_install_property (object_class, PROP_ITEM,
@@ -84,7 +91,14 @@ gimp_item_undo_constructed (GObject *object)
G_OBJECT_CLASS (parent_class)->constructed (object);
g_assert (GIMP_IS_ITEM (item_undo->item));
switch (GIMP_UNDO (object)->undo_type)
{
case GIMP_UNDO_ITEM_ATTRIBUTES:
item_undo->attributes =
gimp_attributes_duplicate (gimp_item_get_attributes (item_undo->item));
break;
}
}
static void
@@ -139,5 +153,42 @@ gimp_item_undo_free (GimpUndo *undo,
item_undo->item = NULL;
}
if (item_undo->attributes)
{
g_object_unref (item_undo->attributes);
item_undo->attributes = NULL;
}
GIMP_UNDO_CLASS (parent_class)->free (undo, undo_mode);
}
static void
gimp_item_undo_pop (GimpUndo *undo,
GimpUndoMode undo_mode,
GimpUndoAccumulator *accum)
{
GimpItemUndo *item_undo = GIMP_ITEM_UNDO (undo);
GimpItem *item = GIMP_ITEM_UNDO (undo)->item;
switch (undo->undo_type)
{
case GIMP_UNDO_ITEM_ATTRIBUTES:
{
GimpAttributes *attributes;
attributes = gimp_attributes_duplicate (gimp_item_get_attributes (item));
gimp_item_set_attributes (item, item_undo->attributes, FALSE);
if (item_undo->attributes)
g_object_unref (item_undo->attributes);
item_undo->attributes = attributes;
}
break;
default:
// g_assert_not_reached ();
break;
}
}

View File

@@ -38,6 +38,8 @@ struct _GimpItemUndo
GimpUndo parent_instance;
GimpItem *item; /* the item this undo is for */
GimpAttributes *attributes;
};
struct _GimpItemUndoClass

View File

@@ -743,7 +743,9 @@ static GimpItem *
gimp_layer_duplicate (GimpItem *item,
GType new_type)
{
GimpItem *new_item;
GimpItem *new_item;
GimpAttributes *attributes;
GimpAttributes *new_attributes;
g_return_val_if_fail (g_type_is_a (new_type, GIMP_TYPE_DRAWABLE), NULL);
@@ -774,6 +776,14 @@ gimp_layer_duplicate (GimpItem *item,
new_layer->edit_mask = layer->edit_mask;
new_layer->show_mask = layer->show_mask;
}
attributes = gimp_viewable_get_attributes (GIMP_VIEWABLE (layer));
if (attributes)
{
new_attributes = gimp_attributes_duplicate (attributes);
gimp_viewable_set_attributes (GIMP_VIEWABLE (new_layer), new_attributes);
g_object_unref (new_attributes);
}
}
return new_item;

View File

@@ -26,6 +26,7 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gegl.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpcolor/gimpcolor.h"
#include "libgimpmath/gimpmath.h"
#include "libgimpconfig/gimpconfig.h"
@@ -125,7 +126,6 @@ static gboolean gimp_viewable_deserialize_property (GimpConfig *config,
GScanner *scanner,
GTokenType *expected);
G_DEFINE_TYPE_WITH_CODE (GimpViewable, gimp_viewable, GIMP_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
gimp_viewable_config_iface_init))
@@ -213,6 +213,7 @@ gimp_viewable_class_init (GimpViewableClass *klass)
static void
gimp_viewable_init (GimpViewable *viewable)
{
viewable->attributes = NULL;
}
static void
@@ -225,6 +226,7 @@ gimp_viewable_config_iface_init (GimpConfigInterface *iface)
static void
gimp_viewable_finalize (GObject *object)
{
GimpViewable *viewable = GIMP_VIEWABLE (object);
GimpViewablePrivate *private = GET_PRIVATE (object);
if (private->icon_name)
@@ -250,6 +252,11 @@ gimp_viewable_finalize (GObject *object)
g_object_unref (private->preview_pixbuf);
private->preview_pixbuf = NULL;
}
if (viewable->attributes)
{
g_object_unref (viewable->attributes);
viewable->attributes = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -570,8 +577,23 @@ gimp_viewable_invalidate_preview (GimpViewable *viewable)
void
gimp_viewable_size_changed (GimpViewable *viewable)
{
GimpAttributes *attributes = NULL;
gint width, height;
g_return_if_fail (GIMP_IS_VIEWABLE (viewable));
gimp_viewable_get_size (viewable, &width, &height);
attributes = gimp_viewable_get_attributes (viewable);
if (attributes)
{
gimp_attributes_set_pixel_size (attributes,
width,
height);
}
g_signal_emit (viewable, viewable_signals[SIZE_CHANGED], 0);
}
@@ -1301,6 +1323,30 @@ gimp_viewable_set_expanded (GimpViewable *viewable,
GIMP_VIEWABLE_GET_CLASS (viewable)->set_expanded (viewable, expanded);
}
void
gimp_viewable_set_attributes (GimpViewable *viewable,
GimpAttributes *attributes)
{
g_return_if_fail (GIMP_IS_VIEWABLE (viewable));
if (attributes)
{
if (viewable->attributes)
g_object_unref (viewable->attributes);
viewable->attributes = attributes;
g_object_ref (viewable->attributes);
}
}
GimpAttributes *
gimp_viewable_get_attributes (GimpViewable *viewable)
{
g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), NULL);
return viewable->attributes;
}
gboolean
gimp_viewable_is_ancestor (GimpViewable *ancestor,
GimpViewable *descendant)

View File

@@ -43,7 +43,8 @@ typedef struct _GimpViewableClass GimpViewableClass;
struct _GimpViewable
{
GimpObject parent_instance;
GimpObject parent_instance;
GimpAttributes *attributes;
};
struct _GimpViewableClass
@@ -97,6 +98,7 @@ struct _GimpViewableClass
void (* set_expanded) (GimpViewable *viewable,
gboolean expand);
gboolean (* get_expanded) (GimpViewable *viewable);
};
@@ -179,7 +181,10 @@ GimpContainer * gimp_viewable_get_children (GimpViewable *viewable);
gboolean gimp_viewable_get_expanded (GimpViewable *viewable);
void gimp_viewable_set_expanded (GimpViewable *viewable,
gboolean expanded);
void gimp_viewable_set_attributes (GimpViewable *viewable,
GimpAttributes *attributes);
GimpAttributes *
gimp_viewable_get_attributes (GimpViewable *viewable);
gboolean gimp_viewable_is_ancestor (GimpViewable *ancestor,
GimpViewable *descendant);

175
app/core/gimpviewableundo.c Normal file
View File

@@ -0,0 +1,175 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gegl.h>
#include "libgimpbase/gimpbase.h"
#include "core-types.h"
#include "gimpviewable.h"
#include "gimpviewableundo.h"
enum
{
PROP_0,
PROP_VIEWABLE
};
static void gimp_viewable_undo_constructed (GObject *object);
static void gimp_viewable_undo_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_viewable_undo_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_viewable_undo_free (GimpUndo *undo,
GimpUndoMode undo_mode);
G_DEFINE_TYPE (GimpViewableUndo, gimp_viewable_undo, GIMP_TYPE_UNDO)
#define parent_class gimp_viewable_undo_parent_class
static void
gimp_viewable_undo_class_init (GimpViewableUndoClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpUndoClass *undo_class = GIMP_UNDO_CLASS (klass);
object_class->constructed = gimp_viewable_undo_constructed;
object_class->set_property = gimp_viewable_undo_set_property;
object_class->get_property = gimp_viewable_undo_get_property;
undo_class->pop = gimp_viewable_undo_pop;
undo_class->free = gimp_viewable_undo_free;
g_object_class_install_property (object_class, PROP_VIEWABLE,
g_param_spec_object ("viewable", NULL, NULL,
GIMP_TYPE_VIEWABLE,
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
}
static void
gimp_viewable_undo_init (GimpViewableUndo *undo)
{
}
static void
gimp_viewable_undo_constructed (GObject *object)
{
GimpViewableUndo *viewable_undo = GIMP_VIEWABLE_UNDO (object);
G_OBJECT_CLASS (parent_class)->constructed (object);
g_assert (GIMP_IS_VIEWABLE (viewable_undo->viewable));
}
static void
gimp_viewable_undo_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GimpViewableUndo *viewable_undo = GIMP_VIEWABLE_UNDO (object);
switch (property_id)
{
case PROP_VIEWABLE:
viewable_undo->viewable = g_value_dup_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gimp_viewable_undo_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GimpViewableUndo *viewable_undo = GIMP_VIEWABLE_UNDO (object);
switch (property_id)
{
case PROP_VIEWABLE:
g_value_set_object (value, viewable_undo->viewable);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gimp_viewable_undo_free (GimpUndo *undo,
GimpUndoMode undo_mode)
{
GimpViewableUndo *viewable_undo = GIMP_VIEWABLE_UNDO (undo);
if (viewable_undo->viewable)
{
g_object_unref (viewable_undo->viewable);
viewable_undo->viewable = NULL;
}
GIMP_UNDO_CLASS (parent_class)->free (undo, undo_mode);
}
static void
gimp_viewable_undo_pop (GimpUndo *undo,
GimpUndoMode undo_mode,
GimpUndoAccumulator *accum)
{
GimpViewableUndo *viewable_undo = GIMP_VIEWABLE_UNDO (undo);
GimpViewable *viewable = GIMP_VIEWABLE_UNDO (undo)->viewable;
switch (undo->undo_type)
{
case GIMP_UNDO_IMAGE_ATTRIBUTES:
{
GimpAttributes *attributes;
attributes = gimp_attributes_duplicate (gimp_image_get_attributes (image));
gimp_image_set_attributes (image, image_undo->attributes, FALSE);
if (image_undo->attributes)
g_object_unref (image_undo->attributes);
image_undo->attributes = attributes;
}
break;
default:
g_assert_not_reached ();
}
}

View File

@@ -0,0 +1,51 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GIMP_VIEWABLE_UNDO_H__
#define __GIMP_VIEWABLE_UNDO_H__
#include "gimpundo.h"
#define GIMP_TYPE_VIEWABLE_UNDO (gimp_viewable_undo_get_type ())
#define GIMP_VIEWABLE_UNDO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_VIEWABLE_UNDO, GimpViewableUndo))
#define GIMP_VIEWABLE_UNDO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_VIEWABLE_UNDO, GimpViewableUndoClass))
#define GIMP_IS_VIEWABLE_UNDO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_VIEWABLE_UNDO))
#define GIMP_IS_VIEWABLE_UNDO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_VIEWABLE_UNDO))
#define GIMP_VIEWABLE_UNDO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_VIEWABLE_UNDO, GimpViewableUndoClass))
typedef struct _GimpViewableUndoClass GimpViewableUndoClass;
struct _GimpViewableUndo
{
GimpUndo parent_instance;
GimpViewable *viewable; /* the viewable this undo is for */
};
struct _GimpViewableUndoClass
{
GimpUndoClass parent_class;
};
GType gimp_viewable_undo_get_type (void) G_GNUC_CONST;
#endif /* __GIMP_VIEWABLE_UNDO_H__ */

View File

@@ -442,6 +442,7 @@ main (int argc,
basename = g_path_get_basename (argv[0]);
g_set_prgname (basename);
g_setenv ("GIMP_PROG_BASENAME", basename, TRUE);
g_free (basename);
/* Check argv[] for "--verbose" first */

View File

@@ -1487,66 +1487,66 @@ image_set_colormap_invoker (GimpProcedure *procedure,
}
static GimpValueArray *
image_get_metadata_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
image_set_attributes_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpImage *image;
const gchar *attributes_string;
image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
attributes_string = g_value_get_string (gimp_value_array_index (args, 1));
if (success)
{
GimpAttributes *attributes = gimp_attributes_deserialize (attributes_string);
gimp_image_set_attributes (image, attributes, TRUE);
if (attributes)
g_object_unref (attributes);
}
return gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static GimpValueArray *
image_get_attributes_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpValueArray *return_vals;
GimpImage *image;
gchar *metadata_string = NULL;
gchar *attributes_string = NULL;
image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
if (success)
{
GimpMetadata *metadata = gimp_image_get_metadata (image);
GimpAttributes *attributes = gimp_image_get_attributes (image);
if (metadata)
metadata_string = gimp_metadata_serialize (metadata);
if (attributes)
attributes_string = gimp_attributes_serialize (attributes);
}
return_vals = gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_take_string (gimp_value_array_index (return_vals, 1), metadata_string);
g_value_take_string (gimp_value_array_index (return_vals, 1), attributes_string);
return return_vals;
}
static GimpValueArray *
image_set_metadata_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpImage *image;
const gchar *metadata_string;
image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
metadata_string = g_value_get_string (gimp_value_array_index (args, 1));
if (success)
{
GimpMetadata *metadata = gimp_metadata_deserialize (metadata_string);
gimp_image_set_metadata (image, metadata, TRUE);
if (metadata)
g_object_unref (metadata);
}
return gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static GimpValueArray *
image_clean_all_invoker (GimpProcedure *procedure,
Gimp *gimp,
@@ -4156,15 +4156,45 @@ register_image_procs (GimpPDB *pdb)
g_object_unref (procedure);
/*
* gimp-image-get-metadata
* gimp-image-set-attributes
*/
procedure = gimp_procedure_new (image_get_metadata_invoker);
procedure = gimp_procedure_new (image_set_attributes_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-image-get-metadata");
"gimp-image-set-attributes");
gimp_procedure_set_static_strings (procedure,
"gimp-image-get-metadata",
"Returns the image's metadata.",
"Returns exif/iptc/xmp metadata from the image.",
"gimp-image-set-attributes",
"Set the image's attributes.",
"Sets attributes on the image.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL);
gimp_procedure_add_argument (procedure,
gimp_param_spec_image_id ("image",
"image",
"The image",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_string ("attributes-string",
"attributes string",
"The attributes as a xml string",
FALSE, FALSE, FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-image-get-attributes
*/
procedure = gimp_procedure_new (image_get_attributes_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-image-get-attributes");
gimp_procedure_set_static_strings (procedure,
"gimp-image-get-attributes",
"Returns the image's attributes.",
"Returns attributes from the image.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
@@ -4176,45 +4206,15 @@ register_image_procs (GimpPDB *pdb)
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gimp_param_spec_string ("metadata-string",
"metadata string",
"The exif/ptc/xmp metadata as a string",
gimp_param_spec_string ("attributes-string",
"attributes string",
"The attributes as a xml string",
FALSE, FALSE, FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-image-set-metadata
*/
procedure = gimp_procedure_new (image_set_metadata_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-image-set-metadata");
gimp_procedure_set_static_strings (procedure,
"gimp-image-set-metadata",
"Set the image's metadata.",
"Sets exif/iptc/xmp metadata on the image.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL);
gimp_procedure_add_argument (procedure,
gimp_param_spec_image_id ("image",
"image",
"The image",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_string ("metadata-string",
"metadata string",
"The exif/ptc/xmp metadata as a string",
FALSE, FALSE, FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-image-clean-all
*/

View File

@@ -28,7 +28,7 @@
#include "internal-procs.h"
/* 802 procedures registered total */
/* 804 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)

View File

@@ -30,6 +30,7 @@
#include "pdb-types.h"
#include "core/gimpimage.h"
#include "core/gimpitem-metadata.h"
#include "core/gimpitem.h"
#include "core/gimplayermask.h"
#include "core/gimplist.h"
@@ -821,6 +822,67 @@ item_set_tattoo_invoker (GimpProcedure *procedure,
error ? *error : NULL);
}
static GimpValueArray *
item_get_attributes_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpValueArray *return_vals;
GimpItem *item;
gchar *attributes_string = NULL;
item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
if (success)
{
GimpAttributes *attributes = gimp_item_get_attributes (item);
if (attributes)
attributes_string = gimp_attributes_serialize (attributes);
}
return_vals = gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_take_string (gimp_value_array_index (return_vals, 1), attributes_string);
return return_vals;
}
static GimpValueArray *
item_set_attributes_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpItem *item;
const gchar *attributes_string;
item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
attributes_string = g_value_get_string (gimp_value_array_index (args, 1));
if (success)
{
GimpAttributes *attributes = gimp_attributes_deserialize (attributes_string);
gimp_item_set_attributes (item, attributes, TRUE);
if (attributes)
g_object_unref (attributes);
}
return gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static GimpValueArray *
item_attach_parasite_invoker (GimpProcedure *procedure,
Gimp *gimp,
@@ -1730,6 +1792,66 @@ register_item_procs (GimpPDB *pdb)
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-item-get-attributes
*/
procedure = gimp_procedure_new (item_get_attributes_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-item-get-attributes");
gimp_procedure_set_static_strings (procedure,
"gimp-item-get-attributes",
"Returns the item's attributes.",
"Returns attributes from the item.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL);
gimp_procedure_add_argument (procedure,
gimp_param_spec_item_id ("item",
"item",
"The item",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gimp_param_spec_string ("attributes-string",
"attributes string",
"The attributes as a xml string",
FALSE, FALSE, FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-item-set-attributes
*/
procedure = gimp_procedure_new (item_set_attributes_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-item-set-attributes");
gimp_procedure_set_static_strings (procedure,
"gimp-item-set-attributes",
"Set the item's attributes.",
"Sets attributes on the item.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL);
gimp_procedure_add_argument (procedure,
gimp_param_spec_item_id ("item",
"item",
"The item",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_string ("attributes-string",
"attributes string",
"The attributes as a xml string",
FALSE, FALSE, FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-item-attach-parasite
*/

View File

@@ -270,7 +270,7 @@ gimp_save_dialog_set_image (GimpSaveDialog *dialog,
tooltip = g_strdup_printf (_("Disables compression to make the XCF "
"file readable by %s and later."),
version_string);
if (gimp_image_get_metadata (image))
if (gimp_image_get_attributes (image))
{
gchar *temp_tooltip;

View File

@@ -48,6 +48,7 @@
#include "core/gimpimage-undo.h"
#include "core/gimpitemstack.h"
#include "core/gimplayer-floating-selection.h"
#include "core/gimpitem-metadata.h"
#include "core/gimplayer-new.h"
#include "core/gimplayermask.h"
#include "core/gimpparasitelist.h"
@@ -268,6 +269,31 @@ xcf_load_image (Gimp *gimp,
gimp_parasite_list_remove (private->parasites,
gimp_parasite_name (parasite));
}
else
{
/* check for an attributes parasite */
parasite = gimp_image_parasite_find (GIMP_IMAGE (image),
"gimp-image-attributes");
if (parasite)
{
GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
GimpAttributes *attributes;
const gchar *attributes_string;
attributes_string = (gchar *) gimp_parasite_data (parasite);
attributes = gimp_attributes_deserialize (attributes_string);
if (attributes)
{
gimp_image_set_attributes (image, attributes, FALSE);
g_object_unref (attributes);
}
gimp_parasite_list_remove (private->parasites,
gimp_parasite_name (parasite));
}
}
/* migrate the old "exif-data" parasite */
parasite = gimp_image_parasite_find (GIMP_IMAGE (image),
@@ -284,13 +310,11 @@ xcf_load_image (Gimp *gimp,
}
else
{
GimpMetadata *metadata = gimp_image_get_metadata (image);
GError *my_error = NULL;
GimpMetadata *metadata = NULL;
GimpAttributes *attributes = NULL;
GError *my_error = NULL;
if (metadata)
g_object_ref (metadata);
else
metadata = gimp_metadata_new ();
metadata = gimp_metadata_new ();
if (! gimp_metadata_set_from_exif (metadata,
gimp_parasite_data (parasite),
@@ -306,7 +330,12 @@ xcf_load_image (Gimp *gimp,
}
else
{
gimp_image_set_metadata (image, metadata, FALSE);
attributes = gimp_attributes_new ();
attributes = gimp_attributes_from_metadata (attributes, metadata);
gimp_image_set_attributes (image, attributes, FALSE);
g_object_unref (attributes);
}
g_object_unref (metadata);
@@ -341,13 +370,11 @@ xcf_load_image (Gimp *gimp,
}
else
{
GimpMetadata *metadata = gimp_image_get_metadata (image);
GError *my_error = NULL;
GimpMetadata *metadata = NULL;
GimpAttributes *attributes = NULL;
GError *my_error = NULL;
if (metadata)
g_object_ref (metadata);
else
metadata = gimp_metadata_new ();
metadata = gimp_metadata_new ();
if (! gimp_metadata_set_from_xmp (metadata,
(const guint8 *) xmp_data + 10,
@@ -363,7 +390,12 @@ xcf_load_image (Gimp *gimp,
}
else
{
gimp_image_set_metadata (image, metadata, FALSE);
attributes = gimp_attributes_new ();
attributes = gimp_attributes_from_metadata (attributes, metadata);
gimp_image_set_attributes (image, attributes, FALSE);
g_object_unref (attributes);
}
g_object_unref (metadata);
@@ -1425,25 +1457,26 @@ xcf_load_layer (XcfInfo *info,
GimpImage *image,
GList **item_path)
{
GimpLayer *layer;
GimpLayerMask *layer_mask;
guint32 hierarchy_offset;
guint32 layer_mask_offset;
gboolean apply_mask = TRUE;
gboolean edit_mask = FALSE;
gboolean show_mask = FALSE;
gboolean active;
gboolean floating;
guint32 group_layer_flags = 0;
guint32 text_layer_flags = 0;
gint width;
gint height;
gint type;
GimpImageBaseType base_type;
gboolean has_alpha;
const Babl *format;
gboolean is_fs_drawable;
gchar *name;
GimpLayer *layer;
GimpLayerMask *layer_mask;
const GimpParasite *parasite;
guint32 hierarchy_offset;
guint32 layer_mask_offset;
gboolean apply_mask = TRUE;
gboolean edit_mask = FALSE;
gboolean show_mask = FALSE;
gboolean active;
gboolean floating;
guint32 group_layer_flags = 0;
guint32 text_layer_flags = 0;
gint width;
gint height;
gint type;
GimpImageBaseType base_type;
gboolean has_alpha;
const Babl *format;
gboolean is_fs_drawable;
gchar *name;
/* check and see if this is the drawable the floating selection
* is attached to. if it is then we'll do the attachment in our caller.
@@ -1520,6 +1553,29 @@ xcf_load_layer (XcfInfo *info,
GIMP_LOG (XCF, "layer props loaded");
parasite = gimp_item_parasite_find (GIMP_ITEM (layer),
"gimp-item-attributes");
if (parasite)
{
GimpAttributes *attributes;
const gchar *attributes_string;
attributes_string = (gchar *) gimp_parasite_data (parasite);
attributes = gimp_attributes_deserialize (attributes_string);
if (attributes)
{
gimp_item_set_attributes (GIMP_ITEM (layer), attributes, FALSE);
g_object_unref (attributes);
}
gimp_item_parasite_detach (GIMP_ITEM (layer),
"gimp-item-attributes",
FALSE);
}
GIMP_LOG (XCF, "layer attributes loaded");
xcf_progress_update (info);
/* call the evil text layer hack that might change our layer pointer */
@@ -1609,13 +1665,14 @@ static GimpChannel *
xcf_load_channel (XcfInfo *info,
GimpImage *image)
{
GimpChannel *channel;
guint32 hierarchy_offset;
gint width;
gint height;
gboolean is_fs_drawable;
gchar *name;
GimpRGB color = { 0.0, 0.0, 0.0, GIMP_OPACITY_OPAQUE };
GimpChannel *channel;
const GimpParasite *parasite;
guint32 hierarchy_offset;
gint width;
gint height;
gboolean is_fs_drawable;
gchar *name;
GimpRGB color = { 0.0, 0.0, 0.0, GIMP_OPACITY_OPAQUE };
/* check and see if this is the drawable the floating selection
* is attached to. if it is then we'll do the attachment in our caller.
@@ -1640,6 +1697,27 @@ xcf_load_channel (XcfInfo *info,
if (!xcf_load_channel_props (info, image, &channel))
goto error;
parasite = gimp_item_parasite_find (GIMP_ITEM (channel),
"gimp-item-attributes");
if (parasite)
{
GimpAttributes *attributes;
const gchar *attributes_string;
attributes_string = (gchar *) gimp_parasite_data (parasite);
attributes = gimp_attributes_deserialize (attributes_string);
if (attributes)
{
gimp_item_set_attributes (GIMP_ITEM (channel), attributes, FALSE);
g_object_unref (attributes);
}
gimp_item_parasite_detach (GIMP_ITEM (channel),
"gimp-item-attributes",
FALSE);
}
xcf_progress_update (info);
/* read the hierarchy and layer mask offsets */

View File

@@ -45,6 +45,7 @@
#include "core/gimpimage-metadata.h"
#include "core/gimpimage-private.h"
#include "core/gimpimage-sample-points.h"
#include "core/gimpitem-metadata.h"
#include "core/gimplayer.h"
#include "core/gimplayermask.h"
#include "core/gimpparasitelist.h"
@@ -337,11 +338,11 @@ xcf_save_image_props (XcfInfo *info,
GimpImage *image,
GError **error)
{
GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
GimpParasite *grid_parasite = NULL;
GimpParasite *meta_parasite = NULL;
GimpParasite *compat_parasite = NULL;
GimpUnit unit = gimp_image_get_unit (image);
GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
GimpParasite *grid_parasite = NULL;
GimpParasite *meta_parasite = NULL;
GimpParasite *compat_parasite = NULL;
GimpUnit unit = gimp_image_get_unit (image);
gdouble xres;
gdouble yres;
@@ -393,6 +394,27 @@ xcf_save_image_props (XcfInfo *info,
gimp_parasite_list_add (private->parasites, grid_parasite);
}
#if 0
if (gimp_image_get_attributes (image))
{
GimpParasite *attributes_parasite = NULL;
GimpAttributes *attributes = gimp_image_get_attributes (image);
gchar *attributes_string;
attributes_string = gimp_attributes_serialize (attributes);
if (attributes_string)
{
attributes_parasite = gimp_parasite_new ("gimp-image-attributes",
GIMP_PARASITE_PERSISTENT,
strlen (attributes_string) + 1,
attributes_string);
gimp_parasite_list_add (private->parasites, attributes_parasite);
g_free (attributes_string);
}
}
#endif
if (gimp_image_get_metadata (image))
{
GimpMetadata *metadata = gimp_image_get_metadata (image);
@@ -468,6 +490,25 @@ xcf_save_layer_props (XcfInfo *info,
GimpParasiteList *parasites;
gint offset_x;
gint offset_y;
GimpParasite *attributes_parasite = NULL;
if (gimp_item_get_attributes (GIMP_ITEM (layer)))
{
GimpAttributes *attributes = gimp_item_get_attributes (GIMP_ITEM (layer));
gchar *attributes_string;
attributes_string = gimp_attributes_serialize (attributes);
if (attributes_string)
{
attributes_parasite = gimp_parasite_new ("gimp-item-attributes",
GIMP_PARASITE_PERSISTENT,
strlen (attributes_string) + 1,
attributes_string);
gimp_item_parasite_attach (GIMP_ITEM (layer), attributes_parasite, FALSE);
g_free (attributes_string);
}
}
if (gimp_viewable_get_children (GIMP_VIEWABLE (layer)))
xcf_check_error (xcf_save_prop (info, image, PROP_GROUP_ITEM, error));
@@ -581,6 +622,27 @@ xcf_save_channel_props (XcfInfo *info,
{
GimpParasiteList *parasites;
guchar col[3];
GimpParasite *attributes_parasite = NULL;
#if 0
if (gimp_item_get_attributes (GIMP_ITEM (channel)))
{
GimpAttributes *attributes = gimp_item_get_attributes (GIMP_ITEM (channel));
gchar *attributes_string;
attributes_string = gimp_attributes_serialize (attributes);
if (attributes_string)
{
attributes_parasite = gimp_parasite_new ("gimp-item-attributes",
GIMP_PARASITE_PERSISTENT,
strlen (attributes_string) + 1,
attributes_string);
gimp_item_parasite_attach (GIMP_ITEM (channel), attributes_parasite, FALSE);
g_free (attributes_string);
}
}
#endif
if (channel == gimp_image_get_active_channel (image))
xcf_check_error (xcf_save_prop (info, image, PROP_ACTIVE_CHANNEL, error));

View File

@@ -66,7 +66,7 @@ m4_define([pycairo_required_version], [1.0.2])
m4_define([poppler_required_version], [0.44.0])
m4_define([poppler_data_required_version], [0.4.7])
m4_define([libgudev_required_version], [167])
m4_define([gexiv2_required_version], [0.6.1])
m4_define([gexiv2_required_version], [0.10.3])
m4_define([libmypaint_required_version], [1.3.0])
m4_define([lcms_required_version], [2.7])
m4_define([libpng_required_version], [1.6.25])
@@ -2429,6 +2429,7 @@ plug-ins/imagemap/images/Makefile
plug-ins/lighting/Makefile
plug-ins/lighting/images/Makefile
plug-ins/map-object/Makefile
plug-ins/metainfo/Makefile
plug-ins/pagecurl/Makefile
plug-ins/print/Makefile
plug-ins/pygimp/Makefile

Binary file not shown.

After

Width:  |  Height:  |  Size: 569 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 850 B

View File

@@ -0,0 +1,275 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="24"
height="24"
viewBox="0 0 24 24"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="gimp-image-tag 24.svg">
<defs
id="defs4">
<linearGradient
id="linearGradient19282"
osb:paint="solid"
gradientTransform="matrix(1.2178615,0,0,1.043881,378.84797,1794.4958)">
<stop
offset="0"
id="stop19284"
style="stop-color:#505050;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient19282-2"
osb:paint="solid"
gradientTransform="matrix(1.2178615,0,0,1.043881,356.69172,1794.4958)">
<stop
offset="0"
id="stop19284-1"
style="stop-color:#666666;stop-opacity:1" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2807"
id="linearGradient2813"
x1="34.197105"
y1="33.725819"
x2="17.160702"
y2="17.396523"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.51166,0,0,0.475019,3.220846,5.837432)" />
<linearGradient
inkscape:collect="always"
id="linearGradient2807">
<stop
style="stop-color:#d3d7cf"
offset="0"
id="stop2809" />
<stop
style="stop-color:#eeeeec"
offset="1"
id="stop2811" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2065"
id="linearGradient2071"
x1="-11.986486"
y1="13.122552"
x2="-11.986486"
y2="29.726542"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.46355126,0,0,0.4786134,21.056353,5.7526316)" />
<linearGradient
inkscape:collect="always"
id="linearGradient2065">
<stop
style="stop-color:#555753"
offset="0"
id="stop2067" />
<stop
style="stop-color:#fcaf3e"
offset="1"
id="stop2069" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4928"
id="radialGradient4915"
cx="-6.0070167"
cy="32.837029"
fx="-6.0070167"
fy="32.837029"
r="9.90625"
gradientTransform="matrix(0.462962,0,0,0.44272,14.86446,6.713194)"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient4928">
<stop
id="stop4930"
offset="0"
style="stop-color:#fce94f;stop-opacity:1;" />
<stop
id="stop4932"
offset="1"
style="stop-color:#fce94f;stop-opacity:0;" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4616"
id="linearGradient4622"
x1="25.355263"
y1="34.006802"
x2="25.355263"
y2="32.409008"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.462962,0,0,0.461866,4.347921,6.0846753)" />
<linearGradient
inkscape:collect="always"
id="linearGradient4616">
<stop
style="stop-color:#2e3436;stop-opacity:1;"
offset="0"
id="stop4618" />
<stop
style="stop-color:#2e3436;stop-opacity:0;"
offset="1"
id="stop4620" />
</linearGradient>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="2.4076613"
inkscape:cx="160"
inkscape:cy="995.02261"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="2340"
inkscape:window-height="1022"
inkscape:window-x="156"
inkscape:window-y="156"
inkscape:window-maximized="0" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Ebene 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="layer1-5"
inkscape:label="Ebene 1"
transform="matrix(2.3238903,0,0,2.3238903,-624.38128,-1263.9315)">
<g
inkscape:label="Layer 1"
id="layer1-6"
transform="translate(269.14287,-491.99997)">
<g
transform="matrix(0.69565065,0,0,0.80000484,24.148475,1040.5518)"
id="g4028">
<g
transform="translate(-38.71351,-12.237062)"
id="g2403">
<g
id="g3799"
transform="matrix(0.557846,0,0,0.461866,-85.36183,64.50698)"
inkscape:r_cx="true"
inkscape:r_cy="true"
style="opacity:0.58241763" />
<rect
style="opacity:1;fill:url(#linearGradient2813);fill-opacity:1;stroke:#8a8a8a;stroke-width:0.99999869;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect2073"
width="22.000015"
height="19.00001"
x="4.500001"
y="7.4999981"
rx="1.8229138"
ry="1.8185979" />
<rect
style="opacity:1;fill:url(#linearGradient2071);fill-opacity:1;stroke:#888a85;stroke-width:1.01321542;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect2063"
width="16.236822"
height="11.486709"
x="7.3816152"
y="11.256679"
rx="0.20280379"
ry="0.2071792" />
<path
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:url(#radialGradient4915);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none"
d="m 11.79411,16.401215 c -2.392951,0.151471 -4.296871,2.150075 -4.296871,4.575364 0,0.09366 0.00889,0.181964 0.014468,0.274234 l 9.143509,0 c 0.0056,-0.09227 0.01447,-0.180574 0.01447,-0.274234 0,-2.523879 -2.056354,-4.575364 -4.586223,-4.575364 -0.09882,0 -0.192077,-0.0062 -0.289351,0 z"
id="path4898"
inkscape:r_cx="true"
inkscape:r_cy="true"
inkscape:connector-curvature="0" />
<rect
style="opacity:1;fill:url(#linearGradient4622);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect1324"
width="15.740722"
height="0.92373294"
x="7.5886593"
y="21.326269"
rx="0"
ry="0" />
<rect
style="opacity:1;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:0.99999893;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect2077"
width="20.000008"
height="16.99999"
x="5.5000043"
y="8.4999981"
rx="1.42609"
ry="1.4227122" />
<path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 18.031043,21.675958 c 0,0 -0.257213,-1.424098 -0.257213,-2.296525 0.0071,-0.39799 3.604954,-3.498458 3.614237,-3.960285 l -0.836462,0.727219 -0.585726,-1.589717 1.974613,0.204118 0.925925,-0.923733 -1.048689,0.768044 -0.360661,-0.08165 -0.4425,-1.610129 0.22506,1.569306 -1.63441,-0.08165 0.511509,1.29875 -1.416971,-1.400809 1.498813,1.949752 c 3.7e-5,0.43486 -2.954107,3.089518 -2.949079,2.631777 L 16.024282,17.241 l -0.102301,-2.216308 0.925925,-0.263924 0.811179,-1.99555 -1.069313,1.844378 -0.834796,-0.03774 -1.868696,-1.574507 -2.565841,-0.979767 2.192051,1.201894 -1.757172,0.155689 2.314813,0 1.388887,1.385599 0.163681,2.393383 -2.478493,-2.393383 1.042268,1.250322 -1.505231,1.05901 1.653439,-0.923733 2.615524,3.286696 -0.1023,2.242895 1.183137,0 z"
id="path2079"
sodipodi:nodetypes="cccccccccccccccccccccccccccccccccccc"
inkscape:connector-curvature="0" />
<path
inkscape:r_cy="true"
inkscape:r_cx="true"
id="path4924"
d="m 11.925565,18.563623 c -1.305803,0.08266 -2.344749,1.17327 -2.344749,2.49672 0,0.05111 0.00485,0.0993 0.00789,0.149646 l 4.989498,0 c 0.003,-0.05035 0.0079,-0.09854 0.0079,-0.149646 0,-1.377249 -1.122129,-2.49672 -2.502647,-2.49672 -0.05393,0 -0.104814,-0.0034 -0.157896,0 z"
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:#fef39e;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none"
inkscape:connector-curvature="0" />
<path
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:#fffbd7;fill-opacity:0.55681817;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none"
d="m 11.963041,19.163267 c -0.995873,0.06304 -1.788226,0.894796 -1.788226,1.904128 0,0.03898 0.0037,0.07573 0.006,0.114127 l 3.805249,0 c 0.0023,-0.0384 0.006,-0.07515 0.006,-0.114127 0,-1.050362 -0.855793,-1.904128 -1.908647,-1.904128 -0.04113,0 -0.07994,-0.0026 -0.12042,0 z"
id="path4926"
inkscape:r_cx="true"
inkscape:r_cy="true"
inkscape:connector-curvature="0" />
</g>
</g>
</g>
<g
transform="matrix(0.70710678,-0.70710678,0.70710678,0.70710678,81.714643,582.33533)"
style="stroke:#f7ffff;stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="g4559">
<path
style="fill:#0000ff;fill-opacity:1;stroke:#f7ffff;stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
d="m 157.03498,113.29807 8.9e-4,-3.47688 1.13932,-1.14753 1.13933,-1.14754 1.16389,1.14589 1.1639,1.14588 0,3.47853 0,3.47853 -2.30411,0 -2.30411,0 8.9e-4,-3.47688 z"
id="path4551"
inkscape:connector-curvature="0" />
<circle
style="fill:#ffffff;fill-opacity:1;stroke:#f7ffff;stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path4557"
cx="159.2991"
cy="109.53211"
r="0.58017093" />
</g>
</g>
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#dbddda;stroke-width:0.1;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect4212"
width="39.872719"
height="36.549992"
x="157.41417"
y="451.77939" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -0,0 +1,268 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="16"
height="16"
viewBox="0 0 16 16"
id="svg4214"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="gimp-image-tag.svg">
<defs
id="defs4216">
<linearGradient
id="linearGradient19282"
osb:paint="solid"
gradientTransform="matrix(1.2178615,0,0,1.043881,378.84797,1794.4958)">
<stop
offset="0"
id="stop19284"
style="stop-color:#505050;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient19282-2"
osb:paint="solid"
gradientTransform="matrix(1.2178615,0,0,1.043881,356.69172,1794.4958)">
<stop
offset="0"
id="stop19284-1"
style="stop-color:#666666;stop-opacity:1" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2807"
id="linearGradient2813"
x1="34.197105"
y1="33.725819"
x2="17.160702"
y2="17.396523"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.51166,0,0,0.475019,3.220846,5.837432)" />
<linearGradient
inkscape:collect="always"
id="linearGradient2807">
<stop
style="stop-color:#d3d7cf"
offset="0"
id="stop2809" />
<stop
style="stop-color:#eeeeec"
offset="1"
id="stop2811" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2065"
id="linearGradient2071"
x1="-11.986486"
y1="13.122552"
x2="-11.986486"
y2="29.726542"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.46355126,0,0,0.4786134,21.056353,5.7526316)" />
<linearGradient
inkscape:collect="always"
id="linearGradient2065">
<stop
style="stop-color:#555753"
offset="0"
id="stop2067" />
<stop
style="stop-color:#fcaf3e"
offset="1"
id="stop2069" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4928"
id="radialGradient4915"
cx="-6.0070167"
cy="32.837029"
fx="-6.0070167"
fy="32.837029"
r="9.90625"
gradientTransform="matrix(0.462962,0,0,0.44272,14.86446,6.713194)"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient4928">
<stop
id="stop4930"
offset="0"
style="stop-color:#fce94f;stop-opacity:1;" />
<stop
id="stop4932"
offset="1"
style="stop-color:#fce94f;stop-opacity:0;" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4616"
id="linearGradient4622"
x1="25.355263"
y1="34.006802"
x2="25.355263"
y2="32.409008"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.462962,0,0,0.461866,4.347921,6.0846753)" />
<linearGradient
inkscape:collect="always"
id="linearGradient4616">
<stop
style="stop-color:#2e3436;stop-opacity:1;"
offset="0"
id="stop4618" />
<stop
style="stop-color:#2e3436;stop-opacity:0;"
offset="1"
id="stop4620" />
</linearGradient>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="3.8436364"
inkscape:cx="41.428571"
inkscape:cy="1011.4286"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="3440"
inkscape:window-height="1377"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1" />
<metadata
id="metadata4219">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Ebene 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="layer1-9"
inkscape:label="Ebene 1"
transform="translate(-268.84576,-544.6878)">
<g
inkscape:label="Layer 1"
id="layer1-6"
transform="translate(269.14287,-491.99997)">
<g
transform="matrix(0.69565065,0,0,0.80000484,24.148475,1040.5518)"
id="g4028">
<g
transform="translate(-38.71351,-12.237062)"
id="g2403">
<g
id="g3799"
transform="matrix(0.557846,0,0,0.461866,-85.36183,64.50698)"
inkscape:r_cx="true"
inkscape:r_cy="true"
style="opacity:0.58241763" />
<rect
style="opacity:1;fill:url(#linearGradient2813);fill-opacity:1;stroke:#8a8a8a;stroke-width:0.99999869;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect2073"
width="22.000015"
height="19.00001"
x="4.500001"
y="7.4999981"
rx="1.8229138"
ry="1.8185979" />
<rect
style="opacity:1;fill:url(#linearGradient2071);fill-opacity:1;stroke:#888a85;stroke-width:1.01321542;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect2063"
width="16.236822"
height="11.486709"
x="7.3816152"
y="11.256679"
rx="0.20280379"
ry="0.2071792" />
<path
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:url(#radialGradient4915);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none"
d="m 11.79411,16.401215 c -2.392951,0.151471 -4.296871,2.150075 -4.296871,4.575364 0,0.09366 0.00889,0.181964 0.014468,0.274234 l 9.143509,0 c 0.0056,-0.09227 0.01447,-0.180574 0.01447,-0.274234 0,-2.523879 -2.056354,-4.575364 -4.586223,-4.575364 -0.09882,0 -0.192077,-0.0062 -0.289351,0 z"
id="path4898"
inkscape:r_cx="true"
inkscape:r_cy="true"
inkscape:connector-curvature="0" />
<rect
style="opacity:1;fill:url(#linearGradient4622);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect1324"
width="15.740722"
height="0.92373294"
x="7.5886593"
y="21.326269"
rx="0"
ry="0" />
<rect
style="opacity:1;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:0.99999893;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect2077"
width="20.000008"
height="16.99999"
x="5.5000043"
y="8.4999981"
rx="1.42609"
ry="1.4227122" />
<path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 18.031043,21.675958 c 0,0 -0.257213,-1.424098 -0.257213,-2.296525 0.0071,-0.39799 3.604954,-3.498458 3.614237,-3.960285 l -0.836462,0.727219 -0.585726,-1.589717 1.974613,0.204118 0.925925,-0.923733 -1.048689,0.768044 -0.360661,-0.08165 -0.4425,-1.610129 0.22506,1.569306 -1.63441,-0.08165 0.511509,1.29875 -1.416971,-1.400809 1.498813,1.949752 c 3.7e-5,0.43486 -2.954107,3.089518 -2.949079,2.631777 L 16.024282,17.241 l -0.102301,-2.216308 0.925925,-0.263924 0.811179,-1.99555 -1.069313,1.844378 -0.834796,-0.03774 -1.868696,-1.574507 -2.565841,-0.979767 2.192051,1.201894 -1.757172,0.155689 2.314813,0 1.388887,1.385599 0.163681,2.393383 -2.478493,-2.393383 1.042268,1.250322 -1.505231,1.05901 1.653439,-0.923733 2.615524,3.286696 -0.1023,2.242895 1.183137,0 z"
id="path2079"
sodipodi:nodetypes="cccccccccccccccccccccccccccccccccccc"
inkscape:connector-curvature="0" />
<path
inkscape:r_cy="true"
inkscape:r_cx="true"
id="path4924"
d="m 11.925565,18.563623 c -1.305803,0.08266 -2.344749,1.17327 -2.344749,2.49672 0,0.05111 0.00485,0.0993 0.00789,0.149646 l 4.989498,0 c 0.003,-0.05035 0.0079,-0.09854 0.0079,-0.149646 0,-1.377249 -1.122129,-2.49672 -2.502647,-2.49672 -0.05393,0 -0.104814,-0.0034 -0.157896,0 z"
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:#fef39e;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none"
inkscape:connector-curvature="0" />
<path
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:#fffbd7;fill-opacity:0.55681817;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none"
d="m 11.963041,19.163267 c -0.995873,0.06304 -1.788226,0.894796 -1.788226,1.904128 0,0.03898 0.0037,0.07573 0.006,0.114127 l 3.805249,0 c 0.0023,-0.0384 0.006,-0.07515 0.006,-0.114127 0,-1.050362 -0.855793,-1.904128 -1.908647,-1.904128 -0.04113,0 -0.07994,-0.0026 -0.12042,0 z"
id="path4926"
inkscape:r_cx="true"
inkscape:r_cy="true"
inkscape:connector-curvature="0" />
</g>
</g>
</g>
<g
transform="matrix(0.70710678,-0.70710678,0.70710678,0.70710678,81.714643,582.33533)"
style="stroke:#f7ffff;stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="g4559">
<path
style="fill:#0000ff;fill-opacity:1;stroke:#f7ffff;stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
d="m 157.03498,113.29807 8.9e-4,-3.47688 1.13932,-1.14753 1.13933,-1.14754 1.16389,1.14589 1.1639,1.14588 0,3.47853 0,3.47853 -2.30411,0 -2.30411,0 8.9e-4,-3.47688 z"
id="path4551"
inkscape:connector-curvature="0" />
<circle
style="fill:#ffffff;fill-opacity:1;stroke:#f7ffff;stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path4557"
cx="159.2991"
cy="109.53211"
r="0.58017093" />
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 569 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 850 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 739 B

View File

@@ -0,0 +1,189 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="24"
height="24"
id="svg4136"
version="1.1"
inkscape:version="0.91 r13725"
viewBox="0 0 24 24"
sodipodi:docname="gimp-image-tag-sym-24.svg"
inkscape:export-filename="D:\x\gimp-image-tag-sym-48.png"
inkscape:export-xdpi="68.080002"
inkscape:export-ydpi="68.080002">
<defs
id="defs4138">
<linearGradient
id="linearGradient8074"
osb:paint="solid">
<stop
style="stop-color:#be00be;stop-opacity:1;"
offset="0"
id="stop8072" />
</linearGradient>
<linearGradient
id="linearGradient7561"
osb:paint="solid">
<stop
style="stop-color:#a5a5a5;stop-opacity:1;"
offset="0"
id="stop7558" />
</linearGradient>
<linearGradient
id="linearGradient7548"
osb:paint="solid">
<stop
style="stop-color:#ebebeb;stop-opacity:1;"
offset="0"
id="stop7546" />
</linearGradient>
<linearGradient
id="linearGradient7542"
osb:paint="solid">
<stop
style="stop-color:#c9c9c9;stop-opacity:1;"
offset="0"
id="stop7538" />
</linearGradient>
<linearGradient
id="linearGradient19282"
osb:paint="solid"
gradientTransform="matrix(0,-735328.32,170712.69,0,2464326300,577972450)">
<stop
style="stop-color:#b4b4b4;stop-opacity:1;"
offset="0"
id="stop19284" />
</linearGradient>
<linearGradient
id="linearGradient19282-4"
osb:paint="solid"
gradientTransform="matrix(0.34682586,0,0,0.30620888,-13.35187,382.03851)">
<stop
style="stop-color:#bebebe;stop-opacity:1;"
offset="0"
id="stop19284-0" />
</linearGradient>
<linearGradient
xlink:href="#linearGradient19282-4"
id="linearGradient10174"
x1="-97"
y1="168.5"
x2="-87"
y2="168.5"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(520.93726,194.66866)" />
<linearGradient
xlink:href="#linearGradient19282-4"
id="linearGradient10176"
x1="142.0002"
y1="386.95001"
x2="156.0002"
y2="386.95001"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(520.93726,194.66866)" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="5.5"
inkscape:cx="-7.7272727"
inkscape:cy="32"
inkscape:current-layer="g4559"
showgrid="true"
inkscape:document-units="px"
inkscape:grid-bbox="true"
inkscape:window-width="3440"
inkscape:window-height="1377"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1" />
<metadata
id="metadata4141">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer"
transform="translate(0,-40)">
<g
id="stock"
style="display:inline"
transform="matrix(1.4886364,0,0,1.508596,-93.79,-1.8312358)"
inkscape:export-xdpi="90.773643"
inkscape:export-ydpi="90.773643">
<g
transform="translate(-77.874095,-351.36258)"
style="display:inline"
id="gimp-image">
<rect
transform="translate(241.0002,217)"
y="162"
x="-100"
height="16"
width="16"
id="rect6346"
style="fill:none;stroke:none" />
<path
inkscape:connector-curvature="0"
id="rect5882"
d="m 142.0002,379.9 0,14.1 14,0 0,-14.1 z m 1,1.1 12,0 0,9 -12,0 z"
style="fill:url(#linearGradient10176);fill-opacity:1;stroke:none" />
<path
inkscape:connector-curvature="0"
id="rect10683"
transform="translate(241.0002,217)"
d="m -97,165 0,7 1,0 c 0,-0.75515 0.671573,-1.375 1.5,-1.375 0.828427,0 1.5,0.61985 1.5,1.375 l 1,0 0,-1.5 c 1.4e-4,-0.98573 -0.7274,-1.47402 -2,-2.0625 0,0 0.02947,3.7e-4 0.25,0 0.40803,0.0835 1.38212,0.3501 1.75,0.59375 -0.09819,-0.35554 -0.14101,-0.89353 -0.4375,-1.34375 C -92.73401,167.23732 -94,166.34375 -94,166.34375 l 0.0625,-0.0312 c 0.05568,-0.0402 0.9453,0.7655 1.25,0.6875 -0.13515,-0.32497 -0.25949,-0.63468 -0.40625,-0.8125 l 0.1875,-0.0312 c 0.35629,0.59147 0.46684,0.72309 0.84375,1.15625 0.12472,0.0571 -0.03108,-0.0423 1.0625,-0.59375 L -91,167 c 0,0 -1.0625,0.30993 -0.75,0.90625 0.22248,0.30573 0.39823,1.01025 0.75,1.09375 0,0 0.85009,-1.22532 1.5,-1.625 0,0 -0.21923,-0.50879 -0.21875,-0.78125 3.7e-4,-0.20918 0.15625,-0.59375 0.15625,-0.59375 0.02319,0.39561 -0.0029,0.83091 0.28125,1.21875 L -88.34375,166 -88,166 c 0,0 -2.25088,2.3886 -2,2.78125 0.39455,-0.048 2,-0.34375 2,-0.34375 l 0,0.0625 c -1.04689,0.34884 -1.67111,0.68872 -2,1.5 l 0,2 3,0 0,-7 z"
style="opacity:0.3;fill:url(#linearGradient10174);fill-opacity:1;stroke:none" />
</g>
</g>
<g
transform="matrix(2.1155203,-2.1155203,2.1155203,2.1155203,-559.23734,114.18176)"
style="fill:#808080;stroke:#f7ffff;stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="g4559">
<path
style="fill:#999999;fill-opacity:1;stroke:#f7ffff;stroke-width:0.03767881;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
d="m 148.95421,117.66287 0.005,-1.31006 0.43094,-0.434 0.43093,-0.43402 0.4369,0.43009 0.43691,0.43009 -0.005,1.31068 -0.005,1.31067 -0.86817,0.003 -0.86817,0.003 0.005,-1.31005 z"
id="path4551"
inkscape:connector-curvature="0"
inkscape:export-xdpi="90.773643"
inkscape:export-ydpi="90.773643" />
<circle
style="fill:#ffffff;fill-opacity:1;stroke:#f7ffff;stroke-width:0.03767936;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path4557"
cx="150.25793"
cy="116.81281"
r="0.21860467"
inkscape:export-xdpi="90.773643"
inkscape:export-ydpi="90.773643"
transform="matrix(0.99999277,-0.00380225,-0.00380225,0.99999277,0,0)" />
</g>
</g>
<g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="Layer 2"
transform="translate(0,-40)" />
</svg>

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -0,0 +1,189 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="16"
height="16"
id="svg4136"
version="1.1"
inkscape:version="0.91 r13725"
viewBox="0 0 16 16"
sodipodi:docname="gimp-image-tag-sym-16.svg"
inkscape:export-filename="D:\x\gimp-image-tag-sym-48.png"
inkscape:export-xdpi="68.080002"
inkscape:export-ydpi="68.080002">
<defs
id="defs4138">
<linearGradient
id="linearGradient8074"
osb:paint="solid">
<stop
style="stop-color:#be00be;stop-opacity:1;"
offset="0"
id="stop8072" />
</linearGradient>
<linearGradient
id="linearGradient7561"
osb:paint="solid">
<stop
style="stop-color:#a5a5a5;stop-opacity:1;"
offset="0"
id="stop7558" />
</linearGradient>
<linearGradient
id="linearGradient7548"
osb:paint="solid">
<stop
style="stop-color:#ebebeb;stop-opacity:1;"
offset="0"
id="stop7546" />
</linearGradient>
<linearGradient
id="linearGradient7542"
osb:paint="solid">
<stop
style="stop-color:#c9c9c9;stop-opacity:1;"
offset="0"
id="stop7538" />
</linearGradient>
<linearGradient
id="linearGradient19282"
osb:paint="solid"
gradientTransform="matrix(0,-735328.32,170712.69,0,2464326300,577972450)">
<stop
style="stop-color:#b4b4b4;stop-opacity:1;"
offset="0"
id="stop19284" />
</linearGradient>
<linearGradient
id="linearGradient19282-4"
osb:paint="solid"
gradientTransform="matrix(0.34682586,0,0,0.30620888,-13.35187,382.03851)">
<stop
style="stop-color:#bebebe;stop-opacity:1;"
offset="0"
id="stop19284-0" />
</linearGradient>
<linearGradient
xlink:href="#linearGradient19282-4"
id="linearGradient10174"
x1="-97"
y1="168.5"
x2="-87"
y2="168.5"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(520.93726,194.66866)" />
<linearGradient
xlink:href="#linearGradient19282-4"
id="linearGradient10176"
x1="142.0002"
y1="386.95001"
x2="156.0002"
y2="386.95001"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(520.93726,194.66866)" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="5.5"
inkscape:cx="-7.7272727"
inkscape:cy="32"
inkscape:current-layer="g4559"
showgrid="true"
inkscape:document-units="px"
inkscape:grid-bbox="true"
inkscape:window-width="3440"
inkscape:window-height="1377"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1" />
<metadata
id="metadata4141">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer"
transform="translate(0,-48)">
<g
id="stock"
style="display:inline"
transform="matrix(0.97282511,0,0,0.98586873,-61.228842,20.979234)"
inkscape:export-xdpi="90.773643"
inkscape:export-ydpi="90.773643">
<g
transform="translate(-77.874095,-351.36258)"
style="display:inline"
id="gimp-image">
<rect
transform="translate(241.0002,217)"
y="162"
x="-100"
height="16"
width="16"
id="rect6346"
style="fill:none;stroke:none" />
<path
inkscape:connector-curvature="0"
id="rect5882"
d="m 142.0002,379.9 0,14.1 14,0 0,-14.1 z m 1,1.1 12,0 0,9 -12,0 z"
style="fill:url(#linearGradient10176);fill-opacity:1;stroke:none" />
<path
inkscape:connector-curvature="0"
id="rect10683"
transform="translate(241.0002,217)"
d="m -97,165 0,7 1,0 c 0,-0.75515 0.671573,-1.375 1.5,-1.375 0.828427,0 1.5,0.61985 1.5,1.375 l 1,0 0,-1.5 c 1.4e-4,-0.98573 -0.7274,-1.47402 -2,-2.0625 0,0 0.02947,3.7e-4 0.25,0 0.40803,0.0835 1.38212,0.3501 1.75,0.59375 -0.09819,-0.35554 -0.14101,-0.89353 -0.4375,-1.34375 C -92.73401,167.23732 -94,166.34375 -94,166.34375 l 0.0625,-0.0312 c 0.05568,-0.0402 0.9453,0.7655 1.25,0.6875 -0.13515,-0.32497 -0.25949,-0.63468 -0.40625,-0.8125 l 0.1875,-0.0312 c 0.35629,0.59147 0.46684,0.72309 0.84375,1.15625 0.12472,0.0571 -0.03108,-0.0423 1.0625,-0.59375 L -91,167 c 0,0 -1.0625,0.30993 -0.75,0.90625 0.22248,0.30573 0.39823,1.01025 0.75,1.09375 0,0 0.85009,-1.22532 1.5,-1.625 0,0 -0.21923,-0.50879 -0.21875,-0.78125 3.7e-4,-0.20918 0.15625,-0.59375 0.15625,-0.59375 0.02319,0.39561 -0.0029,0.83091 0.28125,1.21875 L -88.34375,166 -88,166 c 0,0 -2.25088,2.3886 -2,2.78125 0.39455,-0.048 2,-0.34375 2,-0.34375 l 0,0.0625 c -1.04689,0.34884 -1.67111,0.68872 -2,1.5 l 0,2 3,0 0,-7 z"
style="opacity:0.3;fill:url(#linearGradient10174);fill-opacity:1;stroke:none" />
</g>
</g>
<g
transform="matrix(2.1155203,-2.1155203,2.1155203,2.1155203,-559.23734,114.18176)"
style="fill:#808080;stroke:#f7ffff;stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="g4559">
<path
style="fill:#999999;fill-opacity:1;stroke:#f7ffff;stroke-width:0.02462314;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
d="m 147.26469,118.59655 0.003,-0.85612 0.28162,-0.28362 0.28161,-0.28364 0.28552,0.28107 0.28552,0.28106 -0.003,0.85653 -0.003,0.85653 -0.56735,0.002 -0.56735,0.002 0.003,-0.85612 z"
id="path4551"
inkscape:connector-curvature="0"
inkscape:export-xdpi="90.773643"
inkscape:export-ydpi="90.773643" />
<circle
style="fill:#ffffff;fill-opacity:1;stroke:#f7ffff;stroke-width:0.02462349;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path4557"
cx="148.27634"
cy="118.23177"
r="0.14285833"
inkscape:export-xdpi="90.773643"
inkscape:export-ydpi="90.773643"
transform="matrix(0.99999277,-0.00380225,-0.00380225,0.99999277,0,0)" />
</g>
</g>
<g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="Layer 2"
transform="translate(0,-48)" />
</svg>

After

Width:  |  Height:  |  Size: 7.0 KiB

View File

@@ -142,6 +142,7 @@ scalable_images = \
scalable/gimp-histogram.svg \
scalable/gimp-images.svg \
scalable/gimp-image.svg \
scalable/gimp-image-metadata.svg \
scalable/gimp-image-open.svg \
scalable/gimp-image-reload.svg \
scalable/gimp-info.svg \
@@ -353,6 +354,7 @@ vector24_images = \
24/gimp-grid.svg \
24/gimp-histogram.svg \
24/gimp-image.svg \
24/gimp-image-metadata.svg \
24/gimp-images.svg \
24/gimp-info.svg \
24/gimp-landscape.svg \
@@ -605,6 +607,7 @@ icons16_images = \
16/gimp-histogram-logarithmic.png \
16/gimp-histogram.png \
16/gimp-image.png \
16/gimp-image-metadata.png \
16/gimp-images.png \
16/gimp-image-open.png \
16/gimp-image-reload.png \
@@ -861,6 +864,7 @@ icons24_images = \
24/gimp-hchain.png \
24/gimp-hfill.png \
24/gimp-image.png \
24/gimp-image-metadata.png \
24/gimp-images.png \
24/gimp-info.png \
24/gimp-layer-mask.png \
@@ -970,6 +974,7 @@ icons48_images = \
48/gimp-channel.png \
48/gimp-floating-selection.png \
48/gimp-image.png \
48/gimp-image-metadata.png \
48/gimp-layer-mask.png \
48/gimp-layer.png \
48/gimp-prefs-color-management.png \

View File

@@ -222,6 +222,8 @@ libgimp_sources = \
gimpimage.h \
gimpimagecolorprofile.c \
gimpimagecolorprofile.h \
gimpitem.c \
gimpitem.h \
gimplayer.c \
gimplayer.h \
gimppalette.c \
@@ -345,6 +347,7 @@ gimpinclude_HEADERS = \
gimpgradientselect.h \
gimpimage.h \
gimpimagecolorprofile.h \
gimpitem.h \
gimplayer.h \
gimppalette.h \
gimppalettes.h \

View File

@@ -425,6 +425,7 @@ EXPORTS
gimp_image_get_active_drawable
gimp_image_get_active_layer
gimp_image_get_active_vectors
gimp_image_get_attributes
gimp_image_get_channel_by_name
gimp_image_get_channel_by_tattoo
gimp_image_get_channel_position
@@ -524,6 +525,7 @@ EXPORTS
gimp_image_set_active_channel
gimp_image_set_active_layer
gimp_image_set_active_vectors
gimp_image_set_attributes
gimp_image_set_cmap
gimp_image_set_color_profile
gimp_image_set_color_profile_from_file
@@ -551,6 +553,7 @@ EXPORTS
gimp_item_attach_parasite
gimp_item_delete
gimp_item_detach_parasite
gimp_item_get_attributes
gimp_item_get_children
gimp_item_get_color_tag
gimp_item_get_image
@@ -573,6 +576,7 @@ EXPORTS
gimp_item_is_valid
gimp_item_is_vectors
gimp_item_set_color_tag
gimp_item_set_attributes
gimp_item_set_linked
gimp_item_set_lock_content
gimp_item_set_lock_position

View File

@@ -46,6 +46,7 @@
#include <libgimp/gimpgradientselect.h>
#include <libgimp/gimpimage.h>
#include <libgimp/gimpimagecolorprofile.h>
#include <libgimp/gimpitem.h>
#include <libgimp/gimplayer.h>
#include <libgimp/gimppalette.h>
#include <libgimp/gimppalettes.h>

View File

@@ -99,7 +99,6 @@ gimp_image_get_thumbnail_data (gint32 image_ID,
return image_data;
}
/**
* gimp_image_get_metadata:
* @image_ID: The image.
@@ -115,19 +114,50 @@ gimp_image_get_thumbnail_data (gint32 image_ID,
GimpMetadata *
gimp_image_get_metadata (gint32 image_ID)
{
GimpMetadata *metadata = NULL;
gchar *metadata_string;
GimpMetadata *metadata = NULL;
GimpAttributes *attributes = NULL;
gchar *attributes_string = NULL;
metadata_string = _gimp_image_get_metadata (image_ID);
if (metadata_string)
metadata = gimp_metadata_new ();
attributes_string = _gimp_image_get_attributes (image_ID);
if (attributes_string)
{
metadata = gimp_metadata_deserialize (metadata_string);
g_free (metadata_string);
attributes = gimp_attributes_deserialize (attributes_string);
g_free (attributes_string);
gimp_attributes_to_metadata (attributes, metadata, "image/any");
}
return metadata;
}
/**
* gimp_image_get_attributes:
* @image_ID: The image.
*
* Returns the image's attributes.
*
* Returns attributes from the image.
*
* Returns: The attributes, or %NULL if there is none.
*
* Since: 2.10
**/
GimpAttributes *
gimp_image_get_attributes (gint32 image_ID)
{
GimpAttributes *attributes = NULL;
gchar *attributes_string = NULL;
attributes_string = _gimp_image_get_attributes (image_ID);
if (attributes_string)
{
attributes = gimp_attributes_deserialize (attributes_string);
g_free (attributes_string);
}
return attributes;
}
/**
* gimp_image_set_metadata:
* @image_ID: The image.
@@ -146,16 +176,49 @@ gboolean
gimp_image_set_metadata (gint32 image_ID,
GimpMetadata *metadata)
{
gchar *metadata_string = NULL;
GimpAttributes *attributes = NULL;
gchar *attributes_string = NULL;
gboolean success;
if (metadata)
metadata_string = gimp_metadata_serialize (metadata);
attributes = gimp_attributes_from_metadata (attributes, metadata);
if (attributes)
attributes_string = gimp_attributes_serialize (attributes);
success = _gimp_image_set_metadata (image_ID, metadata_string);
success = _gimp_image_set_attributes (image_ID, attributes_string);
if (attributes_string)
g_free (attributes_string);
if (metadata_string)
g_free (metadata_string);
return success;
}
/**
* gimp_image_set_attributes:
* @image_ID: The image.
* @metadata: The GimpAttributes object.
*
* Set the image's attributes.
*
* Sets attributes on the image, or deletes it if
* @attributes is %NULL.
*
* Returns: TRUE on success.
*
* Since: 2.10
**/
gboolean
gimp_image_set_attributes (gint32 image_ID,
GimpAttributes *attributes)
{
gchar *attributes_string = NULL;
gboolean success;
if (attributes)
attributes_string = gimp_attributes_serialize (attributes);
success = _gimp_image_set_attributes (image_ID, attributes_string);
if (attributes_string)
g_free (attributes_string);
return success;
}

View File

@@ -45,6 +45,11 @@ GimpMetadata * gimp_image_get_metadata (gint32 image_ID)
gboolean gimp_image_set_metadata (gint32 image_ID,
GimpMetadata *metadata);
gboolean gimp_image_set_attributes (gint32 image_ID,
GimpAttributes *attributes);
GimpAttributes *gimp_image_get_attributes (gint32 image_ID);
GIMP_DEPRECATED_FOR(gimp_image_get_colormap)
guchar * gimp_image_get_cmap (gint32 image_ID,
gint *num_colors);

View File

@@ -1532,58 +1532,28 @@ _gimp_image_set_colormap (gint32 image_ID,
}
/**
* _gimp_image_get_metadata:
* _gimp_image_set_attributes:
* @image_ID: The image.
* @attributes_string: The attributes as a xml string.
*
* Returns the image's metadata.
* Set the image's attributes.
*
* Returns exif/iptc/xmp metadata from the image.
*
* Returns: The exif/ptc/xmp metadata as a string.
**/
gchar *
_gimp_image_get_metadata (gint32 image_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gchar *metadata_string = NULL;
return_vals = gimp_run_procedure ("gimp-image-get-metadata",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
metadata_string = g_strdup (return_vals[1].data.d_string);
gimp_destroy_params (return_vals, nreturn_vals);
return metadata_string;
}
/**
* _gimp_image_set_metadata:
* @image_ID: The image.
* @metadata_string: The exif/ptc/xmp metadata as a string.
*
* Set the image's metadata.
*
* Sets exif/iptc/xmp metadata on the image.
* Sets attributes on the image.
*
* Returns: TRUE on success.
**/
gboolean
_gimp_image_set_metadata (gint32 image_ID,
const gchar *metadata_string)
_gimp_image_set_attributes (gint32 image_ID,
const gchar *attributes_string)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-image-set-metadata",
return_vals = gimp_run_procedure ("gimp-image-set-attributes",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_STRING, metadata_string,
GIMP_PDB_STRING, attributes_string,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
@@ -1593,6 +1563,36 @@ _gimp_image_set_metadata (gint32 image_ID,
return success;
}
/**
* _gimp_image_get_attributes:
* @image_ID: The image.
*
* Returns the image's attributes.
*
* Returns attributes from the image.
*
* Returns: The attributes as a xml string.
**/
gchar *
_gimp_image_get_attributes (gint32 image_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gchar *attributes_string = NULL;
return_vals = gimp_run_procedure ("gimp-image-get-attributes",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
attributes_string = g_strdup (return_vals[1].data.d_string);
gimp_destroy_params (return_vals, nreturn_vals);
return attributes_string;
}
/**
* gimp_image_clean_all:
* @image_ID: The image.

View File

@@ -125,9 +125,9 @@ G_GNUC_INTERNAL guint8* _gimp_image_get_colormap (gint32
G_GNUC_INTERNAL gboolean _gimp_image_set_colormap (gint32 image_ID,
gint num_bytes,
const guint8 *colormap);
G_GNUC_INTERNAL gchar* _gimp_image_get_metadata (gint32 image_ID);
G_GNUC_INTERNAL gboolean _gimp_image_set_metadata (gint32 image_ID,
const gchar *metadata_string);
G_GNUC_INTERNAL gboolean _gimp_image_set_attributes (gint32 image_ID,
const gchar *attributes_string);
G_GNUC_INTERNAL gchar* _gimp_image_get_attributes (gint32 image_ID);
gboolean gimp_image_clean_all (gint32 image_ID);
gboolean gimp_image_is_dirty (gint32 image_ID);
G_GNUC_INTERNAL gboolean _gimp_image_thumbnail (gint32 image_ID,

View File

@@ -28,6 +28,7 @@
#include "gimp.h"
#include "gimpui.h"
#include "gimpimagemetadata.h"
#include "libgimpbase/gimpbase.h"
#include "libgimp-intl.h"
@@ -44,7 +45,6 @@ static gboolean gimp_image_metadata_rotate_dialog (gint32 image_I
GExiv2Orientation orientation,
const gchar *parasite_name);
/* public functions */
/**
@@ -122,81 +122,90 @@ gimp_image_metadata_load_prepare (gint32 image_ID,
*/
void
gimp_image_metadata_load_finish (gint32 image_ID,
gint32 layer_ID,
const gchar *mime_type,
GimpMetadata *metadata,
GimpMetadataLoadFlags flags,
gboolean interactive)
{
GimpAttributes *attributes = NULL;
g_return_if_fail (image_ID > 0);
g_return_if_fail (mime_type != NULL);
g_return_if_fail (GEXIV2_IS_METADATA (metadata));
if (flags & GIMP_METADATA_LOAD_COMMENT)
{
gchar *comment;
comment = gexiv2_metadata_get_tag_interpreted_string (metadata,
"Exif.Photo.UserComment");
if (! comment)
comment = gexiv2_metadata_get_tag_interpreted_string (metadata,
"Exif.Image.ImageDescription");
if (comment)
{
GimpParasite *parasite;
parasite = gimp_parasite_new ("gimp-comment",
GIMP_PARASITE_PERSISTENT,
strlen (comment) + 1,
comment);
g_free (comment);
gimp_image_attach_parasite (image_ID, parasite);
gimp_parasite_free (parasite);
}
}
if (flags & GIMP_METADATA_LOAD_RESOLUTION)
{
gdouble xres;
gdouble yres;
GimpUnit unit;
if (gimp_metadata_get_resolution (metadata, &xres, &yres, &unit))
{
gimp_image_set_resolution (image_ID, xres, yres);
gimp_image_set_unit (image_ID, unit);
}
}
if (flags & GIMP_METADATA_LOAD_ORIENTATION)
{
gimp_image_metadata_rotate_query (image_ID, mime_type,
metadata, interactive);
}
attributes = gimp_attributes_from_metadata (attributes, metadata);
if (attributes)
{
if (flags & GIMP_METADATA_LOAD_COMMENT)
{
GimpAttribute *attribute = NULL;
gchar *comment = NULL;
attribute = gimp_attributes_get_attribute (attributes, "Exif.Photo.UserComment");
if (attribute)
comment = gimp_attribute_get_string (attribute);
else
{
attribute = gimp_attributes_get_attribute (attributes, "Exif.Image.ImageDescription");
if (attribute)
comment = gimp_attribute_get_string (attribute);
}
if (comment)
{
GimpParasite *parasite;
parasite = gimp_parasite_new ("gimp-comment",
GIMP_PARASITE_PERSISTENT,
strlen (comment) + 1,
comment);
g_free (comment);
gimp_image_attach_parasite (image_ID, parasite);
gimp_parasite_free (parasite);
}
}
if (flags & GIMP_METADATA_LOAD_RESOLUTION)
{
gdouble xres;
gdouble yres;
GimpUnit unit;
if (gimp_attributes_get_resolution (attributes, &xres, &yres, &unit))
{
gimp_image_set_resolution (image_ID, xres, yres);
gimp_image_set_unit (image_ID, unit);
}
}
}
if (flags & GIMP_METADATA_LOAD_COLORSPACE)
{
GimpColorProfile *profile = gimp_image_get_color_profile (image_ID);
/* only look for colorspace information from metadata if the
* image didn't contain an embedded color profile
*/
if (! profile)
{
GimpMetadataColorspace colorspace;
GimpAttributesColorspace colorspace;
colorspace = gimp_metadata_get_colorspace (metadata);
colorspace = gimp_attributes_get_colorspace (attributes);
switch (colorspace)
{
case GIMP_METADATA_COLORSPACE_UNSPECIFIED:
case GIMP_METADATA_COLORSPACE_UNCALIBRATED:
case GIMP_METADATA_COLORSPACE_SRGB:
case GIMP_ATTRIBUTES_COLORSPACE_UNSPECIFIED:
case GIMP_ATTRIBUTES_COLORSPACE_UNCALIBRATED:
case GIMP_ATTRIBUTES_COLORSPACE_SRGB:
/* use sRGB, a NULL profile will do the right thing */
break;
case GIMP_METADATA_COLORSPACE_ADOBERGB:
case GIMP_ATTRIBUTES_COLORSPACE_ADOBERGB:
profile = gimp_color_profile_new_rgb_adobe ();
break;
}
@@ -209,7 +218,13 @@ gimp_image_metadata_load_finish (gint32 image_ID,
g_object_unref (profile);
}
gimp_image_set_metadata (image_ID, metadata);
gimp_image_set_attributes (image_ID, attributes);
if (layer_ID > 0)
{
gimp_item_set_attributes (layer_ID, attributes);
}
g_object_unref (attributes);
}
/**
@@ -219,7 +234,7 @@ gimp_image_metadata_load_finish (gint32 image_ID,
* @suggested_flags: Suggested default values for the @flags passed to
* gimp_image_metadata_save_finish()
*
* Gets the image metadata for saving it using
* Gets the image attributes for saving using
* gimp_image_metadata_save_finish().
*
* The @suggested_flags are determined from what kind of metadata
@@ -227,7 +242,7 @@ gimp_image_metadata_load_finish (gint32 image_ID,
* value for GIMP_METADATA_SAVE_THUMBNAIL is determined by whether
* there was a thumbnail in the previously imported image.
*
* Returns: The image's metadata, prepared for saving.
* Returns: The image's attributes, prepared for saving.
*
* Since: 2.10
*/
@@ -236,7 +251,8 @@ gimp_image_metadata_save_prepare (gint32 image_ID,
const gchar *mime_type,
GimpMetadataSaveFlags *suggested_flags)
{
GimpMetadata *metadata;
GimpAttributes *attributes = NULL;
GimpMetadata *metadata = NULL;
g_return_val_if_fail (image_ID > 0, NULL);
g_return_val_if_fail (mime_type != NULL, NULL);
@@ -244,133 +260,35 @@ gimp_image_metadata_save_prepare (gint32 image_ID,
*suggested_flags = GIMP_METADATA_SAVE_ALL;
metadata = gimp_image_get_metadata (image_ID);
attributes = gimp_image_get_attributes (image_ID);
metadata = gimp_metadata_new ();
if (metadata)
if (attributes)
{
GDateTime *datetime;
const GimpParasite *comment_parasite;
const gchar *comment = NULL;
gint image_width;
gint image_height;
gdouble xres;
gdouble yres;
gchar buffer[32];
image_width = gimp_image_width (image_ID);
image_height = gimp_image_height (image_ID);
datetime = g_date_time_new_now_local ();
comment_parasite = gimp_image_get_parasite (image_ID, "gimp-comment");
if (comment_parasite)
comment = gimp_parasite_data (comment_parasite);
/* Exif */
if (! gexiv2_metadata_has_exif (metadata))
if (! gimp_attributes_has_tag_type (attributes, TAG_EXIF))
*suggested_flags &= ~GIMP_METADATA_SAVE_EXIF;
if (comment)
{
gexiv2_metadata_set_tag_string (metadata,
"Exif.Photo.UserComment",
comment);
gexiv2_metadata_set_tag_string (metadata,
"Exif.Image.ImageDescription",
comment);
}
g_snprintf (buffer, sizeof (buffer),
"%d:%02d:%02d %02d:%02d:%02d",
g_date_time_get_year (datetime),
g_date_time_get_month (datetime),
g_date_time_get_day_of_month (datetime),
g_date_time_get_hour (datetime),
g_date_time_get_minute (datetime),
g_date_time_get_second (datetime));
gexiv2_metadata_set_tag_string (metadata,
"Exif.Image.DateTime",
buffer);
gexiv2_metadata_set_tag_string (metadata,
"Exif.Image.Software",
PACKAGE_STRING);
gimp_metadata_set_pixel_size (metadata,
image_width, image_height);
gimp_image_get_resolution (image_ID, &xres, &yres);
gimp_metadata_set_resolution (metadata, xres, yres,
gimp_image_get_unit (image_ID));
/* XMP */
if (! gexiv2_metadata_has_xmp (metadata))
if (! gimp_attributes_has_tag_type (attributes, TAG_XMP))
*suggested_flags &= ~GIMP_METADATA_SAVE_XMP;
gexiv2_metadata_set_tag_string (metadata,
"Xmp.dc.Format",
mime_type);
if (! g_strcmp0 (mime_type, "image/tiff"))
{
/* TIFF specific XMP data */
g_snprintf (buffer, sizeof (buffer), "%d", image_width);
gexiv2_metadata_set_tag_string (metadata,
"Xmp.tiff.ImageWidth",
buffer);
g_snprintf (buffer, sizeof (buffer), "%d", image_height);
gexiv2_metadata_set_tag_string (metadata,
"Xmp.tiff.ImageLength",
buffer);
g_snprintf (buffer, sizeof (buffer),
"%d:%02d:%02d %02d:%02d:%02d",
g_date_time_get_year (datetime),
g_date_time_get_month (datetime),
g_date_time_get_day_of_month (datetime),
g_date_time_get_hour (datetime),
g_date_time_get_minute (datetime),
g_date_time_get_second (datetime));
gexiv2_metadata_set_tag_string (metadata,
"Xmp.tiff.DateTime",
buffer);
}
/* IPTC */
if (! gexiv2_metadata_has_iptc (metadata))
if (! gimp_attributes_has_tag_type (attributes, TAG_IPTC))
*suggested_flags &= ~GIMP_METADATA_SAVE_IPTC;
g_snprintf (buffer, sizeof (buffer),
"%d-%d-%d",
g_date_time_get_year (datetime),
g_date_time_get_month (datetime),
g_date_time_get_day_of_month (datetime));
gexiv2_metadata_set_tag_string (metadata,
"Iptc.Application2.DateCreated",
buffer);
g_snprintf (buffer, sizeof (buffer),
"%02d:%02d:%02d-%02d:%02d",
g_date_time_get_hour (datetime),
g_date_time_get_minute (datetime),
g_date_time_get_second (datetime),
g_date_time_get_hour (datetime),
g_date_time_get_minute (datetime));
gexiv2_metadata_set_tag_string (metadata,
"Iptc.Application2.TimeCreated",
buffer);
g_date_time_unref (datetime);
/* Thumbnail */
if (FALSE /* FIXME if (original image had a thumbnail) */)
*suggested_flags &= ~GIMP_METADATA_SAVE_THUMBNAIL;
gimp_attributes_to_metadata (attributes, metadata, mime_type);
}
return metadata;
@@ -402,93 +320,162 @@ gimp_image_metadata_save_finish (gint32 image_ID,
GError **error)
{
GExiv2Metadata *new_metadata;
gboolean support_exif;
gboolean support_xmp;
gboolean support_iptc;
gchar *value;
gboolean success = FALSE;
gint i;
GimpAttributes *attributes = NULL;
gboolean success = FALSE;
gchar buffer[32];
GDateTime *datetime;
const GimpParasite *comment_parasite;
const gchar *comment = NULL;
gint image_width;
gint image_height;
gdouble xres;
gdouble yres;
g_return_val_if_fail (image_ID > 0, FALSE);
g_return_val_if_fail (mime_type != NULL, FALSE);
g_return_val_if_fail (GEXIV2_IS_METADATA (metadata), FALSE);
g_return_val_if_fail (G_IS_FILE (file), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
attributes = gimp_attributes_from_metadata (attributes, metadata);
if (! (flags & (GIMP_METADATA_SAVE_EXIF |
GIMP_METADATA_SAVE_XMP |
GIMP_METADATA_SAVE_IPTC |
GIMP_METADATA_SAVE_THUMBNAIL)))
return TRUE;
image_width = gimp_image_width (image_ID);
image_height = gimp_image_height (image_ID);
datetime = g_date_time_new_now_local ();
comment_parasite = gimp_image_get_parasite (image_ID, "gimp-comment");
if (comment_parasite)
comment = gimp_parasite_data (comment_parasite);
/* read metadata from saved file */
new_metadata = gimp_metadata_load_from_file (file, error);
if (! new_metadata)
return FALSE;
support_exif = gexiv2_metadata_get_supports_exif (new_metadata);
support_xmp = gexiv2_metadata_get_supports_xmp (new_metadata);
support_iptc = gexiv2_metadata_get_supports_iptc (new_metadata);
/* Exif */
if ((flags & GIMP_METADATA_SAVE_EXIF) && support_exif)
if (flags & GIMP_METADATA_SAVE_EXIF)
{
gchar **exif_data = gexiv2_metadata_get_exif_tags (metadata);
for (i = 0; exif_data[i] != NULL; i++)
if (comment)
{
if (! gexiv2_metadata_has_tag (new_metadata, exif_data[i]) &&
gimp_metadata_is_tag_supported (exif_data[i], mime_type))
{
value = gexiv2_metadata_get_tag_string (metadata, exif_data[i]);
gexiv2_metadata_set_tag_string (new_metadata, exif_data[i],
value);
g_free (value);
}
gimp_attributes_new_attribute (attributes,
"Exif.Photo.UserComment",
(gchar *) comment,
TYPE_UNICODE);
gimp_attributes_new_attribute (attributes,
"Exif.Image.ImageDescription",
(gchar *) comment,
TYPE_ASCII);
}
g_strfreev (exif_data);
g_snprintf (buffer, sizeof (buffer),
"%d:%02d:%02d %02d:%02d:%02d",
g_date_time_get_year (datetime),
g_date_time_get_month (datetime),
g_date_time_get_day_of_month (datetime),
g_date_time_get_hour (datetime),
g_date_time_get_minute (datetime),
g_date_time_get_second (datetime));
gimp_attributes_new_attribute (attributes,
"Exif.Image.DateTime",
buffer,
TYPE_ASCII);
gimp_attributes_new_attribute (attributes,
"Exif.Image.Software",
PACKAGE_STRING,
TYPE_ASCII);
gimp_attributes_set_pixel_size (attributes,
image_width, image_height);
gimp_image_get_resolution (image_ID, &xres, &yres);
gimp_attributes_set_resolution (attributes, xres, yres,
gimp_image_get_unit (image_ID));
}
if ((flags & GIMP_METADATA_SAVE_XMP) && support_xmp)
/* XMP */
if (flags & GIMP_METADATA_SAVE_XMP)
{
gchar **xmp_data = gexiv2_metadata_get_xmp_tags (metadata);
gimp_attributes_new_attribute (attributes,
"Xmp.dc.Format",
(gchar *) mime_type,
TYPE_ASCII);
for (i = 0; xmp_data[i] != NULL; i++)
if (! g_strcmp0 (mime_type, "image/tiff"))
{
if (! gexiv2_metadata_has_tag (new_metadata, xmp_data[i]) &&
gimp_metadata_is_tag_supported (xmp_data[i], mime_type))
{
value = gexiv2_metadata_get_tag_string (metadata, xmp_data[i]);
gexiv2_metadata_set_tag_string (new_metadata, xmp_data[i],
value);
g_free (value);
}
}
/* TIFF specific XMP data */
g_strfreev (xmp_data);
g_snprintf (buffer, sizeof (buffer), "%d", image_width);
gimp_attributes_new_attribute (attributes,
"Xmp.tiff.ImageWidth",
buffer,
TYPE_ASCII);
g_snprintf (buffer, sizeof (buffer), "%d", image_height);
gimp_attributes_new_attribute (attributes,
"Xmp.tiff.ImageLength",
buffer,
TYPE_ASCII);
g_snprintf (buffer, sizeof (buffer),
"%d:%02d:%02d %02d:%02d:%02d",
g_date_time_get_year (datetime),
g_date_time_get_month (datetime),
g_date_time_get_day_of_month (datetime),
g_date_time_get_hour (datetime),
g_date_time_get_minute (datetime),
g_date_time_get_second (datetime));
gimp_attributes_new_attribute (attributes,
"Xmp.tiff.DateTime",
buffer,
TYPE_ASCII);
}
}
if ((flags & GIMP_METADATA_SAVE_IPTC) && support_iptc)
/* IPTC */
if (flags & GIMP_METADATA_SAVE_IPTC)
{
gchar **iptc_data = gexiv2_metadata_get_iptc_tags (metadata);
for (i = 0; iptc_data[i] != NULL; i++)
{
if (! gexiv2_metadata_has_tag (new_metadata, iptc_data[i]) &&
gimp_metadata_is_tag_supported (iptc_data[i], mime_type))
{
value = gexiv2_metadata_get_tag_string (metadata, iptc_data[i]);
gexiv2_metadata_set_tag_string (new_metadata, iptc_data[i],
value);
g_free (value);
}
}
g_snprintf (buffer, sizeof (buffer),
"%d-%d-%d",
g_date_time_get_year (datetime),
g_date_time_get_month (datetime),
g_date_time_get_day_of_month (datetime));
gimp_attributes_new_attribute (attributes,
"Iptc.Application2.DateCreated",
buffer,
TYPE_ASCII);
g_snprintf (buffer, sizeof (buffer),
"%02d:%02d:%02d",
g_date_time_get_hour (datetime),
g_date_time_get_minute (datetime),
g_date_time_get_second (datetime));
gimp_attributes_new_attribute (attributes,
"Iptc.Application2.TimeCreated",
buffer,
TYPE_ASCII);
g_date_time_unref (datetime);
g_strfreev (iptc_data);
}
if (flags & GIMP_METADATA_SAVE_THUMBNAIL)
gimp_attributes_to_metadata (attributes, new_metadata, mime_type);
/* Thumbnail */
if ((flags & GIMP_METADATA_SAVE_THUMBNAIL) && g_strcmp0 (mime_type, "image/tiff"))
{
GdkPixbuf *thumb_pixbuf;
gchar *thumb_buffer;

View File

@@ -35,6 +35,7 @@ GimpMetadata * gimp_image_metadata_load_prepare (gint32 image_ID
GFile *file,
GError **error);
void gimp_image_metadata_load_finish (gint32 image_ID,
gint32 layer_ID,
const gchar *mime_type,
GimpMetadata *metadata,
GimpMetadataLoadFlags flags,

86
libgimp/gimpitem.c Normal file
View File

@@ -0,0 +1,86 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
*
* gimpitem.c
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gimp.h"
#include "gimpitem.h"
/**
* gimp_item_get_attributes:
* @item_ID: The item.
*
* Returns the item's attributes.
*
* Returns attributes from the item.
*
* Returns: The attributes, or %NULL if there is none.
*
* Since: GIMP 2.10
**/
GimpAttributes *
gimp_item_get_attributes (gint32 item_ID)
{
GimpAttributes *attributes = NULL;
gchar *attributes_string;
attributes_string = _gimp_item_get_attributes (item_ID);
if (attributes_string)
{
attributes = gimp_attributes_deserialize (attributes_string);
g_free (attributes_string);
}
return attributes;
}
/**
* gimp_item_set_attributes:
* @item_ID: The item.
* @metadata: The GimpAttributes object.
*
* Set the item's attributes.
*
* Sets attributes on the item, or deletes it if
* @attributes is %NULL.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.10
**/
gboolean
gimp_item_set_attributes (gint32 item_ID,
GimpAttributes *attributes)
{
gchar *attributes_string = NULL;
gboolean success;
if (attributes)
attributes_string = gimp_attributes_serialize (attributes);
success = _gimp_item_set_attributes (item_ID, attributes_string);
if (attributes_string)
g_free (attributes_string);
return success;
}

40
libgimp/gimpitem.h Normal file
View File

@@ -0,0 +1,40 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
*
* gimpitem.h
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
#error "Only <libgimp/gimp.h> can be included directly."
#endif
#ifndef __GIMP_ITEM_H__
#define __GIMP_ITEM_H__
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
gboolean gimp_item_set_attributes (gint32 item_ID,
GimpAttributes *attributes);
GimpAttributes *gimp_item_get_attributes (gint32 item_ID);
G_END_DECLS
#endif /* __GIMP_ITEM_H__ */

View File

@@ -934,6 +934,68 @@ gimp_item_set_tattoo (gint32 item_ID,
return success;
}
/**
* _gimp_item_get_attributes:
* @item_ID: The item.
*
* Returns the item's attributes.
*
* Returns attributes from the item.
*
* Returns: The attributes as a xml string.
**/
gchar *
_gimp_item_get_attributes (gint32 item_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gchar *attributes_string = NULL;
return_vals = gimp_run_procedure ("gimp-item-get-attributes",
&nreturn_vals,
GIMP_PDB_ITEM, item_ID,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
attributes_string = g_strdup (return_vals[1].data.d_string);
gimp_destroy_params (return_vals, nreturn_vals);
return attributes_string;
}
/**
* _gimp_item_set_attributes:
* @item_ID: The item.
* @attributes_string: The attributes as a xml string.
*
* Set the item's attributes.
*
* Sets attributes on the item.
*
* Returns: TRUE on success.
**/
gboolean
_gimp_item_set_attributes (gint32 item_ID,
const gchar *attributes_string)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-item-set-attributes",
&nreturn_vals,
GIMP_PDB_ITEM, item_ID,
GIMP_PDB_STRING, attributes_string,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_item_attach_parasite:
* @item_ID: The item.

View File

@@ -32,49 +32,52 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
gboolean gimp_item_is_valid (gint32 item_ID);
gint32 gimp_item_get_image (gint32 item_ID);
gboolean gimp_item_delete (gint32 item_ID);
gboolean gimp_item_is_drawable (gint32 item_ID);
gboolean gimp_item_is_layer (gint32 item_ID);
gboolean gimp_item_is_text_layer (gint32 item_ID);
gboolean gimp_item_is_channel (gint32 item_ID);
gboolean gimp_item_is_layer_mask (gint32 item_ID);
gboolean gimp_item_is_selection (gint32 item_ID);
gboolean gimp_item_is_vectors (gint32 item_ID);
gboolean gimp_item_is_group (gint32 item_ID);
gint32 gimp_item_get_parent (gint32 item_ID);
gint* gimp_item_get_children (gint32 item_ID,
gint *num_children);
gchar* gimp_item_get_name (gint32 item_ID);
gboolean gimp_item_set_name (gint32 item_ID,
const gchar *name);
gboolean gimp_item_get_visible (gint32 item_ID);
gboolean gimp_item_set_visible (gint32 item_ID,
gboolean visible);
gboolean gimp_item_get_linked (gint32 item_ID);
gboolean gimp_item_set_linked (gint32 item_ID,
gboolean linked);
gboolean gimp_item_get_lock_content (gint32 item_ID);
gboolean gimp_item_set_lock_content (gint32 item_ID,
gboolean lock_content);
gboolean gimp_item_get_lock_position (gint32 item_ID);
gboolean gimp_item_set_lock_position (gint32 item_ID,
gboolean lock_position);
GimpColorTag gimp_item_get_color_tag (gint32 item_ID);
gboolean gimp_item_set_color_tag (gint32 item_ID,
GimpColorTag color_tag);
gint gimp_item_get_tattoo (gint32 item_ID);
gboolean gimp_item_set_tattoo (gint32 item_ID,
gint tattoo);
gboolean gimp_item_attach_parasite (gint32 item_ID,
const GimpParasite *parasite);
gboolean gimp_item_detach_parasite (gint32 item_ID,
const gchar *name);
GimpParasite* gimp_item_get_parasite (gint32 item_ID,
const gchar *name);
gchar** gimp_item_get_parasite_list (gint32 item_ID,
gint *num_parasites);
gboolean gimp_item_is_valid (gint32 item_ID);
gint32 gimp_item_get_image (gint32 item_ID);
gboolean gimp_item_delete (gint32 item_ID);
gboolean gimp_item_is_drawable (gint32 item_ID);
gboolean gimp_item_is_layer (gint32 item_ID);
gboolean gimp_item_is_text_layer (gint32 item_ID);
gboolean gimp_item_is_channel (gint32 item_ID);
gboolean gimp_item_is_layer_mask (gint32 item_ID);
gboolean gimp_item_is_selection (gint32 item_ID);
gboolean gimp_item_is_vectors (gint32 item_ID);
gboolean gimp_item_is_group (gint32 item_ID);
gint32 gimp_item_get_parent (gint32 item_ID);
gint* gimp_item_get_children (gint32 item_ID,
gint *num_children);
gchar* gimp_item_get_name (gint32 item_ID);
gboolean gimp_item_set_name (gint32 item_ID,
const gchar *name);
gboolean gimp_item_get_visible (gint32 item_ID);
gboolean gimp_item_set_visible (gint32 item_ID,
gboolean visible);
gboolean gimp_item_get_linked (gint32 item_ID);
gboolean gimp_item_set_linked (gint32 item_ID,
gboolean linked);
gboolean gimp_item_get_lock_content (gint32 item_ID);
gboolean gimp_item_set_lock_content (gint32 item_ID,
gboolean lock_content);
gboolean gimp_item_get_lock_position (gint32 item_ID);
gboolean gimp_item_set_lock_position (gint32 item_ID,
gboolean lock_position);
GimpColorTag gimp_item_get_color_tag (gint32 item_ID);
gboolean gimp_item_set_color_tag (gint32 item_ID,
GimpColorTag color_tag);
gint gimp_item_get_tattoo (gint32 item_ID);
gboolean gimp_item_set_tattoo (gint32 item_ID,
gint tattoo);
G_GNUC_INTERNAL gchar* _gimp_item_get_attributes (gint32 item_ID);
G_GNUC_INTERNAL gboolean _gimp_item_set_attributes (gint32 item_ID,
const gchar *attributes_string);
gboolean gimp_item_attach_parasite (gint32 item_ID,
const GimpParasite *parasite);
gboolean gimp_item_detach_parasite (gint32 item_ID,
const gchar *name);
GimpParasite* gimp_item_get_parasite (gint32 item_ID,
const gchar *name);
gchar** gimp_item_get_parasite_list (gint32 item_ID,
gint *num_parasites);
G_END_DECLS

84
libgimp/gimpviewable.c Normal file
View File

@@ -0,0 +1,84 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
*
* gimpimage.c
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gimp.h"
#include "gimpimage.h"
/**
* gimp_viewable_get_attributes:
* @object_ID: The viewable object.
*
* Returns the viewable's attributes.
*
* Returns attributes from the viewable.
*
* Returns: The attributes, or %NULL if there is none.
*
* Since: GIMP 2.10
**/
GimpAttributes *
gimp_viewable_get_attributes (gint32 object_ID)
{
GimpAttributes *attributes = NULL;
gchar *attributes_string;
attributes_string = _gimp_viewable_get_attributes (object_ID);
if (attributes_string)
{
attributes = gimp_attributes_deserialize (NULL, attributes_string);
g_free (attributes_string);
}
return attributes;
}
/**
* gimp_viewable_set_attributes:
* @object_ID: The viewable object.
* @attributes: The GimpAttributes object.
*
* Set the viewable's attributes.
*
* Sets attributes on the viewable, or deletes it if
* @attributes is %NULL.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.10
**/
gboolean
gimp_viewable_set_attributes (gint32 object_ID,
GimpAttributes *attributes)
{
gchar *attributes_string = NULL;
gboolean success;
if (attributes)
attributes_string = gimp_attributes_serialize (attributes);
success = _gimp_viewable_set_attributes (object_ID, attributes_string);
if (attributes_string)
g_free (attributes_string);
return success;
}

100
libgimp/gimpviewable_pdb.c Normal file
View File

@@ -0,0 +1,100 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* gimpimage_pdb.c
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*/
/* NOTE: This file is auto-generated by pdbgen.pl */
#include "config.h"
#include <string.h>
#include "gimp.h"
/**
* SECTION: gimpimage
* @title: gimpimage
* @short_description: Operations on complete images.
*
* Operations on complete images: creation, resizing/rescaling, and
* operations involving multiple layers.
**/
/**
* _gimp_viewable_get_attributes:
* @object_ID: The viewable object.
*
* Returns the viewable's attributes.
*
* Returns attributes from the viewable.
*
* Returns: The attributes as a xml string.
**/
gchar *
_gimp_viewable_get_attributes (gint32 object_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gchar *attributes_string = NULL;
return_vals = gimp_run_procedure ("gimp-viewable-get-attributes",
&nreturn_vals,
GIMP_PDB_IMAGE, object_ID,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
attributes_string = g_strdup (return_vals[1].data.d_string);
gimp_destroy_params (return_vals, nreturn_vals);
return attributes_string;
}
/**
* _gimp_viewable_set_attributes:
* @object_ID: The viewable object.
* @attributes_string: The attributes as a string.
*
* Set the viewable's attributes.
*
* Sets attributes on the viewable.
*
* Returns: TRUE on success.
**/
gboolean
_gimp_image_set_attributes (gint32 object_ID,
const gchar *attributes_string)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-viewable-set-attributes",
&nreturn_vals,
GIMP_PDB_IMAGE, object_ID,
GIMP_PDB_STRING, attributes_string,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}

View File

@@ -90,6 +90,12 @@ libgimpbase_sources = \
gimpparam.h \
gimpversion.h \
\
gimpattribute.c \
gimpattribute.h \
gimpattributes.c \
gimpattributes.h \
gimpattributes-image.c \
gimpattributes-image.h \
gimpbase-private.c \
gimpbase-private.h \
gimpchecks.c \
@@ -110,6 +116,8 @@ libgimpbase_sources = \
gimpparasiteio.h \
gimpprotocol.c \
gimpprotocol.h \
gimprational.c \
gimprational.h \
gimprectangle.c \
gimprectangle.h \
gimpreloc.c \
@@ -143,6 +151,9 @@ libgimpbaseinclude_HEADERS = \
gimpparam.h \
gimpversion.h \
\
gimpattribute.h \
gimpattributes.h \
gimpattributes-image.h \
gimpchecks.h \
gimpdatafiles.h \
gimpenv.h \
@@ -150,6 +161,7 @@ libgimpbaseinclude_HEADERS = \
gimpmetadata.h \
gimpparasite.h \
gimpparasiteio.h \
gimprational.h \
gimprectangle.h \
gimpsignal.h \
gimpunit.h \

2002
libgimpbase/gimpattribute.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,97 @@
/* gimpattribute.h generated by valac 0.24.0, the Vala compiler, do not modify */
#ifndef __GIMPATTRIBUTE_H__
#define __GIMPATTRIBUTE_H__
#include <glib.h>
G_BEGIN_DECLS
#define GIMP_TYPE_ATTRIBUTE (gimp_attribute_get_type ())
#define GIMP_ATTRIBUTE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_ATTRIBUTE, GimpAttribute))
#define GIMP_ATTRIBUTE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_ATTRIBUTE, GimpAttributeClass))
#define GIMP_IS_ATTRIBUTE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_ATTRIBUTE))
#define GIMP_IS_ATTRIBUTE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_ATTRIBUTE))
#define GIMP_ATTRIBUTE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_ATTRIBUTE, GimpAttributeClass))
#define GIMP_ATTRIBUTE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GIMP_TYPE_ATTRIBUTE, GimpAttributePrivate))
#define GIMP_TYPE_ATTRIBUTE_TAG_TYPE (gimp_attribute_tag_type_get_type ())
GType gimp_attribute_tag_type_get_type (void) G_GNUC_CONST;
typedef enum {
TYPE_INVALID,
TYPE_LONG,
TYPE_SLONG,
TYPE_FLOAT,
TYPE_DOUBLE,
TYPE_SHORT,
TYPE_SSHORT,
TYPE_DATE,
TYPE_TIME,
TYPE_ASCII,
TYPE_UNICODE,
TYPE_BYTE,
TYPE_MULTIPLE,
TYPE_RATIONAL,
TYPE_SRATIONAL,
TYPE_UNKNOWN,
NUM_VALUE_TYPES
} GimpAttributeValueType;
typedef enum {
STRUCTURE_TYPE_BAG,
STRUCTURE_TYPE_SEQ,
STRUCTURE_TYPE_ALT,
STRUCTURE_TYPE_LANG,
STRUCTURE_TYPE_NONE,
STRUCTURE_TYPE_STRUCT,
NUM_STRUCTURE_TYPES
} GimpAttributeStructureType;
typedef enum {
TAG_INVALID,
TAG_EXIF,
TAG_XMP,
TAG_IPTC,
TAG_GIMP,
TAG_MISC,
NUM_TAG_TYPES
} GimpAttributeTagType;
GType gimp_attribute_get_type (void) G_GNUC_CONST;
GimpAttribute* gimp_attribute_new_string (const gchar *name,
gchar *value,
GimpAttributeValueType type);
const gchar* gimp_attribute_get_interpreted_string (GimpAttribute *attribute);
void gimp_attribute_set_interpreted_string (GimpAttribute *attribute,
const gchar *value);
GimpAttribute* gimp_attribute_copy (GimpAttribute *attribute);
gboolean gimp_attribute_is_valid (GimpAttribute *attribute);
const gchar* gimp_attribute_get_attribute_type (GimpAttribute *attribute);
const gchar* gimp_attribute_get_attribute_ifd (GimpAttribute *attribute);
const gchar* gimp_attribute_get_attribute_tag (GimpAttribute *attribute);
const gboolean gimp_attribute_is_new_namespace (GimpAttribute *attribute);
const gchar* gimp_attribute_get_name (GimpAttribute *attribute);
const gchar* gimp_attribute_get_sortable_name (GimpAttribute *attribute);
GValue gimp_attribute_get_value (GimpAttribute *attribute);
gchar* gimp_attribute_get_string (GimpAttribute *attribute);
GimpAttributeTagType gimp_attribute_get_tag_type (GimpAttribute *attribute);
GimpAttributeValueType gimp_attribute_get_value_type_from_string (const gchar *string);
GimpAttributeValueType gimp_attribute_get_value_type (GimpAttribute *attribute);
void gimp_attribute_set_value_type (GimpAttribute *attribute,
GimpAttributeValueType value_type);
gboolean gimp_attribute_has_structure (GimpAttribute *attribute);
GSList* gimp_attribute_get_attribute_structure (GimpAttribute *attribute);
void gimp_attribute_set_structure_type (GimpAttribute *attribute,
GimpAttributeStructureType value);
GimpAttributeStructureType gimp_attribute_get_structure_type (GimpAttribute *attribute);
gdouble gimp_attribute_get_gps_degree (GimpAttribute *attribute);
gchar* gimp_attribute_get_xml (GimpAttribute *attribute);
void gimp_attribute_print (GimpAttribute *attribute);
G_END_DECLS
#endif

View File

@@ -0,0 +1,471 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
*
* gimpattributes-image.c
* Copyright (C) 2014 Hartmut Kuhse <hatti@gimp.org>
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <glib-object.h>
#include <gexiv2/gexiv2.h>
#ifdef G_OS_WIN32
#endif
#include "libgimpmath/gimpmath.h"
#include "gimprational.h"
#include "gimpbasetypes.h"
#include "gimpattribute.h"
#include "gimpattributes.h"
#include "gimplimits.h"
#include "gimpmetadata.h"
#include "gimpunit.h"
#include "gimpattributes-image.h"
/**
* SECTION: gimpattributes-image
* @title: gimpattributes-image
* @short_description: handle image data.
* @see_also: GimpAttribute, GimpAttributes
*
* handle image data.
**/
/**
* gimp_metadata_set_resolution:
* @metadata: A #GimpMetadata instance.
* @xres: The image's X Resolution, in ppi
* @yres: The image's Y Resolution, in ppi
* @unit: The image's unit
*
* Sets Exif.Image.XResolution, Exif.Image.YResolution and
* Exif.Image.ResolutionUnit @metadata.
*
* Since: GIMP 2.10
*/
void
gimp_attributes_set_resolution (GimpAttributes *attributes,
gdouble xres,
gdouble yres,
GimpUnit unit)
{
gchar buffer[64];
gint exif_unit;
gint factor;
g_return_if_fail (GIMP_IS_ATTRIBUTES (attributes));
if (gimp_unit_is_metric (unit))
{
xres /= 2.54;
yres /= 2.54;
exif_unit = 3;
}
else
{
exif_unit = 2;
}
for (factor = 1; factor <= 100 /* arbitrary */; factor++)
{
if (fabs (xres * factor - ROUND (xres * factor)) < 0.01 &&
fabs (yres * factor - ROUND (yres * factor)) < 0.01)
break;
}
g_snprintf (buffer, sizeof (buffer), "%d/%d", ROUND (xres * factor), factor);
gimp_attributes_new_attribute (attributes, "Exif.Image.XResolution", buffer, TYPE_RATIONAL);
g_snprintf (buffer, sizeof (buffer), "%d/%d", ROUND (yres * factor), factor);
gimp_attributes_new_attribute (attributes, "Exif.Image.YResolution", buffer, TYPE_RATIONAL);
g_snprintf (buffer, sizeof (buffer), "%d", exif_unit);
gimp_attributes_new_attribute (attributes, "Exif.Image.ResolutionUnit", buffer, TYPE_SHORT);
}
/**
* gimp_attributes_get_resolution:
* @metadata: A #GimpMetadata instance.
* @xres: Return location for the X Resolution, in ppi
* @yres: Return location for the Y Resolution, in ppi
* @unit: Return location for the unit unit
*
* Returns values based on Exif.Image.XResolution,
* Exif.Image.YResolution and Exif.Image.ResolutionUnit of @metadata.
*
* Return value: %TRUE on success, %FALSE otherwise.
*
* Since: GIMP 2.10
*/
gboolean
gimp_attributes_get_resolution (GimpAttributes *attributes,
gdouble *xres,
gdouble *yres,
GimpUnit *unit)
{
GimpAttribute *x_attribute;
GimpAttribute *y_attribute;
GimpAttribute *res_attribute;
gint xnom, xdenom;
gint ynom, ydenom;
gint exif_unit = 2;
g_return_val_if_fail (GIMP_IS_ATTRIBUTES (attributes), FALSE);
x_attribute = gimp_attributes_get_attribute (attributes, "Exif.Image.XResolution");
y_attribute = gimp_attributes_get_attribute (attributes, "Exif.Image.YResolution");
res_attribute = gimp_attributes_get_attribute (attributes, "Exif.Image.ResolutionUnit");
if (x_attribute)
{
GValue value;
Rational *rats;
gint *_nom;
gint *_denom;
gint l;
value = gimp_attribute_get_value (x_attribute);
rats = g_value_get_boxed (&value);
rational_to_int (rats, &_nom, &_denom, &l);
if (l > 0)
{
xnom = _nom[0];
xdenom = _denom[0];
}
rational_free (rats);
}
else
return FALSE;
if (y_attribute)
{
GValue value;
Rational *rats;
gint *_nom;
gint *_denom;
gint l;
value = gimp_attribute_get_value (y_attribute);
rats = g_value_get_boxed (&value);
rational_to_int (rats, &_nom, &_denom, &l);
if (l > 0)
{
ynom = _nom[0];
ydenom = _denom[0];
}
rational_free (rats);
}
else
return FALSE;
if (res_attribute)
{
GValue value = gimp_attribute_get_value (res_attribute);
exif_unit = (gint) g_value_get_uint (&value);
}
if (xnom != 0 && xdenom != 0 &&
ynom != 0 && ydenom != 0)
{
gdouble xresolution = (gdouble) xnom / (gdouble) xdenom;
gdouble yresolution = (gdouble) ynom / (gdouble) ydenom;
if (exif_unit == 3)
{
xresolution *= 2.54;
yresolution *= 2.54;
}
if (xresolution >= GIMP_MIN_RESOLUTION &&
xresolution <= GIMP_MAX_RESOLUTION &&
yresolution >= GIMP_MIN_RESOLUTION &&
yresolution <= GIMP_MAX_RESOLUTION)
{
if (xres)
*xres = xresolution;
if (yres)
*yres = yresolution;
if (unit)
{
if (exif_unit == 3)
*unit = GIMP_UNIT_MM;
else
*unit = GIMP_UNIT_INCH;
}
return TRUE;
}
}
return FALSE;
}
/**
* gimp_attributes_set_bits_per_sample:
* @metadata: A #GimpMetadata instance.
* @bps: Bytes per pixel, per component
*
* Sets Exif.Image.BitsPerSample on @metadata.
*
* Since: GIMP 2.10
*/
void
gimp_attributes_set_bits_per_sample (GimpAttributes *attributes,
gint bps)
{
gchar buffer[32];
g_return_if_fail (GIMP_IS_ATTRIBUTES (attributes));
g_snprintf (buffer, sizeof (buffer), "%d", bps);
gimp_attributes_new_attribute (attributes, "Exif.Image.BitsPerSample", buffer, TYPE_SHORT);
}
/**
* gimp_attributes_set_pixel_size:
* @metadata: A #GimpMetadata instance.
* @width: Width in pixels
* @height: Height in pixels
*
* Sets Exif.Image.ImageWidth and Exif.Image.ImageLength on @metadata.
*
* Since: GIMP 2.10
*/
void
gimp_attributes_set_pixel_size (GimpAttributes *attributes,
gint width,
gint height)
{
gchar buffer[32];
g_return_if_fail (GIMP_IS_ATTRIBUTES (attributes));
g_snprintf (buffer, sizeof (buffer), "%d", width);
gimp_attributes_new_attribute (attributes, "Exif.Image.ImageWidth", buffer, TYPE_LONG);
g_snprintf (buffer, sizeof (buffer), "%d", height);
gimp_attributes_new_attribute (attributes, "Exif.Image.ImageLength", buffer, TYPE_LONG);
}
/**
* gimp_metadata_get_colorspace:
* @attributes: Ab #GimpAttributes instance.
*
* Returns values based on Exif.Photo.ColorSpace, Xmp.exif.ColorSpace,
* Exif.Iop.InteroperabilityIndex, Exif.Nikon3.ColorSpace,
* Exif.Canon.ColorSpace of @metadata.
*
* Return value: The colorspace specified by above tags.
*
* Since: 2.10
*/
GimpAttributesColorspace
gimp_attributes_get_colorspace (GimpAttributes *attributes)
{
glong exif_cs = -1;
GimpAttribute *attribute = NULL;
GValue val;
g_return_val_if_fail (GIMP_IS_ATTRIBUTES (attributes),
GIMP_ATTRIBUTES_COLORSPACE_UNSPECIFIED);
/* the logic here was mostly taken from darktable and libkexiv2 */
attribute = gimp_attributes_get_attribute (attributes, "Exif.Photo.ColorSpace");
if ( ! attribute)
{
attribute = gimp_attributes_get_attribute (attributes, "Xmp.exif.ColorSpace");
}
if (attribute)
{
if (gimp_attribute_get_value_type (attribute) == TYPE_LONG || gimp_attribute_get_value_type (attribute) == TYPE_SLONG)
{
val = gimp_attribute_get_value (attribute);
exif_cs = g_value_get_long (&val);
}
}
if (exif_cs == 0x01)
{
return GIMP_ATTRIBUTES_COLORSPACE_SRGB;
}
else if (exif_cs == 0x02)
{
return GIMP_ATTRIBUTES_COLORSPACE_ADOBERGB;
}
else
{
if (exif_cs == 0xffff)
{
gchar *iop_index;
attribute = gimp_attributes_get_attribute (attributes, "Exif.Iop.InteroperabilityIndex");
if (attribute)
iop_index = gimp_attribute_get_string (attribute);
if (! g_strcmp0 (iop_index, "R03"))
{
g_free (iop_index);
return GIMP_ATTRIBUTES_COLORSPACE_ADOBERGB;
}
else if (! g_strcmp0 (iop_index, "R98"))
{
g_free (iop_index);
return GIMP_ATTRIBUTES_COLORSPACE_SRGB;
}
g_free (iop_index);
}
attribute = gimp_attributes_get_attribute (attributes, "Exif.Nikon3.ColorSpace");
if (attribute)
{
if (gimp_attribute_get_value_type (attribute) == TYPE_LONG || gimp_attribute_get_value_type (attribute) == TYPE_SLONG)
{
glong nikon_cs;
val = gimp_attribute_get_value (attribute);
nikon_cs = g_value_get_long (&val);
if (nikon_cs == 0x01)
{
return GIMP_ATTRIBUTES_COLORSPACE_SRGB;
}
else if (nikon_cs == 0x02)
{
return GIMP_ATTRIBUTES_COLORSPACE_ADOBERGB;
}
}
}
attribute = gimp_attributes_get_attribute (attributes, "Exif.Canon.ColorSpace");
if (attribute)
{
if (gimp_attribute_get_value_type (attribute) == TYPE_LONG || gimp_attribute_get_value_type (attribute) == TYPE_SLONG)
{
glong canon_cs;
val = gimp_attribute_get_value (attribute);
canon_cs = g_value_get_long (&val);
if (canon_cs == 0x01)
{
return GIMP_ATTRIBUTES_COLORSPACE_SRGB;
}
else if (canon_cs == 0x02)
{
return GIMP_ATTRIBUTES_COLORSPACE_ADOBERGB;
}
}
}
if (exif_cs == 0xffff)
return GIMP_ATTRIBUTES_COLORSPACE_UNCALIBRATED;
}
return GIMP_ATTRIBUTES_COLORSPACE_UNSPECIFIED;
}
/**
* gimp_metadata_set_colorspace:
* @metadata: A #GimpMetadata instance.
* @colorspace: The color space.
*
* Sets Exif.Photo.ColorSpace, Xmp.exif.ColorSpace,
* Exif.Iop.InteroperabilityIndex, Exif.Nikon3.ColorSpace,
* Exif.Canon.ColorSpace of @metadata.
*
* Since: 2.10
*/
void
gimp_attributes_set_colorspace (GimpAttributes *attributes,
GimpAttributesColorspace colorspace)
{
g_return_if_fail (GIMP_IS_ATTRIBUTES (attributes));
gimp_attributes_remove_attribute (attributes, "Exif.Photo.ColorSpace");
gimp_attributes_remove_attribute (attributes, "Xmp.exif.ColorSpace");
gimp_attributes_remove_attribute (attributes, "Exif.Iop.InteroperabilityIndex");
switch (colorspace)
{
case GIMP_ATTRIBUTES_COLORSPACE_UNSPECIFIED:
gimp_attributes_remove_attribute (attributes, "Exif.Nikon3.ColorSpace");
gimp_attributes_remove_attribute (attributes, "Exif.Canon.ColorSpace");
break;
case GIMP_ATTRIBUTES_COLORSPACE_UNCALIBRATED:
gimp_attributes_new_attribute (attributes, "Exif.Photo.ColorSpace", "0xffff", TYPE_LONG);
gimp_attributes_new_attribute (attributes, "Xmp.exif.ColorSpace", "0xffff", TYPE_LONG);
break;
case GIMP_ATTRIBUTES_COLORSPACE_SRGB:
gimp_attributes_new_attribute (attributes, "Exif.Photo.ColorSpace", "0x01", TYPE_LONG);
gimp_attributes_new_attribute (attributes, "Xmp.exif.ColorSpace", "0x01", TYPE_LONG);
gimp_attributes_new_attribute (attributes, "Exif.Iop.InteroperabilityIndex", "R98", TYPE_ASCII);
if (gimp_attributes_has_attribute (attributes, "Exif.Nikon3.ColorSpace"))
{
gimp_attributes_remove_attribute (attributes, "Exif.Nikon3.ColorSpace");
gimp_attributes_new_attribute (attributes, "Exif.Nikon3.ColorSpace", "0x01", TYPE_LONG);
}
if (gimp_attributes_has_attribute (attributes, "Exif.Canon.ColorSpace"))
{
gimp_attributes_remove_attribute (attributes, "Exif.Canon.ColorSpace");
gimp_attributes_new_attribute (attributes, "Exif.Canon.ColorSpace", "0x01", TYPE_LONG);
}
break;
case GIMP_ATTRIBUTES_COLORSPACE_ADOBERGB:
gimp_attributes_new_attribute (attributes, "Exif.Photo.ColorSpace", "0x02", TYPE_LONG);
gimp_attributes_new_attribute (attributes, "Xmp.exif.ColorSpace", "0x02", TYPE_LONG);
gimp_attributes_new_attribute (attributes, "Exif.Iop.InteroperabilityIndex", "R03", TYPE_ASCII);
if (gimp_attributes_has_attribute (attributes, "Exif.Nikon3.ColorSpace"))
{
gimp_attributes_remove_attribute (attributes, "Exif.Nikon3.ColorSpace");
gimp_attributes_new_attribute (attributes, "Exif.Nikon3.ColorSpace", "0x02", TYPE_LONG);
}
if (gimp_attributes_has_attribute (attributes, "Exif.Canon.ColorSpace"))
{
gimp_attributes_remove_attribute (attributes, "Exif.Canon.ColorSpace");
gimp_attributes_new_attribute (attributes, "Exif.Canon.ColorSpace", "0x02", TYPE_LONG);
}
break;
}
}

View File

@@ -0,0 +1,59 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
*
* gimpattributes-image.h
* Copyright (C) 2014 Hartmut Kuhse <hatti@gimp.org>
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef __GIMPATTRIBUTES_IMAGE_H__
#define __GIMPATTRIBUTES_IMAGE_H__
G_BEGIN_DECLS
typedef enum
{
GIMP_ATTRIBUTES_COLORSPACE_UNSPECIFIED,
GIMP_ATTRIBUTES_COLORSPACE_UNCALIBRATED,
GIMP_ATTRIBUTES_COLORSPACE_SRGB,
GIMP_ATTRIBUTES_COLORSPACE_ADOBERGB
} GimpAttributesColorspace;
gboolean gimp_attributes_get_resolution (GimpAttributes *attributes,
gdouble *xres,
gdouble *yres,
GimpUnit *unit);
void gimp_attributes_set_resolution (GimpAttributes *attributes,
gdouble xres,
gdouble yres,
GimpUnit unit);
void gimp_attributes_set_bits_per_sample (GimpAttributes *attributes,
gint bps);
void gimp_attributes_set_pixel_size (GimpAttributes *attributes,
gint width,
gint height);
GimpAttributesColorspace gimp_attributes_get_colorspace (GimpAttributes *attributes);
void gimp_attributes_set_colorspace (GimpAttributes *attributes,
GimpAttributesColorspace colorspace);
G_END_DECLS
#endif

1830
libgimpbase/gimpattributes.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,79 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
*
* gimpattributes.h
* Copyright (C) 2014 Hartmut Kuhse <hatti@gimp.org>
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef __GIMPATTRIBUTES_H__
#define __GIMPATTRIBUTES_H__
G_BEGIN_DECLS
#define GIMP_TYPE_ATTRIBUTES (gimp_attributes_get_type ())
#define GIMP_ATTRIBUTES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_ATTRIBUTES, GimpAttributes))
#define GIMP_ATTRIBUTES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_ATTRIBUTES, GimpAttributesClass))
#define GIMP_IS_ATTRIBUTES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_ATTRIBUTES))
#define GIMP_IS_ATTRIBUTES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_ATTRIBUTES))
#define GIMP_ATTRIBUTES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_ATTRIBUTES, GimpAttributesClass))
#define GIMP_ATTRIBUTES_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GIMP_TYPE_ATTRIBUTES, GimpAttributesPrivate))
GType gimp_attributes_get_type (void) G_GNUC_CONST;
GimpAttributes * gimp_attributes_new (void);
gint gimp_attributes_size (GimpAttributes *attributes);
GimpAttributes * gimp_attributes_duplicate (GimpAttributes *attributes);
GHashTable * gimp_attributes_get_table (GimpAttributes *attributes);
void gimp_attributes_add_attribute (GimpAttributes *attributes,
GimpAttribute *attribute);
GimpAttribute * gimp_attributes_get_attribute (GimpAttributes *attributes,
const gchar *name);
gboolean gimp_attributes_remove_attribute (GimpAttributes *attributes,
const gchar *name);
gboolean gimp_attributes_has_attribute (GimpAttributes *attributes,
const gchar *name);
gboolean gimp_attributes_new_attribute (GimpAttributes *attributes,
const gchar *name,
gchar *value,
GimpAttributeValueType
type);
GimpAttributes * gimp_attributes_from_metadata (GimpAttributes *attributes,
GimpMetadata *metadata);
void gimp_attributes_to_metadata (GimpAttributes *attributes,
GimpMetadata *metadata,
const gchar *mime_type);
const gchar * gimp_attributes_to_xmp_packet (GimpAttributes *attributes,
const gchar *mime_type);
gchar * gimp_attributes_serialize (GimpAttributes *attributes);
GimpAttributes * gimp_attributes_deserialize (const gchar *xml);
gboolean gimp_attributes_has_tag_type (GimpAttributes *attributes,
GimpAttributeTagType tag_type);
void gimp_attributes_print (GimpAttributes *attributes);
GList * gimp_attributes_iter_init (GimpAttributes *attributes,
GList **iter);
gboolean gimp_attributes_iter_next (GimpAttributes *attributes,
GimpAttribute **attribute,
GList **prev);
G_END_DECLS
#endif

View File

@@ -1,6 +1,53 @@
EXPORTS
gimp_add_mask_type_get_type
gimp_any_to_utf8
gimp_attribute_copy
gimp_attribute_get_attribute_type
gimp_attribute_get_attribute_ifd
gimp_attribute_get_attribute_structure
gimp_attribute_get_attribute_tag
gimp_attribute_get_interpreted_string
gimp_attribute_get_name
gimp_attribute_get_sortable_name
gimp_attribute_get_string
gimp_attribute_get_structure_type
gimp_attribute_get_tag_type
gimp_attribute_get_value
gimp_attribute_get_value_type
gimp_attribute_get_value_type_from_string
gimp_attribute_get_gps_degree
gimp_attribute_get_xml
gimp_attribute_has_structure
gimp_attribute_is_valid
gimp_attribute_new_string
gimp_attribute_print
gimp_attribute_set_interpreted_string
gimp_attribute_set_structure_type
gimp_attribute_set_value_type
gimp_attributes_add_attribute
gimp_attributes_deserialize
gimp_attributes_duplicate
gimp_attributes_from_metadata
gimp_attributes_get_attribute
gimp_attributes_get_colorspace
gimp_attributes_get_resolution
gimp_attributes_get_table
gimp_attributes_has_tag_type
gimp_attributes_iter_init
gimp_attributes_iter_next
gimp_attributes_new
gimp_attributes_new_attribute
gimp_attributes_print
gimp_attributes_remove_attribute
gimp_attributes_has_attribute
gimp_attributes_serialize
gimp_attributes_set_bits_per_sample
gimp_attributes_set_colorspace
gimp_attributes_set_pixel_size
gimp_attributes_set_resolution
gimp_attributes_size
gimp_attributes_to_metadata
gimp_attributes_to_xmp_packet
gimp_base_init
gimp_blend_mode_get_type
gimp_brush_generated_shape_get_type
@@ -71,7 +118,6 @@ EXPORTS
gimp_merge_type_get_type
gimp_message_handler_type_get_type
gimp_metadata_deserialize
gimp_metadata_duplicate
gimp_metadata_get_colorspace
gimp_metadata_get_resolution
gimp_metadata_is_tag_supported
@@ -83,8 +129,6 @@ EXPORTS
gimp_metadata_set_colorspace
gimp_metadata_set_from_exif
gimp_metadata_set_from_xmp
gimp_metadata_set_pixel_size
gimp_metadata_set_resolution
gimp_micro_version
gimp_minor_version
gimp_offset_type_get_type
@@ -210,3 +254,5 @@ EXPORTS
gp_tile_ack_write
gp_tile_data_write
gp_tile_req_write
rational_free
srational_free

View File

@@ -23,6 +23,9 @@
#include <libgimpbase/gimpbasetypes.h>
#include <libgimpbase/gimpattribute.h>
#include <libgimpbase/gimpattributes.h>
#include <libgimpbase/gimpattributes-image.h>
#include <libgimpbase/gimpchecks.h>
#include <libgimpbase/gimpcpuaccel.h>
#include <libgimpbase/gimpdatafiles.h>

View File

@@ -45,6 +45,8 @@ G_BEGIN_DECLS
#endif
typedef struct _GimpAttribute GimpAttribute;
typedef struct _GimpAttributes GimpAttributes;
typedef struct _GimpParasite GimpParasite;
typedef struct _GimpDatafileData GimpDatafileData;
typedef struct _GimpEnumDesc GimpEnumDesc;

View File

@@ -195,7 +195,7 @@ is_script (const gchar *filename)
static gchar **exts = NULL;
const gchar *ext = strrchr (filename, '.');
gchar *pathext;
const gchar *pathext;
gint i;
if (exts == NULL)

View File

@@ -92,7 +92,6 @@ static const gchar *unsupported_tags[] =
"Exif.Image.ClipPath",
"Exif.Image.XClipPathUnits",
"Exif.Image.YClipPathUnits",
"Xmp.xmpMM.History",
"Exif.Image.XPTitle",
"Exif.Image.XPComment",
"Exif.Image.XPAuthor",
@@ -100,8 +99,7 @@ static const gchar *unsupported_tags[] =
"Exif.Image.XPSubject",
"Exif.Image.DNGVersion",
"Exif.Image.DNGBackwardVersion",
"Exif.Iop"
};
"Exif.Iop"};
static const guint8 minimal_exif[] =
{
@@ -173,35 +171,6 @@ gimp_metadata_new (void)
return metadata;
}
/**
* gimp_metadata_duplicate:
* @metadata: The object to duplicate, or %NULL.
*
* Duplicates a #GimpMetadata instance.
*
* Return value: The new #GimpMetadata, or %NULL if @metadata is %NULL.
*
* Since: 2.10
*/
GimpMetadata *
gimp_metadata_duplicate (GimpMetadata *metadata)
{
GimpMetadata *new_metadata = NULL;
g_return_val_if_fail (metadata == NULL || GEXIV2_IS_METADATA (metadata), NULL);
if (metadata)
{
gchar *xml;
xml = gimp_metadata_serialize (metadata);
new_metadata = gimp_metadata_deserialize (xml);
g_free (xml);
}
return new_metadata;
}
typedef struct
{
gchar name[1024];

301
libgimpbase/gimprational.c Normal file
View File

@@ -0,0 +1,301 @@
/*
* gimprational.c
*
* Created on: 19.09.2014
* Author: kuhse
*/
#include <stdlib.h>
#include "gimprational.h"
static gpointer rational_copy (gpointer data);
static gpointer srational_copy (gpointer data);
G_DEFINE_BOXED_TYPE (Rational, rational,
rational_copy,
rational_free)
G_DEFINE_BOXED_TYPE (SRational, srational,
srational_copy,
srational_free)
/**
* string_to_rational:
*
* @string: a #gchar array
* @rational: a pointer to a #Rational struct
*
* converts a string, representing one/more rational values into
* a #Rational struct.
*
* Since: 2.10
*/
void
string_to_rational (gchar *string, Rational **rational)
{
gchar **nom;
gchar **rats;
gint count;
gint i;
Rational *rval;
GArray *rational_array;
rats = g_strsplit (string, " ", -1);
count = 0;
while (rats[count])
count++;
rational_array = g_array_new (TRUE, TRUE, sizeof (RationalValue));
for (i = 0; i < count; i++)
{
RationalValue or;
nom = g_strsplit (rats[i], "/", 2);
if (nom[0] && nom[1])
{
or.nom = (guint) atoi (nom [0]);
or.denom = (guint) atoi (nom [1]);
}
else
count--;
rational_array = g_array_append_val (rational_array, or);
g_strfreev (nom);
}
g_strfreev (rats);
rval = g_slice_new (Rational);
rval->rational_array = rational_array;
rval->length = count;
*rational = rval;
}
/**
* rational_to_string:
*
* @rational : a pointer to a @Rational struct
* @nom : a pointer to a #gint array
* @denom : a pointer to a #gint array
* @length : a pointer to a #gint
*
* converts a @rational to nom/denum gchar arrays
*
* Since: 2.10
*/
void
rational_to_int (Rational *rational, gint **nom, gint **denom, gint *length)
{
gint i;
gint *_nom;
gint *_denom;
g_return_if_fail (rational != NULL);
_nom = g_new (gint, rational->length);
_denom = g_new (gint, rational->length);
for (i = 0; i < rational->length; i++)
{
RationalValue one;
one = g_array_index(rational->rational_array, RationalValue, i);
_nom[i] = one.nom;
_denom[i] = one.denom;
}
*nom = _nom;
*denom = _denom;
*length = rational->length;
}
/**
* rational_copy:
*
* @data: a #gpointer to a #Rational structure
*
* copy part of the #Rational type
*
* Since: 2.10
*/
static gpointer
rational_copy (gpointer data)
{
struct _Rational *rational = (struct _Rational *) data;
struct _Rational *copy = g_slice_new (Rational);
gint i;
GArray *rlacp;
if (!data)
return NULL;
rlacp = g_array_new (TRUE, TRUE, sizeof (RationalValue));
for (i = 0; i < rational->length; i++)
{
RationalValue or;
RationalValue cor;
or = g_array_index (rational->rational_array, RationalValue, i);
cor.nom = or.nom;
cor.denom = or.denom;
rlacp = g_array_append_val (rlacp, cor);
}
copy->rational_array = rlacp;
copy->length = rational->length;
return (gpointer) copy;
}
/**
* rational_free:
*
* @data: a #gpointer to a #Rational structure
*
* free part of the #Rational type
*
* Since: 2.10
*/
void
rational_free (gpointer data)
{
struct _Rational *rational = (struct _Rational *) data;
if (rational)
{
if (rational->rational_array)
g_array_free (rational->rational_array, TRUE);
rational->length = 0;
}
}
/**
* string_to_srational:
*
* @string: a #gchar array
* @srational: a pointer to a #Rational struct
*
* converts a string, representing one/more srational values into
* a #SRational struct.
*
* Since: 2.10
*/
void
string_to_srational (gchar *string, SRational **srational)
{
gchar **nom;
gchar **srats;
gint count;
gint i;
SRational *srval;
GArray *srational_array;
srats = g_strsplit (string, " ", -1);
count = 0;
while (srats[count])
count++;
srational_array = g_array_new (TRUE, TRUE, sizeof (SRationalValue));
for (i = 0; i < count; i++)
{
SRationalValue or;
nom = g_strsplit (srats[i], "/", 2);
if (nom[0] && nom[1])
{
or.nom = (gint) atoi (nom [0]);
or.denom = (guint) atoi (nom [1]);
}
else
count--;
srational_array = g_array_append_val (srational_array, or);
g_strfreev (nom);
}
g_strfreev (srats);
srval = g_slice_new (SRational);
srval->srational_array = srational_array;
srval->length = count;
*srational = srval;
}
/**
* srational_copy:
*
* @data: a #gpointer to a #SRational structure
*
* copy part of the #SRational type
*
* Since: 2.10
*/
static gpointer
srational_copy (gpointer data)
{
struct _SRational *srational = (struct _SRational *) data;
struct _SRational *copy = g_slice_new (SRational);
gint i;
GArray *rlacp;
if (!data)
return NULL;
rlacp = g_array_new (TRUE, TRUE, sizeof (SRationalValue));
for (i = 0; i < srational->length; i++)
{
SRationalValue or;
SRationalValue cor;
or = g_array_index (srational->srational_array, SRationalValue, i);
cor.nom = or.nom;
cor.denom = or.denom;
rlacp = g_array_append_val (rlacp, cor);
}
copy->srational_array = rlacp;
copy->length = srational->length;
return (gpointer) copy;
}
/**
* srational_free:
*
* @data: a #gpointer to a #SRational structure
*
* free part of the #SRational type
*
* Since: 2.10
*/
void
srational_free (gpointer data)
{
struct _SRational *srational = (struct _SRational *) data;
if (srational)
{
if (srational->srational_array)
g_array_free (srational->srational_array, TRUE);
srational->length = 0;
}
}

View File

@@ -0,0 +1,68 @@
/*
* gimprational.h
*
* Created on: 19.09.2014
* Author: kuhse
*/
#ifndef __GIMPRATIONAL_H__
#define __GIMPRATIONAL_H__
#include <glib-object.h>
G_BEGIN_DECLS
#define GIMP_TYPE_RATIONAL (rational_get_type ())
#define GIMP_TYPE_SRATIONAL (srational_get_type ())
typedef struct _RationalValue RationalValue;
struct _RationalValue
{
guint nom;
guint denom;
};
typedef struct _SRationalValue SRationalValue;
struct _SRationalValue
{
gint nom;
guint denom;
};
typedef struct _Rational Rational;
struct _Rational
{
GArray *rational_array;
gint length;
};
typedef struct _SRational SRational;
struct _SRational
{
GArray *srational_array;
gint length;
};
GType rational_get_type (void) G_GNUC_CONST;
GType srational_get_type (void) G_GNUC_CONST;
void rational_free (gpointer data);
void srational_free (gpointer data);
void string_to_rational (gchar *string,
Rational **rational);
void rational_to_int (Rational *rational,
gint **nom,
gint **denom,
gint *length);
void string_to_srational (gchar *string,
SRational **srational);
G_END_DECLS
#endif /* __GIMPRATIONAL_H__ */

View File

@@ -22,6 +22,10 @@
#include "config.h"
#include <gtk/gtk.h>
#include <glib/gstdio.h>
#include "libgimpconfig/gimpconfig.h"
#include "libgimpbase/gimpbase.h"
#include "gimpwidgetstypes.h"
@@ -56,6 +60,11 @@ struct _GimpDialogPrivate
GimpHelpFunc help_func;
gchar *help_id;
GtkWidget *help_button;
gchar *allocation_rc;
gint dialog_width;
gint dialog_height;
gint dialog_x;
gint dialog_y;
};
#define GET_PRIVATE(dialog) G_TYPE_INSTANCE_GET_PRIVATE (dialog, \
@@ -63,28 +72,36 @@ struct _GimpDialogPrivate
GimpDialogPrivate)
static void gimp_dialog_constructed (GObject *object);
static void gimp_dialog_dispose (GObject *object);
static void gimp_dialog_finalize (GObject *object);
static void gimp_dialog_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_dialog_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_dialog_constructed (GObject *object);
static void gimp_dialog_dispose (GObject *object);
static void gimp_dialog_finalize (GObject *object);
static void gimp_dialog_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_dialog_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_dialog_hide (GtkWidget *widget);
static gboolean gimp_dialog_delete_event (GtkWidget *widget,
GdkEventAny *event);
static void gimp_dialog_hide (GtkWidget *widget);
static gboolean gimp_dialog_delete_event (GtkWidget *widget,
GdkEventAny *event);
static void gimp_dialog_close (GtkDialog *dialog);
static void gimp_dialog_close (GtkDialog *dialog);
static void gimp_dialog_help (GObject *dialog);
static void gimp_dialog_response (GtkDialog *dialog,
gint response_id);
static void gimp_dialog_help (GObject *dialog);
static void gimp_dialog_response (GtkDialog *dialog,
gint response_id);
static void gimp_dialog_read_context (GtkWidget *dialog,
gchar *name,
GtkAllocation *allocation);
static void gimp_dialog_save_context (GtkDialog *dialog,
GtkAllocation allocation);
void gimp_dialog_unmap_callback (GtkDialog *dialog);
void gimp_dialog_map_callback (GtkDialog *dialog);
G_DEFINE_TYPE (GimpDialog, gimp_dialog, GTK_TYPE_DIALOG)
@@ -446,7 +463,9 @@ gimp_dialog_new_valist (const gchar *title,
const gchar *help_id,
va_list args)
{
GtkWidget *dialog;
GtkWidget *dialog;
const gchar *prog_name;
const gchar *gimp_basename;
g_return_val_if_fail (title != NULL, NULL);
g_return_val_if_fail (role != NULL, NULL);
@@ -461,6 +480,9 @@ gimp_dialog_new_valist (const gchar *title,
"parent", parent,
NULL);
prog_name = g_get_prgname ();
gimp_basename = g_getenv ("GIMP_PROG_BASENAME");
if (parent)
{
if (flags & GTK_DIALOG_DESTROY_WITH_PARENT)
@@ -468,6 +490,27 @@ gimp_dialog_new_valist (const gchar *title,
G_CALLBACK (gimp_dialog_close),
dialog, G_CONNECT_SWAPPED);
}
else
{
if (dialog && strcmp (prog_name, gimp_basename))
{
GimpDialogPrivate *private = GET_PRIVATE (dialog);
GtkAllocation allocation;
g_printerr ("allocating: %s\n", role);
private->allocation_rc = g_strdup (role);
gimp_dialog_read_context(dialog, private->allocation_rc, &allocation);
private->dialog_x = allocation.x;
private->dialog_y = allocation.y;
private->dialog_width = allocation.width;
private->dialog_height = allocation.height;
g_signal_connect(GTK_WIDGET(dialog), "unmap", G_CALLBACK(gimp_dialog_unmap_callback), NULL);
g_signal_connect (GTK_WIDGET(dialog), "map-event", G_CALLBACK (gimp_dialog_map_callback), NULL);
}
}
gimp_dialog_add_buttons_valist (GIMP_DIALOG (dialog), args);
@@ -686,3 +729,244 @@ gimp_dialogs_show_help_button (gboolean show)
{
show_help_button = show ? TRUE : FALSE;
}
enum
{
POS_X,
POS_Y,
WIDTH,
HEIGHT
};
static void
gimp_dialog_read_context(GtkWidget *dialog, gchar *name, GtkAllocation *allocation)
{
GimpDialogPrivate *private = GET_PRIVATE (dialog);
gchar *options_path;
GFile *options_dir;
GFile *options_file;
GScanner *scanner;
GTokenType token;
GError *error = NULL;
gint x=0, y=0, width=0, height=0;
allocation->height = height;
allocation->width = width;
allocation->x = x;
allocation->y = y;
g_return_if_fail (private->allocation_rc != NULL);
options_path = g_build_filename (g_strdup (gimp_directory ()),
"plugin-options",
NULL);
options_dir = g_file_new_for_path (options_path);
options_file = g_file_get_child(options_dir, g_strconcat (private->allocation_rc, ".rc", NULL));
scanner = gimp_scanner_new_gfile (options_file, &error);
if (! scanner)
{
g_clear_error (&error);
g_free (options_path);
g_object_unref (options_dir);
g_object_unref (options_file);
return;
}
g_scanner_scope_add_symbol (scanner, 0, "pos-x",
GINT_TO_POINTER (POS_X));
g_scanner_scope_add_symbol (scanner, 0, "pos-y",
GINT_TO_POINTER (POS_Y));
g_scanner_scope_add_symbol (scanner, 0, "width",
GINT_TO_POINTER (WIDTH));
g_scanner_scope_add_symbol (scanner, 0, "height",
GINT_TO_POINTER (HEIGHT));
token = G_TOKEN_LEFT_PAREN;
while (g_scanner_peek_next_token (scanner) == token)
{
token = g_scanner_get_next_token (scanner);
switch (token)
{
case G_TOKEN_LEFT_PAREN:
token = G_TOKEN_SYMBOL;
break;
case G_TOKEN_SYMBOL:
if (scanner->value.v_symbol == GINT_TO_POINTER (POS_X))
{
token = G_TOKEN_IDENTIFIER;
if (! gimp_scanner_parse_int (scanner, &x))
break;
}
else if (scanner->value.v_symbol == GINT_TO_POINTER (POS_Y))
{
token = G_TOKEN_IDENTIFIER;
if (! gimp_scanner_parse_int (scanner, &y))
break;
}
else if (scanner->value.v_symbol == GINT_TO_POINTER (WIDTH))
{
token = G_TOKEN_IDENTIFIER;
if (! gimp_scanner_parse_int (scanner, &width))
break;
}
else if (scanner->value.v_symbol == GINT_TO_POINTER (HEIGHT))
{
token = G_TOKEN_IDENTIFIER;
if (! gimp_scanner_parse_int (scanner, &height))
break;
}
token = G_TOKEN_RIGHT_PAREN;
break;
case G_TOKEN_RIGHT_PAREN:
token = G_TOKEN_LEFT_PAREN;
break;
default: /* do nothing */
break;
}
}
if (token != G_TOKEN_LEFT_PAREN)
{
g_scanner_get_next_token (scanner);
g_scanner_unexp_token (scanner, token, NULL, NULL, NULL, "fatal parse error", TRUE);
}
if (error)
{
g_print("error: %s\n", error->message);
g_clear_error (&error);
}
allocation->height = height;
allocation->width = width;
allocation->x = x;
allocation->y = y;
gimp_scanner_destroy (scanner);
g_free (options_path);
g_object_unref (options_dir);
g_object_unref (options_file);
}
static void
gimp_dialog_save_context(GtkDialog *dialog, GtkAllocation allocation)
{
GimpDialogPrivate *private = GET_PRIVATE (dialog);
gchar *options_path;
GFile *options_dir;
GFile *options_file;
GimpConfigWriter *writer;
GError *error = NULL;
g_return_if_fail (private->allocation_rc != NULL);
options_path = g_build_filename (g_strdup (gimp_directory ()),
"plugin-options",
NULL);
options_dir = g_file_new_for_path (options_path);
if (! g_file_query_exists (options_dir, NULL))
{
g_file_make_directory (options_dir, NULL, &error);
}
if (error)
{
g_clear_error (&error);
g_free (options_path);
g_object_unref (options_dir);
return;
}
g_clear_error (&error);
options_file = g_file_get_child(options_dir, g_strconcat (private->allocation_rc, ".rc", NULL));
writer =
gimp_config_writer_new_gfile (options_file,
TRUE,
"start of file\n",
NULL);
g_object_unref (options_dir);
g_object_unref (options_file);
g_free (options_path);
if (!writer)
{
return;
}
gimp_config_writer_open (writer, "pos-x");
gimp_config_writer_printf (writer, "%d", allocation.x);
gimp_config_writer_close (writer);
gimp_config_writer_open (writer, "pos-y");
gimp_config_writer_printf (writer, "%d", allocation.y);
gimp_config_writer_close (writer);
gimp_config_writer_open (writer, "width");
gimp_config_writer_printf (writer, "%d", allocation.width);
gimp_config_writer_close (writer);
gimp_config_writer_open (writer, "height");
gimp_config_writer_printf (writer, "%d", allocation.height);
gimp_config_writer_close (writer);
if (! gimp_config_writer_finish (writer, "end of file", &error))
{
g_clear_error (&error);
}
}
void
gimp_dialog_unmap_callback (GtkDialog *dialog)
{
GtkAllocation allocation;
GdkRectangle rect;
gint dx, dy, dw, dh, dd;
gint monitor;
GdkWindow *window = gtk_widget_get_window (GTK_WIDGET(dialog));
GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET(dialog));
gdk_window_get_frame_extents (window, &rect);
gdk_window_get_geometry (window, &dx, &dy, &dw, &dh, &dd);
if (window)
monitor = gdk_screen_get_monitor_at_window (screen, window);
allocation.x=rect.x;
allocation.y=rect.y;
allocation.width=dw;
allocation.height=dh;
gimp_dialog_save_context(dialog, allocation);
}
void
gimp_dialog_map_callback (GtkDialog *dialog)
{
GimpDialogPrivate *private = GET_PRIVATE (dialog);
GdkWindow *window = gtk_widget_get_window (GTK_WIDGET(dialog));
if(private->dialog_width > 0 && private->dialog_height > 0)
{
gdk_window_move_resize (window,
private->dialog_x,
private->dialog_y,
private->dialog_width,
private->dialog_height);
}
}

View File

@@ -166,6 +166,7 @@ static const GtkStockItem gimp_stock_items[] =
{ GIMP_STOCK_TOOL_PRESET, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_IMAGE, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_IMAGE_METADATA, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_LAYER, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_TEXT_LAYER, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_FLOATING_SELECTION, NULL, 0, 0, LIBGIMP_DOMAIN },

View File

@@ -182,6 +182,7 @@ G_BEGIN_DECLS
#define GIMP_STOCK_FLIP_VERTICAL "gimp-flip-vertical"
#define GIMP_STOCK_IMAGE "gimp-image"
#define GIMP_STOCK_IMAGE_METADATA "gimp-image-metadata"
#define GIMP_STOCK_LAYER "gimp-layer"
#define GIMP_STOCK_TEXT_LAYER "gimp-text-layer"
#define GIMP_STOCK_FLOATING_SELECTION "gimp-floating-selection"

View File

@@ -55,6 +55,7 @@ SUBDIRS = \
imagemap \
lighting \
map-object \
metainfo \
pagecurl \
$(print) \
screenshot \

View File

@@ -52,6 +52,7 @@ libexec_PROGRAMS = \
align-layers \
animation-optimize \
animation-play \
attributes \
blinds \
blur \
border-average \
@@ -116,10 +117,10 @@ libexec_PROGRAMS = \
grid \
guillotine \
hot \
iptc \
jigsaw \
$(MAIL) \
max-rgb \
metadata \
newsprint \
nl-filter \
oilify \
@@ -218,6 +219,24 @@ animation_play_LDADD = \
$(INTLLIBS) \
$(animation_play_RC)
attributes_SOURCES = \
attributes.c
attributes_LDADD = \
$(libgimpui) \
$(libgimpwidgets) \
$(libgimpmodule) \
$(libgimp) \
$(libgimpmath) \
$(libgimpconfig) \
$(libgimpcolor) \
$(libgimpbase) \
$(GTK_LIBS) \
$(GEGL_LIBS) \
$(RT_LIBS) \
$(INTLLIBS) \
$(attributes_RC)
blinds_SOURCES = \
blinds.c
@@ -1354,6 +1373,26 @@ hot_LDADD = \
$(INTLLIBS) \
$(hot_RC)
iptc_CFLAGS = $(GEXIV2_CFLAGS)
iptc_SOURCES = \
iptc.c
iptc_LDADD = \
$(libgimpui) \
$(libgimpwidgets) \
$(libgimpmodule) \
$(libgimp) \
$(libgimpmath) \
$(libgimpconfig) \
$(libgimpcolor) \
$(libgimpbase) \
$(GTK_LIBS) \
$(GEXIV2_LIBS) \
$(RT_LIBS) \
$(INTLLIBS) \
$(iptc_RC)
jigsaw_SOURCES = \
jigsaw.c
@@ -1405,26 +1444,6 @@ max_rgb_LDADD = \
$(INTLLIBS) \
$(max_rgb_RC)
metadata_CFLAGS = $(GEXIV2_CFLAGS)
metadata_SOURCES = \
metadata.c
metadata_LDADD = \
$(libgimpui) \
$(libgimpwidgets) \
$(libgimpmodule) \
$(libgimp) \
$(libgimpmath) \
$(libgimpconfig) \
$(libgimpcolor) \
$(libgimpbase) \
$(GTK_LIBS) \
$(GEXIV2_LIBS) \
$(RT_LIBS) \
$(INTLLIBS) \
$(metadata_RC)
newsprint_SOURCES = \
newsprint.c

View File

@@ -0,0 +1,949 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* attributes.c
* Copyright (C) 2014 Hartmut Kuhse <hatti@gimp.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* additions: share/gimp/2.0/ui/plug-ins/plug-in-attributes.ui
* This plug-in reads in a (libgimpbase/gimpattributes.c) object and
* presents it:
* as GtkTreeView lists
* in a GtkNotebook.
* The GtkNotebook pages represents the type of attributes, as "exif",
* "xmp", "iptc" or more.
* The expanders of the GtkTreeView represents the IFD (Exif) or Key (XMP, IPTC).
* of the attribute.
* The list entry of the GtkTreeView represents the tag of the attribute.
*/
#include "config.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <glib/gstdio.h>
#include <gio/gio.h>
#ifdef G_OS_WIN32
#include <io.h>
#endif
#include <gtk/gtk.h>
#include <gexiv2/gexiv2.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
#include <libgimpbase/gimpbase.h>
#include "libgimp/stdplugins-intl.h"
#define PLUG_IN_IMAGE_PROC "plug-in-image-attributes-viewer"
#define PLUG_IN_LAYER_PROC "plug-in-layer-attributes-viewer"
#define PLUG_IN_HELP "plug-in-attributes-viewer"
#define PLUG_IN_BINARY "attributes"
#define THUMB_SIZE 48
#define RESPONSE_EXPORT 1
#define RESPONSE_GPS 3
typedef enum
{
ATT_IMAGE,
ATT_LAYER,
ATT_CHANNEL
} AttributesSource;
enum
{
C_IFD = 0,
C_TAG,
C_VALUE,
C_SORT,
NUM_COL
};
/* local function prototypes */
static void query (void);
static void run (const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals);
static void attributes_dialog_response (GtkWidget *widget,
gint response_id,
gpointer data);
static gboolean attributes_dialog (gint32 image_id,
AttributesSource source,
GimpAttributes *attributes);
static void attributes_dialog_set_attributes (GimpAttributes *attributes,
GtkBuilder *builder);
static GtkTreeIter *attributes_get_parent (const gchar *type,
const gchar *name);
static void attributes_add_parent (const gchar *type,
const gchar *name,
GtkTreeIter *iter);
static GtkTreeStore *attributes_notebook_page_get (GtkWidget *notebook,
const gchar *name);
static GtkWidget *attributes_treeview_new (void);
static void attributes_file_export_dialog (GtkWidget *parent,
GimpAttributes *attributes);
static void attributes_export_dialog_response (GtkWidget *dlg,
gint response_id,
gpointer data);
static void attributes_show_gps (GtkWidget *parent,
GimpAttributes *attributes);
static void attributes_message_dialog (GtkMessageType type,
GtkWindow *parent,
const gchar *title,
const gchar *message);
/* local variables */
const GimpPlugInInfo PLUG_IN_INFO =
{
NULL, /* init_proc */
NULL, /* quit_proc */
query, /* query_proc */
run, /* run_proc */
};
static GHashTable *ifd_table = NULL;
static GHashTable *tab_table = NULL;
static gchar *item_name = NULL;
static GtkWidget *gps_button;
static gdouble gps_latitude = 0.0;
static gdouble gps_longitude = 0.0;
static gchar *gps_latitude_ref = "N";
static gchar *gps_longitude_ref = "W";
/* functions */
MAIN ()
static void
query (void)
{
static const GimpParamDef image_attribs_args[] =
{
{ GIMP_PDB_INT32, "run-mode", "Run mode { RUN-INTERACTIVE (0) }" },
{ GIMP_PDB_IMAGE, "image", "Input image" }
};
static const GimpParamDef layer_attribs_args[] =
{
{ GIMP_PDB_INT32, "run-mode", "Run mode { RUN-INTERACTIVE (0) }" },
{ GIMP_PDB_IMAGE, "image", "Input image" },
{ GIMP_PDB_LAYER, "layer", "Input layer" }
};
gimp_install_procedure (PLUG_IN_IMAGE_PROC,
N_("View attributes (Exif, IPTC, XMP, ...)"),
"View attributes information attached to the "
"current image. This can include Exif, IPTC, "
"XMP and/or other information. Some or all of these "
"attributes will be saved in the file, depending on "
"the output file format.",
"Hartmut Kuhse",
"Hartmut Kuhse",
"2014",
N_("Image Attributes"),
"*",
GIMP_PLUGIN,
G_N_ELEMENTS (image_attribs_args), 0,
image_attribs_args, NULL);
gimp_plugin_menu_register (PLUG_IN_IMAGE_PROC, "<Image>/Image");
gimp_plugin_icon_register (PLUG_IN_IMAGE_PROC, GIMP_ICON_TYPE_ICON_NAME,
(const guint8 *) GIMP_STOCK_IMAGE_METADATA);
gimp_install_procedure (PLUG_IN_LAYER_PROC,
N_("View attributes (Exif, IPTC, XMP, ...)"),
"View attributes information attached to the "
"current layer. This can include Exif, IPTC, "
"XMP and/or other information.",
"Hartmut Kuhse",
"Hartmut Kuhse",
"2014",
N_("Layer Attributes"),
"*",
GIMP_PLUGIN,
G_N_ELEMENTS (layer_attribs_args), 0,
layer_attribs_args, NULL);
gimp_plugin_menu_register (PLUG_IN_LAYER_PROC, "<Layers>");
gimp_plugin_icon_register (PLUG_IN_LAYER_PROC, GIMP_ICON_TYPE_ICON_NAME,
(const guint8 *) GIMP_STOCK_IMAGE_METADATA);
}
static void
run (const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals)
{
GimpAttributes *attributes;
AttributesSource source;
gint32 item_ID;
static GimpParam values[1];
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
*nreturn_vals = 1;
*return_vals = values;
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
INIT_I18N();
gimp_ui_init (PLUG_IN_BINARY, TRUE);
if (! strcmp (name, PLUG_IN_IMAGE_PROC))
{
item_ID = param[1].data.d_image;
attributes = gimp_image_get_attributes (item_ID);
source = ATT_IMAGE;
status = GIMP_PDB_SUCCESS;
}
else if (! strcmp (name, PLUG_IN_LAYER_PROC))
{
item_ID = param[2].data.d_layer;
attributes = gimp_item_get_attributes (item_ID);
source = ATT_LAYER;
status = GIMP_PDB_SUCCESS;
}
else
{
status = GIMP_PDB_CALLING_ERROR;
}
if (attributes)
{
ifd_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
tab_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
attributes_dialog (item_ID, source, attributes);
}
else
{
g_message (_("This image has no attributes attached to it."));
}
if (attributes)
g_object_unref (attributes);
if (ifd_table)
g_hash_table_unref (ifd_table);
values[0].data.d_status = status;
}
static void
attributes_dialog_response (GtkWidget *widget,
gint response_id,
gpointer data)
{
GimpAttributes *attributes = (GimpAttributes *) data;
switch (response_id)
{
case RESPONSE_EXPORT:
attributes_file_export_dialog (widget, attributes);
break;
case RESPONSE_GPS:
attributes_show_gps (widget, attributes);
break;
default:
gtk_widget_destroy (widget);
break;
}
}
static gboolean
attributes_dialog (gint32 item_id,
AttributesSource source,
GimpAttributes *attributes)
{
GtkBuilder *builder;
GtkWidget *dialog;
GtkWidget *attributes_vbox;
GtkWidget *content_area;
GdkPixbuf *pixbuf;
GtkWidget *label_header;
GtkWidget *label_info;
GtkWidget *thumb_box;
gchar *header;
gchar *ui_file;
gchar *title;
gchar *role;
GError *error = NULL;
gimp_ui_init (PLUG_IN_BINARY, FALSE);
switch (source)
{
case ATT_IMAGE:
item_name = g_filename_display_basename (gimp_image_get_uri (item_id));
header = g_strdup_printf ("Image");
role = g_strdup_printf ("gimp-image-attributes-dialog");
pixbuf = gimp_image_get_thumbnail (item_id, THUMB_SIZE, THUMB_SIZE,
GIMP_PIXBUF_SMALL_CHECKS);
break;
case ATT_LAYER:
item_name = gimp_item_get_name (item_id);
header = g_strdup_printf ("Layer");
role = g_strdup_printf ("gimp-layer-attributes-dialog");
pixbuf = gimp_drawable_get_thumbnail (item_id, THUMB_SIZE, THUMB_SIZE,
GIMP_PIXBUF_SMALL_CHECKS);
break;
default:
item_name = g_strdup_printf ("unknown");
header = g_strdup_printf ("Unknown");
role = g_strdup_printf ("gimp-attributes-dialog");
pixbuf = NULL;
break;
}
title = g_strdup_printf ("Attributes: %s", item_name);
builder = gtk_builder_new ();
ui_file = g_build_filename (gimp_data_directory (),
"ui", "plug-ins", "plug-in-attributes.ui", NULL);
if (! gtk_builder_add_from_file (builder, ui_file, &error))
{
g_printerr ("Error occured while loading UI file!\n");
g_printerr ("Message: %s\n", error->message);
g_clear_error (&error);
g_free (ui_file);
g_object_unref (builder);
return FALSE;
}
g_free (ui_file);
dialog = gimp_dialog_new (title,
role,
NULL, 0,
gimp_standard_help_func, PLUG_IN_HELP,
_("_Export XMP..."), RESPONSE_EXPORT,
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
NULL);
gps_button = gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Show GPS..."), RESPONSE_GPS);
gtk_widget_set_sensitive (GTK_WIDGET (gps_button), FALSE);
g_signal_connect (dialog, "response",
G_CALLBACK (attributes_dialog_response),
attributes);
g_signal_connect (dialog, "destroy",
G_CALLBACK (gtk_main_quit),
NULL);
g_free (title);
g_free (role);
gtk_window_set_default_size (GTK_WINDOW (dialog),
650,
550);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
RESPONSE_GPS,
RESPONSE_EXPORT,
GTK_RESPONSE_CLOSE,
-1);
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
attributes_vbox = GTK_WIDGET (gtk_builder_get_object (builder,
"attributes-vbox"));
gtk_container_set_border_width (GTK_CONTAINER (attributes_vbox), 2);
gtk_box_pack_start (GTK_BOX (content_area), attributes_vbox, TRUE, TRUE, 0);
label_header = GTK_WIDGET (gtk_builder_get_object (builder, "label-header"));
gimp_label_set_attributes (GTK_LABEL (label_header),
PANGO_ATTR_SCALE, PANGO_SCALE_LARGE,
PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD,
-1);
gtk_label_set_text (GTK_LABEL (label_header), header);
label_info = GTK_WIDGET (gtk_builder_get_object (builder, "label-info"));
gimp_label_set_attributes (GTK_LABEL (label_info),
PANGO_ATTR_SCALE, PANGO_SCALE_SMALL,
-1);
gtk_label_set_text (GTK_LABEL (label_info), item_name);
g_free (header);
if (pixbuf)
{
GtkWidget *image;
thumb_box = GTK_WIDGET (gtk_builder_get_object (builder, "thumb-box"));
if (thumb_box)
{
image = gtk_image_new_from_pixbuf (pixbuf);
gtk_box_pack_end (GTK_BOX (thumb_box), image, FALSE, FALSE, 0);
gtk_widget_show (image);
}
}
attributes_dialog_set_attributes (attributes, builder);
gtk_widget_show (GTK_WIDGET (dialog));
gtk_main ();
return TRUE;
}
/* private functions */
static void
attributes_dialog_set_attributes (GimpAttributes *attributes,
GtkBuilder *builder)
{
GtkTreeStore *exif_store;
GtkTreeStore *xmp_store;
GtkTreeStore *iptc_store;
GtkTreeView *exif_treeview;
GtkTreeView *xmp_treeview;
GtkTreeView *iptc_treeview;
GtkWidget *attributes_notebook;
GList *iter_list = NULL;
GimpAttribute *attribute = NULL;
gboolean gps_lat = FALSE;
gboolean gps_lon = FALSE;
exif_store = GTK_TREE_STORE (gtk_builder_get_object (builder,
"exif-treestore"));
xmp_store = GTK_TREE_STORE (gtk_builder_get_object (builder,
"xmp-treestore"));
iptc_store = GTK_TREE_STORE (gtk_builder_get_object (builder,
"iptc-treestore"));
exif_treeview = GTK_TREE_VIEW (gtk_builder_get_object (builder,
"exif-treeview"));
xmp_treeview = GTK_TREE_VIEW (gtk_builder_get_object (builder,
"xmp-treeview"));
iptc_treeview = GTK_TREE_VIEW (gtk_builder_get_object (builder,
"iptc-treeview"));
attributes_notebook = GTK_WIDGET (gtk_builder_get_object (builder,
"attributes-notebook"));
gimp_attributes_iter_init (attributes, &iter_list);
while (gimp_attributes_iter_next (attributes, &attribute, &iter_list))
{
const gchar *name;
const gchar *type;
const gchar *ifd;
const gchar *tag;
const gchar *value;
const gchar *tag_sorted;
gchar *value_utf;
GtkTreeIter *parent = NULL;
GtkTreeIter *iter = g_slice_new (GtkTreeIter);
name = gimp_attribute_get_name (attribute);
type = gimp_attribute_get_attribute_type (attribute);
ifd = gimp_attribute_get_attribute_ifd (attribute);
tag = gimp_attribute_get_attribute_tag (attribute);
tag_sorted = gimp_attribute_get_sortable_name (attribute);
value = gimp_attribute_get_interpreted_string (attribute);
if (! g_utf8_validate (value, -1, NULL))
value_utf = g_locale_to_utf8 (value, -1, NULL, NULL, NULL);
else
value_utf = g_strdup (value);
parent = attributes_get_parent (type, ifd);
if (! g_strcmp0 (name, "Exif.GPSInfo.GPSLatitude"))
{
gps_lat = TRUE;
gps_latitude = gimp_attribute_get_gps_degree (attribute);
if (gps_latitude < 0.0 && !gps_latitude_ref)
{
gps_latitude = gps_latitude * -1.0;
gps_latitude_ref = "S";
}
}
if (! g_strcmp0 (name, "Exif.GPSInfo.GPSLatitudeRef"))
{
gps_latitude_ref = gimp_attribute_get_string (attribute);
}
if (! g_strcmp0 (name, "Exif.GPSInfo.GPSLongitude"))
{
gps_lon = TRUE;
gps_longitude = gimp_attribute_get_gps_degree (attribute);
if (gps_longitude < 0.0 && !gps_longitude_ref)
{
gps_longitude = gps_longitude * -1.0;
gps_longitude_ref = "W";
}
}
if (! g_strcmp0 (name, "Exif.GPSInfo.GPSLongitudeRef"))
{
gps_longitude_ref = gimp_attribute_get_string (attribute);
}
if (gps_lat && gps_lon)
{
gtk_widget_set_sensitive (gps_button, TRUE);
gps_lat = FALSE;
gps_lon = FALSE;
}
switch (gimp_attribute_get_tag_type (attribute))
{
case TAG_EXIF:
{
gtk_tree_store_append (exif_store, iter, parent);
if (!parent)
{
GtkTreeIter child;
gtk_tree_store_set (exif_store, iter,
C_IFD, ifd,
C_TAG, "",
C_VALUE, "",
C_SORT, "",
-1);
parent = iter;
gtk_tree_store_append (exif_store, &child, parent);
gtk_tree_store_set (exif_store, &child,
C_IFD, "",
C_TAG, tag,
C_VALUE, value_utf,
C_SORT, tag_sorted,
-1);
attributes_add_parent (type, ifd, parent);
}
else
{
gtk_tree_store_set (exif_store, iter,
C_IFD, "",
C_TAG, tag,
C_VALUE, value_utf,
C_SORT, tag_sorted,
-1);
}
}
break;
case TAG_XMP:
{
gtk_tree_store_append (xmp_store, iter, parent);
if (!parent)
{
GtkTreeIter child;
gtk_tree_store_set (xmp_store, iter,
C_IFD, ifd,
C_TAG, "",
C_VALUE, "",
C_SORT, "",
-1);
parent = iter;
gtk_tree_store_append (xmp_store, &child, parent);
gtk_tree_store_set (xmp_store, &child,
C_IFD, "",
C_TAG, tag,
C_VALUE, value_utf,
C_SORT, tag_sorted,
-1);
attributes_add_parent (type, ifd, parent);
}
else
{
gtk_tree_store_set (xmp_store, iter,
C_IFD, "",
C_TAG, tag,
C_VALUE, value_utf,
C_SORT, tag_sorted,
-1);
}
}
break;
case TAG_IPTC:
{
gtk_tree_store_append (iptc_store, iter, parent);
if (!parent)
{
GtkTreeIter child;
gtk_tree_store_set (iptc_store, iter,
C_IFD, ifd,
C_TAG, "",
C_VALUE, "",
C_SORT, "",
-1);
parent = iter;
gtk_tree_store_append (iptc_store, &child, parent);
gtk_tree_store_set (iptc_store, &child,
C_IFD, "",
C_TAG, tag,
C_VALUE, value_utf,
C_SORT, tag_sorted,
-1);
attributes_add_parent (type, ifd, parent);
}
else
{
gtk_tree_store_set (iptc_store, iter,
C_IFD, "",
C_TAG, tag,
C_VALUE, value_utf,
C_SORT, tag_sorted,
-1);
}
}
break;
default:
{
GtkTreeStore *treestore;
GtkTreeIter iter;
treestore = attributes_notebook_page_get (attributes_notebook, type);
gtk_tree_store_append (treestore, &iter, NULL);
gtk_tree_store_set (treestore, &iter,
C_IFD, "",
C_TAG, name,
C_VALUE, value_utf,
-1);
}
break;
}
}
gtk_tree_view_expand_all (exif_treeview);
gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(exif_store),
C_SORT, GTK_SORT_ASCENDING);
gtk_tree_view_expand_all (xmp_treeview);
gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(xmp_store),
C_SORT, GTK_SORT_ASCENDING);
gtk_tree_view_expand_all (iptc_treeview);
gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(iptc_store),
C_SORT, GTK_SORT_ASCENDING);
}
static GtkTreeIter *
attributes_get_parent (const gchar *type, const gchar *name)
{
gchar *key;
gchar *lowchar;
GtkTreeIter *iter;
gpointer *data;
key = g_strdup_printf ("%s.%s", type, name);
lowchar = g_ascii_strdown (key, -1);
g_free (key);
data = g_hash_table_lookup (ifd_table, (gpointer) lowchar);
g_free (lowchar);
if (data)
{
iter = (GtkTreeIter *) data;
return iter;
}
else
{
return NULL;
}
}
static void
attributes_add_parent (const gchar *type, const gchar *name, GtkTreeIter *iter)
{
gchar *key;
gchar *lowchar;
key = g_strdup_printf ("%s.%s", type, name);
lowchar = g_ascii_strdown (key, -1);
g_free (key);
g_hash_table_insert (ifd_table, (gpointer) lowchar, (gpointer) iter);
}
static GtkTreeStore *
attributes_notebook_page_get (GtkWidget *notebook,
const gchar *name)
{
GtkWidget *scrolledwindow;
GtkWidget *treeview;
gchar *lowchar;
gpointer *data;
GtkTreeStore *treestore;
lowchar = g_ascii_strdown (name, -1);
data = g_hash_table_lookup (tab_table, (gpointer) lowchar);
if (data)
{
treestore = (GtkTreeStore *) data;
g_free (lowchar);
}
else
{
treeview = attributes_treeview_new ();
scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_show (scrolledwindow);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow), GTK_SHADOW_IN);
gtk_widget_show (treeview);
gtk_container_add (GTK_CONTAINER (scrolledwindow), treeview);
gtk_tree_view_set_enable_search (GTK_TREE_VIEW (treeview), FALSE);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
scrolledwindow,
gtk_label_new (name));
treestore = GTK_TREE_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (treeview)));
g_hash_table_insert (tab_table, (gpointer) lowchar, (gpointer) treestore);
}
return treestore;
}
static GtkWidget *
attributes_treeview_new (void)
{
GtkWidget *treeview;
GtkTreeStore *treestore;
GtkCellRenderer *ifd_renderer;
GtkCellRenderer *tag_renderer;
GtkCellRenderer *val_renderer;
GtkTreeViewColumn *ifd_column;
GtkTreeViewColumn *tag_column;
GtkTreeViewColumn *val_column;
ifd_renderer = gtk_cell_renderer_text_new ();
tag_renderer = gtk_cell_renderer_text_new ();
val_renderer = gtk_cell_renderer_text_new ();
treestore = gtk_tree_store_new (NUM_COL, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
treeview = gtk_tree_view_new ();
gtk_tree_view_set_model(GTK_TREE_VIEW (treeview), GTK_TREE_MODEL(treestore));
ifd_column = gtk_tree_view_column_new_with_attributes ("", ifd_renderer, "text", C_IFD, NULL);
tag_column = gtk_tree_view_column_new_with_attributes ("Tag", tag_renderer, "text", C_TAG, NULL);
val_column = gtk_tree_view_column_new_with_attributes ("Value", val_renderer, "text", C_VALUE, NULL);
gtk_tree_view_column_set_resizable (ifd_column, TRUE);
gtk_tree_view_column_set_resizable (tag_column, TRUE);
gtk_tree_view_column_set_resizable (val_column, TRUE);
gtk_tree_view_insert_column (GTK_TREE_VIEW (treeview), ifd_column, -1);
gtk_tree_view_insert_column (GTK_TREE_VIEW (treeview), tag_column, -1);
gtk_tree_view_insert_column (GTK_TREE_VIEW (treeview), val_column, -1);
return treeview;
}
/* select file to export */
static void
attributes_file_export_dialog (GtkWidget *parent,
GimpAttributes *attributes)
{
static GtkWidget *dlg = NULL;
gchar *suggest_file;
// GTK_WINDOW (parent),
suggest_file = g_strdup_printf ("%s.xmp", item_name);
if (! dlg)
{
dlg = gtk_file_chooser_dialog_new (_("Export XMP to File"),
GTK_WINDOW (parent),
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dlg),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gtk_dialog_set_default_response (GTK_DIALOG (dlg), GTK_RESPONSE_OK);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dlg),
TRUE);
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dlg), suggest_file);
g_signal_connect (dlg, "destroy",
G_CALLBACK (gtk_widget_destroyed),
&dlg);
g_signal_connect (dlg, "response",
G_CALLBACK (attributes_export_dialog_response),
attributes);
g_free (suggest_file);
}
gtk_window_present (GTK_WINDOW (dlg));
}
/* call default browser for google maps */
static void
attributes_show_gps (GtkWidget *parent,
GimpAttributes *attributes)
{
GError *error = NULL;
gchar *uri = NULL;
gchar lat_buf[G_ASCII_DTOSTR_BUF_SIZE];
gchar lon_buf[G_ASCII_DTOSTR_BUF_SIZE];
if (!g_strcmp0 (gps_latitude_ref, "S"))
gps_latitude = gps_latitude * -1.0;
if (!g_strcmp0 (gps_longitude_ref, "W"))
gps_longitude = gps_longitude * -1.0;
g_ascii_formatd (lat_buf, G_ASCII_DTOSTR_BUF_SIZE, "%.6f",
gps_latitude);
g_ascii_formatd (lon_buf, G_ASCII_DTOSTR_BUF_SIZE, "%.6f",
gps_longitude);
uri = g_strdup_printf ("http://maps.google.com?q=%s,%s&z=15",
lat_buf,
lon_buf);
g_app_info_launch_default_for_uri (uri, NULL, &error);
if (error)
{
attributes_message_dialog (GTK_MESSAGE_ERROR, GTK_WINDOW (parent),
_("GPS failure"),
error->message);
}
}
/* save XMP metadata to a file (only XMP, nothing else) */
static void
attributes_export_dialog_response (GtkWidget *dlg,
gint response_id,
gpointer data)
{
GimpAttributes *attributes = (GimpAttributes *) data;
g_return_if_fail (attributes != NULL);
if (response_id == GTK_RESPONSE_OK)
{
GString *buffer;
const gchar *xmp_data = NULL;
gchar *filename = NULL;
int fd;
xmp_data = gimp_attributes_to_xmp_packet (attributes, "file/xmp");
if (!xmp_data)
{
attributes_message_dialog (GTK_MESSAGE_ERROR, GTK_WINDOW (dlg),
_("XMP creation failed"),
_("Cannot create xmp packet"));
return;
}
buffer = g_string_new (xmp_data);
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dlg));
fd = g_open (filename, O_CREAT | O_TRUNC | O_WRONLY | _O_BINARY, 0666);
if (fd < 0)
{
attributes_message_dialog (GTK_MESSAGE_ERROR, GTK_WINDOW (dlg),
_("Open failed"),
_("Cannot create file"));
g_string_free (buffer, TRUE);
g_free (filename);
return;
}
if (write (fd, buffer->str, buffer->len) < 0)
{
attributes_message_dialog (GTK_MESSAGE_ERROR, GTK_WINDOW (dlg),
_("Save failed"),
_("Some error occurred while saving"));
g_string_free (buffer, TRUE);
g_free (filename);
return;
}
if (close (fd) < 0)
{
attributes_message_dialog (GTK_MESSAGE_ERROR, GTK_WINDOW (dlg),
_("Save failed"),
_("Could not close the file"));
g_string_free (buffer, TRUE);
g_free (filename);
return;
}
g_string_free (buffer, TRUE);
g_free (filename);
}
gtk_widget_destroy (dlg); /* FIXME: destroy or unmap? */
}
/* show a transient message dialog */
static void
attributes_message_dialog (GtkMessageType type,
GtkWindow *parent,
const gchar *title,
const gchar *message)
{
GtkWidget *dlg;
dlg = gtk_message_dialog_new (parent, 0, type, GTK_BUTTONS_OK, "%s", message);
if (title)
gtk_window_set_title (GTK_WINDOW (dlg), title);
gtk_window_set_role (GTK_WINDOW (dlg), "metadata-message");
gtk_dialog_run (GTK_DIALOG (dlg));
gtk_widget_destroy (dlg);
}

View File

@@ -57,6 +57,7 @@ static void run (const gchar *name,
gint *nreturn_vals,
GimpParam **return_vals);
static gint32 load_image (const gchar *filename,
gint32 *layer_ID,
GError **error);
static gboolean load_icc_profile (jas_image_t *jas_image,
gint image_ID,
@@ -126,6 +127,7 @@ run (const gchar *name,
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
gint image_ID;
GError *error = NULL;
gint32 layer_ID;
run_mode = param[0].data.d_int32;
@@ -154,7 +156,7 @@ run (const gchar *name,
break;
}
image_ID = load_image (param[1].data.d_string, &error);
image_ID = load_image (param[1].data.d_string, &layer_ID, &error);
if (image_ID != -1)
{
@@ -168,7 +170,7 @@ run (const gchar *name,
{
GimpMetadataLoadFlags flags = GIMP_METADATA_LOAD_ALL;
gimp_image_metadata_load_finish (image_ID, "image/jp2",
gimp_image_metadata_load_finish (image_ID, layer_ID, "image/jp2",
metadata, flags,
interactive);
@@ -203,13 +205,13 @@ run (const gchar *name,
static gint32
load_image (const gchar *filename,
gint32 *layer_ID,
GError **error)
{
gint fd;
jas_stream_t *stream;
gint32 image_ID = -1;
jas_image_t *image;
gint32 layer_ID;
GimpImageType image_type;
GimpImageBaseType base_type;
gint width;

View File

@@ -140,6 +140,7 @@ static void run (const gchar *name,
GimpParam **return_vals);
static gint32 load_image (const gchar *filename,
gint32 *layer_ID,
gboolean interactive,
gboolean *resolution_loaded,
GError **error);
@@ -147,6 +148,7 @@ static gboolean save_image (const gchar *filename,
gint32 image_ID,
gint32 drawable_ID,
gint32 orig_image_ID,
gint *bits_depth,
GError **error);
static int respin_cmap (png_structp pp,
@@ -416,6 +418,7 @@ run (const gchar *name,
GimpRunMode run_mode;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
gint32 image_ID;
gint32 layer_ID;
gint32 drawable_ID;
GError *error = NULL;
@@ -448,6 +451,7 @@ run (const gchar *name,
}
image_ID = load_image (param[1].data.d_string,
&layer_ID,
interactive,
&resolution_loaded,
&error);
@@ -467,7 +471,7 @@ run (const gchar *name,
if (resolution_loaded)
flags &= ~GIMP_METADATA_LOAD_RESOLUTION;
gimp_image_metadata_load_finish (image_ID, "image/png",
gimp_image_metadata_load_finish (image_ID, layer_ID, "image/png",
metadata, flags,
interactive);
@@ -492,6 +496,7 @@ run (const gchar *name,
GimpMetadata *metadata;
GimpMetadataSaveFlags metadata_flags;
gint32 orig_image_ID;
gint bits_depth;
GimpExportReturn export = GIMP_EXPORT_CANCEL;
gboolean alpha;
@@ -525,8 +530,8 @@ run (const gchar *name,
}
metadata = gimp_image_metadata_save_prepare (orig_image_ID,
"image/png",
&metadata_flags);
"image/png",
&metadata_flags);
pngvals.save_exif = (metadata_flags & GIMP_METADATA_SAVE_EXIF) != 0;
pngvals.save_xmp = (metadata_flags & GIMP_METADATA_SAVE_XMP) != 0;
@@ -608,7 +613,7 @@ run (const gchar *name,
if (status == GIMP_PDB_SUCCESS)
{
if (save_image (param[3].data.d_string,
image_ID, drawable_ID, orig_image_ID, &error))
image_ID, drawable_ID, orig_image_ID, &bits_depth, &error))
{
if (metadata)
{
@@ -637,10 +642,12 @@ run (const gchar *name,
metadata_flags &= ~GIMP_METADATA_SAVE_THUMBNAIL;
file = g_file_new_for_path (param[3].data.d_string);
gimp_image_metadata_save_finish (orig_image_ID,
"image/png",
metadata, metadata_flags,
file, NULL);
g_object_unref (metadata);
g_object_unref (file);
}
@@ -655,8 +662,6 @@ run (const gchar *name,
if (export == GIMP_EXPORT_EXPORT)
gimp_image_delete (image_ID);
if (metadata)
g_object_unref (metadata);
}
else if (strcmp (name, GET_DEFAULTS_PROC) == 0)
{
@@ -817,6 +822,7 @@ load_color_profile (png_structp pp,
*/
static gint32
load_image (const gchar *filename,
gint32 *layer_ID,
gboolean interactive,
gboolean *resolution_loaded,
GError **error)
@@ -1427,6 +1433,7 @@ save_image (const gchar *filename,
gint32 image_ID,
gint32 drawable_ID,
gint32 orig_image_ID,
gint *bits_depth,
GError **error)
{
gint i, k; /* Looping vars */
@@ -1500,6 +1507,8 @@ save_image (const gchar *filename,
break;
}
*bits_depth = bit_depth;
pp = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (!pp)
{

View File

@@ -1,6 +1,7 @@
align_layers_RC = align-layers.rc.o
animation_optimize_RC = animation-optimize.rc.o
animation_play_RC = animation-play.rc.o
attributes_RC = attributes.rc.o
blinds_RC = blinds.rc.o
blur_RC = blur.rc.o
border_average_RC = border-average.rc.o
@@ -65,10 +66,10 @@ gradient_map_RC = gradient-map.rc.o
grid_RC = grid.rc.o
guillotine_RC = guillotine.rc.o
hot_RC = hot.rc.o
iptc_RC = iptc.rc.o
jigsaw_RC = jigsaw.rc.o
mail_RC = mail.rc.o
max_rgb_RC = max-rgb.rc.o
metadata_RC = metadata.rc.o
newsprint_RC = newsprint.rc.o
nl_filter_RC = nl-filter.rc.o
oilify_RC = oilify.rc.o

513
plug-ins/common/iptc.c Normal file
View File

@@ -0,0 +1,513 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* iptc.c
* Copyright (C) 2013 Hartmut Kuhse
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <gegl.h>
#include <gtk/gtk.h>
#include <gexiv2/gexiv2.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
#include "libgimp/stdplugins-intl.h"
#define PLUG_IN_IMAGE_PROC "plug-in-image-iptc-editor"
#define PLUG_IN_LAYER_PROC "plug-in-layer-iptc-editor"
#define PLUG_IN_CHANNEL_PROC "plug-in-channel-iptc-editor"
#define PLUG_IN_HELP "plug-in-iptc-editor"
#define PLUG_IN_BINARY "iptc"
#define THUMB_SIZE 48
#define IPTC_PREFIX "Iptc."
typedef struct
{
gchar *tag;
gchar *mode;
} iptc_tag;
typedef enum
{
ATT_IMAGE,
ATT_LAYER,
ATT_CHANNEL
} AttributesSource;
/* local function prototypes */
static void query (void);
static void run (const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals);
static gboolean iptc_dialog (gint32 image_id,
GimpAttributes *attributes,
AttributesSource source,
GtkBuilder *builder);
static void iptc_dialog_set_iptc (GimpAttributes *attributes,
GtkBuilder *builder);
static void iptc_change_iptc (GimpAttributes *attributes,
GtkBuilder *builder);
/* local variables */
const GimpPlugInInfo PLUG_IN_INFO =
{
NULL, /* init_proc */
NULL, /* quit_proc */
query, /* query_proc */
run, /* run_proc */
};
static const iptc_tag const iptc_tags[] =
{
{ "Iptc.Application2.Byline", "single" },
{ "Iptc.Application2.BylineTitle", "single" },
{ "Iptc.Application2.Caption", "multi" },
{ "Iptc.Application2.Category", "single" },
{ "Iptc.Application2.City", "single" },
{ "Iptc.Application2.Copyright", "single" },
{ "Iptc.Application2.CountryName", "single" },
{ "Iptc.Application2.Credit", "single" },
{ "Iptc.Application2.Headline", "multi" },
{ "Iptc.Application2.Keywords", "multi" },
{ "Iptc.Application2.ObjectName", "single" },
{ "Iptc.Application2.ProvinceState", "single" },
{ "Iptc.Application2.Source", "single" },
{ "Iptc.Application2.SpecialInstructions", "multi" },
{ "Iptc.Application2.SubLocation", "single" },
{ "Iptc.Application2.SuppCategory", "multi" },
{ "Iptc.Application2.TransmissionReference", "single" },
{ "Iptc.Application2.Urgency", "single" },
{ "Iptc.Application2.Writer", "single" }
};
/* functions */
MAIN ()
static void
query (void)
{
static const GimpParamDef image_attribs_args[] =
{
{ GIMP_PDB_INT32, "run-mode", "Run mode { RUN-INTERACTIVE (0) }" },
{ GIMP_PDB_IMAGE, "image", "Input image" }
};
static const GimpParamDef layer_attribs_args[] =
{
{ GIMP_PDB_INT32, "run-mode", "Run mode { RUN-INTERACTIVE (0) }" },
{ GIMP_PDB_IMAGE, "image", "Input image" },
{ GIMP_PDB_LAYER, "layer", "Input layer" }
};
static const GimpParamDef channel_attribs_args[] =
{
{ GIMP_PDB_INT32, "run-mode", "Run mode { RUN-INTERACTIVE (0) }" },
{ GIMP_PDB_IMAGE, "image", "Input image" },
{ GIMP_PDB_CHANNEL, "channel", "Input channel" }
};
gimp_install_procedure (PLUG_IN_IMAGE_PROC,
N_("View and edit IPTC data"),
"View and edit IPTC information attached to the "
"current image. This iptc will be saved in the "
"file, depending on the output file format.",
"Hartmut Kuhse",
"Hartmut Kuhse",
"2014",
N_("Edit IPTC Metadata"),
"*",
GIMP_PLUGIN,
G_N_ELEMENTS (image_attribs_args), 0,
image_attribs_args, NULL);
gimp_plugin_menu_register (PLUG_IN_IMAGE_PROC, "<Image>/Image");
gimp_install_procedure (PLUG_IN_LAYER_PROC,
N_("View and edit IPTC data"),
"View and edit IPTC information attached to the "
"current layer. This iptc will be saved in the "
"xcf file.",
"Hartmut Kuhse",
"Hartmut Kuhse",
"2014",
N_("Edit layers IPTC Metadata"),
"*",
GIMP_PLUGIN,
G_N_ELEMENTS (layer_attribs_args), 0,
layer_attribs_args, NULL);
gimp_plugin_menu_register (PLUG_IN_LAYER_PROC, "<Layers>");
gimp_install_procedure (PLUG_IN_CHANNEL_PROC,
N_("View and edit IPTC data"),
"View and edit IPTC information attached to the "
"current channel. This iptc will be saved in the "
"xcf file.",
"Hartmut Kuhse",
"Hartmut Kuhse",
"2014",
N_("Edit channels IPTC Metadata"),
"*",
GIMP_PLUGIN,
G_N_ELEMENTS (channel_attribs_args), 0,
channel_attribs_args, NULL);
gimp_plugin_menu_register (PLUG_IN_CHANNEL_PROC, "<Channels>");
}
static void
run (const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals)
{
GimpAttributes *attributes;
GtkBuilder *builder;
AttributesSource source;
gint32 item_ID;
static GimpParam values[1];
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
*nreturn_vals = 1;
*return_vals = values;
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
INIT_I18N();
gimp_ui_init (PLUG_IN_BINARY, TRUE);
if (! strcmp (name, PLUG_IN_IMAGE_PROC))
{
item_ID = param[1].data.d_image;
attributes = gimp_image_get_attributes (item_ID);
source = ATT_IMAGE;
status = GIMP_PDB_SUCCESS;
}
else if (! strcmp (name, PLUG_IN_LAYER_PROC))
{
item_ID = param[2].data.d_layer;
attributes = gimp_item_get_attributes (item_ID);
source = ATT_LAYER;
status = GIMP_PDB_SUCCESS;
}
else if (! strcmp (name, PLUG_IN_CHANNEL_PROC))
{
item_ID = param[2].data.d_channel;
attributes = gimp_item_get_attributes (item_ID);
source = ATT_CHANNEL;
status = GIMP_PDB_SUCCESS;
}
else
{
status = GIMP_PDB_CALLING_ERROR;
}
if (! attributes)
{
attributes = gimp_attributes_new();
}
builder = gtk_builder_new ();
if (status == GIMP_PDB_SUCCESS && iptc_dialog (item_ID, attributes, source, builder))
{
iptc_change_iptc (attributes, builder);
if (! strcmp (name, PLUG_IN_IMAGE_PROC))
{
gimp_image_set_attributes (item_ID, attributes);
}
else if (! strcmp (name, PLUG_IN_LAYER_PROC))
{
gimp_item_set_attributes (item_ID, attributes);
}
else if (! strcmp (name, PLUG_IN_CHANNEL_PROC))
{
gimp_item_set_attributes (item_ID, attributes);
}
status = GIMP_PDB_SUCCESS;
}
else
{
status = GIMP_PDB_CALLING_ERROR;
}
g_object_unref (attributes);
values[0].data.d_status = status;
}
static gboolean
iptc_dialog (gint32 item_id,
GimpAttributes *attributes,
AttributesSource source,
GtkBuilder *builder)
{
GtkWidget *dialog;
GtkWidget *iptc_vbox;
GtkWidget *content_area;
GdkPixbuf *pixbuf;
GtkWidget *label_header;
GtkWidget *label_info;
GtkWidget *thumb_box;
gchar *ui_file;
gchar *title;
gchar *fname;
gchar *header;
gchar *role;
GError *error = NULL;
gboolean run;
switch (source)
{
case ATT_IMAGE:
fname = g_filename_display_basename (gimp_image_get_uri (item_id));
header = g_strdup_printf ("Image");
title = g_strdup_printf ("Image: %s", fname);
role = g_strdup_printf ("gimp-image-iptc-dialog");
pixbuf = gimp_image_get_thumbnail (item_id, THUMB_SIZE, THUMB_SIZE,
GIMP_PIXBUF_SMALL_CHECKS);
break;
case ATT_LAYER:
fname = gimp_item_get_name (item_id);
header = g_strdup_printf ("Layer");
title = g_strdup_printf ("Layer: %s", fname);
role = g_strdup_printf ("gimp-layer-iptc-dialog");
pixbuf = gimp_drawable_get_thumbnail (item_id, THUMB_SIZE, THUMB_SIZE,
GIMP_PIXBUF_SMALL_CHECKS);
break;
case ATT_CHANNEL:
fname = gimp_item_get_name (item_id);
header = g_strdup_printf ("Channel");
title = g_strdup_printf ("Channel: %s", fname);
role = g_strdup_printf ("gimp-channel-iptc-dialog");
pixbuf = gimp_drawable_get_thumbnail (item_id, THUMB_SIZE, THUMB_SIZE,
GIMP_PIXBUF_SMALL_CHECKS);
break;
default:
fname = g_strdup_printf ("unknown");
header = g_strdup_printf ("Unknown");
title = g_strdup_printf ("Attributes: %s", fname);
role = g_strdup_printf ("gimp-iptc-dialog");
pixbuf = NULL;
break;
}
ui_file = g_build_filename (gimp_data_directory (),
"ui", "plug-ins", "plug-in-iptc.ui", NULL);
if (! gtk_builder_add_from_file (builder, ui_file, &error))
{
g_printerr ("Error occured while loading UI file!\n");
g_printerr ("Message: %s\n", error->message);
g_clear_error (&error);
g_free (ui_file);
g_object_unref (builder);
return FALSE;
}
g_free (ui_file);
dialog = gimp_dialog_new (title,
role,
NULL, 0,
gimp_standard_help_func, PLUG_IN_HELP,
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
g_free (title);
g_free (role);
gtk_window_set_default_size (GTK_WINDOW (dialog),
600,
-1);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CLOSE,
-1);
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
iptc_vbox = GTK_WIDGET (gtk_builder_get_object (builder,
"iptc-vbox"));
gtk_container_set_border_width (GTK_CONTAINER (iptc_vbox), 2);
gtk_box_pack_start (GTK_BOX (content_area), iptc_vbox, TRUE, TRUE, 0);
label_header = GTK_WIDGET (gtk_builder_get_object (builder, "label-header"));
gimp_label_set_attributes (GTK_LABEL (label_header),
PANGO_ATTR_SCALE, PANGO_SCALE_LARGE,
PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD,
-1);
gtk_label_set_text (GTK_LABEL (label_header), header);
label_info = GTK_WIDGET (gtk_builder_get_object (builder, "label-info"));
gimp_label_set_attributes (GTK_LABEL (label_info),
PANGO_ATTR_SCALE, PANGO_SCALE_SMALL,
-1);
gtk_label_set_text (GTK_LABEL (label_info), fname);
g_free (header);
g_free (fname);
if (pixbuf)
{
GtkWidget *image;
thumb_box = GTK_WIDGET (gtk_builder_get_object (builder, "thumb-box"));
if (thumb_box)
{
image = gtk_image_new_from_pixbuf (pixbuf);
gtk_box_pack_end (GTK_BOX (thumb_box), image, FALSE, FALSE, 0);
gtk_widget_show (image);
}
}
iptc_dialog_set_iptc (attributes, builder);
run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
return run;
}
/* private functions */
static void
iptc_dialog_set_iptc (GimpAttributes *attributes,
GtkBuilder *builder)
{
gchar *value;
gint i;
for (i = 0; i < G_N_ELEMENTS (iptc_tags); i++)
{
GimpAttribute *attribute = NULL;
GtkWidget *widget = NULL;
attribute = gimp_attributes_get_attribute (attributes, iptc_tags[i].tag);
widget = GTK_WIDGET (gtk_builder_get_object (builder, iptc_tags[i].tag));
if (attribute && widget)
{
value = gimp_attribute_get_string (attribute);
if (GTK_IS_ENTRY (widget))
{
GtkEntry *entry_widget = GTK_ENTRY (widget);
gtk_entry_set_text (entry_widget, value);
}
else if (GTK_IS_TEXT_VIEW (widget))
{
GtkTextView *text_view = GTK_TEXT_VIEW (widget);
GtkTextBuffer *buffer;
buffer = gtk_text_view_get_buffer (text_view);
gtk_text_buffer_set_text (buffer, value, -1);
}
g_free (value);
}
}
}
static void
iptc_change_iptc (GimpAttributes *attributes,
GtkBuilder *builder)
{
gint i;
for (i = 0; i < G_N_ELEMENTS (iptc_tags); i++)
{
GimpAttribute *attribute;
GObject *object = gtk_builder_get_object (builder,
iptc_tags[i].tag);
if (! strcmp ("single", iptc_tags[i].mode))
{
GtkEntry *entry = GTK_ENTRY (object);
const gchar *text = gtk_entry_get_text (entry);
if (strcmp ("", text))
{
attribute = gimp_attribute_new_string (iptc_tags[i].tag, (gchar *) text, TYPE_UNICODE);
gimp_attributes_add_attribute (attributes, attribute);
}
else
{
gimp_attributes_remove_attribute (attributes, iptc_tags[i].tag);
}
}
else if (!strcmp ("multi", iptc_tags[i].mode))
{
GtkTextView *text_view = GTK_TEXT_VIEW (object);
GtkTextBuffer *buffer;
GtkTextIter start;
GtkTextIter end;
gchar *text;
buffer = gtk_text_view_get_buffer (text_view);
gtk_text_buffer_get_start_iter (buffer, &start);
gtk_text_buffer_get_end_iter (buffer, &end);
text = gtk_text_buffer_get_text (buffer, &start, &end, TRUE);
if (strcmp ("", text))
{
attribute = gimp_attribute_new_string (iptc_tags[i].tag, (gchar *) text, TYPE_MULTIPLE);
gimp_attributes_add_attribute (attributes, attribute);
}
else
{
gimp_attributes_remove_attribute (attributes, iptc_tags[i].tag);
}
g_free (text);
}
}
}

View File

@@ -1,383 +0,0 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* metadata.c
* Copyright (C) 2013 Hartmut Kuhse
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <gegl.h>
#include <gtk/gtk.h>
#include <gexiv2/gexiv2.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
#include "libgimp/stdplugins-intl.h"
#define PLUG_IN_PROC "plug-in-metadata-editor"
#define PLUG_IN_BINARY "metadata"
#define PLUG_IN_ROLE "gimp-metadata"
#define EXIF_PREFIX "Exif."
#define IPTC_PREFIX "Iptc."
#define XMP_PREFIX "Xmp."
enum
{
C_XMP_TAG = 0,
C_XMP_VALUE,
NUM_XMP_COLS
};
enum
{
C_EXIF_TAG = 0,
C_EXIF_VALUE,
NUM_EXIF_COLS
};
typedef struct
{
gchar *tag;
gchar *mode;
} iptc_tag;
/* local function prototypes */
static void query (void);
static void run (const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals);
static gboolean metadata_dialog (gint32 image_id,
GExiv2Metadata *metadata);
static void metadata_dialog_set_metadata (GExiv2Metadata *metadata,
GtkBuilder *builder);
static void metadata_dialog_iptc_callback (GtkWidget *dialog,
GtkBuilder *builder);
/* local variables */
const GimpPlugInInfo PLUG_IN_INFO =
{
NULL, /* init_proc */
NULL, /* quit_proc */
query, /* query_proc */
run, /* run_proc */
};
static const iptc_tag const iptc_tags[] =
{
{ "Iptc.Application2.Byline", "single" },
{ "Iptc.Application2.BylineTitle", "single" },
{ "Iptc.Application2.Caption", "multi" },
{ "Iptc.Application2.Category", "single" },
{ "Iptc.Application2.City", "single" },
{ "Iptc.Application2.Copyright", "single" },
{ "Iptc.Application2.CountryName", "single" },
{ "Iptc.Application2.Credit", "single" },
{ "Iptc.Application2.Headline", "multi" },
{ "Iptc.Application2.Keywords", "multi" },
{ "Iptc.Application2.ObjectName", "single" },
{ "Iptc.Application2.ProvinceState", "single" },
{ "Iptc.Application2.Source", "single" },
{ "Iptc.Application2.SpecialInstructions", "multi" },
{ "Iptc.Application2.SubLocation", "single" },
{ "Iptc.Application2.SuppCategory", "multi" },
{ "Iptc.Application2.TransmissionReference", "single" },
{ "Iptc.Application2.Urgency", "single" },
{ "Iptc.Application2.Writer", "single" }
};
/* functions */
MAIN ()
static void
query (void)
{
static const GimpParamDef metadata_args[] =
{
{ GIMP_PDB_INT32, "run-mode", "Run mode { RUN-INTERACTIVE (0) }" },
{ GIMP_PDB_IMAGE, "image", "Input image" }
};
gimp_install_procedure (PLUG_IN_PROC,
N_("View and edit metadata (Exif, IPTC, XMP)"),
"View and edit metadata information attached to the "
"current image. This can include Exif, IPTC and/or "
"XMP information. Some or all of this metadata "
"will be saved in the file, depending on the output "
"file format.",
"Hartmut Kuhse, Michael Natterer",
"Hartmut Kuhse, Michael Natterer",
"2013",
N_("Image Metadata"),
"*",
GIMP_PLUGIN,
G_N_ELEMENTS (metadata_args), 0,
metadata_args, NULL);
gimp_plugin_menu_register (PLUG_IN_PROC, "<Image>/Image");
}
static void
run (const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals)
{
static GimpParam values[1];
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
*nreturn_vals = 1;
*return_vals = values;
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
INIT_I18N();
gimp_ui_init (PLUG_IN_BINARY, TRUE);
if (! strcmp (name, PLUG_IN_PROC))
{
GimpMetadata *metadata;
gint32 image_ID = param[1].data.d_image;
metadata = gimp_image_get_metadata (image_ID);
if (metadata)
{
metadata_dialog (image_ID, metadata);
}
else
{
g_message (_("This image has no metadata attached to it."));
}
status = GIMP_PDB_SUCCESS;
}
else
{
status = GIMP_PDB_CALLING_ERROR;
}
values[0].data.d_status = status;
}
static gboolean
metadata_dialog (gint32 image_id,
GExiv2Metadata *metadata)
{
GtkBuilder *builder;
GtkWidget *dialog;
GtkWidget *metadata_vbox;
GtkWidget *content_area;
GObject *write_button;
gchar *ui_file;
gchar *title;
gchar *name;
GError *error = NULL;
builder = gtk_builder_new ();
ui_file = g_build_filename (gimp_data_directory (),
"ui", "plug-ins", "plug-in-metadata.ui", NULL);
if (! gtk_builder_add_from_file (builder, ui_file, &error))
{
g_printerr ("Error occured while loading UI file!\n");
g_printerr ("Message: %s\n", error->message);
g_clear_error (&error);
g_free (ui_file);
g_object_unref (builder);
return FALSE;
}
g_free (ui_file);
name = gimp_image_get_name (image_id);
title = g_strdup_printf ("Metadata: %s", name);
g_free (name);
dialog = gimp_dialog_new (title,
"gimp-metadata-dialog",
NULL, 0,
gimp_standard_help_func, PLUG_IN_PROC,
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
NULL);
g_free (title);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_CLOSE,
-1);
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
metadata_vbox = GTK_WIDGET (gtk_builder_get_object (builder,
"metadata-vbox"));
gtk_container_set_border_width (GTK_CONTAINER (metadata_vbox), 12);
gtk_box_pack_start (GTK_BOX (content_area), metadata_vbox, TRUE, TRUE, 0);
write_button = gtk_builder_get_object (builder, "iptc-write-button");
g_signal_connect (write_button, "clicked",
G_CALLBACK (metadata_dialog_iptc_callback),
builder);
metadata_dialog_set_metadata (metadata, builder);
gtk_dialog_run (GTK_DIALOG (dialog));
return TRUE;
}
/* private functions */
static void
metadata_dialog_set_metadata (GExiv2Metadata *metadata,
GtkBuilder *builder)
{
GtkListStore *exif_store;
GtkListStore *xmp_store;
gchar **exif_data;
gchar **iptc_data;
gchar **xmp_data;
gchar *value;
gchar *value_utf;
GtkTreeIter iter;
gint i;
exif_store = GTK_LIST_STORE (gtk_builder_get_object (builder,
"exif-liststore"));
xmp_store = GTK_LIST_STORE (gtk_builder_get_object (builder,
"xmp-liststore"));
exif_data = gexiv2_metadata_get_exif_tags (metadata);
for (i = 0; exif_data[i] != NULL; i++)
{
gtk_list_store_append (exif_store, &iter);
value = gexiv2_metadata_get_tag_interpreted_string (metadata,
exif_data[i]);
value_utf = g_locale_to_utf8 (value, -1, NULL, NULL, NULL);
gtk_list_store_set (exif_store, &iter,
C_EXIF_TAG, exif_data[i],
C_EXIF_VALUE, value_utf,
-1);
}
xmp_data = gexiv2_metadata_get_xmp_tags (metadata);
for (i = 0; xmp_data[i] != NULL; i++)
{
gtk_list_store_append (xmp_store, &iter);
value = gexiv2_metadata_get_tag_interpreted_string (metadata,
xmp_data[i]);
value_utf = g_locale_to_utf8 (value, -1, NULL, NULL, NULL);
gtk_list_store_set (xmp_store, &iter,
C_XMP_TAG, xmp_data[i],
C_XMP_VALUE, value_utf,
-1);
}
iptc_data = gexiv2_metadata_get_iptc_tags (metadata);
for (i = 0; iptc_data[i] != NULL; i++)
{
GtkWidget *widget;
widget = GTK_WIDGET (gtk_builder_get_object (builder, iptc_data[i]));
value = gexiv2_metadata_get_tag_interpreted_string (metadata,
iptc_data[i]);
value_utf = g_locale_to_utf8 (value, -1, NULL, NULL, NULL);
if (GTK_IS_ENTRY (widget))
{
GtkEntry *entry_widget = GTK_ENTRY (widget);
gtk_entry_set_text (entry_widget, value_utf);
}
else if (GTK_IS_TEXT_VIEW (widget))
{
GtkTextView *text_view = GTK_TEXT_VIEW (widget);
GtkTextBuffer *buffer;
buffer = gtk_text_view_get_buffer (text_view);
gtk_text_buffer_set_text (buffer, value_utf, -1);
}
}
}
static void
metadata_dialog_iptc_callback (GtkWidget *dialog,
GtkBuilder *builder)
{
#if 0
GExiv2Metadata *metadata;
gint i;
metadata = gimp_image_get_metadata (handler->image);
for (i = 0; i < G_N_ELEMENTS (iptc_tags); i++)
{
GObject *object = gtk_builder_get_object (handler->builder,
iptc_tags[i].tag);
if (! strcmp ("single", iptc_tags[i].mode))
{
GtkEntry *entry = GTK_ENTRY (object);
gexiv2_metadata_set_tag_string (metadata, iptc_tags[i].tag,
gtk_entry_get_text (entry));
}
else if (!strcmp ("multi", iptc_tags[i].mode))
{
GtkTextView *text_view = GTK_TEXT_VIEW (object);
GtkTextBuffer *buffer;
GtkTextIter start;
GtkTextIter end;
gchar *text;
buffer = gtk_text_view_get_buffer (text_view);
gtk_text_buffer_get_start_iter (buffer, &start);
gtk_text_buffer_get_end_iter (buffer, &end);
text = gtk_text_buffer_get_text (buffer, &start, &end, TRUE);
gexiv2_metadata_set_tag_string (metadata, iptc_tags[i].tag, text);
g_free (text);
}
}
#endif
}

View File

@@ -2,6 +2,7 @@
'align-layers' => { ui => 1 },
'animation-optimize' => {},
'animation-play' => { ui => 1, gegl => 1 },
'attributes' => { ui => 1, gegl => 1 },
'blinds' => { ui => 1 },
'blur' => {},
'border-average' => { ui => 1, gegl => 1 },
@@ -66,10 +67,10 @@
'grid' => { ui => 1 },
'guillotine' => {},
'hot' => { ui => 1 },
'iptc' => { ui => 1, libs => 'GEXIV2_LIBS', cflags => 'GEXIV2_CFLAGS' },
'jigsaw' => { ui => 1 },
'mail' => { ui => 1, optional => 1 },
'max-rgb' => { ui => 1 },
'metadata' => { ui => 1, libs => 'GEXIV2_LIBS', cflags => 'GEXIV2_CFLAGS' },
'newsprint' => { ui => 1 },
'nl-filter' => { ui => 1 },
'oilify' => { ui => 1 },

View File

@@ -167,14 +167,14 @@ load_image (const gchar *filename,
GimpImageType layer_type;
gint32 layer;
const Babl *format;
GeglBuffer *buffer = NULL;
GeglBuffer *buffer = NULL;
gint bpp;
gint tile_height;
gchar *pixels = NULL;
gchar *pixels = NULL;
gint begin;
gint32 success = FALSE;
gint32 success = FALSE;
gchar *comment;
GimpMetadata *metadata;
GimpMetadata *metadata = NULL;
gboolean have_metadata = FALSE;
guchar *exif_data;
guint exif_size;
@@ -367,7 +367,9 @@ load_image (const gchar *filename,
}
if (have_metadata)
gimp_image_set_metadata (image, metadata);
{
gimp_image_set_metadata (image, metadata);
}
g_object_unref (metadata);

View File

@@ -58,12 +58,13 @@ gint32 preview_layer_ID;
gint32
load_image (const gchar *filename,
GimpRunMode runmode,
gint32 *layer_ID,
gboolean preview,
gboolean *resolution_loaded,
GError **error)
{
gint32 volatile image_ID;
gint32 layer_ID;
gint32 _layer_ID;
struct jpeg_decompress_struct cinfo;
struct my_error_mgr jerr;
jpeg_saved_marker_ptr marker;
@@ -232,11 +233,11 @@ load_image (const gchar *filename,
cinfo.output_width,
cinfo.output_height,
layer_type, 100, GIMP_NORMAL_MODE);
layer_ID = preview_layer_ID;
_layer_ID = preview_layer_ID;
}
else
{
layer_ID = gimp_layer_new (image_ID, _("Background"),
_layer_ID = gimp_layer_new (image_ID, _("Background"),
cinfo.output_width,
cinfo.output_height,
layer_type, 100, GIMP_NORMAL_MODE);
@@ -343,7 +344,7 @@ load_image (const gchar *filename,
* loop counter, so that we don't have to keep track ourselves.
*/
buffer = gimp_drawable_get_buffer (layer_ID);
buffer = gimp_drawable_get_buffer (_layer_ID);
format = babl_format (image_type == GIMP_RGB ? "R'G'B' u8" : "Y' u8");
while (cinfo.output_scanline < cinfo.output_height)
@@ -412,7 +413,9 @@ load_image (const gchar *filename,
gimp_progress_update (1.0);
}
gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
gimp_image_insert_layer (image_ID, _layer_ID, -1, 0);
*layer_ID = _layer_ID;
return image_ID;
}

View File

@@ -20,6 +20,7 @@
gint32 load_image (const gchar *filename,
GimpRunMode runmode,
gint32 *layer_ID,
gboolean preview,
gboolean *resolution_loaded,
GError **error);

View File

@@ -188,6 +188,7 @@ background_jpeg_save (PreviewPersistent *pp)
GFile *file = g_file_new_for_path (pp->file_name);
GFileInfo *info;
gchar *text;
gint32 layer_ID;
GError *error = NULL;
info = g_file_query_info (file,
@@ -218,7 +219,7 @@ background_jpeg_save (PreviewPersistent *pp)
g_object_unref (file);
/* and load the preview */
load_image (pp->file_name, GIMP_RUN_NONINTERACTIVE, TRUE, NULL, NULL);
load_image (pp->file_name, GIMP_RUN_NONINTERACTIVE, &layer_ID, TRUE, NULL, NULL);
}
/* we cleanup here (load_image doesn't run in the background) */

View File

@@ -173,6 +173,7 @@ run (const gchar *name,
GimpRunMode run_mode;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
gint32 image_ID;
gint32 layer_ID;
gint32 drawable_ID;
GimpParasite *parasite;
GError *error = NULL;
@@ -210,7 +211,7 @@ run (const gchar *name,
break;
}
image_ID = load_image (param[1].data.d_string, run_mode, FALSE,
image_ID = load_image (param[1].data.d_string, run_mode, &layer_ID, FALSE,
&resolution_loaded, &error);
if (image_ID != -1)
@@ -223,12 +224,12 @@ run (const gchar *name,
if (metadata)
{
GimpMetadataLoadFlags flags = GIMP_METADATA_LOAD_ALL;
GimpMetadataLoadFlags flags = GIMP_METADATA_LOAD_ALL;
if (resolution_loaded)
flags &= ~GIMP_METADATA_LOAD_RESOLUTION;
gimp_image_metadata_load_finish (image_ID, "image/jpeg",
gimp_image_metadata_load_finish (image_ID, layer_ID, "image/jpeg",
metadata, flags,
load_interactive);
@@ -574,7 +575,6 @@ run (const gchar *name,
g_object_unref (file);
}
}
if (metadata)
g_object_unref (metadata);
}

View File

@@ -211,7 +211,7 @@ run (const gchar *name,
if (resolution_loaded)
flags &= ~GIMP_METADATA_LOAD_RESOLUTION;
gimp_image_metadata_load_finish (image_ID, "image/x-psd",
gimp_image_metadata_load_finish (image_ID, -1, "image/x-psd",
metadata, flags,
interactive);
@@ -315,6 +315,8 @@ run (const gchar *name,
metadata, metadata_flags,
file, NULL);
g_object_unref (file);
g_object_unref (metadata);
}
values[0].data.d_status = GIMP_PDB_SUCCESS;
@@ -334,8 +336,6 @@ run (const gchar *name,
if (export == GIMP_EXPORT_EXPORT)
gimp_image_delete (image_ID);
if (metadata)
g_object_unref (metadata);
}
/* Unknown procedure */

View File

@@ -219,6 +219,7 @@ load_dialog (TIFF *tif,
gint32
load_image (GFile *file,
gint32 *layer_ID,
TIFF *tif,
TiffSelectedPages *pages,
gboolean *resolution_loaded,
@@ -929,6 +930,8 @@ load_image (GFile *file,
g_free (name);
}
*layer_ID = layer;
if (! base_format && image_type == GIMP_INDEXED)
{
/* can't create the palette format here, need to get it from

View File

@@ -37,6 +37,7 @@ gboolean load_dialog (TIFF *tif,
TiffSelectedPages *pages);
gint32 load_image (GFile *file,
gint32 *layer_ID,
TIFF *tif,
TiffSelectedPages *pages,
gboolean *resolution_loaded,

View File

@@ -264,13 +264,14 @@ run (const gchar *name,
if (run_it)
{
gint32 image;
gboolean resolution_loaded = FALSE;
gint32 image;
gint32 layer_ID;
gboolean resolution_loaded = FALSE;
gimp_set_data (LOAD_PROC,
&pages.target, sizeof (pages.target));
image = load_image (file, tif, &pages,
image = load_image (file, &layer_ID, tif, &pages,
&resolution_loaded,
&error);
@@ -291,7 +292,7 @@ run (const gchar *name,
if (resolution_loaded)
flags &= ~GIMP_METADATA_LOAD_RESOLUTION;
gimp_image_metadata_load_finish (image, "image/tiff",
gimp_image_metadata_load_finish (image, layer_ID, "image/tiff",
metadata, flags,
run_mode == GIMP_RUN_INTERACTIVE);

View File

@@ -0,0 +1,63 @@
## Process this file with automake to produce Makefile.in
libgimpui = $(top_builddir)/libgimp/libgimpui-$(GIMP_API_VERSION).la
libgimpwidgets = $(top_builddir)/libgimpwidgets/libgimpwidgets-$(GIMP_API_VERSION).la
libgimp = $(top_builddir)/libgimp/libgimp-$(GIMP_API_VERSION).la
libgimpconfig = $(top_builddir)/libgimpconfig/libgimpconfig-$(GIMP_API_VERSION).la
libgimpcolor = $(top_builddir)/libgimpcolor/libgimpcolor-$(GIMP_API_VERSION).la
libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la
libgimpmath = $(top_builddir)/libgimpmath/libgimpmath-$(GIMP_API_VERSION).la
if OS_WIN32
mwindows = -mwindows
endif
if HAVE_WINDRES
include $(top_srcdir)/build/windows/gimprc-plug-ins.rule
metainfo_RC = metainfo.rc.o
endif
AM_LDFLAGS = $(mwindows)
libexecdir = $(gimpplugindir)/plug-ins
libexec_PROGRAMS = metainfo
metainfo_SOURCES = \
metainfo.c \
metainfo.h \
interface.h \
interface.c \
metainfo-helper.c \
metainfo-helper.h \
datapage.c \
datapage.h \
page-description.c \
page-description.h \
page-artwork.c \
page-artwork.h \
page-administration.c \
page-administration.h \
page-rights.c \
page-rights.h
AM_CPPFLAGS = \
-I$(top_srcdir) \
$(GTK_CFLAGS) \
$(GEGL_CFLAGS) \
$(GEXIV2_CFLAGS) \
-I$(includedir)
LDADD = \
$(libgimpui) \
$(libgimpwidgets) \
$(libgimp) \
$(libgimpmath) \
$(libgimpconfig) \
$(libgimpcolor) \
$(libgimpbase) \
$(GEXIV2_LIBS) \
$(GTK_LIBS) \
$(RT_LIBS) \
$(INTLLIBS) \
$(metainfo_RC)

1307
plug-ins/metainfo/datapage.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,128 @@
/* page.h
*
* Copyright (C) 2014, Hartmut Kuhse <hatti@gimp.org>
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*/
// int (*arr)[8];
#ifndef __PAGE_H__
#define __PAGE_H__
#include <glib.h>
G_BEGIN_DECLS
#define TYPE_DATAPAGE (datapage_get_type ())
#define DATAPAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATAPAGE, datapage))
#define DATAPAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATAPAGE, datapageClass))
#define IS_DATAPAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATAPAGE))
#define IS_DATAPAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATAPAGE))
#define DATAPAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATAPAGE, datapageClass))
typedef enum
{
WIDGET_TYPE_ENTRY,
WIDGET_TYPE_COMBOBOX
} WidgetType;
typedef enum
{
LIST_TYPE_NONE,
LIST_TYPE_SEQ,
LIST_TYPE_BAG,
LIST_TYPE_LANGALT
} ListType;
typedef struct _ComboBoxData ComboBoxData;
struct _ComboBoxData
{
const gchar *val_in_combo; /* translateable - value shown in the combobox */
const gchar *val_in_tag; /* value saved as tag value */
};
typedef struct _MetadataEntry MetadataEntry;
struct _MetadataEntry
{
gchar *label; /* label of the widget */
const gchar *ui_label; /* name of the label widget in GtkBuilder ui file */
const gchar *ui_entry; /* name of the entry widget in GtkBuilder ui file */
const gchar *xmp_tag; /* xmp tag, saved in GimpAttribute.name */
WidgetType widget_type; /* type of entry widget in GtkBuilder ui : GtkEntry or GtkComboBox */
gint number_of_comboarray; /*number of entry in ComboBoxData - array. Only valid for combobox entries */
};
typedef struct _StructureElement StructureElement;
struct _StructureElement
{
gint number_of_element; /* simply the number, corresponding to STRUCTURES_ON_PAGE */
const gchar *identifier; /* translateable - identifier for combobox entries */
const gchar *struct_tag; /* structure tag without array number */
GimpAttributeStructureType struct_type; /* type of structure, gexiv2 cannot get the right list type from tag*/
const gchar *expand_label_widget; /* name of the expander label widget */
const gchar *struct_combo_widget; /* name of the combobox widget for this structure */
const gchar *struct_liststore_widget; /* name of the liststore of the combobox for this structure */
const gchar *add_widget; /* name of the add structure button for this structure */
const gchar *remove_widget; /* name of the remove structure button for this structure */
};
typedef struct _Datapage Datapage;
typedef struct _DatapageClass DatapageClass;
struct _Datapage {
GObject parent_instance;
StructureElement *struct_element;
gint structure_element_count;
MetadataEntry *metadata_entry;
gint metadata_entry_count;
ComboBoxData *combobox_data;
gint combobox_data_count;
gint max_combobox_entries;
GtkBuilder *builder;
// GimpAttributes *attributes;
};
struct _DatapageClass {
GObjectClass parent_class;
};
GType datapage_get_type (void) G_GNUC_CONST;
Datapage* datapage_new (GtkBuilder *builder);
void datapage_set_structure_element (Datapage *datapage,
StructureElement *struct_elem,
gint structure_element_count);
void datapage_set_combobox_data (Datapage *datapage,
ComboBoxData *combobox_data,
gint combobox_data_count,
gint max_combobox_entries);
void datapage_set_metadata_entry (Datapage *datapage,
MetadataEntry *metadata_entry,
gint metadata_entry_count);
void datapage_read_from_attributes (Datapage *datapage,
GimpAttributes **attributes);
void datapage_save_to_attributes (Datapage *datapage,
GimpAttributes **attributes);
G_END_DECLS
#endif

Some files were not shown because too many files have changed in this diff Show More