Commit Graph

7768 Commits

Author SHA1 Message Date
Ell 67e685758d plug-ins: in file-psd, insert layers to image after writing buffers
When loading PSDs, insert layers to the image as the last step of
layer creation, after writing the pixel data to their buffers, so
that the data of child layers is available when their parent
group's projection is subseqeuently invalidated; otherwise, we'd
need an additional gimp_drawable_update() call after writing the
data to the buffers.
2017-12-06 10:20:01 -05:00
Thomas Manni b1ac9f33b2 Bug 790917 - Exporting 16bit per channel w/ alpha data as TGA destroys part of the image
Do not use the bytes-per-pixel size of the input drawable.
Use the bpp of the output format instead.
2017-12-03 01:22:28 +01:00
Jehan 1e78d3d249 plug-ins: make Darktable version checking more generic.
I realize that on Fedora 27, the output of `darktable --version` is:
"this is darktable darktable-2.2.5-4.fc27"
This is different from the expected output in our plug-in ("this is
darktable 2.2.5"). I assume this version string can be customized and
distribution packagers will use the capability. So a regular expression,
in a slightly more flexible fashion would be better. I still assume that
the version string with start with "this is darktable", but then I
accept any non-number string until I reach a common major.minor.patch
version-looking string.
2017-11-26 03:56:55 +01:00
Tobias Ellinghaus c10c640451
plug-ins: Hide darktable debug output
Only show debugging messages from the darktable raw loader when the
environment variable DARKTABLE_DEBUG is set.
2017-11-20 12:48:47 +01:00
Ell 54ec9373fb Bug 789981 - Wrong layer structure in PSDs with deeply nested layer groups
Photoshop CS5 adds support for layer groups whose nesting depth is
above 5.  The end markers of these groups use an undocumented
"lsdk" key for their section dividers, rather than the usual
"lsct".  This caused the PSD plugin to treat them as regular
layers, resulting in wrong layer-tree structure.

Add support for "lsdk" section dividers upon loading, and also
generate "lsdk" section dividers upon saving sufficiently-deep
groups.
2017-11-11 17:51:02 -05:00
Ell 6708af3976 plug-ins: in file-psd, repalce tabs with spaces 2017-11-11 17:51:02 -05:00
Ell 70881728f2 Bug 786844 - Wavelet decompose plugin changes image slightly
(AKA Issue with grain merge layer mode)

Fall back to using the legacy grain-extract/merge modes when the
input image precision is integer, and only use the non-legacy modes
when the precision is floating point.  The midpoint intensity value
of the non-legacy modes is 0.5, which isn't representable exactly
using integer precision, causing small deviations between the input
image and the reconstructed image.
2017-10-29 11:27:35 -04:00
Ell 66b92854f0 Bug 789436 - Fix out of boundary write in file-xmc.c.
Fix stupid mistake in last commit, by me :)
2017-10-24 20:05:15 -04:00
Tobias Stoeckmann 9a073508f7 Bug 789436 - Fix out of boundary write in file-xmc.c.
A malicious XMC file can contain an invalid TOC count, which could lead
to an out of boundary write on 32 bit systems due to integer overflow.

This error occurs during thumbnail creation.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2017-10-24 19:06:22 -04:00
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
Michael Natterer f47df72dc6 plug-ins: link file-raw aginst libgimpcolor and libgimpconfig explicitly
otherwise, implicit transitive linking will pull in the installed
libs, not the ones from the source tree, and the build can fail when
any of the libs' APIs changes.

Also remove some useless #includes.
2017-10-09 18:33:02 +02: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
Alexandre Prokoudine 290c5f54e3 wavelet-decompose: marke user-visible messages for translation 2017-09-28 04:10:55 +03:00
Alexandre Prokoudine fbf0d33323 Mark user-visible messages for translation 2017-09-28 03:59:44 +03:00
Jehan 88e6dc46af plug-ins: use a domain on g_set_error().
Without a domain error, glib outputs on console:
> g_error_new_valist: runtime check failed: (domain != 0)
Let's just create a domain error for the file-pdf-load plugin.
2017-09-26 23:48:52 +02:00
Jehan f4d9aa00f1 Bug 788175 - New string in file-pdf-load.c needs plurals. 2017-09-26 23:43:55 +02:00
Thomas Manni 41a2a3634c plug-ins: wavelet-decompose improvements
Add an option to keep the decomposition in a layer group.

Add an option to add layer mask to each scales layers.

Do not use 'new from visible' because it produces unexpected result when
- image is already composed by several layers
- target layer has not the same size as the image canvas
Replaced by succession of layer copy and merge down.
2017-09-26 13:51:46 +02:00
Jehan d5fd67022b plug-ins: add parameters to file-pdf-load2 to load multiple pages.
This is a new API function, so now is the right time to add missing
parameters! This will allow to load a selection of pages, and even to
reorder the document while doing so. Or simply load all pages in the
right order with n_pages <= 0.
2017-09-25 03:26:25 +02:00
Jehan 71450ef7da plug-ins: forgot to typecast the parameter.
Never commit even oneliners when exhausted. This is today's lesson.
2017-09-25 01:53:59 +02:00
Jehan ce4cc1a768 Bug 787039 - Make clear that the PDF import dialog selects all pages...
... by default.
Even though selecting nothing is equivalent to selecting all in our
code, let's just explicitly select all pages before showing the dialog
so to make this behavior explicit.
2017-09-24 23:56:35 +02:00
Jehan 0f2002c948 plug-ins: check GError domain and code, not the message.
When there is a well-documented GError domain/code, use these,
especially since messages can be localized (not sure if that is the case
for this one, but theoretically it could) and change over time.

Also remove the "nice-to-have" comment on file-pdf-load since we won't
be changing it now, but leave it on file-pdf-load2 parameters which can
still change before 2.10.
2017-09-10 22:57:12 +02:00
Jehan af8519b208 plug-ins: fixes and review to the previous commit.
- Clean out some C++ style comments (our coding style only accepts
  C-style comments. Anyway these comments were just old useless code).
- A block indentation fix.
- As a guideline, it is better to keep a GError as the last parameter.
- In non-interactive mode, the new procedure must use the value in
  parameter, otherwise passing the password just doesn't work.
2017-09-10 21:55:41 +02:00
Lionel N 8ef7303f7d Bug 787090 - Encrypted PDF support
Fix for non-interative mode so that it doesn't raise any gtk dialogs.
Added a file-pdf-load2 procedure with an extra argument for the password.
2017-09-10 21:02:05 +02:00
Jehan 54b4d1e0a2 Bug 787326 - MacOS's CFSTR() does not work with const variables.
This is untested, written from gathering information on the web. MacOS
people, please try and compile GIMP!
2017-09-09 14:39:05 +02: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
Tobias Ellinghaus b86b19235e
darktable: Fix typo in last commit 2017-09-04 14:08:31 +02:00
Tobias Ellinghaus 82dd06720d
darktable: Add more shell escaping for Windows
Apparently Lua chokes when it sees c:\darktable\... as a path to a script,
thinking the '\d' was an escape sequence. Thus we have to add an extra
layer of escaping. Houdini like. Who came up with the brilliant idea to
use '\' as a separator anyway? So much pain just to be different?
2017-09-04 12:56:34 +02:00
Tobias Ellinghaus 855f2f1cbe
plug-ins: Fix finding raw loaders on Win/OSX
Without including gdk.h the #defines to determine the system are not
available, resulting in no platform specific code being compiled in.
2017-09-04 11:59:33 +02:00
Michael Natterer e6c1c14a94 pdb, libgimp: change the gimp-drawable-invert API again
Remove the invert-linear and invert-non-linear variants and simply add
"gboolean linear" to gimp-drawable-invert. This should actually be an
enum but I didn't find a good name right now...
2017-09-03 21:28:47 +02:00
Jehan 278c054dd6 plug-ins: gimp_dialog_run() returns int.
Oups my review was not thorough enough!
2017-09-01 13:09:20 +02:00
Lionel N 6b1291747f Open password protected PDF feature
Supports for password protected PDF. When an encrypted PDF is opened, a
dialog box asks for the password.
When an encrypted PDF is opened, a dialog box asks for the password.
The password dialog box loops as long as the password is wrong (or user
hits CANCEL/escape key)

Reviewed and fixed by Jehan.
2017-09-01 12:56:49 +02:00
Michael Natterer 2e6c39ed9c pdb, libgimp: rename gimp_drawable_invert() to _invert_non_linear()
and add gimp_drawable_invert_linear(). Also, finally deprecate
gimp_invert() and port all its uses in plug-ins and scripts to
gimp_drawable_invert_non_linear() so the result is the same.
2017-08-30 12:27:17 +02:00
Juan Palacios f3d684b0fc plug-ins: in file-psd, fix missing some attributes loading empty layers 2017-08-27 15:16:19 -04:00
Jehan ad4564e527 plug-ins: do not use stock IDs.
They are to be deprecated in future GTK+ and we don't use them anymore
anywhere else in our code.
See also commit 7da7bab0.
2017-08-23 21:47:14 +02: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 497fb9b0c3 plug-ins: in metedata-editor.c, don't use initial declarations
... in for loops
2017-08-21 11:41:33 -04:00
Michael Natterer 4f245c8272 plug-ins: s/snprintf/g_snprintf/ in fits-io.c 2017-08-21 12:31:28 +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
Tobias Ellinghaus 87dbc05cbd
darktable: add info message to dt when started
Tell users that they just have to close darktable to export the image
and don't need to do anything.
2017-08-12 21:55:54 +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