Commit Graph

129 Commits

Author SHA1 Message Date
Ell 4165ba2a03 plug-ins: in file-psd, fix active layer selection upon loading
When loading a PSD, set the active layer after adding all the
layers to the image, instead of at the time of its creation, since
the active layer may change when adding subsequent layers.
2017-10-22 12:30:22 -04:00
Ell 6fb497247d plug-ins: in file-psd, read/write layer group expanded state
Use the new gimp-item-{get,set}-expanded() PDB functions to read
and write group-layer expanded state in PSDs.
2017-10-22 12:30:22 -04:00
Ell adff950d58 app: in file-psd, make layer-group saving more Photoshop-like
Tweak the layer group saving code so that the saved PSDs match
Photoshop-produced PSDs a bit more closely.  For the most part, it
doesn't seem to matter much, but it does somewhat improve
compatibility with other programs that read PSDs.
2017-10-09 10:45:52 -04:00
Ell 9e015f4b7d plug-ins: in file-psd, fix bad sign extension in decode_packbits() 2017-10-09 08:48:03 -04:00
Ell eb2741ed70 Bug 592533 - Mask positions move to top-left when saving as PSD
And: Bug 593251 - Mask positions may be incorrect when opening a PSD

The position-relative flag of layer masks doesn't specify how the
mask position is represented in the PSD -- it's always absolute --
but rather whether the layer and the mask are linked or unlinked.
Since masks are always linked to their layers in GIMP, just ignore
this flag (and, when saving, clear the flag so that the mask is
linked to layer when loaded in PS.)
2017-09-04 16:03:10 -04:00
Ell 3cfa35ec07 plug-ins: in file-psd, fix active layer selection during loading 2017-09-04 13:58:37 -04:00
Ell 6ecce4cbf9 plug-ins: in file-psd, fix potential group-layer naming conflict during loading
Set the layer name of group layers early on, while processing their
end marker, so that the default group name won't collide with the
names of subsequent layers, leading to wrong layer names.  The real
name of the group layer is set again when processing its start
marker.
2017-09-04 13:58:37 -04:00
Ell dc89e380c8 plug-ins: in file-psd, improve layer opacity loading/saving
Avoid losing precision and improve rounding when rescaling layer
opacity during loading and saving, respectively.
2017-09-04 13:58:37 -04:00
Ell 58f2bbfdbd plug-ins: in file-psd, refactor layer creation code during loading
Reduce code duplication for layer creation and property
initialization across normal layers, empty layers, and group
layers.
2017-09-04 13:58:37 -04:00
Juan Palacios f3d684b0fc plug-ins: in file-psd, fix missing some attributes loading empty layers 2017-08-27 15:16:19 -04:00
Michael Natterer e16c8a2352 Move the new "default_new_layer_mode" APIs to the image...
...in both the core and libgimp.

Images now know what the default mode for new layers is:

- NORMAL for empty images
- NORMAL for images with any non-legacy layer
- NORMAL_LEGAVY for images with only legacy layers

This changes behavior when layers are created from the UI, but *also*
when created by plug-ins (yes there is a compat issue here):

- Most (all?) single-layer file importers now create NORMAL layers
- Screenshot, Webpage etc also create NORMAL layers

Scripts that create images from scratch (logos etc) should not be
affected because they usually have NORMAL_LEGACY hardcoded.

3rd party plug-ins and scripts will also behave old-style unless they
get ported to gimp_image_get_default_new_layer_mode().
2017-08-21 20:18:00 +02:00
Ell e40ebde536 plug-ins: in file-psd, add support for exporting layer groups
Preserve layer-group structure when exporting to PSD, instead of
flattening the groups.

Fix active-layer index saving (the index was reversed.)
2017-08-20 17:16:28 -04:00
Ell 33255a439b plug-ins: in file-psd, improve PS <-> GIMP layer-mode mapping
Streamline the layer-mode mapping code, to reduce duplication.

Add mappings for the following modes:  Subtract, Divide, Luma/
luminance darken only (Darker Color), Luma/luminance lighten only
(Lighter Color), and Luminance (Luminosity).
2017-08-20 17:15:32 -04:00
Michael Natterer 838449254a plug-ins: use gimp_get_default_new_layer_mode() for most new layers
instead of hardcoding NORMAL_LEGACY.
2017-08-20 17:12:46 +02:00
Ell dccaa5d5d1 plug-ins: in file-psd, use SRC_OVER and RGB_PERCEPTUAL for all layers
Use SRC_OVER, instead of SRC_ATOP, as the composite mode for all
layers (or use AUTO, when it results in SRC_OVER), to match
Photoshop's behavior.  Use RGB_PERCEPTUAL as the blend and composite
space, instead of AUTO, whose interpretation depends on the specific
layer mode, to match Photoshop's behavior for RGB images.  Use NORMAL
mode, instead of NORMAL_LEGACY, with the above properties, for normal
layers, for consistency with the other layer modes, which don't (and,
indeed, can't) use the legacy modes.
2017-08-09 09:59:39 -04:00
Ell 4d3481ca7a plug-ins: small cleanup to last commit 2017-08-09 08:38:08 -04:00
Ell e8f6a3888b plug-ins: in file-psd, read blend mode info of lsct layer records
The section-divider (lsct) layer resource may contain blend mode
information, which apparently overrides the blend mode specified in
the layer record.  When reading such a resource, replace the layer's
blend mode with the one specified by the resource.

It seems like pass-through group layers specify normal mode in their
layer record, but pass-through in their section-divider resource, so
this commit allows correctly loading such layers.
2017-08-09 08:33:29 -04:00
Alexandre Prokoudine 63b041046e Some basics of loading and exporting the pass-through mode of layer groups in PSD.
The plug-in is still missing two essential bits:

1) setting blend mode to a layer group;
2) preserving layer group when exporting to PSD.
2017-08-09 01:31:44 +03:00
Ell 03756d0980 app: rename "Color (HSV) (legacy)" mode to "Color (HSL) (legacy)"
The color-space qualification is, in fact, a 2.9 thing, so there's no
historic reason to keep the wrong name for the legacy mode.
2017-03-16 06:23:30 -04:00
Ell b22c09e7b7 app: implement color-erase mode as a GimpOperationLayerMode blendfun
... and get rid of the dedicated op.  This gives us support for all
the blend/composite options for this mode.

Rename COLOR_ERASE to COLOR_ERASE_LEGACY, with perceptual blending/
compositing and immutable everything, and add a new COLOR_ERASE
mode, defaulting to linear blending/compositing, with mutable
everything.  Modify affected code.
2017-03-08 14:13:51 -05:00
Michael Natterer 3cf423f0cd *: rename NORMAL to NORMAL_LEGACY and NORMAL_LINEAR to NORMAL
and make NORMAL_LEGACY immutable.
2017-02-26 16:26:34 +01:00
Michael Natterer 63f1ec4101 app, libgimp, plug-ins: remove the _LINEAR layer mode variants
Missing: PDB API to set the various sub-modes we now have for layer modes.
2017-02-19 23:15:59 +01:00
Juan Palacios 9b636ff798 Bug 778571 - Add support to import/export layer color tags from/to psd files
Except GIMP's "brown" tag which is not supported by PS.
2017-02-13 21:30:26 +01:00
Alexandre Prokoudine b3e4588a5f psd: add support for loading and exporting Hard Mix layer mode
Also remove warning from the Vivid Light loader, we are good now.
2017-02-05 16:36:41 +03:00
Alexandre Prokoudine 832c79e8d8 Activate exporting more layer modes from XCF to PSD 2017-02-04 18:43:34 +03:00
Alexandre Prokoudine 2bce09ff9b Add Linear Burn to PSD exporting, update the list of XCF layer modes 2017-02-04 18:03:59 +03:00
Alexandre Prokoudine 023cdd159e Update XCF to PSD layer mode mappings 2017-02-04 17:55:18 +03:00
Alexandre Prokoudine 0584fc0e45 psd: add stubs for Darker Color and Lighter Color layer modes 2017-02-04 17:28:13 +03:00
Alexandre Prokoudine b471c90aee Update PSD to GIMP layer mode mappings 2017-02-04 17:22:07 +03:00
Michael Natterer 393ce1d53b plug-ins: use the new composite mode API in file-psd
No clue if this is right.
2017-02-02 00:40:37 +01:00
Michael Natterer 152adbb1bd Rename GIMP_LAYER_MODE_FOO_BROKEN to GIMP_LAYER_MODE_FOO_LEGACY
"Broken" sounds like it needs fixing, but it's legacy compat stuff
that will have to stay for all eternity.
2017-01-09 01:27:20 +01:00
Michael Natterer 66060e3307 app, libgimp*, plug-ins: replace enum GimpLayerModeEffects by GimpLayerMode
with proper value names. Mark most values as _BROKEN because they use
weird alpha compositing that has to die. Move GimpLayerModeEffects to
libgimpbase, deprecate it, and set it as compat enum for GimpLayerMode.
Add the GimpLayerModeEffects values as compat constants to script-fu
and pygimp.
2017-01-08 23:00:19 +01:00
Hartmut Kuhse 66bc98d299 Revert "New GimpMetadata as subclass of GExiv2Metadata"
This reverts commit 3ab08c8bfd.
2017-01-03 19:36:22 +01:00
Hartmut Kuhse 3ab08c8bfd New GimpMetadata as subclass of GExiv2Metadata 2017-01-03 19:26:35 +01:00
Jehan e83ed61178 plug-ins: cleaning out some indentation tabs. 2016-11-03 23:02:19 +01:00
Matthias Junker-Petschick 3139cb9305 Bug 771558 - PSD files with a layer additional data length...
...not divisible by 4 are incorrectly reported as corrupt

file-psd: Do not round up the extra data length field when reading
layer info.

Fixes the PSD layer extra information handling in read_layer_info() by
not rounding up the data length field to a multiple of 4.

Layers can contain extra data, which is encoded at the end of layer
records. The length of this data should always be stored rounded up to
an even byte count. When loading a PSD file, it can be expected that
this value is already rounded up and this operation should not be
necessary. If an uneven byte count is encountered, a warning is
emitted but the loading process is not aborted.
2016-10-09 22:29:51 +02:00
Richard Kreckel dd9b0fc55b Bug 768044 - Fix many typos
This fixes many typos in comments and one in a user-visible string (msgid
"center abscisse" changed to "center abscissa" in affected po files. too).
2016-06-26 00:35:24 +02:00
Jehan 8a37c928eb app, plug-ins, libgimp*: clean out all remaining trailing spaces/tabs.
Rather than just discovering them by chance, a simple grep and some
search and replace are much more efficient! :-)
Cleaning only done on C and automake files.
2016-06-02 02:04:26 +02:00
Jehan ec27b539ea plug-ins: various s/save/export/ replacement on visible strings. 2016-02-16 02:35:43 +01:00
Massimo Valentini 32469d53b7 Bug 684295: wrong layer group structure in gimp 2.8.2...
... (read PSD file from PS CS3)

use a position of 0 when inserting normal layers
as they're always inserted on top of their group

-1 means inside the group when the active drawable is
a group or above it when it's not. This used to work
before layer groups or in simple cases.
2016-01-04 12:55:58 +01:00
Massimo Valentini e79632728d Bug 760029: PSD loader fails to load files with...
... adjustment or fill layers

the length of the compressed channel data was truncated
for the wrong type used in read_channel_data signature
2016-01-04 12:55:58 +01:00
Michael Natterer 67597f42ad Bug 754727 - gimp 2.9.1 git compilation fails in file-psd
Fix some glitches in patches I recently applied blindly :)
2015-09-08 18:54:02 +02:00
Julien Nabet 5a2757c6ec Bug 753986 - manage layer resource block lnsr
Layer name source (id on 4 characters encoded in MacRoman).
psd from PS>5 have "luni" (Layer Unicode)

See https://bugzilla.gnome.org/show_bug.cgi?id=753986#c4 for more details

Janitorial on lyvr:
move IFDBG at the beginning of the function
+change the content of it
2015-09-06 16:57:11 +02:00
Julien Nabet 8fb017342c Bug 753980 - manage layer resource block lyvr
Layer version appeared in PS7
Just warns if version is < 70 but nothing more
2015-08-23 13:51:05 +02:00
Michael Natterer 01df24c47e plug-ins: remove obsolete #defines from file-psd/psd.h 2015-08-20 11:26:59 +02:00
Michael Natterer 1d37c67879 plug-ins: use the GimpColorProfile API instead of the "icc-profile" parasite 2015-08-20 11:15:26 +02:00
ShadowKyogre 925ee21750 Bug 750594 - Colors in PSD files are far lighter on import and far darker on export
GIMP's PSD plugin was assuming that colors in PSD files are linearly interpolated
on both export and import. This commit fixes the issue by doing the following:

- when importing, assume the colors are gamma interpolated in the entire image
- when importing and exporting, treat the colors in each layer as gamma interpolated
- when importing and exporting, treat indexed colors as actually indexed colors
- when exporting, treat the interpolation in the channels and masks as linearly interpolated
2015-06-24 19:02:17 +02:00
Massimo Valentini 6138b58f14 file-psd: use correct size for high bit depth extra channels
it was missing a '* bps' in the size of data passed to GEGL
and the lower half of an extra-channel from a 16bit psd
appeared as garbage in GIMP
2015-06-19 18:58:39 +02:00
Massimo Valentini b07cf7fbee file-psd: improve high bit depth and compression support
see:
Bug 750729 - Importing *.PSDs with greater than
 8-bit depth lose their masks and appear funny
2015-06-13 18:33:00 +02:00
Michael Natterer 34c788d34e plug-ins: fix indentation of calls to read_channel_data() in psd-load.c 2015-05-01 16:36:51 -04:00