Commit Graph

541 Commits

Author SHA1 Message Date
Michael Natterer d1b9f74c6f app: we always need to freeze/thaw around gimp_font_factory_data_init()
so pull it to the parent class. Also remove the "no_data" parameter
from the data_init() virtual function and handle it in
gimp_font_factory_data_init() itself.
2018-06-03 23:16:29 +02:00
Michael Natterer 6b5fd27943 app: call the standard font "Standard" not "Sans-serif"
Sans-serif is also an actual font from the list and the standard font
is being used when there is really no font at all.
2018-06-03 23:13:55 +02:00
Michael Natterer 40b95227af app: make gimp_font_get_standard() return a GimpData
like all other GimpData sublasses.
2018-06-03 22:46:48 +02:00
Michael Natterer c563659ed8 app: move the GimpAsyncSet and the waiting code to GimpDataFactory
it's potentially useful for all data factories.
2018-06-03 22:28:00 +02:00
Michael Natterer 1b1739bb06 app: use gimp_data_factory_get_data_path() in GimpFontFactory
Also, make sure we freeze() and thaw() the font container correctly,
so that all places keep their fonts across a refresh.

The only thing to make this actually work seems to be a bug in the
list views, grid views work perfectly.
2018-06-03 20:44:28 +02: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
Michael Natterer 0763ea2a69 app: add new GimpDataFactory subclass GimpFontFactory
which contains all the font loading and refreshing including all async
stuff and is a complete replacement for gimp-fonts.c and GimpFontList.
2018-06-03 01:25:25 +02:00
Michael Natterer 4d3c715990 app: derive GimpFont from GimpData 2018-06-03 00:45:06 +02:00
Ell 0e19f159f5 app: restore font list in async callback, not async-set notify handler
When font loading is finished, restore the font list in the
corresponding async completion callback, and not in the
"notify::empty" signal handler of the fonts async set

This solves a problem arising when gimp_fonts_wait() is called
*inside* a "notify::empty" signal handler, emitted when reloading
fonts (causing the "empty" property of the fonts async set to
switch from TRUE to FALSE):  When the wait is over, "empty" will
switch back from FALSE to TRUE, however, since the "notify" signal
is non-recursive, the corresponding handler will not be called,
gimp_fonts_wait() will return *before* the font list is restored,
and the caller will see an empty font list.  This can happen under
certain circumstances when reloading fonts while the text tool is
active.
2018-05-30 12:58:09 -04:00
Ell c27316093e app: code cleanup in previous commits 2018-05-30 02:22:34 -04: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 0a5a4fed03 app: add gimp_fonts_wait()
... which waits for font-loading to complete, using gimp_wait() to
show a message while waiting.

Note that we don't currently allow the wait to be canceled, since
it may have unpredictable effects on plug-ins, but the interface is
such that the wait might not complete, so calling code should be
prepared for that.
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
Ell ad8add6808 app: add "independent" parameter to gimp_parallel_run_async()
Add a boolean "independent" parameter to gimp_parallel_run_async().
When FALSE, the passed function is run in the shared async thread
pool; when TRUE, the passed function is run in an independent
thread.

Generally, async operations should run in the async pool, however,
it might be desirable to run long-standing operations, especially
ones that can't be canceled, in independent threads.  This avoids
stalling quicker operations, and shutdown.

Adapt the rest of the code for the change.  In particular,
initialize the font cache in an independent thread.
2018-05-27 13:17:24 -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
Jehan 2484dec7d5 Issue #1211: Load fonts in background after startup.
Fonts should not be blocking startup as this provides a very bad
experience when people have a lot of fonts. This was experienced even
more on Windows where loading time are often excessively long.
We were already running font loading in a thread, yet were still
blocking startup (thread was only so that the loading status GUI could
get updated as a feedback). Now we will only start loading and proceed
directly to next steps.
While fonts are not loaded, the text tool will not be usable, yet all
other activities can be performed.
2018-05-27 02:13:33 +02:00
Ell 3e92e7a449 app: use gimp_parallel_run_async() when loading fonts
Replace the custom threading code with a call to
gimp_parallel_run_async().  This simplifies the code, while
maintaining the current (blocking) behavior.  In the future, we
might build upon this to actually load the fonts in the background.
2018-05-26 11:33:32 -04: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
Jehan 962b8496fc Bug 795899 - "Some fonts failed to load" error when missing fonts/...
... directory in the configuration folder.
This subfolder should have been created already. Just in case it is not
(for any reason), just recreate it rather than popping up an error.
2018-05-09 14:27:22 +02:00
Jehan 98a575370c app: add a check on not-NULL string before g_utf8_validate().
Still looking for possible crash case during gimp_font_list_load_names()
(cf. bug 795650). g_utf8_validate() segfaults if called with NULL.
Though looking at pango_font_description_to_string() implementation, it
doesn't look like it would ever return NULL. Yet it is worth
double-checking. We don't load font every second anyway.
2018-05-05 15:55:30 +02:00
Jehan d58f131b59 Bug 795650 - Gimp crashes on start in Windows.
Add more assertion checks (similar to commit d094ab7e56).

This is still not a fix per-se, but at least would make the code a bit
more robust. In particular FcObjectSetDestroy() could crash if somehow
FcObjectSetBuild() had returned a NULL pointer. And obviously
dereferencing a NULL fontset would crash as well.
Now if any of these happened, no fonts would be loaded. But at least
GIMP would not crash.
2018-05-05 15:26:26 +02:00
Jehan d094ab7e56 app: add some g_return_if_fail() in gimp_font_list_load_names().
Some crash happens inside this function (cf. bug 795650) on Windows.
Because of very inaccurate trace on this OS, it is hard to determine the
exact issue. Let's at least add some basic check on function parameters.
This won't fix any core issue, but may make things a bit more robust and
bugs easier to detect.
2018-05-01 03:41:37 +02:00
Jehan e796e3a50a app: popup error at startup when some fonts fail to load.
As proposed on IRC. This will allow people to debug their fonts (for
instance when there are permission issues or whatnot) by knowing the
list of problematic fonts in an error dialog at startup (and not only on
terminal).
2018-05-01 03:25:58 +02:00
Jehan 55d1ea5cf0 app: check that the font path is not NULL.
This is for Windows where we apparently need to call
g_win32_locale_filename_from_utf8() before feeding the path to
FcConfigAppFontAddFile().
Unfortunately as we discovered earlier (cf. commit ba06a0fe86), this
can sometimes return NULL. So we absolutely need to check for the path
not being NULL first.
2018-04-30 22:05:11 +02:00
Jehan 69f864d5f5 app: use a GFileEnumerator to loop through font files. 2018-04-30 21:58:19 +02:00
Jehan 3de1f33702 app: font loading output a GError.
This GError will either specify the font which failed to load (if
unique) or a vague message about fonts which fail to load.
Unfortunately right now, this message also goes to terminal because the
GUI is not ready yet.
2018-04-29 19:47:44 +02:00
Jehan 00dcd50a6c Bug 748553 - GIMP crash if a font does not have read permission.
Do not use FcConfigAppFontAddDir() because it seems to be half-loading
some fonts, even when they are not actually readable. On the other hand,
FcConfigAppFontAddFile() properly fails and does not leave the font list
in unstable state.
2018-04-29 17:34:13 +02:00
luz.paz 4a77ff2d3d Bug 795557 - Misc. typo fixes in source, comments and doxygen (pt3)
Found via `codespell` and grep.
2018-04-25 23:49:06 +02:00
Ell ce9ca03ed4 app: add gimp_drawable_{start,end,flush}_paint()
gimp_drawable_start/end_paint() are used to enter/exit paint mode
for a given drawable.  While the drawable is in paint mode,
gimp_drawable_get_buffer() returns a copy of the real drawable's
buffer, referred to as the paint buffer, so that modifications to
the returned buffer don't immediately affect the projection, and
calls to gimp_drawable_update() queue the updated region, instead
of emitting an "update" signal.

gimp_drawable_flush_paint() can be called while the drawable is in
paint mode, in order to copy the updated region of the paint buffer
back to the drawable's real buffer, and to emit "update" signals
for the queued region.

We use these functions in the next commit, to move painting to a
separate thread in the paint tools.
2018-04-08 09:42:47 -04:00
Ell 3b8e1ebecb app: use gimp_drawable_steal_buffer() in gimp_text_layer_from_layer()
When constructing a text layer from an existing layer in
gimp_text_layer_from_layer(), steal the old layer's buffer using
the new gimp_drawable_steal_buffer(), instead of using simple
pointer assignment, as the latter is generaly unsafe (even though
it should currently work).
2018-02-13 13:29:16 -05:00
Michael Natterer 539927ebfa app: replace all g_assert() by the newly added gimp_assert()
which is just a #define to g_assert for now, but can now easily be
turned into something that does some nicer debugging using our new
stack trace infrastructure. This commit also reverts all constructed()
functions to use assert again.
2018-02-11 22:23:10 +01:00
Ell f7d6805ebb */Makefile.am: add abbreviations to generated enum files
Update the dprod production of generated enum files to include
abbreviated value descriptions, as per the previous commits.

Add a comment for translators above the abbreviated descriptions,
specifying the full description they abbreviate.
2017-11-30 03:10:14 -05:00
Ell 58fdaae3ad enums: add intermediate generated enum files to .gitignore 2017-08-24 15:35: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
Ell 3ca48a0b30 enums: don't use comments in generated enum recipes
Works in bash, but apparently not portable.
2017-06-02 11:15:43 -04:00
Ell 5bcde32caf enums: run gimp-mkenums from the build dir
Commit 1e6acbd4e1 modified the
generated enum recipes to run gimp-mkenums from the source
directory, instead of the build directory, so that only the
basenames of the corresponding header files would appear in
the comment at the top of the generated files.  This was a
mistake -- $(GIMP_MKENUMS) is expecting to be invoked from the
build directory.

Switch back to running gimp-mkenums from the build directory.  To
avoid including the relative path from the build directory to the
source directory in the generated file, add a @basename@ production
variable to gimp-mkenums, which exapnds to the basename of the
input file, and use it instead of @filename@ in the recipes for the
generated enum files.
2017-05-22 20:29:18 -04:00
Ell f9fa0d1b18 enums: don't write generated enum files to src-dir if unchanged
When regenerating an enum file, don't copy it back to the source
directory if it hasn't actually changed.  This allows using a read-
only source directory where the enum header is newer than the
generated file, as long as they're not really out of sync.

OTOH, *do* touch the generated source-dir file even when unchanged,
in order to avoid re-running its recipe on the next build, however,
allow this to silently fail (which is harmless).
2017-05-22 17:58:04 -04:00
Ell 1e6acbd4e1 enums: generate enum files in source dir
We check them into git, so this makes it easier to keep them in
sync when using a separate build directory.

Case in point -- this commit also syncs a few enum files that went
out-of-sync with their headers.
2017-05-06 17:26:16 -04:00
Michael Natterer 3cd717120c app: set the complete layer mode in gimp_text_layer_from_layer() 2017-02-22 00:59:23 +01:00
Michael Natterer 1415a78fa1 Bug 774383 - Text layer created by gimp-text-fontname doesn't...
...respect border when resized

gimp_text_layout_new(): in FIXED box mode, subtract (2 * border) when
setting the layout width.
2016-11-15 13:23:00 +01: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
Michael Natterer 7f3090febb app: gimp_fonts_exit() don't disconnect from a NULL gimp->config 2016-09-13 12:24:15 +02:00
Michael Natterer 314027f0c9 app: create members of the Gimp instance earlier
Move fonts, data factories, document list, paint methods and user
context creation to gimp_init() or gimp_constructed() so that most
members are created when gimp_new() is done. This does not load any
data earlier, it just makes sure that all containers exist when
gimp_load_config() is called. It's also cleaner and less fragile,
2016-09-13 09:47:27 +02:00
Jehan 6c674e973c app, libgimp*, plug-ins, icons: revert icon names into freedesktop...
... standard icon names and GTK+ icon names as second choice.
We should only use GIMP specific icon names as last resort, when there
is no standard or GTK+ names dedicated to the function.
This is made possible thanks to commit 3cc77b0.

s/gimp-document-recent/document-open-recent/
s/gimp-indent/format-indent-more/
s/gimp-next/go-next/
s/gimp-previous/go-previous/
s/gimp-save/document-save/
s/gimp-save-as/document-save-as/
s/gimp-revert/document-revert/
s/gimp-open/document-open/
s/gimp-document-recent/document-open-recent/
s/gimp-quit/window-close/ ou s/gimp-quit/application-exit/
s/gimp-warning/dialog-warning/
s/gimp-edit-clear/edit-clear/

s/gimp-justify-.*/gtk-justify-.*/
s/gimp-font/gtk-select-font/
s/gimp-color-palette/gtk-select-color/
s/gimp-cancel/gtk-cancel/
2016-09-03 15:49:29 +02:00
Massimo Valentini 4eef125153 Bug 766706: Deleting text layer content does not clean canvas 2016-06-27 16:48:14 +02:00
klausstaedtler 210a834f4c icons: Bug 759904
patch
gimpfont.c
2016-06-10 13:50:44 +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 2ef8719cbe app: rename more stuff from "floating sel" to "floating selection" 2016-05-20 16:46:26 +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
Ell 76adffa943 app: clear cond and mutex after usage 2016-04-19 17:43:55 +02:00
Michael Natterer 29f55a95ef app, pdb: minor cleanup in the new font loading code 2016-04-17 21:06:00 +01:00
Kristian Rietveld 30b73125f8 Bug 449848 - Startup: initialize fontconfig in the background ...
... to avoid long pause on start

On non-Linux operating systems the fontconfig cache is often not
initialized by default. The first time GIMP was launched, this led
to a non-responding application, confusing many users.

The initialization of fontconfig has now been moved to a separate
thread. The main thread will wait for this fontconfig thread to
complete, regularly pulsing the UI.

This patch was partly based on an earlier patch by Tor Lillqvist.
2016-04-17 17:27:06 +01: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 789e9f2cf4 app: remove /*< skip >*/ and /*< pdb-skip >*/ annotations from enums
where their headers are not even parsed by the affected scripts.
2016-01-07 17:44:46 +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
Jehan 6f81975bda Bug 751836: font alias "sans" deprecated in fontconfig…
…to be replaced by "sans-serif".
2015-07-12 14:07:04 +02:00
Massimo Valentini f0028624df Bug 751178: GIMP doesn't load fonts from folders...
which path contains Cyrillic characters
2015-06-22 19:40:25 +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
Simon Budig a102690145 remove unnecessary if()
Spotted by Andrey Karpov using static code analysis:
   http://www.viva64.com/en/b/0273/
2014-08-16 00:37:14 +02:00
Simon Budig 40c06ab685 fix some copy&paste errors
Spotted by Andrey Karpov using static code analysis:
   http://www.viva64.com/en/b/0273/
2014-08-16 00:37:13 +02:00
Michael Natterer 980ba7f85a app: move memsize functions into their own files gimp-memsize.[ch] 2014-08-12 13:57:57 +02:00
Michael Natterer 9751d04b47 app: more filename -> GFile in gimp-fonts.c 2014-07-29 14:40:25 +02:00
Michael Natterer 583be797a1 app: use gimp_config_path_expand_to_files() for the font path 2014-07-24 21:23:11 +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
Mukund Sivaraman e0015fa67a app: Update coding style (minor) 2014-05-03 19:59:00 +05:30
Mukund Sivaraman 33acc4b62b app: Use HarfBuzz directly instead of deprecated Pango functions
I have verified manually that the previews ("Aa") shown for English and
Tamil are correct (i.e., the modified function works).
2014-05-03 00:27:47 +05:30
Mukund Sivaraman 81e955ed1b build: Add HarfBuzz dependency 2014-05-03 00:27:47 +05:30
Michael Natterer 7257574b93 Bug 726495 - "Text to path" delivers a path offset from the text
In gimp_text_layout_render() do a cairo_save/restore() around drawing
the (possibly offset and transformed) text, so we can later get the
rendered path from cairo_copy_path() relative to the original coords
and not relative to the offset and transformed coords.
2014-04-11 16:56:29 +02:00
Michael Natterer 6c73f28b6d Bug 719560 - Build failure with freetype 2.5.1
Apply patch from su-v that fixes the freetype include to
the madness devised and recommended by freetype.
2013-11-29 21:57:46 +01: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
Michael Natterer 697572ccc0 app,libgimp*: fix includes to follow our include policy
- don't include <gdk-pixbuf/gdk-pixbuf.h> in headers in app/
- instead, include it in many .c files instead of <glib-object.h>,
  finally acknowledging the fact that app/ depends on gdk-pixbuf almost
  globally
- fix up includes as if libgimpbase depended in GIO, which it soon will
2013-10-15 01:58:39 +02: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 ec786816bb */Makefile.am: merge INCLUDES into AM_CPPFLAGS
automake-1.13 finally warns about this anachronism.
2013-06-05 20:48:37 +02:00
Michael Natterer 3b68ae0f3c app, pdb, libgimp: Remove all traces of the supersampling recursion level
from all transform APIs. This is no longer used since we use GEGL to
transform, the value was only passed around and never used.
2013-05-31 01:15:32 +02:00
Nils Philippsen 1c00c2e4f8 app: fix re-initializing fontconfig in gimp_fonts_reset()
Calling FcConfigSetCurrent() with NULL is just broken, it almost
immediately dereferences the passed pointer. Apparently this line
is executed seldom, otherwise we'd see way more crashes in this place.
Just use FcInitReinitialize() which exists for the very purpose of
reinitializing the fontconfig library.
2013-02-05 13:54:36 +01:00
Michael Natterer 908f727f0a Chain up unconditionally in GObject::constructed()
It's supported since GLib 2.28.
2012-11-12 21:51:22 +01: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
Massimo Valentini b25f9abedf Bug 676413: Text to Path cuts off without covering the whole layer
Use an unbounded cairo_recording_surface to extract a
cairo_path_t from a pango_layout.
2012-10-30 18:07:08 +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
Simon Budig 1bbf9ca440 do not crash on fonts with 000 permissions. 2012-06-06 01:16:02 +02:00
Michael Natterer 00b3a9c745 libgimpcolor: add Cairo <-> GEGL utility functions from app/ 2012-05-03 04:07:16 +02:00
Michael Natterer 3ad73b3658 libgimpcolor: add GdkPixbuf <-> GeglBuffer utility functions
and update tons of includes in libgimp and app.
2012-05-03 03:37:20 +02:00
Michael Natterer 85bd6b0dd9 app: pass a format, not bpp, to gimp_viewable_get_dummy_pixbuf()
and add tons of <gegl.h> includes.
2012-05-02 17:51:08 +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 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 ff86f85744 app: remove x, y and color parameters from temp_buf_new()
Fix the places that passed the color by either temp_buf_data_clear()
or memset(), and assign x and y manually, they are going to vanish
completely soon.
2012-05-02 17:50:58 +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
Michael Natterer 3e119c5af7 libgimpcolor: add gimp_rgb[a]_set,get_pixel()
which converts from/to any pixel format using Babl. Added tons of
includes and CFLAGS now that libgimpcolor publically uses Babl.
2012-05-02 17:50:43 +02:00
Michael Natterer 87b7af7fa5 app: remove drawable->private->format, its buffer has a format already
Also, make group layer type conversion much less hackish by using the
same kind of temporary states that are used for reallocating its
projection on size change.
2012-05-02 17:50:42 +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 5a7b7d9a4b app: add gimp_gegl_buffer_get_tile_manager()
and ust it in some get_memsize() functions instead of having a
FIXME. So many files changed because they need to inlcude <gegl.h>
now.
2012-05-02 17:46:07 +02:00
Michael Natterer d5795c0081 app: use a GeglBuffer instead of TileManager as storage in drawables \o/ 2012-05-02 17:46:06 +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
Michael Natterer 8aabfb1779 app: s/read_buffer/write_buffer/ in GimpTextLayer because we fill the tiles 2012-05-02 17:45:55 +02:00
Michael Natterer fd579343df app: use GeglBufferIterator in gimp_text_layer_render_layout() 2012-05-02 17:45:54 +02:00
Massimo Valentini 39368a410d plugged memory leaks 2012-02-07 17:32:02 +01:00
Michael Natterer 056e09a6cb Remove the makefile.msc build system, it is unmaintained since 2008 2011-12-16 15:53:56 +01:00
Nils Philippsen 439e8b0bf1 app/text: nuke gimpfont-utils.[ch]
gimp_font_util_pango_font_description_to_string() isn't needed any
longer as this was fixed long ago in pango itself (and we require a much
higher version anyway). See Pango bug #166540 (at GNOME Bugzilla).
2011-09-19 15:44:26 +02:00
Michael Natterer cc47b2a600 libgimpwidgets/color: move the cairo color utility functions to libgimpcolor
Add CAIRO_CFLAGS to a lot of Makefiles to make this possible, and
because they pull in cairo via the libgimp headers.
2011-04-28 15:50:39 +02:00
Michael Natterer 2af539020b app: don't include individual files from libgimp* 2011-04-28 14:23:33 +02:00
Michael Natterer f0a52f1db9 Bug 646316 - Hinting change to medium on first edit of text field
gimp_text_set_property(): Deserialize the compat "hinting" property
only if the new "hint-style" one has its default value, so we don't
overwrite a serialized new "hint-style" with a compat "hinting" that
is only there for old GIMP versions.
2011-04-16 15:17:22 +02:00
Michael Natterer f09360ba80 app: GimpTextLayout: use the unit conversion functions from gimpunit.[ch]
instead of duplicating them. Multiply by PANGO_SCALE in the callers
and ceil() fixed text box pixel extents so we don't cut off stuff by
fractions of a pixel.
2011-03-18 21:39:28 +01:00
Michael Natterer f13abfa3f0 app: change image parameter in gimp_text_layout_new() to xres,yres
Because GimpTextLayout doesn't depend on any image, it only needs a
resolution.
2011-03-18 02:31:20 +01:00
Michael Natterer 9f30550f9a app: move drawable->type to private 2011-03-16 02:02:47 +01:00
Michael Natterer a62071e9eb app: remove mamber GimpDrawable::bytes
because it's always the same as GIMP_IMAGE_TYPE_BYTES(drawable->type)
2011-03-16 00:16:31 +01:00
Michael Natterer 40e11d7ad1 app: pass the image to g_object_new() in gimp_text_layer_from_layer() 2011-02-01 14:15:46 +01:00
Michael Natterer eacd80446d app: finally get rid of gimp_item_configure() and drawable_configure()
and turn them into gimp_item_new() and gimp_drawable_new()
2011-02-01 12:47:24 +01:00
Michael Natterer 5c8ec234cc app: add "image" as construct property to GimpItem
- The image *must* now be passed to g_object_new() when creating items
- Remove the "image" parameter from all item configure() functions
- Set the item's ID in gimp_item_set_image() if it has none yet
2011-02-01 10:28:10 +01:00
Michael Natterer 90419e0672 app: add "gboolean push_undo" to gimp_item_parasite_attach/detach()
and use this API instead of manually fiddling with the item's
GimpParasiteList.
2011-01-30 20:40:43 +01:00
Michael Natterer 0428be2944 app: add gimp_item_replace_item() which is a bad hack and documented as such
in order to get rid of fiddling with GimpItem internals inside
gimptextlayer-xcf.c
2011-01-30 19:26:32 +01:00
Michael Natterer c1b3575648 app: implement GObject::constructed() instead of ::constructor() 2011-01-12 23:06:03 +01:00
Michael Natterer 0b38824448 app: add a "text" property to GimpTextLayer and emit notifications for it 2010-11-28 15:27:35 +01:00
Michael Natterer 77a5999f13 Bug 634315 - gimptextlayout.c: typo in assignment 2010-11-25 00:04:41 +01:00
Michael Natterer dcdc09872d Bug 631934 - Interaction between Old text parameters and new region specific text attributes
This patch inserts GimpText's property values as attributes into the
rendered markup and work transparently for both the tool options and
the text PDB API.
2010-10-29 04:45:12 +02:00
Barak Itkin 8cf6695a50 Fix Bug 631742 - Can't change color of first letter
Fix the bug by making sure we set the base color before setting the markup which
contains color for specific regions. This is a temporary fix, it solves Bug
631742 and introduces a less critical bug (which is described as part of Bug
631934) that will be solved with upcoming design changes.
2010-10-12 02:13:28 +02:00
Sven Neumann db72c72c1f Bug 631609 - [regression] no transparency on antialiased fonts
Render the layout into an ARGB32 surface and convert the text layer
pixel format from that.
2010-10-07 22:21:49 +02:00
Martin Nordholts cc7755f876 Port stuff to gimp_item_is_text_layer()
Port stuff to gimp_item_is_text_layer() instead of
gimp_drawable_is_text_layer(). Nevermind the previous commit, it
should never have been pushed...
2010-10-05 07:39:00 +02:00
Martin Nordholts 49a0be731e app: s/gimp_drawable_is_text_layer/gimp_item_is_text_layer/g 2010-10-05 07:12:30 +02:00
Sven Neumann d96b491050 Update use of Pango API and bump required version to 1.22.0
Uodate Pango required version and stop using the deprecated
pango_cairo_font_map_create_context(). Compile with
PANGO_DISABLED_DEPRECATED for pango < 1.30.
2010-09-07 00:53:17 +02:00
Michael Natterer 3759b3f0d1 app: render the text layout directly into the layer's pixels
instead of using a mask. Enables color tags. Set the default color
from the text object using a pango color attibute and factor out
GimpTextLayout attribute setting into a utility function.
2010-09-01 23:30:40 +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
Michael Natterer 5dd9e4bbc3 app: remove member GimpDrawable::has_alpha
because it is always the same as GIMP_IMAGE_TYPE_HAS_ALPHA(drawable->type),
so simply use that instead.
2010-06-08 10:10:04 +02:00
Michael Natterer e22e881a9c app: more optional debug output (in #ifdef VERBOSE) 2010-03-28 20:46:23 +02:00
Michael Natterer f9e68fe0ee Fix undo when going back from a modified text layer to an editable one
My earlier change to using gimp_drawable_push_undo() here was a very
bad idea. Go back to using gimp_image_undo_push_drawable_mod(), but
make use of its new tile-copying feature so the problem that made me
do the earlier change is fixed too. See comments in the changed code.
2010-03-18 10:32:52 +01:00
Michael Natterer 13cbdabcc3 app: fix publically reported layout offset for a couple of cases
Move the code that adjusts the layout's x-offset for fixed-width text
boxes and RTL, centered- and right justified text. It was living in
gimp_text_layout_render() and was correctly applied at rendering time,
so everything looked fine. Move it to gimp_text_layout_position() so
it becomes part of the layout's permanent properties, is reported by
gimp_text_layout_get_offsets() and thus used by the text tool which
can draw cursor and selection at the right place.
2010-03-11 20:58:11 +01:00
Michael Natterer 1d74c1f9cf app: don't overwrite all markup-set attributes with letter_spacing
if letter_spcaing is enabled. Instead add its attribute to the ones
which are already there.
2010-03-03 10:18:31 +01:00
Michael Natterer 9a9d7489d1 app: make undo compression in the text tool work again
- in GimpText, make "text" and "markup" mutually exclusive, so that
  whenever one is set to non-NULL, the other is cleared automatically.
- add gimp_text_buffer_has_markup() which returns TRUE if any char
  in the buffer is tagged.
- in the text tool, only set "markup" on the text proxy if there is
  actually markup in the buffer, and set "text" otherwise.

This way we don't push "text" *and* "markup" undos on each keystroke,
and undo compression works the way it did before.
2010-03-02 21:54:24 +01:00
Michael Natterer e9abde75ee app: if there is no "text", generate the layer name from "markup"
Add gimp_markup_extract_text() which does just what it says (includes
code stolen from gmarkup.c), and use it if the layer's text object
doesn't have any text set.
2010-03-02 21:19:57 +01:00
Michael Natterer 9c4864e789 app: optimize away redundant and expensive text layer re-rendering
- Add signal GimpText::changed() and emit it from
  GObject::dispatch_properties_changed() after all notifications have
  been emitted, so "changed" is emitted only once for any number of
  properties set within a g_object_freeze/thaw_notify() pair.
- Connect GimpTextLayer to "changed" instead of "notify" so we aviod
  lots of expensive re-rendering when multiple properties are set
  at once.
- Connect GimpTextTool to "notify" *and* "changed", and move some
  common code to the "changed" callback (e.g. we don't need to
  re-frame the item for each set property).
2010-03-02 17:44:31 +01:00
Michael Natterer db6a669c4b app: add "markup" property to GimpText
And prefer it over "text" when rendering. Everything is exactly as
before if "markup" is never set.
2010-02-26 01:27:05 +01:00
Michael Natterer ea7495a95c app: take the rendering direction into account when adjusting the x-offset
Move the layout to the right edge of the bounding box if LTR and RIGHT
*or* RTL and LEFT.
2010-02-21 17:47:21 +01:00
Michael Natterer 0908e53148 app: use the new unit conversion functions
and get rid of the brainfuck idea that app/ has to use _gimp_unit_foo()
functions, passing a gimp pointer. Instead, simply use the libgimpbase
API all over the place. Should we ever allow more than one gimp instance,
they will simply have to share one unit database.
2010-02-21 16:46:39 +01:00