Commit Graph

120 Commits

Author SHA1 Message Date
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
Michael Natterer c6ac3550d3 plug-ins: replace ">> 3" by "/ 8" in psd-load.c 2015-05-01 16:31:21 -04:00
Michael Natterer cf4cc504cf plug-ins: set G_LOG_DOMAIN in file-psd so it's possible to see the debug output 2015-05-01 16:19:52 -04:00
Michael Natterer bc4cf9918f Bug 673501 - Issue with Overlay
GIMP's OVERLAY mode was identical to SOFTLIGHT. This commit fixes the
issue and introduces a NEW_OVERLAY mode and enum value.

- change gimp:overlay-mode to be a real (svg-ish) overlay mode
- when compositing, map OVERLAY to gimp:softlight-mode
- when compisiting, map NEW_OVERLAY to gimp:overlay-mode
- bump the XCF version when NEW_OVERLAY is used
- map OVERLAY to SOFTLIGHT when loading and saving XCF
- map OVERLAY to softlight in all PDB setters
- map OVERLAY to softlight when deserializing a GimpContext
- change all paint mode menus to show an entry for NEW_OVERLAY
  instead of OVERLAY
- change PSP, PSD and OpenRaster to use NEW_OVERLAY

These changes should (redundantly) make sure that no OVERLAY enum
value is used in the core any longer because it gets mapped to
SOFTLIGHT at all entry points, with the downside of introducing a
setter/getter asymmetry when OVERLAY was set in a PDB api.
2015-04-29 13:32:58 -04:00
Michael Natterer 48618b88dc plug-ins: update file-psd/.gitignore 2015-04-26 15:50:13 -04:00
Michael Natterer 37c8e5602d plug-ins: merge file-psd-load and file-psd-save into one binary file-psd
which share the psd.c file for query() and run(), instead of having
save's stuff commented out in psd.c, and having it duplicated in
psd-save.c for the separate binary.
2015-04-26 15:37:31 -04:00
Michael Natterer 68ba2037c9 Bug 748488 - Unable to export to *.psd
Fix multiple small but crashing bugs:

- call gegl_init()
- gegl_buffer_get()'s scale must be 1.0 not 0
- don't unref the metadata object twice
2015-04-26 15:06:16 -04:00
Michael Natterer 3d3f1d6855 Bug 748487 - Thumbnails sometimes don't render correctly with *.PSD files
Using the right Babl format (JPEG previews don't have an alpha
channel), and fixing the main scanline loading loop (which was totally
busted) make the PSD previews look like images.
2015-04-26 13:31:01 -04:00
Massimo Valentini b42e764d9c Bug 698859: PSD import filter: opening a PSD file causes...
...file-psd-load segfault.

Fix loading of PSDs where the number of "end group" markers doesn't
match the number of "start group" markers, which seems to be what is
saved by Photoshop in some cases/versions/whatever.
2015-04-25 23:26:30 -04:00
Michael Natterer 9c5ef53c66 plug-ins: convert tabs to spaces in file-psd/psd-load.c 2015-04-25 23:20:00 -04:00