2014-06-12 17:57:26 -07:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
|
*
|
2018-04-13 14:36:16 -07:00
|
|
|
* gimpoperationgradient.h
|
2014-06-12 17:57:26 -07:00
|
|
|
* Copyright (C) 2014 Michael Henning <drawoc@darkrefraction.com>
|
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2018-07-11 14:47:19 -07:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2014-06-12 17:57:26 -07:00
|
|
|
*/
|
|
|
|
|
|
2018-04-13 14:36:16 -07:00
|
|
|
#ifndef __GIMP_OPERATION_GRADIENT_H__
|
|
|
|
|
#define __GIMP_OPERATION_GRADIENT_H__
|
2014-06-12 17:57:26 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <gegl-plugin.h>
|
|
|
|
|
|
|
|
|
|
|
2018-04-13 14:36:16 -07:00
|
|
|
#define GIMP_TYPE_OPERATION_GRADIENT (gimp_operation_gradient_get_type ())
|
|
|
|
|
#define GIMP_OPERATION_GRADIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_GRADIENT, GimpOperationGradient))
|
|
|
|
|
#define GIMP_OPERATION_GRADIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_GRADIENT, GimpOperationGradientClass))
|
|
|
|
|
#define GIMP_IS_OPERATION_GRADIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_GRADIENT))
|
|
|
|
|
#define GIMP_IS_OPERATION_GRADIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_GRADIENT))
|
|
|
|
|
#define GIMP_OPERATION_GRADIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_GRADIENT, GimpOperationGradientClass))
|
2014-06-12 17:57:26 -07:00
|
|
|
|
|
|
|
|
|
2018-04-13 14:36:16 -07:00
|
|
|
typedef struct _GimpOperationGradient GimpOperationGradient;
|
|
|
|
|
typedef struct _GimpOperationGradientClass GimpOperationGradientClass;
|
2014-06-12 17:57:26 -07:00
|
|
|
|
2018-04-13 14:36:16 -07:00
|
|
|
struct _GimpOperationGradient
|
2014-06-12 17:57:26 -07:00
|
|
|
{
|
app: various improvements to GimpOperationGradient
Invalidate the gradient cache while setting relevant properties,
and validate it, reconstructing if necessary, during prepare(),
rather than process(), to avoid the need to use a mutex.
Make sure the cache has at least two elements, corresponding to
the initial and final colors of the gradient, since both colors
might be needed, and to avoid division by zero.
Avoid using a cache if its necessary size is too big, or if the
gradient type is conical, since the necessary cache size for
conical gradients is unrelated to the gradient line length.
Improve index rounding during cache lookup.
Lots of indentation fixes.
2018-04-25 06:41:13 -07:00
|
|
|
GeglOperationFilter parent_instance;
|
2014-06-12 17:57:26 -07:00
|
|
|
|
app: various improvements to GimpOperationGradient
Invalidate the gradient cache while setting relevant properties,
and validate it, reconstructing if necessary, during prepare(),
rather than process(), to avoid the need to use a mutex.
Make sure the cache has at least two elements, corresponding to
the initial and final colors of the gradient, since both colors
might be needed, and to avoid division by zero.
Avoid using a cache if its necessary size is too big, or if the
gradient type is conical, since the necessary cache size for
conical gradients is unrelated to the gradient line length.
Improve index rounding during cache lookup.
Lots of indentation fixes.
2018-04-25 06:41:13 -07:00
|
|
|
GimpContext *context;
|
2014-06-29 17:40:47 -07:00
|
|
|
|
app: various improvements to GimpOperationGradient
Invalidate the gradient cache while setting relevant properties,
and validate it, reconstructing if necessary, during prepare(),
rather than process(), to avoid the need to use a mutex.
Make sure the cache has at least two elements, corresponding to
the initial and final colors of the gradient, since both colors
might be needed, and to avoid division by zero.
Avoid using a cache if its necessary size is too big, or if the
gradient type is conical, since the necessary cache size for
conical gradients is unrelated to the gradient line length.
Improve index rounding during cache lookup.
Lots of indentation fixes.
2018-04-25 06:41:13 -07:00
|
|
|
GimpGradient *gradient;
|
|
|
|
|
gdouble start_x, start_y, end_x, end_y;
|
|
|
|
|
GimpGradientType gradient_type;
|
|
|
|
|
GimpRepeatMode gradient_repeat;
|
|
|
|
|
gdouble offset;
|
|
|
|
|
gboolean gradient_reverse;
|
|
|
|
|
GimpGradientBlendColorSpace gradient_blend_color_space;
|
2014-06-12 17:57:26 -07:00
|
|
|
|
app: various improvements to GimpOperationGradient
Invalidate the gradient cache while setting relevant properties,
and validate it, reconstructing if necessary, during prepare(),
rather than process(), to avoid the need to use a mutex.
Make sure the cache has at least two elements, corresponding to
the initial and final colors of the gradient, since both colors
might be needed, and to avoid division by zero.
Avoid using a cache if its necessary size is too big, or if the
gradient type is conical, since the necessary cache size for
conical gradients is unrelated to the gradient line length.
Improve index rounding during cache lookup.
Lots of indentation fixes.
2018-04-25 06:41:13 -07:00
|
|
|
gboolean supersample;
|
|
|
|
|
gint supersample_depth;
|
|
|
|
|
gdouble supersample_threshold;
|
2014-06-12 17:57:26 -07:00
|
|
|
|
app: various improvements to GimpOperationGradient
Invalidate the gradient cache while setting relevant properties,
and validate it, reconstructing if necessary, during prepare(),
rather than process(), to avoid the need to use a mutex.
Make sure the cache has at least two elements, corresponding to
the initial and final colors of the gradient, since both colors
might be needed, and to avoid division by zero.
Avoid using a cache if its necessary size is too big, or if the
gradient type is conical, since the necessary cache size for
conical gradients is unrelated to the gradient line length.
Improve index rounding during cache lookup.
Lots of indentation fixes.
2018-04-25 06:41:13 -07:00
|
|
|
gboolean dither;
|
2018-04-17 16:11:33 -07:00
|
|
|
|
app: various improvements to GimpOperationGradient
Invalidate the gradient cache while setting relevant properties,
and validate it, reconstructing if necessary, during prepare(),
rather than process(), to avoid the need to use a mutex.
Make sure the cache has at least two elements, corresponding to
the initial and final colors of the gradient, since both colors
might be needed, and to avoid division by zero.
Avoid using a cache if its necessary size is too big, or if the
gradient type is conical, since the necessary cache size for
conical gradients is unrelated to the gradient line length.
Improve index rounding during cache lookup.
Lots of indentation fixes.
2018-04-25 06:41:13 -07:00
|
|
|
GimpRGB *gradient_cache;
|
|
|
|
|
gint gradient_cache_size;
|
2018-04-25 10:05:29 -07:00
|
|
|
GMutex gradient_cache_mutex;
|
2014-06-12 17:57:26 -07:00
|
|
|
};
|
|
|
|
|
|
2018-04-13 14:36:16 -07:00
|
|
|
struct _GimpOperationGradientClass
|
2014-06-12 17:57:26 -07:00
|
|
|
{
|
2015-04-26 19:39:41 -07:00
|
|
|
GeglOperationFilterClass parent_class;
|
2014-06-12 17:57:26 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2018-04-13 14:36:16 -07:00
|
|
|
GType gimp_operation_gradient_get_type (void) G_GNUC_CONST;
|
2014-06-12 17:57:26 -07:00
|
|
|
|
|
|
|
|
|
2018-04-13 14:36:16 -07:00
|
|
|
#endif /* __GIMP_OPERATION_GRADIENT_H__ */
|