In gimp_drawable_get_sub_preview_async(), when the drawable buffer
has a validate handler (i.e., when it's a group layer), use a chunk
iterator to validate the buffer in chunks, where each chunk is
validated in a separate invocation of the async function. This
prevents validation from blocking the main thread for too long when
the buffer is not already fully validated.
In gimp_drawable_get_sub_preview_async(), when the drawable buffer
has a validate handler (i.e., when the drawable is a group layer),
validate the requested area before calling gegl_buffer_get(), so
that the buffer is validated in a single step, instead of tile-by-
tile.
In gimp_drawable_get_sub_preview_async(), use
gimp_idle_run_async_full() to render the preview in a low-priority
idle source when the drawable uses a validate handler (i.e., when
it's a group layer), to avoid rendering the preview before the
projection is done rendering, causing a noticeable freeze.
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.
... which is an asynchronous version of
gimp_drawable_get_sub_preview().
We currently support async preview generation for drawables whose
buffer isn't backed by a GimpTileHandlerValidate tile handler
(i.e., anything other than group layers), since preview generation
fir such drawables may involve processing the corresponding graph,
which isn't thread-safe.
When the GIMP_NO_ASYNC_DRAWABLE_PREVIEWS environment variable is
defined, all drawable previews are synchronously generated.
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.
Change gimp_viewable_get_[new]_preview() to return buffers of the
image's and layers' colorspace, but in u8. This way layer and image
previews can transform them correctly to the display profile.
Note: this makes plug-ins receive thumbnail buffers in that
pixel format too.
Also change gimp_viewable_get_[new]_pixbuf() to always return sRGB
buffers that can reasonably be put to screen directly, or put into DND
buffers. This is at least more correct now.
gimp_drawable_get_sub_preview(): both the preview buffer's scale
factor and the src coordinates in the drawable were calculated
wrongly. Found by Massimo.
- 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
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.
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.
2009-02-05 Michael Natterer <mitch@gimp.org>
* app/core/gimpdrawable.h
* app/core/gimpdrawable-preview.c: move the preview related
members to the private struct.
* app/core/gimpdrawable.c
* app/core/gimpdrawable-private.h
* app/core/gimpselection.c: changed accordingly.
svn path=/trunk/; revision=27986
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
2008-10-09 Michael Natterer <mitch@gimp.org>
Add GEGL_CFLAGS and #includes as if gimpdrawable.h and gimpimage.h
had a GEGL dependency (they will have in the next commit, but I
wanted to keep the commit separate).
* app/dialogs/Makefile.am
* app/file/Makefile.am
* app/gui/Makefile.am
* app/menus/Makefile.am
* app/paint/Makefile.am
* app/plug-in/Makefile.am
* app/text/Makefile.am
* app/vectors/Makefile.am
* app/widgets/Makefile.am
* app/xcf/Makefile.am: add GEGL_CFLAGS.
* app/actions/*.c
* app/core/*.c
* app/dialogs/*.c
* app/display/*.c
* app/file/*.c
* app/gui/*.c
* app/menus/*.c
* app/paint/*.c
* app/pdb/gimppdb-utils.c
* app/pdb/gimpprocedure.c
* app/plug-in/*.c
* app/text/*.c
* app/tools/*.c
* app/vectors/*.c
* app/widgets/*.c
* app/xcf/*.c: add <gegl.h> or replace <glib-object.h> by <gegl.h>
to all files which include a drawable subclass or gimpimage.h
* tools/pdbgen/app.pl: include <gegl.h> instead of <glib-object.h>
in all generated files.
* app/pdb/*-cmds.c: regenerated.
* data/images/gimp-splash.png: the goat is still sleeping.
By Aurore Derriennic.
svn path=/trunk/; revision=27202
2007-07-17 Sven Neumann <sven@gimp.org>
* app/paint-funcs/Makefile.am
* app/paint-funcs/scale-funcs.[ch]
* app/paint-funcs/sample-funcs.[ch]: moved subsample_region() to
new file and also moved subsample_indexed_region() there.
* app/base/tile-manager-preview.c
* app/core/gimpdrawable-preview.c: changed accordingly.
svn path=/trunk/; revision=22953
2007-07-17 Sven Neumann <sven@gimp.org>
* app/base/tile-manager-preview.[ch]: added
tile_manager_get_sub_preview().
* app/core/gimpdrawable-preview.c: use the new function except
for
indexed drawables.
svn path=/trunk/; revision=22950
2006-08-29 Michael Natterer <mitch@gimp.org>
Changed GimpViewable preview rendering to have a context to get
FG/BG/whatever from. Use the context to enable dynamic FG/BG
colors in gradients. Fixes bug #127676 and bug #352214. Addresses
bug #128367 (doesn't fix it because there's no loading/saving and
no GUI yet).
* app/core/core-enums.[ch]: added enum GimpGradientColor to enable
specifying gradient colors in terms of foreground and background.
* app/core/gimpgradient.[ch]: added color_type members to the
GimpGradientSegment struct and honor them in
gimp_gradient_get_color_at(). Added GimpContext parameters to all
functions which finally call get_color_at().
* app/core/gimp-gradients.c: use the new method to implement the
builtin gradients.
* app/core/gimpviewable.[ch]: added GimpContext parameters to all
get_preview() and get_pixbuf() functions.
* app/core/gimpbrush.c
* app/core/gimpbuffer.c
* app/core/gimpdrawable-preview.[ch]
* app/core/gimpgradient.c
* app/core/gimpimage-preview.[ch]
* app/core/gimpimagefile.c
* app/core/gimppalette.c
* app/core/gimppattern.c
* app/core/gimpundo.[ch]
* app/text/gimpfont.c
* app/vectors/gimpvectors-preview.[ch]: changed ::get_preview()
and ::get_pixbuf() implementations accordingly.
* app/core/gimpdrawable-blend.c
* app/core/gimppalette-import.[ch]
* app/dialogs/dialogs-constructors.c
* app/dialogs/palette-import-dialog.c
* app/dialogs/resize-dialog.c
* app/display/gimpdisplayshell-layer-select.c
* app/display/gimpdisplayshell.c
* app/display/gimpnavigationeditor.c
* app/paint/gimppaintoptions.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimptexttool.c
* app/actions/gradient-editor-commands.c
* app/widgets/gimpaction.c
* app/widgets/gimpbrusheditor.[ch]
* app/widgets/gimpbufferview.c
* app/widgets/gimpcellrendererviewable.c
* app/widgets/gimpchanneltreeview.c
* app/widgets/gimpclipboard.c
* app/widgets/gimpcoloreditor.c
* app/widgets/gimpcomponenteditor.c
* app/widgets/gimpcontainerbox.c
* app/widgets/gimpcontainercombobox.c
* app/widgets/gimpcontainereditor.c
* app/widgets/gimpcontainerentry.c
* app/widgets/gimpcontainergridview.c
* app/widgets/gimpcontainertreeview.[ch]
* app/widgets/gimpdataeditor.[ch]
* app/widgets/gimpdevicestatus.c
* app/widgets/gimpdnd.[ch]
* app/widgets/gimpdrawabletreeview.c
* app/widgets/gimpfiledialog.c
* app/widgets/gimpgradienteditor.[ch]
* app/widgets/gimpgradientselect.c
* app/widgets/gimpitemtreeview.c
* app/widgets/gimplayertreeview.c
* app/widgets/gimppaletteeditor.[ch]
* app/widgets/gimppropwidgets.[ch]
* app/widgets/gimpselectioneditor.c
* app/widgets/gimpthumbbox.[ch]
* app/widgets/gimptoolbox-image-area.c
* app/widgets/gimptoolbox-indicator-area.c
* app/widgets/gimptooloptionseditor.c
* app/widgets/gimpundoeditor.c
* app/widgets/gimpvectorstreeview.c
* app/widgets/gimpview-popup.[ch]
* app/widgets/gimpview.[ch]
* app/widgets/gimpviewablebutton.c
* app/widgets/gimpviewabledialog.c
* app/widgets/gimpviewrenderer.[ch]
* app/widgets/gimpviewrenderer-frame.c
* app/widgets/gimpviewrendererbrush.c
* app/widgets/gimpviewrendererbuffer.c
* app/widgets/gimpviewrendererdrawable.c
* app/widgets/gimpviewrenderergradient.c
* app/widgets/gimpviewrendererimage.c
* tools/pdbgen/pdb/drawable.pdb
* tools/pdbgen/pdb/gradient.pdb
* tools/pdbgen/pdb/gradients.pdb
* tools/pdbgen/pdb/image.pdb: added tons of GimpContext members
and parameters, implement GimpDocked::set_context() in many
widgets. Pass these locally remembered contexts to GimpViewable
functions. Did some minor cleanups on the way. There are still
some minor FIXMEs around where the code uses a NULL context (which
is allowed by the APIs)
* app/pdb/drawable_cmds.c
* app/pdb/gradient_cmds.c
* app/pdb/gradients_cmds.c
* app/pdb/image_cmds.c: regenerated.
2006-04-07 Sven Neumann <sven@gimp.org>
* app/core/gimpdrawable.[ch]: renamed gimp_drawable_data() to
gimp_drawable_get_tiles().
[lots of files]: changed accordingly.
2005-09-03 Michael Natterer <mitch@gimp.org>
* app/base/pixel-region.[ch]: some general cleanup.
(pixel_region_init_temp_buf)
(pixel_region_init_data): new functions which initialize pixel
regions on TempBufs and on raw contiguous arrays of pixel data.
(pixel_region_configure): fixed a bug that has probably been there
forever: when processing contiguous (non-tiled) data, interpret
the original x and y coordinates of the region as offsets into
the data. Before this fix, the initial x and y were simply ignored
(by using them in a broken way), thus always forcing the upper
left corner of the region being the beginning of the passed data.
Lots of code was working around this problem by setting the
pixel_region's data pointer to the proper starting pixel of the
region in the middle the buffer.
* libgimp/gimppixelrgn.c: some general cleanup.
(gimp_pixel_rgn_configure): same fix as above. Fortunately, nobody
seems to know that libgimp pixel regions can be used on arrays of
data, just as core ones. Only two plug-ins were using this
feature, and they are antique and written by spencer and federico,
respectively. They both don't use offsets into the buffers and are
not affected by this change. It's highly unlikely that anybody out
there knows/uses this feature, so it can IMHO be safely changed.
* app/base/temp-buf.c
* app/core/gimpbuffer.c
* app/core/gimpdrawable-combine.c
* app/core/gimpdrawable-preview.c
* app/core/gimpimage-preview.c
* app/core/gimplayer.c
* app/paint/gimpbrushcore.c
* app/paint/gimpclone.c
* app/paint/gimpconvolve.c
* app/paint/gimpdodgeburn.c
* app/paint/gimppaintcore.c
* app/paint/gimpsmudge.c
* app/tools/gimpiscissorstool.c
* app/tools/gimppainttool.c: use the pixel_region_init_foo()
functions instead of initializing regions of TempBufs and raw data
manually. Removed lots of workarounds for the broken offset
handling. The changed places of code are much more readable now.
2004-12-15 Michael Natterer <mitch@gimp.org>
* app/core/gimpdrawable-preview.[ch]: added utility function
gimp_drawable_preview_bytes() and use it. Some cleanup,
untabified.
* app/widgets/gimpviewrendererdrawable.c: use
gimp_drawable_preview_bytes() instead of duplicating its code.
2004-12-15 Michael Natterer <mitch@gimp.org>
Sven Neumann <sven@gimp.org>
* app/core/gimpdrawable-preview.c (gimp_drawable_preview_scale):
fixed RGBA resampling by using premultiplied values for the
intermediate accumulation buffer. Fixes bugs #72880 and #72881.
2004-12-12 Michael Natterer <mitch@gimp.org>
* app/core/gimpdrawable-preview.c (gimp_drawable_get_sub_preview):
added precondition check for the coords of the src area. Some
cleanup and simplification.
* app/widgets/gimpviewrendererdrawable.c
(gimp_view_renderer_drawable_render): don't request sub-previews
of areas outside the drawable and don't reuqest previews of zero
width or height. Fixes crashes with the new preview code.
2004-12-11 Michael Natterer <mitch@gimp.org>
* app/core/gimpdrawable-preview.c (gimp_drawable_preview_private):
implement it using gimp_drawable_get_sub_preview(). Removes
massive code duplication introduced by yesterday's fix.
2004-12-11 Michael Natterer <mitch@gimp.org>
* app/core/gimpdrawable-preview.[ch]: added new function
gimp_drawable_get_sub_preview() which returns a scaled preview of
a part of a drawable.
(gimp_drawable_preview_scale): made it work with srcPR.x and
srcPR.y being != 0.
* app/core/gimpimage-preview.c (gimp_image_get_new_preview)
* app/widgets/gimpviewrendererdrawable.c
(gimp_view_renderer_drawable_render): if the area of the drawable
preview is more than 4 times larger than the drawable itself (evil
heuristic, but seems to work fine), use above function to get a
sub-preview of the drawable instead of getting an insanely large
preview of the whole drawable just to use a small part of it.
Fixes bug #142074.
* app/core/gimpimage-preview.c (gimp_image_get_new_preview):
optimized by skipping layers which do not intersect with the
canvas.
2004-05-06 Sven Neumann <sven@gimp.org>
* app/core/gimpdrawable-preview.c
* app/core/gimpimage-projection.c: added sanity so we don't just
plain crash when an indexed image doesn't have a colormap.
* plug-ins/common/png.c: keep at least one entry in the colormap.
Fixes bug #142029.
2004-01-11 Pedro Gimeno <pggimeno@wanadoo.es>
* app/core/gimpdrawable-preview.c (gimp_drawable_preview_scale):
Apply threshold to alpha in the same way as it is applied to the
image in indexed mode. Fixes bug #115793, at least until the
alpha thresholds in indexed images are removed.
* plug-ins/FractalExplorer/Display.c: Fix zoom undo handling
issues. Closes bug #82478.
2003-09-29 Sven Neumann <sven@gimp.org>
* app/core/Makefile.am
* app/core/gimpitem-preview.[ch]: new files with preview code
factored out of GimpDrawable.
* app/core/gimpdrawable-preview.[ch]: code removed here.
* app/core/gimpdrawable.c
* app/core/gimpitem.c: let GimpItem implement
GimpViewable::get_preview_size and GimpViewable::get_popup_size.
* app/widgets/gimppreviewrenderervectors.c: simple scale to the
renderer's size; it already respects the aspect ratio.
2003-09-28 Sven Neumann <sven@gimp.org>
* app/core/gimpscanconvert.c (gimp_scan_convert_free)
(gimp_scan_convert_finish): plugged memleaks and added some sanity
checks.
* app/base/pixel-region.c
* app/core/gimpdrawable-preview.c: removed trailing whitespace.
* app/tools/gimpdrawtool.c (gimp_draw_tool_on_vectors_curve):
gimp_stroke_nearest_point_get() doesn't set cur_pos when there are
no strokes; don't use the uninitialized variable.
2003-09-05 Michael Natterer <mitch@gimp.org>
* app/paint-funcs/paint-funcs.[ch]: removed function map_to_color()
since it does not belong here and the two places using it look much
cleaner when doing that stuff themselves.
* app/core/gimpdrawable-preview.c: cleanup.
(gimp_drawable_preview_scale): do the indexed palette lookup here
instead of calling map_to_color().
* app/core/gimpimage.c (gimp_image_get_color): transform the
colors here instead of calling map_to_color().
* app/core/gimpimage.[ch] (gimp_image_get_color): reordered
parameters src parameters are before dest parameters.
Made the src color const.
(gimp_image_transform_color): reordered so src parameters are
*after* dest parameters (since this function operates on the dest
image and it makes sense to have the dest parameters
together). Made the src color const here, too.
* app/core/gimpdrawable-bucket-fill.c
* app/core/gimpdrawable.c
* app/core/gimpimage-contiguous-region.c
* app/core/gimpimage-projection.c
* app/core/gimpimagemap.c
* app/core/gimplayer.c
* app/core/gimppalette-import.c
* app/paint/gimpclone.c
* app/paint/gimppaintcore.c: changed accordingly.
* app/core/gimpedit.c (gimp_edit_cut,copy): simplified by
moving the "cropped" variable to a local scope.
* app/core/gimpimage-mask.c: calling gimp_image_update() followed
by gimp_viewable_imvalidate_preview(drawable) is equal to calling
gimp_drawable_update() directly.