Commit Graph

180 Commits

Author SHA1 Message Date
Niels De Graef 878804fb01 Cleanup GObject signal marshallers
* Don't generate our own marshallers if they are available in GLib
  already
* Don't set the c_marshaller parameter in `g_signal_new()` if it's a
  default marshaller provided by GLib. See commit message of commit
  39e4aa3c57 on why this is the case.
2020-04-01 21:20:01 +00:00
Michael Natterer 6370147990 app: make all pixbuf rendering in GimpViewRenderer HiDPI-aware
Request pixbufs in double size and cache the created surface instead
of the pixbuf. This affects rendering icons and image thumbnails.

All other rendering (which is most previews) is not ported yet, but
just lacks HiDPI quality, there are no actual bugs.
2019-01-09 20:34:52 +01:00
Michael Natterer abd7cbfc8d Issue #1788 - Inconsistency between FG color and selected color in...
...palette views despite selected color being in the currently
selected pallette

As suggested by Massimo, changing the color comparison EPSILON in
gimppalette.c from 1e-10 to 1e-6 fixes this, and is really small
enough.

Also, generally clean up color comparison epsilons:

- use a #define, not hardcoded values for all uses of
  gimp_rgb[a]_distance()
- call the #defines RGB_EPSILON and RGBA_EPSILON
- make them all 1e-6 or larger
2019-01-02 01:49:43 +01: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
Michael Natterer 5f700549e7 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
Jehan b7685cc579 app: remove check since gimp_widget_load_icon() now always non-NULL.
This is the only place where such a check occured. All other calls
seemed to expect the return value to be non-NULL already.

(cherry picked from commit a9d851070a)
2018-06-24 18:26:49 +02:00
Michael Natterer 1b7d63cce9 Use g_set_object() in a lot of places, and splrinkle some g_clear_object() 2018-06-01 12:59:52 +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
Michael Natterer 3ed305f6f5 libgimpwidgets, app: have all previews track the monitor they are on
and update their color transforms with the new monitor's color
profile. A widget is considered changing monitors when its toplevel
window's center crosses, in order to let widgets within one window
have consistent colors.
2016-06-01 22:42:00 +02:00
Michael Natterer a35276ed91 app: make all GimpViewRenderers color manage themselves
Automatically connect to the global GimpColorConfig unless a different
one is set manually (like for previews that belong to a
GimpDisplayShell and should follow its color management settings.  Add
public API for subclasses to get to the renderer's color
transform. Automatically color manage rendered pixbufs, just as we
already manage temp_bufs.
2016-05-27 23:54:46 +02:00
Michael Natterer 0bfa402c1a Argh, this was meant to be squashed into the previous commit... 2016-05-26 22:18:50 +02:00
Michael Natterer cc92887908 libgimpcolor: add new object GimpColorTransform
which encapsulates a cmsHTRANSFORM and does all the pixel format
conversion magic. It has API to create transforms and proofing
transforms, and to convert pixels arrays and GeglBuffers.

Before, each place which has a transform had to keep around the
transform and its input and output Babl formats, and had to implement
lots of stuff itself. Now all that lives in GimpColorTransform,
removing lots of logic from many places, and pretty much removing lcms
from the public API entirely.

This removes including <lcms2.h>, LCMS_LIBS and LCMS_CFLAGS from
almost all directories and potentially allows to replace lcms by
something else.
2016-05-26 22:15:54 +02:00
Michael Natterer 9bbc52c1be app: add a GimpColorConfig member to GimpViewRenderer
and use it if set to create the display transform, otherwise use the
global config from prefs.
2016-05-14 00:28:15 +02:00
Michael Natterer fd2ee899f9 app: add a private struct to GimpViewRenderer
and move some members there, including "needs_render" which means
GimpViewRenderer now manages that all by itself.
2016-05-14 00:14:51 +02:00
Michael Natterer f718940772 app: don't assume that a GimpColorManaged is always also a GimpPickable
Instead, get the color config via GimpViewRenderer's context.
2016-04-15 18:14:08 +01:00
Michael Natterer 69abd4d972 app: add progress handling to gimp_gegl_convert_color_profile,transform() 2015-10-19 01:29:22 +02:00
Michael Natterer 09fed0a0e5 Bug 478528 - Layer and Image previews are not color managed
Implement color management in GimpViewRenderer: if the viewable is a
GimpColorManaged (true for images and layers), keep around a
GimpColorTransform and convert the preview image to display colors.
2015-09-03 02:25:51 +02:00
Michael Natterer 7c95676f88 app: implement the GimpColorManaged interface in GimpLayer
and change GimpImage and GimpItemStack to emit the "profile-changed"
signal when the image's profile changed. Also connect GimpViewRenderer
to "profile-changed" if the viewable is a GimpColorManaged and
invalidate the preview.
2015-09-03 00:21:40 +02:00
Michael Natterer f374377e9b app: pass the widget to all gimp_view_renderer_render_foo() functions
We will need the widget for color managing previews; it's also more
consistent to pass the widget to all render_foo() functions, not only
to render_icon().
2015-09-02 21:12:59 +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 c88800e840 app: add gimp-priorities.h and keep the most important priorities there
also add comments with all predefined priorities as documentation.
2014-07-02 04:47:24 +02:00
Michael Natterer 7d0b326359 app: add gimp_widget_load_icon() as replacement for gtk_widget_render_icon()
...and use it instead.
2014-05-08 09:11: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
Michael Natterer 00b3a9c745 libgimpcolor: add Cairo <-> GEGL utility functions from app/ 2012-05-03 04:07:16 +02:00
Michael Natterer 1bbd3d40a8 app: make the GimpTempBuf struct private and add accessors 2012-05-02 17:51:12 +02:00
Michael Natterer 1bcab234ab app: explicitly pass around the offsets of the view renderer's temp_bufs
and don't use temp_buf->x and ->y.
2012-05-02 17:51:02 +02:00
Michael Natterer b78d6c1d5d app: port preview rendering to GEGL/cairo
which gets rid of the render blend arrays in gimprender.[ch], and of
image preview demultiplication.
2012-05-02 17:51:02 +02:00
Michael Natterer bdf6b48138 app: move GimpTempBuf from base/ to core/
and forget about include policy in base/, it's scheduled for removal
anyway.
2012-05-02 17:51:01 +02:00
Michael Natterer d5d8e36d21 app: gimp_-namespace all GimpTempBuf functions 2012-05-02 17:51:00 +02:00
Michael Natterer 42a5f01be3 app: rename TempBuf to GimpTempBuf 2012-05-02 17:51:00 +02:00
Michael Natterer 7441a1f6f7 app: turn the TempBuf's "bytes" into "format" and port everything to it 2012-05-02 17:50:59 +02:00
Michael Natterer 867da8f293 app: add gimp_context_get_foreground,background_pixel()
which takes a Babl format to convert from/to.
Include <gegl.h> in a million places.
2012-05-02 17:50:41 +02:00
Michael Natterer b1d6f1b0fd app: lose "default" from protected GimpViewRenderer rendering API
and rename render_surface() to render_temp_buf().
2011-03-08 17:12:39 +01:00
Michael Natterer a2d27983d6 app: remove widget parameter from gimp_view_renderer_default_render_surface() 2011-03-08 17:03:30 +01:00
Michael Natterer 9dee789cfd app: emit "update" when the viewable goes away via the weak notify 2010-10-28 02:16:51 +02:00
Michael Natterer 090a465362 app: don't pass "GdkRectangle *draw_area" to gimp_view_renderer_draw()
Instead, handle the drawing offset generically by offsetting the
cairo_t in two places in the callers, and only pass the width and
height available for drawing.
2010-10-20 18:04:18 +02:00
Michael Natterer 1cc27bcef7 app: port gimp_view_renderer_draw() to take a cairo_t* instead of GdkWindow*
and pass in the cr with clipping set up from the callers instead.
2010-10-15 12:53:58 +02:00
Michael Natterer fad6053643 Make cairo code work with newer cairo backends that actually use caching
Call cairo_surface_flush() before reading or writing a surface's
pixels directly, and use cairo_surface_mark_dirty() after writing
pixels directly, so we don't read old pixels, and our written pixels
get actually used.
2010-06-28 12:23:31 +02:00
Martin Nordholts eae77112e1 app: Bail out, not fail, in gimp_view_render_to_surface() buffer test
Don't fail when checking for availability of buffers in
gimp_view_render_to_surface(). The buffers will be gone when quitting
GIMP while in s-w-m and we don't want to print a warning every time
that happens.
2010-01-06 11:35:37 +01:00
Martin Nordholts b42a5a9967 app: Handle calls to gimp_view_render_to_surface() while GIMP exists 2010-01-05 13:21:09 +01:00
Michael Natterer 1a23b9ecf2 Build with GSEAL_ENABLE and #undef it where accessors are missing 2009-10-17 20:20:39 +02:00
Michael Natterer d9b5207aa2 Change licence to GPLv3 (and to LGPLv3 for libgimp).
2009-01-17  Michael Natterer  <mitch@gimp.org>

	* all files with a GPL header and all COPYING files:

	Change licence to GPLv3 (and to LGPLv3 for libgimp).

	Cleaned up some copyright headers and regenerated the parsers in
	the ImageMap plugin.


svn path=/trunk/; revision=27913
2009-01-17 22:28:01 +00:00
Martin Nordholts ddaa0b48ec s/temp_buf_data/temp_buf_get_data/
* app/base/pixel-region.c
* app/base/temp-buf.c
* app/base/temp-buf.h
* app/core/gimpbrush-load.c
* app/core/gimpbrush-scale.c
* app/core/gimpbrush.c
* app/core/gimpbrushgenerated.c
* app/core/gimpgradient.c
* app/core/gimpimage.c
* app/core/gimppalette.c
* app/core/gimppattern-load.c
* app/core/gimppattern.c
* app/core/gimppreviewcache.c
* app/core/gimpviewable.c
* app/paint-funcs/paint-funcs-generic.h
* app/paint/gimpbrushcore.c
* app/paint/gimpclone.c
* app/paint/gimperaser.c
* app/paint/gimpheal.c
* app/paint/gimpink.c
* app/paint/gimppaintbrush.c
* app/pdb/brush-cmds.c
* app/pdb/brushes-cmds.c
* app/pdb/drawable-cmds.c
* app/pdb/image-cmds.c
* app/pdb/pattern-cmds.c
* app/pdb/patterns-cmds.c
* app/text/gimpfont.c
* app/tools/gimpiscissorstool.c
* app/vectors/gimpvectors-preview.c
* app/widgets/gimpbrushselect.c
* app/widgets/gimppatternselect.c
* app/widgets/gimpviewrenderer.c

svn path=/trunk/; revision=27782
2008-12-13 10:35:53 +00:00
Martin Nordholts e38ca5490a Rename the convenient channel offset defines from FOO_PIX to FOO as this
* app/base/base-types.h: Rename the convenient channel offset
defines from FOO_PIX to FOO as this increases readability.

* app/base/color-balance.c
* app/base/colorize.c
* app/base/desaturate.c
* app/base/hue-saturation.c
* app/base/siox.c
* app/base/threshold.c

* app/core/gimp-edit.c
* app/core/gimp-transform-region.c
* app/core/gimpchannel.c
* app/core/gimpdrawable-bucket-fill.c
* app/core/gimpdrawable-convert.c
* app/core/gimpdrawable-stroke.c
* app/core/gimpdrawable.c
* app/core/gimpimage-convert.c
* app/core/gimpimage.c
* app/core/gimppalette-import.c
* app/core/gimppickable.c

* app/gegl/gimpoperation*mode.c
* app/gegl/gimpoperationcolorbalance.c
* app/gegl/gimpoperationcolorize.c
* app/gegl/gimpoperationhuesaturation.c
* app/gegl/gimpoperationlevels.c
* app/gegl/gimpoperationposterize.c
* app/gegl/gimpoperationthreshold.c

* app/paint-funcs/subsample-region.c

* app/paint/gimpclone.c
* app/paint/gimppaintbrush.c

* app/widgets/gimpviewrenderer.c: Adapt.

svn path=/trunk/; revision=27324
2008-10-19 13:47:09 +00:00
Sven Neumann 6859c9f642 reset the translation on the cairo context. Resurrects brush emblems which
2008-05-10  Sven Neumann  <sven@gimp.org>

	* app/widgets/gimpviewrenderer.c (gimp_view_renderer_real_draw):
	reset the translation on the cairo context. Resurrects brush
	emblems which were drawn in the wrong position.

	* app/widgets/gimpviewrendererbrush.c 
(gimp_view_renderer_brush_draw):
	formatting.


svn path=/trunk/; revision=25614
2008-05-10 11:58:25 +00:00
Sven Neumann b194e6fb62 addec const qualifiers to GimpRGB parameters.
2007-12-28  Sven Neumann  <sven@gimp.org>

	* libgimpwidgets/gimpcairo-utils.[ch]: addec const qualifiers to
	GimpRGB parameters.

	* app/widgets/gimprender.[ch]: removed global variables for
	checkerboard colors and introduced functions to get the
	checkerboard colors as pointers to GimpRGB structs.

	* app/actions/view-actions.c
	* app/display/gimpdisplayshell-appearance.c
	* app/widgets/gimpviewrenderer.c
	* app/widgets/gimpcolormapeditor.c: changed accordingly.


svn path=/trunk/; revision=24451
2007-12-28 19:14:36 +00:00
Sven Neumann 26f6ca6d1d added light and dark check color parameters to
2007-12-28  Sven Neumann  <sven@gimp.org>

	* libgimpwidgets/gimpcairo-utils.[ch]: added light and dark 
check
	color parameters to gimp_cairo_checkerboard_create().

	* libgimpwidgets/gimpcellrenderercolor.c
	* app/widgets/gimpviewrenderer.c (gimp_view_renderer_real_draw):
	changed accordingly.


svn path=/trunk/; revision=24450
2007-12-28 18:44:32 +00:00
Sven Neumann 6312375edd cache the checkerboard pattern.
2007-12-28  Sven Neumann  <sven@gimp.org>

	* app/widgets/gimpviewrenderer.c: cache the checkerboard 
pattern.


svn path=/trunk/; revision=24447
2007-12-28 17:54:01 +00:00
Sven Neumann f97ebdf72d if the surface has CAIRO_CONTENT_COLOR_ALPHA, render it on a checkerboard
2007-12-28  Sven Neumann  <sven@gimp.org>

	* app/widgets/gimpviewrenderer.c (gimp_view_renderer_real_draw):
	if the surface has CAIRO_CONTENT_COLOR_ALPHA, render it on a
	checkerboard background.

	* app/widgets/gimpviewrenderergradient.[ch]: just draw the
	gradient with alpha-transparency instead of doing the blend on 
the
	checkerboard here.

	* app/widgets/gimpcolormapeditor.c: formatting.


svn path=/trunk/; revision=24446
2007-12-28 17:17:10 +00:00