Commit Graph

44 Commits

Author SHA1 Message Date
Jehan d3139e0f7c app: support saving/exporting with multi-selection.
This commit just changes our saving API (i.e. the GimpSaveProcedure
class) to take an array of drawables as argument instead of a single
drawable.

It actually doesn't matter much for exporting as the whole API seems
more or less bogus there and all formats plug-ins mostly care only
whether they will merge/flatten all visible layers (the selected ones
don't really matter) or if the format supports layers of some sort. It
may be worth later strengthening a bit this whole logics, and maybe
allow partial exports for instance.

As for saving, it was not even looking at the passed GimpDrawable either
and was simply re-querying the active layer anyway.
Note that I don't implement the multi-selection saving in XCF yet in
this commit. I only updated the API. The reason is that the current
commit won't be backportable to gimp-2-10 because it is an API break. On
the other hand, the code to save multi-selection can still be backported
even though the save() API will only pass a single drawable (as I said
anyway, this argument was mostly bogus until now, hence it doesn't
matter much for 2.10 logics).
2020-05-17 18:32:16 +02:00
Michael Natterer dad65000e1 plug-ins: port file-raw-save to GimpProcedureConfig and propwidgets
and remove its builder file.
2019-10-23 19:08:34 +02:00
Sabri Ünal 6dcdbf652b CID 228166: Resource leak in file-raw-data.c
Overwriting fp in fp = fopen(newfile, "wb") leaks the storage that fp points to.

(cherry picked from commit 31001d9f29)
2019-10-19 23:30:28 +02:00
Michael Natterer df8d5b02ae libgimp, plug-ins: remove the "preview" parameter from gimp_ui_init()
It's dead since a looong time.
2019-09-20 19:56:00 +02:00
Michael Natterer 6bca8c4f89 pdb, app, libgimp, plug-ins: replace most PDB filenames/URIs by GFile
and in an attack of madness, changes almost all file plug-in
code to use GFile instead of filenames, which means passing
the GFile down to the bottom and get its filename at the very
end where it's actually needed.
2019-09-11 21:48:34 +02:00
Michael Natterer 8a78203aed Properly prefix the values of enum GimpPDBProcType
to be GIMP_PDB_PROC_TYPE_PLUGIN, _EXTENSION etc.
2019-08-30 12:52:28 +02:00
Michael Natterer ee5a93f368 plug-ins: port file-raw-data to GimpPlugIn and libgmp objects 2019-08-24 12:33:18 +02:00
Michael Natterer de121374ef Change the "handles uri" flag of file procedures to "handle remote"
And always pass URIs to all file procedures, the ones what didn't
register as "handles remove" will only ever get local file:// URIs.

Change all file plug-ins (also legacy ones) to expect URIs instead
of filenames, and convert to local paths in the plug-in.

The wire protocol should now be almost 100% clean of non-UTF-8 strings.
2019-08-19 12:05:12 +02:00
Michael Natterer e09e563a70 Initial space invasion commit in GIMP
All babl formats now have a space equivalent to a color profile,
determining the format's primaries and TRCs. This commit makes GIMP
aware of this.

libgimp:

- enum GimpPrecision: rename GAMMA values to NON_LINEAR and keep GAMMA
  as deprecated aliases, add PERCEPTUAL values so we now have LINEAR,
  NON_LINEAR and PERCPTUAL for each encoding, matching the babl
  encoding variants RGB, R'G'B' and R~G~B~.

- gimp_color_transform_can_gegl_copy() now returns TRUE if both
  profiles can return a babl space, increasing the amount of fast babl
  color conversions significantly.

- TODO: no solution yet for getting libgimp drawable proxy buffers in
  the right format with space.

plug-ins:

- follow the GimpPrecision change.

- TODO: everything else unchanged and partly broken or sub-optimal,
  like setting a new image's color profile too late.

app:

- add enum GimpTRCType { LINEAR, NON_LINEAR, PERCEPTUAL } as
  replacement for all "linear" booleans.

- change gimp-babl functions to take babl spaces and GimpTRCType
  parameters and support all sorts of new perceptual ~ formats.

- a lot of places changed in the early days of goat invasion didn't
  take advantage of gimp-babl utility functions and constructed
  formats manually. They all needed revisiting and many now use much
  simpler code calling gimp-babl API.

- change gimp_babl_format_get_color_profile() to really extract a
  newly allocated color profile from the format, and add
  gimp_babl_get_builtin_color_profile() which does the same as
  gimp_babl_format_get_color_profile() did before. Visited all callers
  to decide whether they are looking for the format's actual profile,
  or for one of the builtin profiles, simplifying code that only needs
  builtin profiles.

- drawables have a new get_space_api(), get_linear() is now get_trc().

- images now have a "layer space" and an API to get it,
  gimp_image_get_layer_format() returns formats in that space.

- an image's layer space is created from the image's color profile,
  change gimpimage-color-profile to deal with that correctly

- change many babl_format() calls to babl_format_with_space() and take
  the space from passed formats or drawables

- add function gimp_layer_fix_format_space() which replaces the
  layer's buffer with one that has the image's layer format, but
  doesn't change pixel values

- use gimp_layer_fix_format_space() to make sure layers loaded from
  XCF and created by plug-ins have the right space when added to the
  image, because it's impossible to always assign the right space upon
  layer creation

- "assign color profile" and "discard color profile" now require use
  of gimp_layer_fix_format_space() too because the profile is now
  embedded in all formats via the space.  Add
  gimp_image_assign_color_profile() which does all that and call it
  instead of a simple gimp_image_set_color_profile(), also from the
  PDB set-color-profile functions, which are essentially "assign" and
  "discard" calls.

- generally, make sure a new image's color profile is set before
  adding layers to it, gimp_image_set_color_profile() is more than
  before considered know-what-you-are-doing API.

- take special precaution in all places that call
  gimp_drawable_convert_type(), we now must pass a new_profile from
  all callers that convert layers within the same image (such as
  image_convert_type, image_convert_precision), because the layer's
  new space can't be determined from the image's layer format during
  the call.

- change all "linear" properties to "trc", in all config objects like
  for levels and curves, in the histogram, in the widgets. This results
  in some GUI that now has three choices instead of two.
  TODO: we might want to reduce that back to two later.

- keep "linear" boolean properties around as compat if needed for file
  pasring, but always convert the parsed parsed boolean to
  GimpTRCType.

- TODO: the image's "enable color management" switch is currently
  broken, will fix that in another commit.
2018-07-21 16:42:57 +02:00
Michael Natterer 5f700549e7 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
Simon Budig 7d64cf62c6 libgimpwidgets: rename the _grid()-Variants of gimp_scale_entry_*
Adjust all plugins to follow accordingly.

This concludes the GtkTable'ocide.
2018-05-20 21:06:35 +02:00
Simon Budig a076afc2fb file-raw-data: kill GtkTable 2018-05-20 21:06:34 +02:00
Michael Natterer bdbec7941c Use the new macros from the last commit in all files
...and gone are the annoying warnings.
2018-05-20 21:06:34 +02:00
Michael Natterer a535e425ee libgimpwidgets: move all GimpPreviewArea members to private 2018-05-20 21:06:33 +02:00
Michael Natterer eb8487b487 plug-ins: s/GtkObject/GtkAdjustment/g in plug-ins/common/ 2018-05-20 21:06:27 +02:00
luz.paz 147c09f19e Bug 795161 - Misc. typo fixes in source comments and doxygen
Found via `codespell`
Follow-up to  commit 7fdb963e01
2018-04-18 21:06:57 +02:00
Jehan e0c36f3e1b plug-ins: auto-detect HGT variants.
Since SRTM-1 and SRTM-3 data have a fixed image size, it is actually
very easy to auto-detect these by checking the file size. There is no
need to ask the user to select between the 2 variants (even though these
values are made quite obvious by official download links).
I still left the dropdown appear optionally if the detection fails for
some reason (we never know, at least that makes a fallback, for instance
to be able to load partial data!). Yet now by default, HGT file settings
should be fully auto-detected.
2017-12-10 22:50:36 +01:00
Jehan 43f7a43700 plug-ins: update file-hgt-load description...
... and minor space and indentation fix.
2017-12-10 21:37:24 +01:00
Jehan 7fce78b2ce plug-ins: properly set returned error in pdb call.
g_set_error() so that when samplespacing is not a valid argument for
file-hgt-load, the error is properly propagated.
Also add a g_warning() to get the error in the terminal as well.
2017-12-10 05:35:36 +01:00
Jehan 35597db931 plug-ins: register a separate load handler file-hgt-load for HGT files.
This allows for it to show as a separate item in the open dialog, with
proper naming. Also add proper arguments so that the handler works as a
PDB function in non-interactive mode, unlike file-raw-load which works
only interactively.
2017-12-10 05:35:04 +01:00
Jehan 733b2344b3 plug-ins: leave a message for translators.
"Digital Elevation Model" (DEM) is a technical term which therefore
cannot be translated just by its meaning.
2017-12-09 23:12:01 +01:00
Jehan b78b14b17e plug-ins: let's special-case just a bit the HGT data.
- Display title "Digital Elevation Model data" instead of just "Image".
- Don't show the type combo anymore, since HGT is always 16-bit signed
  integer in big endian.
- Don't show the width and height either, but instead show a dropdown
  list to choose between either SRTM-1 or SRTM-3 data. There seems to be
  only these 2 types of data, and this will determine the width and
  height. This choice (SRTM-1 vs 3) will mostly likely be better known
  by people than knowing what image dimension they have to set,
  especially since official links for such files seem to all include the
  information.
2017-12-09 23:01:46 +01:00
Jehan 88ccdb4e2f plug-ins: minor cleaning and fixes.
- Add some parentheses to sizeof (*pointer). Maybe it's just me, but it
  is just a bit clearer to me.
- Free in_raw when out_raw allocation failed.
- Use strrchr() instead of strchr() to get the extension (I had a case
  when testing where the file was inside a folder named similarly with a
  ".hgt" and it would break the comparison test).
- Do a case-insensitive comparison. Even though the original files from
  NASA use lowercase, just to be sure.
2017-12-09 22:20:43 +01:00
Massimo Valentini c572bdf6d6 Bug 771661: Extend the raw data import plugin to open .hgt files
add support to load single channel 16 bit, signed/unsigned,
little/big endian 2d raster data as a 16 bit RGB gamma GIMP image
2017-12-09 20:48:29 +01: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
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
Michael Natterer b1506229f9 plug-ins: change save procedures of the file-raw-data plug-in
The signature of the original file-raw-save procedure must not change,
so change it to use the old parameters.

Change the other procedure (with additional arguments) to
file-raw-save2.
2017-07-31 20:17:51 +02:00
Massimo Valentini f2306abc0a Bug 761170: Warnings building with clang
Fix some of the warnings.
2017-07-15 21:05:56 +02: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 801bd8fb3f plug-ins: get rid of icons in dialog buttons (use labels not stock IDs) 2017-02-12 16:18:54 +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
Michael Schumacher b6e7d19e4f Merge branch 'master' into bug-728633 2016-12-26 20:01:06 +01:00
Michael Natterer 4033415a79 app, libgimpwidgets, plug-ins: kill gtk_scrolled_window_add_with_viewport()
It's deprecated in GTK+ 3.x, so we get rid of some deprecation
warnings. Also, it has always only been a utility function that hides
what is really going on in the widget hierarchy.
2016-09-07 20:12:28 +02:00
Björn Kautler 1ca556972e Bug 728633 - Improvements to the file-raw plugin.
Allow non-interactive and last-vals call of raw image data export.
2016-06-13 23:31:36 +02:00
Björn Kautler 827f72bba5 Bug 728633 - Improvements to the file-raw plugin.
Save and restore last selected values and provide settable default selections for the raw image data export dialog.
2016-06-13 23:07:50 +02:00
Björn Kautler 2395e99a1b Bug 728633 - Improvements to the file-raw plugin.
Use GtkBuilder for raw image data export dialog.
2016-06-13 23:06:31 +02:00
Michael Natterer 26ff8eb40d Bug 761573 - Problem with Raw Image Loader plugin
Use g_file_query_info() to get the file's size, stat() has some
windows 64 bit problem I've forgotten.
2016-02-12 00:36:11 +01:00
Michael Natterer e1baaa0677 Bug 742821 - Grayscale-mode image malformed when exported as planar raw image data
Fix saving of planar data by taking the actual number of components of
the drawable into account, instead of always assuming 3 (RGB).
2015-03-04 22:32:07 +01:00
Michael Natterer f28878b6d3 plug-ins: start the progress before opening files for loading/saving
so the user gets feedback as early as possible.
2014-07-23 21:37:13 +02:00
Michael Natterer b883aec224 plug-ins: pass "RAW" to gimp_export_image() in file-raw-data.c
So the export logic GUI becomes debuggable.
2014-04-27 19:15:17 +02:00
Michael Natterer 740d83c70a plug-ins: fix the build in file-raw-data.c 2014-04-22 22:59:07 +02:00
Björn Kautler c3f2a5a116 Bug 728633 - Improvements to the file-raw plugin
Export the image before saving as raw image data.
2014-04-22 22:10:09 +02:00
Björn Kautler 3e96b96640 Bug 728633 - Improvements to the file-raw plugin
Register 'data' as save extension.
2014-04-22 22:02:29 +02:00
Michael Natterer 14ab0da020 plug-ins: rename file-raw to file-raw-data
to remove confusion with raw digital camera files.
2013-09-01 20:02:56 +02:00