Commit Graph

156 Commits

Author SHA1 Message Date
Niels De Graef 5f92ced1f3 Add (nullable) if applicable
Basically this commit makes sure that all return values that are marked
as "Returns:" also have a `(nullable)` annotation if it is mentioned on
the same line that NULL can also be returned.

This will prevent a few problems in GObject-introspection.
2019-08-03 07:53:47 +00:00
Niels De Graef 1dda60154c Use "Returns:" to annotate return values
To be able to annotate return values through GObject-introspection, you
need to make sure it is tagged with `Returns:` and not something else.
2019-08-03 07:53:47 +00:00
Ell 3afdd7c5c2 app: in GimpDrawable::set_buffer(), take bounds rect instead of offset only
In GimpDrawable::set_buffer(), and the corresponding
gimp_drawable_set_buffer_full() function, take a bounds rectangle,
which specifies both the drawable's new offset and its new size,
instead of only taking the new offset.  In
gimp_drawable_real_set_buffer(), set the item size according to the
rect dimensions, instead of the buffer dimensions.  The rect's
width/height may be 0, in which case the buffer's dimensions are
used.

Adapt the rest of the code.

We do this in preparation for maintaining the drawable's bounding
box separately from its logical bounds, allowing the drawable
content to extend beyond its bounds.
2019-08-02 00:40:01 +03:00
Ell a84b57e67e app: fix unhandled enumeration value warning in gimptextlayer.c 2018-09-18 16:23:19 -04:00
Ell 3b0040c043 app, libgimp*, modules: don't use g_type_class_add_private() ...
... and G_TYPE_INSTANCE_GET_PRIVATE()

g_type_class_add_private() and G_TYPE_INSTANCE_GET_PRIVATE() were
deprecated in GLib 2.58.  Instead, use
G_DEFINE_[ABSTRACT_]TYPE_WITH_PRIVATE(), and
G_ADD_PRIVATE[_DYNAMIC](), and the implictly-defined
foo_get_instance_private() functions, all of which are available in
the GLib versions we depend on.

This commit only covers types registered using one of the
G_DEFINE_FOO() macros (i.e., most types), but not types with a
custom registration function, of which we still have a few -- GLib
currently only provides a (non-deprecated) public API for adding a
private struct using the G_DEFINE_FOO() macros.

Note that this commit was 99% auto-generated (because I'm not
*that* crazy :), so if there are any style mismatches... we'll have
to live with them for now.
2018-09-18 14:39:56 -04:00
ONO Yoshio e98255efc1 Issue #2124 - The origin of vertical, right to left text does not...
... load correctly

Fixed incorrect initialization of private base_dir.
2018-08-31 08:40:16 +09:00
Michael Natterer 8226265b12 Issue #1954 - GIMP-2.99 color changes when converting between...
...linear and perceptual precision

Under certain circumstances (e.g. the image has no color profile),
GimpLayer's implementation of GimpDrawable::convert_type() didn't have
enough information to do the right color space conversion.

Intead of messing with stuff like "set profile in between doing a and b",
simply add a "src_profile" parameter to GimpDrawable::convert_type() so
the complete color space conversion information is available without
relying on obscure states that could change in the future.

Make sure all callers pass the right src_profile, particularly in
gimp_image_convert_precision(), which also needed fixing.
2018-08-05 22:28:56 +02:00
Jehan 5c56f8cb3a app: minor coding-style cleanup.
Adding spaces between function names and parenthese.

I would normally have just amended the contributed patches and pushed,
but gitlab is making our review process over-complicated with many
roundtrips with contributors, and review quality drops. Stating it here
for the records!
See commit 70945b8960 (where this cleaning
should have directly been done).
2018-08-02 12:59:53 +02:00
ONO Yoshio 70945b8960 Fixed that anchor position of text is shifted when text direction is changed.
anchor of LTR is top-left corner.
anchor of TTB-RTL is top-right cornner.
anchor of TTB-LTR is top-left cornner.
2018-08-02 10:29:54 +00:00
ONO Yoshio 587d9bbb03 MR !19: Add support for vertical text writing.
Squashed commit of the following:

commit ee1ff7d502658cfa1248a13a3f0348495db07eda
Author: ONO Yoshio <ohtsuka.yoshio@gmail.com>
Date:   Sun Jul 29 00:31:47 2018 +0900

    Fixed that gimp-text-dir-ttb-* icons are lacked in Symbolic.

commit d87d012d697628da28fe90199cc04b95b72ba8ef
Author: ONO Yoshio <ohtsuka.yoshio@gmail.com>
Date:   Sat Jul 28 16:23:10 2018 +0900

    Fix a typo.

commit cf0238bf7df56c384cdf3b7ec69557d14740f853
Author: ONO Yoshio <ohtsuka.yoshio@gmail.com>
Date:   Sat Jul 28 15:50:57 2018 +0900

    Fixed seg fault error.

commit b07f60d06f
Author: ONO Yoshio <ohtsuka.yoshio@gmail.com>
Date:   Fri Jul 27 17:15:34 2018 +0900

    Add support for vertical text writing.

    https://gitlab.gnome.org/GNOME/gimp/issues/641
2018-07-30 19:14:49 +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
Ell 7c7b6eb537 app: use default new-layer mode for layer groups and text layers
When creating a layer group, or a text layer, use the image's
default new-layer mode, instead of always using (non-legacy)
NORMAL.
2018-06-06 02:39:34 -04:00
Michael Natterer e88fb8e9c7 app: remove all old font management code, switch to GimpFontFactory[View]
Biggest change in this commit is reordering stuff in GimpContext
because GimpFont is now a first class citizen.
2018-06-03 01:27:06 +02:00
Ell f2134180de app, pdb: wait for fonts to load before dependent operations
Use gimp_fonts_wait(), added in the previous commit, to wait for
fonts to finish loading before operations that depend on font
availability.  In particular, this includes font- and text-related
PDB functions, and text-layer rendering.
2018-05-29 16:04:28 -04:00
Ell 1ac2b928d0 app: use GimpAsyncSet for keeping track of font loading
Replace the boolean fonts_loading member of Gimp with
fonts_async_set, which is a GimpAsyncSet object.  This allows us
to easily respond to the completion of font loading and reloading,
as will be done in the next commits.

Additionally, move the call to FcConfigSetCurrent(), used to
activate the loaded font configuration, from the async thread to
the main thread, just to be on the safe side, and avoid calling
FcInitReinitialize() in gimp_fonts_reset() if font loading is still
in progress, which is unsafe.
2018-05-29 16:04:28 -04:00
Jehan cfaa3103e7 app: output proper info message while fonts are loading.
To this effect, I add a variable to differentiate the "no-fonts on the
system" case from "fonts still loading".
2018-05-27 03:42:43 +02:00
Ell 08ff2ac8c8 app: use gimp_gegl_buffer_copy() all over the place
Replace all uses of gegl_buffer_copy() in app/ with
gimp_gegl_buffer_copy(), added in the previous commit.
2018-05-25 08:12:27 -04:00
Michael Natterer 0cb3e75f79 app: use a lot of g_clear_object() and g_clear_pointer()
More than 2000 lines of code less in app/, instead of

if (instance->member)
  {
    g_object_unref/g_free/g_whatever (instance->member);
    instance->member = NULL;
  }

we now simply use

g_clear_object/pointer (&instance->member);
2017-07-15 18:42:44 +02:00
Ell c83f0e88af app: add virtual transform/type-conversion functions to GimpLayer
The GimpLayer implementation of the GimpItem transform functions,
and the GimpDrawable convert_type() function, apply their operation
to both the layer and its mask.  The subclasses of GimpLayer --
GimpGroupLayer and GimpTextLayer -- override some of these
functions, providing their own logic for the layer part, and
duplicating the mask part.

Avoid this duplication by adding a set of virtual transform and
type-conversion functions to GimpLayer.  Have the GimpLayer
implementaion of the corresponding GimpItem and GimpDrawable
functions use these functions to apply the operation to the layer,
while taking care of the mask themselves.  Have GimpLayer's
subclasses override the new virtual functions, instead of the
GimpItem and GimpDrawable ones.

Note that the existing implementation of convert_type() in
GimpTextLayer neglected to convert the mask, hence text layer masks
retained their old format after conversion.  This issue is fixed as
a side effect of this commit.
2017-06-17 13:42:41 -04:00
Michael Natterer 87d38194d7 app, pdb: use GeglDitherMethod instead of simply an integer 2016-11-07 20:41:39 +01:00
Michael Natterer 997ae1e28b Bug 764024 - Allow to choose fill color when resizing layers and images
Add a GimpFillType argument to GimpItem::resize() and fill type
widgets to the canvas and layer resize dialogs. Fill the new parts of
the drawable according to fill type in gimp_drawable_resize(). Make
sure places that need the old behavior get GIMP_FILL_TRANSPARENT
passed by hardcoding it in the GimpItem::resize() implemetations of
channel, mask, selection etc.
2016-10-10 00:02:16 +02:00
Michael Natterer ecf4af88b8 app: add "gboolean new_has_alpha" to gimp_drawable_convert_type()
making its external API "complete". Remove the redundant
"new_base_type" and "new_precision" from the internal (vfunc) API (the
Babl format has the same information).
2016-10-04 01:39:15 +02:00
Massimo Valentini 4eef125153 Bug 766706: Deleting text layer content does not clean canvas 2016-06-27 16:48:14 +02:00
Michael Natterer 8379f7e31d Bug 766988 - Colors applied to images are not color managed
Color manage text layer rendering.
2016-05-29 19:59:41 +02:00
Michael Natterer ef4ab94a12 app: change GimpDrawable::convert_type() to take a target profile
instead of just a boolean "convert_profile". This takes the logic to
figure the right target profile out of gimp_layer_convert_type(), it
can't possibly know everything about how to convert anyway, and having
the logic in the callers conveniently splits it up and distributes its
parts to the places they belong.

This commit should cause no behavor change and is just preparation for
fixing bug 765176.
2016-04-30 18:35:52 +02:00
Michael Natterer e5b6806fe2 app: port tons of files to the new GIMP_CONFIG_PROP_FOO() macros
and remove lots of labels from calls to gimp_prop_foo_new(). Also
had to manually remove some unwanted labels that are now added
automatically, fixes bug #761880.
2016-02-11 23:46:24 +01:00
Michael Natterer ac1c6d7864 app: add progress reporting to gimp_drawable_convert_type()
so it doesn't sit there appearing to do nothing while converting an
image with profile to gamma/linear.
2015-10-21 22:22:30 +02:00
Michael Natterer 76782e622d app: add "gboolean convert_profile" to GimpDrawable::convert_type()
also add "GType old_type" to GimpItem::convert() so implementations
can do things depending on the type of the original item.

In gimp_layer_convert(), if the original item is also a layer, and
color management is not off (with a FIXME because this is the wrong
check), pass convert_profile = TRUE to gimp_drawable_convert_type().

There is no color profile conversion anywhere behind this, this is
just an API change commit.
2015-08-16 15:56:28 +02:00
Øyvind Kolås 7e6320497e follow gegl api changes from commit af5361ca8d, with an abyss policy argument
to gegl_buffer_copy.
2015-05-25 01:27:31 +02:00
Michael Natterer 23037b5230 app: convert all stock IDs kept around by the core by icon names
Particularly GimpViewable's stock_id. Make sure old config files
containing stock IDs are still properly parsed.
2014-05-07 01:01:56 +02:00
Jehan 2aabbbd9c7 Bug 662787 - Segfaults when trying to set a large text size
If a font size is too big for cairo or pango to deal with, nicely back
up from rendering and alert the user via an error dialog.
2013-10-24 20:23:51 +13:00
Jehan c7aa623a55 app: clean out a big bunch of leading tabs.
For some unknown reason, most calls to gimp_message_literal() were
indented with tabs.
2013-09-15 04:59:20 +12:00
Michael Natterer a7223bbd2d Bug 352823 - Changing image mode discards text layer information
For conversions that have no dither options (like RGB -> GRAY or u8 ->
u16), always preserve text editability, for conversions that have
dither options (like RGB -> INDEXED or u16 -> u8), give the user the
choice whether to enable dithering.
2012-11-10 18:56:44 +01:00
Michael Natterer 373a4e7469 app: completely remove TileManager and friends (base/ and paint-funcs/)
And along with it a lot of stuff like the drawable preview cache, the
gegl tile manager backend, temporary gimp_gegl_buffer_foo() stuff, and
the remaining bits of performance.

The projection is in an evil semi-ported state which makes it work
ok-ish for stuff like layer moving, but absolutely unbearable for
painting, there is also an off-by-one rendering glitch at some zoom
levels.
2012-06-20 21:44:09 +02:00
Michael Natterer 00b3a9c745 libgimpcolor: add Cairo <-> GEGL utility functions from app/ 2012-05-03 04:07:16 +02:00
Michael Natterer 5735e35f0c app: add gimp_cairo_image_surface_create_buffer()
and use it to shrink text layer rendering to even fewer lines.
2012-05-02 17:51:02 +02:00
Michael Natterer c14738806e app: use gimp_image_get_layer_format() instead of dealing with image_type 2012-05-02 17:50:57 +02:00
Øyvind Kolås 6efd812d08 app: s/GIMP_GEGL_RECT/GEGL_RECTANGLE/
Defining GeglRectangle inline is so useful that it has been added to
GEGL.
2012-05-02 17:50:52 +02:00
Michael Natterer a1e5b75f44 app: use one gegl_buffer_copy() with the right Babl format to copy to the layer
instead of looping manually to extract pixels from the cairo surface.
2012-05-02 17:50:52 +02:00
Øyvind Kolås ee97c1f4ff app: correct usage of babl formats
GIMP was doing evil hacks lying to GEGL about it's pixels being in a linear
color space when they are not. This causes incorrect rendering, makes gaussian
blur misbehave etc.

The legacy projection modes should be implemented using the same 2.2 gamma
formats that are correct to specify for sRGB data. (for proper color
management in higher bitdepths; icc backend babl formats should be used.)

For the old image modes correct babl formats are:

R'G'B'A u8  -  8 bit RGB with 2.2 gamma (sRGB) with linear alpha component
R'G'B' u8   -  8 bit RGB with 2.2 gamma (sRGB)
Y'A u8      -  8 bit Grayscale with 2.2 gamma with linear alpha component
Y' u8       -  8 bit Grayscale with 2.2 gamma

Y u8        -  8 bit linear data, used for masks/channels
A u8        -  8 bit linear alpha

-----------------------------------------------

RGBA float  -     32bit floating point linear light RGB
RaGaBaA float  -  32bit floating point linear light RGB, premultiplied alpha
                  to be used for processing that needs to scale by the alpha,
                  (blurs, resampling etc)
R'G'B'A float  -  32bit floating point sRGB with gamma, to be used where
                  the result depends on being closer to perceptual when
                  processing, can be used a cheaper alternative to CIE Lab
                  based modes.

-----------------------------------------------

The legacy layer modes should use the formats with gamma 2.2 only for loading
and rendering legacy XCF files correctly, in the brave new world compositing
should most likely be done in linear light with "RGBA float" and even better
"RaGaBaA float" like GEGL does for porter duff and other compositing modes.

The ability to chose the legacy layer modes should probably be hidden from the
user unless an old .xcf has been opened.
2012-05-02 17:50:38 +02:00
Øyvind Kolås bfb3cd60d1 app: adapt to API changes in gegl_buffer_iterator 2012-05-02 17:46:15 +02:00
Michael Natterer efbc4e61b0 app: more gegl_buffer_iterator_new() updates 2012-05-02 17:46:15 +02:00
Øyvind Kolås c872a9368e app: sprinkle level argument over process functions 2012-05-02 17:46:13 +02:00
Michael Natterer a0c1007b66 app: port GimpDrawableUndo, GimpDrawable::push_undo() and ::swap_tiles()
which gets rid of the manual implementation of sparse undo buffers,
but GEGL will take care of proper COW here soo enough.
2012-05-02 17:46:08 +02:00
Michael Natterer f8f4455459 app: change GimpDrawable::set_tiles() to ::set_buffer()
and remove the "type" argument, GeglBuffers have a format.
2012-05-02 17:46:07 +02:00
Michael Natterer 765c2cfea2 app: replace GimpDraable's type by a Babl format
and change gimp_drawable_new() and all gimp_layer_new() variants to
take formats instead of types.
2012-05-02 17:46:06 +02:00
Michael Natterer b89a912cc7 app: use gimp_drawable_set_buffer() in a few places 2012-05-02 17:46:05 +02:00
Michael Natterer 0bcae125b5 app: merge gimp_drawable_get_read_buffer() and get_write_buffer()
into get_buffer(). The loss of zero copy will be compensated soon.
2012-05-02 17:46:04 +02:00
Michael Natterer 9a09d3a762 app: drop "babl" from gimp_foo_get_babl_format[_with_alpha]() 2012-05-02 17:45:58 +02:00
Michael Natterer 53bfc36bbf app: convert colors with Babl in gimp_text_layer_render_layout() 2012-05-02 17:45:57 +02:00