Commit Graph

7875 Commits

Author SHA1 Message Date
Jehan 34b68a2c1d plug-ins: rename s/YUV/YCbCr/ s/eYCC/xvYCC/ s/RGB/sRGB/.
Exchanging with OpenJPEG developers and searching more on the topic, it
seems that YUV is more often refered to as YCbCr. Wikipedia says:

> typically the terms YCbCr and YUV are used interchangeably, leading to
> some confusion. The main difference is that YUV is analog and YCbCr is
> digital

As for eYCC, I am told this is extended YCC. It seems this is refered as
xvYCC (I really can't find much under "eYCC"). So let's rename it too.

Hopefully I made no mistakes!
2018-03-20 17:09:31 +01:00
Jehan 5732b7ab6d plug-ins: add a color space parameter to file-j2k-load().
JPEG 2000 codestream doesn't have a header and guessing the color space
in particular is not foolproof (especially when 3 or 4 components, which
can be many spaces). Therefore the need of a parameter on the API.

Note that JP2 images should always have the color space information. In
interactive mode, I try to be a bit flexible to salvage broken JP2 with
no color space information in the header, but I am not adding a
parameter in file-jp2-load() (on purpose, since we are not going to add
in the API a parameter for a case not supposed to happen with properly
encoded files).
2018-03-20 16:52:04 +01:00
Jehan 7e52c48364 plug-ins: open a dialog to select color space of JPEG 2000 codestream.
JPEG 2000 codestream (.j2k/.j2c) are only compressed code stream data,
without header. In particular we don't have color information, such as
the color space. So we need to open a dialog asking to set the color
space in interactive mode.

Note: according to OpenJPEG developers, a JP2 image (not codestream)
should always have a color space defined in its header. But just to be
flexible, the same dialog may get raised as well if we try to load a JP2
with no valid color space defined in header and no ICC profile embedded.
Maybe if such a thing happened, it means the image is corrupt, yet we
may as well try and salvage it anyway.

Note 2: I also removed a weird test which was setting some images as
being YUV color space by mistake. This actually fixes bug 794413 as a
side effect.
2018-03-20 14:50:23 +01:00
Jehan 5e5fa4a024 plug-ins: .jpc is another known extension for JPEG 2000 codestream.
Even though I haven't seen working samples with this extension,
according to some references, this is a common extension for compressed
JPEG 2000 code stream. Also our old plug-in was listing this extension,
so let's do so now as well.

To this day, the only 2 extensions we used to list in the JasPer-based
plug-in and not in the OpenJPEG one are .jpf and .jpx (JPEG 2000 Part-2)
since OpenJPEG does not have support yet. But actually I think the old
plug-in may have simply been "lying" since JasPer website says the
library is meant to implement JPEG-2000 Part-1 standard.
So I believe we are now on par (and even better on many aspects) with
the former plug-in implementation based on libjasper.
2018-03-20 02:05:49 +01:00
Jehan f2c80e1878 plug-ins: coding style cleaning.
Trailing whitespaces here and there, alignment issues, and so on…
Also get rid of an unused variable.
2018-03-16 22:08:40 +01:00
Darshan kadu a9a3a67cf2 plug-ins: 16/32 bit JPEG2000 support. 2018-03-16 21:39:08 +01:00
Jehan 4fdf301dea plug-ins: properly check widget class holding tag data.
Some tag data is hold in GtkEntry, other in GtkTextView, which are not
parent to each other. Previous checks were wrong and resulted in
"invalid cast from 'GtkEntry' to 'GtkTextView'" WARNINGs (followed by
many CRITICALs because of this first error).

Also properly free the data returned by gtk_text_buffer_get_text() which
is allocated (unlike strings returned by gtk_entry_get_text() which must
not be freed).
2018-03-16 20:20:24 +01:00
Ell a7f3a2dd9f app, pdb, libgimp, plug-ins, menus: rename layer composite modes
Our composite modes don't correspond directly to the Porter-Duff
operators after which they're named, and these names aren't too
descriptive anyway.

Rename the composite modes as follows:

  Source Over       =>  Union
  Source Atop       =>  Clip to Backdrop
  Destination Atop  =>  Clip to Layer
  Source In         =>  Intersection

Update relevant code, including UI text, enumerator names, function
names, and action names.
2018-03-14 16:19:09 -04:00
Jehan 8de34f704d plug-ins: clean a bit commented-out code.
These are remnants from the old Jasper implementation and should have
been deleted days ago.
2018-03-10 03:14:54 +01:00
Jehan a9ff5e14ce plug-ins: run gimp_image_set_color_profile() after image creation.
After moving up the profile extraction, I was running
gimp_image_set_color_profile() with a non-existing image id, which was
obviously wrong. Reorder a bit the operations.

Also try to guess the color space from the profile not only with
OPJ_CLRSPC_UNSPECIFIED but also OPJ_CLRSPC_UNKNOWN images. Indeed I
encountered a case of .jp2 image with no color space in the header, but
with an embedded profile. And unlike the .j2c files I encountered
earlier, the color space was now *_UNKNOWN.
See https://github.com/uclouvain/openjpeg/issues/1103
2018-03-10 02:00:07 +01:00
Jehan 3d55452933 Bug 794152 - JPEG 2000 Code Stream .j2c support.
Current OpenJPEG code only supported the base JP2 container. It now
supports also the JPEG 2000 codestream (which is usually contained
inside other formats, like the JP2 container format, but can also
sometimes be on its own).
The current magics and extension strings were also mixing all kind of
formats. This is now cleaned up a bit.
2018-03-10 00:03:15 +01:00
Jehan 00e828a3ef plug-ins: deduct color space from profile if not specified otherwise.
As explained in the previous commit, the color space is not always
properly declared, in particular with J2K files. If a profile is present
in such a case, try to deduct the color space from this information.
2018-03-09 22:12:23 +01:00
Jehan 6f5c20eef1 plug-ins: assume RGB/RGBA for JPEG2000 without declared color space.
It seems that the color space is not necessarily declared for a JPEG2000
image. From tests, it looks like it especially happens with JPEG2000
codestream (.j2c or .j2k). This variant is apparently mostly designed to
be embedded (from what I read), which may explain why the color space is
not always set (I assume the embedding format would have the color space
information). Mostly a guess.
2018-03-09 21:59:04 +01:00
Jehan ca1304da19 plug-ins: make the JP2 loading errors more accurate. 2018-03-09 16:44:13 +01:00
Jehan 73fbb166b3 plug-ins: robuster tests for image types and minor syntax fixes.
Rather than just assuming all non-gray images are RGB, do a bit more
robust check and reject unknown formats. Indeed even though I see we
took care of YUV, e-YCC and CMYK images above (and normally either
converted them to RGB or already exited with an error), I can see that
the OpenJPEG library could still return OPJ_CLRSPC_UNKNOWN or
OPJ_CLRSPC_UNSPECIFIED. Let's be thorough and not assume we got a SRGB
here.
Also add the alpha-variant tests inside their parent image type
respective test. This should not change anything by any logics, but
let's not leave anything for chance to strike us.

Finally minor coding style fixes:
- Add a space before "if|for" and parenthese.
- Remove some spaces after parentheses.
- Get rid of 2 trailing whitespaces.
- Align function call parameters, declarations, assignments…
2018-03-04 18:27:36 +01:00
Darshan kadu 53a7c6c3a3 Bug 792141 - Replace jasper with openjpeg.
Made plug-in support the RGB and grayscale with alpha.

Comment by Jehan: this makes the original branch work finally usable on
some JPEG 2000 images. Support of the format is not complete yet though
but at least the port to OpenJPEG is now in usable test.
2018-03-04 18:26:07 +01:00
Mukund Sivaraman 58a0a65160 file-jp2-load: Switch from Jasper to OpenJPEG library 2018-03-04 18:21:22 +01:00
Jehan 40df83ad71 Bug 794023 - Bad/Double free bugs found by scan-build.
Thanks to Massimo for raising this issue.
2018-03-03 16:27:04 +01:00
Jehan 8796220434 plug-ins: clean out some lost tabs. 2018-02-26 19:12:50 +01:00
Simon Mueller 653798146e Bug 789728 - Screenshot whole screen (Windows 10) only grabs screen...
... from first monitor

While researching the cause for the missing window contents (bug
793722), I noticed that the full screen capture mode was also not
working as expected. No matter how many monitors were connected, it only
ever captured the contents of the main monitor. This patch adjusts the
source rectangle for the BitBlt copy operation so that multiple monitors
are captured correctly.
2018-02-24 18:27:27 +01:00
Simon Mueller 14236761cd Bug 793722 - Capture screenshot of single window fails if...
... thewindow is IE 11.

The screenshot plugin for windows had a problem when capturing
applications that use hardware rendering acceleration (e.g.
Chromium-based Apps, IE11). Those applications seem to render their
content to a device context (DC) that is different from the one that can
be retrieved via GetDCEx(hWnd). So a screenshot that simply copies the
main window DC will be incomplete (see bug attachment) or just plain
black.

This patch removes the code that uses GetDCEx for single window
screenshots and always uses the display device context instead. This
makes sure that all window contents are actually visible in the
screenshot. With this change, we now have to set the source coordinates
in the call to BitBlt() to the window's coordinates to exclude
everything that isn't the window from the screenshot when doing a single
window screenshot.

Review comment by Jehan: as Simon notes in bug 793722, there is a
regression though, which is that this new code cannot capture any part
of a window which is not in any screen. This is still an improvement
because at least for what is on screen, we always get exactly the same
as what is displayed. This is especially true since hardware-accelerated
applications are more and more common. So let's push this first commit
and hope for further improvements.
2018-02-23 18:19:36 +01:00
Alexandre Prokoudine 912e9baaa6 file-pdf-load: fix plurals 2018-02-18 14:12:03 +03:00
Ell af6b891b64 plug-ins: in file-psd, read and write group-layer masks
Add support for loading and saving group-layer masks from/to PSD
files.
2018-02-05 16:22:12 -05:00
Jehan 2d2dc450e8 plug-ins: clean out some tabs who lost their way. 2018-02-05 15:09:19 +01:00
Jehan 42eaf588fd plug-ins: ico export crashes on indexed images.
It seems the current code simply forgot to break on indexed types and
therefore hit some g_return_*if_reached() code breaking the logics.
Looking further, I see some code taking care of indexed images and
converting them to RGB. And testing after adding breaks looks like it
works just fine.
So I am assuming this was just forgotten breaks indeed, and not on
purpose not allowing indexed images (if that were the intent though,
this is not how it should be done).
2018-02-05 15:04:37 +01:00
Jehan c548d5d342 Bug 792657 - A useless error message when cancelling opening a .svgz.
Use the new gimp_get_pdb_status() to forward the error returned by
gimp_file_load(). Previous code was always returning
GIMP_PDB_EXECUTION_ERROR when the file load was failing, but this was
not granular enough. In particular when the file load is actually
interactively cancelled through Esc or the "Cancel" button, we don't
want to display an error message on screen. Therefore we forward the
actual error raised by the underlining plug-in.
2018-01-19 14:20:40 +01:00
Jehan 911e46ee2b plug-ins: indentation fix.
So minor! But while I was reading this code, I just couldn't just leave
this one indentation unfixed. ;P
2018-01-19 14:04:47 +01:00
Massimo Valentini cb78618d75 Bug 783703: no progress bar changes when exporting to psd format 2018-01-14 23:28:12 +01:00
Jehan 4849d41060 plug-ins: check pointer before freeing.
Thanks to Massimo for notifying about it.
2018-01-14 00:56:40 +01:00
Jehan dcd4e46441 plug-ins: implement RGBE exporting through GEGL.
While we are at it, let's just add RGBE exporting. It's just as easy.

Also rename s/file-gegl-load-rgbe/file-load-rgbe/. All formats just use
the "file-FORMAT-(load|save)" naming for their procedure, even when
implemented directly through "gegl:load|save".
2018-01-13 01:27:01 +01:00
Jehan 3cca5a0a7b plug-ins: use only "#?" for RGBE magic number.
It seems that various software use something different after the "#?",
and even Blender code just ended up only use these 2 characters as magic
number. See also bug 792453.
2018-01-13 00:42:06 +01:00
Massimo Valentini 9799032e4f Bug 792453: Extend the raw data import plugin to open...
... .hdr files (RGBE images)

Expose in GIMP GEGL RGBE file support
2018-01-12 22:00:11 +01:00
Massimo Valentini 5db03953c0 Bug 785138: .GIH brushes and reference displacement...
...when them have layers with different sizes

properly center smaller brushes loading gih files
and always NUL terminate brushes name
2018-01-12 00:49:59 +01:00
Jehan 82f6baf2bb plug-ins: file export should follow preferences regarding metadata.
Various plug-ins exporting metadata should now follow preferences, which
would override any default. Of course these preferences can still be
overriden by saved settings (global parasite), previous run settings,
and finally through the GUI when interactive.
2018-01-11 22:17:32 +01:00
Jehan 096debb0fd Bug 790552 - do not save metadata by default.
This is a privacy concern. Whereas importing metadata is usually a good
idea, exporting it should be a conscious action. A lot of private data
can be leaked through metadata and many people don't realize it (which
also usually means they don't need it). On the other hand, the people
who realize it are the ones who would explicitly edit the metadata and
check what they want to be exported or not.

This is only a first step. Some people may want to always export the
metadata and for these people, there should be abilities to change the
default.
2018-01-11 00:39:22 +01:00
Jehan bc5032012e plug-ins: fix some coding-style issues in metadata-editor.
Mostly missing spaces here and there fixed with search and replace
followed by manual verification and retouching.
2018-01-10 03:32:33 +01:00
Jehan 62ee5d3c7e plug-ins: metadata-editor crashes when strtok() initialized with NULL.
When running strtok() the first time, it needs to be non-NULL so we must
check for the string. This is even more important because NULL actually
has a special meaning in strtok() to indicate further search on the same
string, in a stateful way. So searching with NULL at first call was
crashing the metadata editor plug-in in my case.
I could also imagine it could have reused strings from previous
searches, mixing metadata contents in some edge cases. Anyway that would
be bad as well!

While I was there, I also checked for non-null search string before
strstr() calls, when there was not already such a check before. This
function also requires non-NULL haystack argument.
It feels like this code doesn't do much validity checks, and it's likely
there are more similar issues. I haven't reviewed the whole code, only
this part which was crashing here.
2018-01-10 03:25:24 +01:00
Jehan 657c39dc74 plug-ins, themes: use the "normal text" color as stdout color of...
... the python console.
It was using "selected text", which is most often inverted color (close
if not identical to the background color). As a consequence, it made
stdout output unreadable by default, forcing themes to always define a
style for the python console. Using "normal text" is a much better
choice to default to something readable from a parent style.

As a consequence, I also removed "python-fu-console" styling from the
System theme, where there should be as few theming as possible.
2018-01-09 18:41:59 +01:00
Massimo Valentini e663526de9 Bug 753736: GIMP Python green prompt is virtually...
... unreadable to those with certain type of color blindness
2018-01-09 17:44:37 +01:00
Michael Natterer 29fbeb9e02 plug-ins: "port" qbist to float (remove the uchar conversion from float code) 2018-01-08 21:50:20 +01:00
Michael Natterer f7fe2753e2 plug-ins: port qbist to GEGL, it's just too cool/weird to get lost 2018-01-08 02:45:54 +01:00
Michael Natterer c8e1703dce plug-ins: never edit common/Makefile.am directly
edit plugin-defs.pl and run ./mkgen.pl
2018-01-08 02:43:26 +01:00
Jehan 22a6e2bb19 plug-ins: update the warning message for dimension of X bitmap cursors.
After discussing with Mitch and understanding better the X bitmap/pixmap
history, I make the warning more specific to X bitmap cursors only (not
pixmap).
Also I can see our code always exports RGBA data, so I am not quite sure
if this warning even makes sense since X bitmaps are bicolor maps. On
the other hand, Mitch tells me that "these days gdk turns pixbufs into
bitmaps if the x server doesn't support rgba cursors", so maybe that can
still be of use to warn cursor designers for max compatibility.
Still that's pretty old compatibility stuff, so let's replace "may" by
"might".
2018-01-08 00:19:34 +01:00
Jehan 575013feaa plug-ins: fix a bit of coding styles (spaces and alignment). 2018-01-08 00:07:58 +01:00
Jehan df933c7b70 plug-ins: discard leading 0s in regular expression for cursor size/delay
Leading 0s have no special value, we use base 10 anyway. Removing
leading 0s allows to not trigger the 8-digit test, hence modify a valid
cursor size unecessarily.
2018-01-07 15:49:37 +01:00
Jehan 0484ce83af Bug 792266 - Increase maximum size of x11 cursor during export.
We were basing our max export size on a macro value defined in
libXCursor code: MAX_BITMAP_CURSOR_SIZE. This macro is still defined in
libXCursor and still has the same value (64), yet it is unsure how far
or even where this is enforced since it seems we can get at least 96px
cursors in GNOME/X11.

As a consequence, this commit:
- still warns when cursor size is over this value, with more explicit
  text, yet does not change the cursor size anymore! So it is now
  possible to export bigger cursors, but you still get a warning.
- only changes the cursor size for the existing more-than-8-digits test
  and I add a warning when it does so (we should never modify an image
  silently!).
- adds the size 96 as not triggering the warning about GNOME Settings
  since it definitely looks like this size is valid there (according to
  my own empirical tests). Also since 96 is higher than the libXCursor
  current MAX macro value, this really raises the question to where this
  max is enforced and whether we should not just drop the first warning.

Note that it breaks a bit the string freeze since I modify one string
and adds one. Sorry for this!
2018-01-07 15:16:28 +01:00
Massimo Valentini a5b2139ca3 Bug 765651: file-psd-load.exe crashes importing file
Rather skip extra layer masks than crash.
2018-01-06 12:44:28 +01:00
Massimo Valentini 7ccf5d2624 Bug 761140: importing gimpui module causes plugin query failure
After commit f51acf3bfb the python console no longer
initialized gimpui, because it is no longer part of module
initialization.

If the plug-in is run noninteractively and it imports
gimpui explicitely it is now necessary to call gimp_ui_init ()
at the right time
2018-01-06 12:12:16 +01:00
Michael Natterer 3b950f6177 plug-ins: some cleaup in file-raw, mostly formatting 2018-01-05 15:31:57 +01:00
Tobias Ellinghaus 313d8c2876
file-darktable: Add more debug prints 2018-01-05 14:21:59 +01:00