mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-10-06 01:12:40 +02:00
Compare commits
11 Commits
62821736fb
...
mypaint-br
Author | SHA1 | Date | |
---|---|---|---|
|
430a79e803 | ||
|
68b8d54443 | ||
|
059f8e2965 | ||
|
9eeb80aee7 | ||
|
b7efaa1f2a | ||
|
d3ce30441f | ||
|
76b4dd7d31 | ||
|
d560fd371c | ||
|
f02027d8dd | ||
|
85b878cb3e | ||
|
11de0c781c |
22
INSTALL.in
22
INSTALL.in
@@ -79,7 +79,13 @@ header files installed.
|
||||
9. libpng, libjpeg and lcms are hard dependencies that can not be
|
||||
disabled.
|
||||
|
||||
10. You may want to install other third party libraries or programs
|
||||
10. For mypaint brushes, GIMP requires brushlib (libmypaint) @LIBMYPAINT_REQUIRED_VERSION@,
|
||||
compiled with GEGL support: `scons enable_gegl=true install`.
|
||||
Brushlib repository is hosted at:
|
||||
|
||||
https://gitorious.org/mypaint/libmypaint/
|
||||
|
||||
11. You may want to install other third party libraries or programs
|
||||
that are needed for some of the available plug-ins. We recommend
|
||||
to check that the following libraries are installed: libjasper,
|
||||
libpoppler-glib, libtiff, webkit, libmng, librsvg, libwmf, libaa
|
||||
@@ -94,26 +100,28 @@ header files installed.
|
||||
but you are sure it is installed, you are advised to test your build
|
||||
afterwards.
|
||||
|
||||
11. The Python extension requires Python 2 development headers (@PYTHON2_REQUIRED_VERSION@
|
||||
12. The Python extension requires Python 2 development headers (@PYTHON2_REQUIRED_VERSION@
|
||||
or newer) to be present. You will also need PyGTK and the
|
||||
respective development headers.
|
||||
|
||||
12. Configure GIMP by running the `configure' script. You may want
|
||||
13. Configure GIMP by running the `configure' script. You may want
|
||||
to pass some options to it, see below.
|
||||
|
||||
13. Build GIMP by running `make'. The use of GNU make is recommended.
|
||||
14. Build GIMP by running `make'. The use of GNU make is recommended.
|
||||
If you need to tweak the build to make it work with other flavours
|
||||
of make, we'd appreciate if you'd send us a patch with the changes.
|
||||
|
||||
14. Install GIMP by running `make install'. In order to avoid clashes
|
||||
15. Install GIMP by running `make install'. In order to avoid clashes
|
||||
with other versions of GIMP, we install a binary called gimp-@GIMP_APP_VERSION@.
|
||||
By default there's also a link created so that you can type 'gimp'
|
||||
to start gimp-@GIMP_APP_VERSION@.
|
||||
|
||||
15. Summary of required packages and what version you need:
|
||||
16. Summary of required packages and what version you need:
|
||||
|
||||
ATK: @ATK_REQUIRED_VERSION@
|
||||
babl: @BABL_REQUIRED_VERSION@
|
||||
brushlib: @LIBMYPAINT_REQUIRED_VERSION@
|
||||
libbzip2
|
||||
cairo: @CAIRO_REQUIRED_VERSION@
|
||||
Fontconfig: @FONTCONFIG_REQUIRED_VERSION@
|
||||
freetype2: @FREETYPE2_REQUIRED_VERSION@
|
||||
@@ -130,7 +138,7 @@ header files installed.
|
||||
pangocairo: @PANGOCAIRO_REQUIRED_VERSION@
|
||||
zlib
|
||||
|
||||
16. Summary of optional packages:
|
||||
17. Summary of optional packages:
|
||||
|
||||
Package Name Version Feature
|
||||
|
||||
|
@@ -187,6 +187,8 @@ gimpconsoleldadd = \
|
||||
$(GEXIV2_LIBS) \
|
||||
$(LCMS_LIBS) \
|
||||
$(Z_LIBS) \
|
||||
$(JSON_C_LIBS) \
|
||||
$(LIBMYPAINTGEGL_LIBS) \
|
||||
$(INTLLIBS) \
|
||||
$(RT_LIBS) \
|
||||
$(libm)
|
||||
|
@@ -26,6 +26,8 @@
|
||||
|
||||
#include "actions-types.h"
|
||||
|
||||
#include "config/gimpguiconfig.h" /* playground */
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpcontainer.h"
|
||||
#include "core/gimpcontext.h"
|
||||
@@ -185,6 +187,16 @@ static const GimpEnumActionEntry tools_airbrush_flow_actions[] =
|
||||
NULL }
|
||||
};
|
||||
|
||||
#ifdef HAVE_LIBMYPAINT
|
||||
static const GimpEnumActionEntry tools_mybrush_radius_actions[] =
|
||||
{
|
||||
{ "tools-mybrush-radius-set", GIMP_STOCK_TOOL_MYBRUSH,
|
||||
"Set MyPaint Brush Radius", NULL, NULL,
|
||||
GIMP_ACTION_SELECT_SET, TRUE,
|
||||
NULL }
|
||||
};
|
||||
#endif
|
||||
|
||||
static const GimpEnumActionEntry tools_foreground_select_brush_size_actions[] =
|
||||
{
|
||||
{ "tools-foreground-select-brush-size-set",
|
||||
@@ -497,6 +509,14 @@ tools_actions_setup (GimpActionGroup *group)
|
||||
G_N_ELEMENTS (tools_airbrush_flow_actions),
|
||||
G_CALLBACK (tools_airbrush_flow_cmd_callback));
|
||||
|
||||
#ifdef HAVE_LIBMYPAINT
|
||||
if (GIMP_GUI_CONFIG (group->gimp->config)->playground_mybrush_tool)
|
||||
gimp_action_group_add_enum_actions (group, NULL,
|
||||
tools_mybrush_radius_actions,
|
||||
G_N_ELEMENTS (tools_mybrush_radius_actions),
|
||||
G_CALLBACK (tools_mybrush_radius_cmd_callback));
|
||||
#endif
|
||||
|
||||
gimp_action_group_add_enum_actions (group, NULL,
|
||||
tools_foreground_select_brush_size_actions,
|
||||
G_N_ELEMENTS (tools_foreground_select_brush_size_actions),
|
||||
|
@@ -31,6 +31,9 @@
|
||||
|
||||
#include "paint/gimpinkoptions.h"
|
||||
#include "paint/gimpairbrushoptions.h"
|
||||
#ifdef HAVE_LIBMYPAINT
|
||||
#include "paint/gimpmybrushoptions.h"
|
||||
#endif
|
||||
|
||||
#include "widgets/gimpenumaction.h"
|
||||
#include "widgets/gimpuimanager.h"
|
||||
@@ -293,6 +296,29 @@ tools_airbrush_flow_cmd_callback (GtkAction *action,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBMYPAINT
|
||||
void
|
||||
tools_mybrush_radius_cmd_callback (GtkAction *action,
|
||||
gint value,
|
||||
gpointer data)
|
||||
{
|
||||
GimpContext *context;
|
||||
GimpToolInfo *tool_info;
|
||||
return_if_no_context (context, data);
|
||||
|
||||
tool_info = gimp_context_get_tool (context);
|
||||
|
||||
if (tool_info && GIMP_IS_MYBRUSH_OPTIONS (tool_info->tool_options))
|
||||
{
|
||||
action_select_property ((GimpActionSelectType) value,
|
||||
action_data_get_display (data),
|
||||
G_OBJECT (tool_info->tool_options),
|
||||
"radius",
|
||||
0.1, 0.1, 0.5, 1.0, FALSE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
tools_fg_select_brush_size_cmd_callback (GtkAction *action,
|
||||
gint value,
|
||||
|
@@ -54,6 +54,12 @@ void tools_airbrush_flow_cmd_callback (GtkAction *action,
|
||||
gint value,
|
||||
gpointer data);
|
||||
|
||||
#ifdef HAVE_LIBMYPAINT
|
||||
void tools_mybrush_radius_cmd_callback (GtkAction *action,
|
||||
gint value,
|
||||
gpointer data);
|
||||
#endif
|
||||
|
||||
void tools_fg_select_brush_size_cmd_callback (GtkAction *action,
|
||||
gint value,
|
||||
gpointer data);
|
||||
|
@@ -82,6 +82,7 @@ enum
|
||||
|
||||
PROP_PLAYGROUND_NPD_TOOL,
|
||||
PROP_PLAYGROUND_HANDLE_TRANSFORM_TOOL,
|
||||
PROP_PLAYGROUND_MYBRUSH_TOOL,
|
||||
|
||||
PROP_HIDE_DOCKS,
|
||||
PROP_SINGLE_WINDOW_MODE,
|
||||
@@ -288,6 +289,13 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
|
||||
FALSE,
|
||||
GIMP_PARAM_STATIC_STRINGS |
|
||||
GIMP_CONFIG_PARAM_RESTART);
|
||||
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class,
|
||||
PROP_PLAYGROUND_MYBRUSH_TOOL,
|
||||
"playground-mybrush-tool",
|
||||
PLAYGROUND_MYBRUSH_TOOL_BLURB,
|
||||
FALSE,
|
||||
GIMP_PARAM_STATIC_STRINGS |
|
||||
GIMP_CONFIG_PARAM_RESTART);
|
||||
|
||||
g_object_class_install_property (object_class, PROP_HIDE_DOCKS,
|
||||
g_param_spec_boolean ("hide-docks",
|
||||
@@ -499,6 +507,9 @@ gimp_gui_config_set_property (GObject *object,
|
||||
case PROP_PLAYGROUND_HANDLE_TRANSFORM_TOOL:
|
||||
gui_config->playground_handle_transform_tool = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_PLAYGROUND_MYBRUSH_TOOL:
|
||||
gui_config->playground_mybrush_tool = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_HIDE_DOCKS:
|
||||
gui_config->hide_docks = g_value_get_boolean (value);
|
||||
@@ -640,6 +651,9 @@ gimp_gui_config_get_property (GObject *object,
|
||||
case PROP_PLAYGROUND_HANDLE_TRANSFORM_TOOL:
|
||||
g_value_set_boolean (value, gui_config->playground_handle_transform_tool);
|
||||
break;
|
||||
case PROP_PLAYGROUND_MYBRUSH_TOOL:
|
||||
g_value_set_boolean (value, gui_config->playground_mybrush_tool);
|
||||
break;
|
||||
|
||||
case PROP_HIDE_DOCKS:
|
||||
g_value_set_boolean (value, gui_config->hide_docks);
|
||||
|
@@ -76,6 +76,7 @@ struct _GimpGuiConfig
|
||||
/* experimental playground */
|
||||
gboolean playground_npd_tool;
|
||||
gboolean playground_handle_transform_tool;
|
||||
gboolean playground_mybrush_tool;
|
||||
|
||||
/* saved in sessionrc */
|
||||
gboolean hide_docks;
|
||||
|
@@ -380,6 +380,9 @@ _("Enable the N-Point Deformation tool.")
|
||||
#define PLAYGROUND_HANDLE_TRANSFORM_TOOL_BLURB \
|
||||
_("Enable the Handle Transform tool.")
|
||||
|
||||
#define PLAYGROUND_MYBRUSH_TOOL_BLURB \
|
||||
_("Enable the MyPaint Brush tool.")
|
||||
|
||||
#define SPACE_BAR_ACTION_BLURB \
|
||||
_("What to do when the space bar is pressed in the image window.")
|
||||
|
||||
|
@@ -1475,6 +1475,11 @@ prefs_dialog_new (Gimp *gimp,
|
||||
button = prefs_check_button_add (object, "playground-handle-transform-tool",
|
||||
_("_Handle Transform tool"),
|
||||
GTK_BOX (vbox2));
|
||||
#ifdef HAVE_LIBMYPAINT
|
||||
button = prefs_check_button_add (object, "playground-mybrush-tool",
|
||||
_("_MyPaint Brush tool"),
|
||||
GTK_BOX (vbox2));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,14 +1,15 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-DG_LOG_DOMAIN=\"Gimp-Paint\" \
|
||||
-I$(top_builddir) \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_builddir)/app \
|
||||
-I$(top_srcdir)/app \
|
||||
$(CAIRO_CFLAGS) \
|
||||
$(GEGL_CFLAGS) \
|
||||
$(GDK_PIXBUF_CFLAGS) \
|
||||
-DG_LOG_DOMAIN=\"Gimp-Paint\" \
|
||||
-I$(top_builddir) \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_builddir)/app \
|
||||
-I$(top_srcdir)/app \
|
||||
$(CAIRO_CFLAGS) \
|
||||
$(GEGL_CFLAGS) \
|
||||
$(GDK_PIXBUF_CFLAGS) \
|
||||
$(LIBMYPAINTGEGL_CFLAGS) \
|
||||
-I$(includedir)
|
||||
|
||||
noinst_LIBRARIES = libapppaint.a
|
||||
@@ -80,10 +81,17 @@ libapppaint_a_sources = \
|
||||
gimpsourceoptions.c \
|
||||
gimpsourceoptions.h
|
||||
|
||||
if HAVE_LIBMYPAINT
|
||||
mybrush_sources = \
|
||||
gimpmybrush.c \
|
||||
gimpmybrush.h \
|
||||
gimpmybrushoptions.c \
|
||||
gimpmybrushoptions.h
|
||||
endif
|
||||
|
||||
libapppaint_a_built_sources = paint-enums.c
|
||||
|
||||
libapppaint_a_SOURCES = $(libapppaint_a_built_sources) $(libapppaint_a_sources)
|
||||
|
||||
libapppaint_a_SOURCES = $(libapppaint_a_built_sources) $(mybrush_sources) $(libapppaint_a_sources)
|
||||
#
|
||||
# rules to generate built sources
|
||||
#
|
||||
|
@@ -34,6 +34,9 @@
|
||||
#include "gimperaser.h"
|
||||
#include "gimpheal.h"
|
||||
#include "gimpink.h"
|
||||
#ifdef HAVE_LIBMYPAINT
|
||||
#include "gimpmybrush.h"
|
||||
#endif
|
||||
#include "gimppaintoptions.h"
|
||||
#include "gimppaintbrush.h"
|
||||
#include "gimppencil.h"
|
||||
@@ -64,6 +67,9 @@ gimp_paint_init (Gimp *gimp)
|
||||
gimp_perspective_clone_register,
|
||||
gimp_heal_register,
|
||||
gimp_clone_register,
|
||||
#ifdef HAVE_LIBMYPAINT
|
||||
gimp_mybrush_register,
|
||||
#endif
|
||||
gimp_ink_register,
|
||||
gimp_airbrush_register,
|
||||
gimp_eraser_register,
|
||||
|
251
app/paint/gimpmybrush.c
Normal file
251
app/paint/gimpmybrush.c
Normal file
@@ -0,0 +1,251 @@
|
||||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <cairo.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <gegl.h>
|
||||
|
||||
#include <mypaint-brush.h>
|
||||
#include <mypaint-tiled-surface.h>
|
||||
#include <mypaint-gegl-surface.h>
|
||||
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
|
||||
#include "paint-types.h"
|
||||
|
||||
#include "gegl/gimp-gegl-utils.h"
|
||||
|
||||
#include "config/gimpguiconfig.h" /* playground */
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-undo.h"
|
||||
#include "core/gimptempbuf.h"
|
||||
|
||||
#include "gimpmybrushoptions.h"
|
||||
#include "gimpmybrush.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
struct _GimpMybrushPrivate
|
||||
{
|
||||
MyPaintGeglTiledSurface *surface;
|
||||
MyPaintBrush *brush;
|
||||
};
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_mybrush_paint (GimpPaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
GimpPaintOptions *paint_options,
|
||||
const GimpCoords *coords,
|
||||
GimpPaintState paint_state,
|
||||
guint32 time);
|
||||
static void gimp_mybrush_motion (GimpPaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
GimpPaintOptions *paint_options,
|
||||
const GimpCoords *coords,
|
||||
guint32 time);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpMybrush, gimp_mybrush, GIMP_TYPE_PAINT_CORE)
|
||||
|
||||
#define parent_class gimp_mybrush_parent_class
|
||||
|
||||
|
||||
void
|
||||
gimp_mybrush_register (Gimp *gimp,
|
||||
GimpPaintRegisterCallback callback)
|
||||
{
|
||||
if (GIMP_GUI_CONFIG (gimp->config)->playground_mybrush_tool)
|
||||
(* callback) (gimp,
|
||||
GIMP_TYPE_MYBRUSH,
|
||||
GIMP_TYPE_MYBRUSH_OPTIONS,
|
||||
"gimp-mybrush",
|
||||
_("Mybrush"),
|
||||
"gimp-tool-mybrush");
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_mybrush_class_init (GimpMybrushClass *klass)
|
||||
{
|
||||
GimpPaintCoreClass *paint_core_class = GIMP_PAINT_CORE_CLASS (klass);
|
||||
|
||||
paint_core_class->paint = gimp_mybrush_paint;
|
||||
|
||||
g_type_class_add_private (klass, sizeof (GimpMybrushPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_mybrush_init (GimpMybrush *mybrush)
|
||||
{
|
||||
mybrush->private = G_TYPE_INSTANCE_GET_PRIVATE (mybrush,
|
||||
GIMP_TYPE_MYBRUSH,
|
||||
GimpMybrushPrivate);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_mybrush_paint (GimpPaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
GimpPaintOptions *paint_options,
|
||||
const GimpCoords *coords,
|
||||
GimpPaintState paint_state,
|
||||
guint32 time)
|
||||
{
|
||||
GimpMybrush *mybrush = GIMP_MYBRUSH (paint_core);
|
||||
GimpMybrushOptions *options = GIMP_MYBRUSH_OPTIONS (paint_options);
|
||||
GeglBuffer *buffer;
|
||||
|
||||
switch (paint_state)
|
||||
{
|
||||
case GIMP_PAINT_STATE_INIT:
|
||||
mybrush->private->surface = mypaint_gegl_tiled_surface_new ();
|
||||
|
||||
buffer = mypaint_gegl_tiled_surface_get_buffer (mybrush->private->surface);
|
||||
buffer = gegl_buffer_new (GEGL_RECTANGLE (0, 0,
|
||||
gimp_item_get_width (GIMP_ITEM (drawable)),
|
||||
gimp_item_get_height (GIMP_ITEM (drawable))),
|
||||
gegl_buffer_get_format (buffer));
|
||||
gegl_buffer_copy (gimp_drawable_get_buffer (drawable), NULL,
|
||||
buffer, NULL);
|
||||
mypaint_gegl_tiled_surface_set_buffer (mybrush->private->surface, buffer);
|
||||
g_object_unref (buffer);
|
||||
|
||||
mybrush->private->brush = mypaint_brush_new ();
|
||||
mypaint_brush_from_defaults (mybrush->private->brush);
|
||||
|
||||
if (options->mybrush)
|
||||
{
|
||||
gchar *string;
|
||||
gsize length;
|
||||
|
||||
if (g_file_get_contents (options->mybrush,
|
||||
&string, &length, NULL))
|
||||
{
|
||||
if (! mypaint_brush_from_string (mybrush->private->brush, string))
|
||||
g_printerr ("Failed to deserialize MyPaint brush\n");
|
||||
|
||||
g_free (string);
|
||||
}
|
||||
}
|
||||
|
||||
mypaint_brush_new_stroke (mybrush->private->brush);
|
||||
break;
|
||||
|
||||
case GIMP_PAINT_STATE_MOTION:
|
||||
gimp_mybrush_motion (paint_core, drawable, paint_options, coords, time);
|
||||
break;
|
||||
|
||||
case GIMP_PAINT_STATE_FINISH:
|
||||
mypaint_surface_unref ((MyPaintSurface *) mybrush->private->surface);
|
||||
mybrush->private->surface = NULL;
|
||||
|
||||
mypaint_brush_unref (mybrush->private->brush);
|
||||
mybrush->private->brush = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_mybrush_motion (GimpPaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
GimpPaintOptions *paint_options,
|
||||
const GimpCoords *coords,
|
||||
guint32 time)
|
||||
{
|
||||
GimpMybrush *mybrush = GIMP_MYBRUSH (paint_core);
|
||||
GimpMybrushOptions *options = GIMP_MYBRUSH_OPTIONS (paint_options);
|
||||
GimpContext *context = GIMP_CONTEXT (paint_options);
|
||||
GimpComponentMask active_mask;
|
||||
GimpRGB fg;
|
||||
GimpHSV hsv;
|
||||
MyPaintRectangle rect;
|
||||
|
||||
active_mask = gimp_drawable_get_active_mask (drawable);
|
||||
|
||||
mypaint_brush_set_base_value (mybrush->private->brush,
|
||||
MYPAINT_BRUSH_SETTING_LOCK_ALPHA,
|
||||
(active_mask & GIMP_COMPONENT_ALPHA) ?
|
||||
FALSE : TRUE);
|
||||
|
||||
gimp_context_get_foreground (context, &fg);
|
||||
gimp_rgb_to_hsv (&fg, &hsv);
|
||||
|
||||
mypaint_brush_set_base_value (mybrush->private->brush,
|
||||
MYPAINT_BRUSH_SETTING_COLOR_H,
|
||||
hsv.h);
|
||||
mypaint_brush_set_base_value (mybrush->private->brush,
|
||||
MYPAINT_BRUSH_SETTING_COLOR_S,
|
||||
hsv.s);
|
||||
mypaint_brush_set_base_value (mybrush->private->brush,
|
||||
MYPAINT_BRUSH_SETTING_COLOR_V,
|
||||
hsv.v);
|
||||
|
||||
mypaint_brush_set_base_value (mybrush->private->brush,
|
||||
MYPAINT_BRUSH_SETTING_OPAQUE,
|
||||
gimp_context_get_opacity (context));
|
||||
mypaint_brush_set_base_value (mybrush->private->brush,
|
||||
MYPAINT_BRUSH_SETTING_RADIUS_LOGARITHMIC,
|
||||
options->radius);
|
||||
mypaint_brush_set_base_value (mybrush->private->brush,
|
||||
MYPAINT_BRUSH_SETTING_HARDNESS,
|
||||
options->hardness);
|
||||
|
||||
mypaint_surface_begin_atomic ((MyPaintSurface *) mybrush->private->surface);
|
||||
|
||||
mypaint_brush_stroke_to (mybrush->private->brush,
|
||||
(MyPaintSurface *) mybrush->private->surface,
|
||||
coords->x,
|
||||
coords->y,
|
||||
coords->pressure,
|
||||
coords->xtilt,
|
||||
coords->ytilt,
|
||||
1);
|
||||
|
||||
mypaint_surface_end_atomic ((MyPaintSurface *) mybrush->private->surface,
|
||||
&rect);
|
||||
|
||||
g_printerr ("painted rect: %d %d %d %d\n",
|
||||
rect.x, rect.y, rect.width, rect.height);
|
||||
|
||||
if (rect.width > 0 && rect.height > 0)
|
||||
{
|
||||
GeglBuffer *src;
|
||||
|
||||
src = mypaint_gegl_tiled_surface_get_buffer (mybrush->private->surface);
|
||||
|
||||
gegl_buffer_copy (src,
|
||||
(GeglRectangle *) &rect,
|
||||
gimp_drawable_get_buffer (drawable),
|
||||
NULL);
|
||||
|
||||
paint_core->x1 = MIN (paint_core->x1, rect.x);
|
||||
paint_core->y1 = MIN (paint_core->y1, rect.y);
|
||||
paint_core->x2 = MAX (paint_core->x2, rect.x + rect.width);
|
||||
paint_core->y2 = MAX (paint_core->y2, rect.y + rect.height);
|
||||
|
||||
gimp_drawable_update (drawable, rect.x, rect.y, rect.width, rect.height);
|
||||
}
|
||||
}
|
55
app/paint/gimpmybrush.h
Normal file
55
app/paint/gimpmybrush.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_MYBRUSH_H__
|
||||
#define __GIMP_MYBRUSH_H__
|
||||
|
||||
|
||||
#include "gimppaintcore.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_MYBRUSH (gimp_mybrush_get_type ())
|
||||
#define GIMP_MYBRUSH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_MYBRUSH, GimpMybrush))
|
||||
#define GIMP_MYBRUSH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_MYBRUSH, GimpMybrushClass))
|
||||
#define GIMP_IS_MYBRUSH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_MYBRUSH))
|
||||
#define GIMP_IS_MYBRUSH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_MYBRUSH))
|
||||
#define GIMP_MYBRUSH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_MYBRUSH, GimpMybrushClass))
|
||||
|
||||
|
||||
typedef struct _GimpMybrushPrivate GimpMybrushPrivate;
|
||||
typedef struct _GimpMybrushClass GimpMybrushClass;
|
||||
|
||||
struct _GimpMybrush
|
||||
{
|
||||
GimpPaintCore parent_instance;
|
||||
|
||||
GimpMybrushPrivate *private;
|
||||
};
|
||||
|
||||
struct _GimpMybrushClass
|
||||
{
|
||||
GimpPaintCoreClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
void gimp_mybrush_register (Gimp *gimp,
|
||||
GimpPaintRegisterCallback callback);
|
||||
|
||||
GType gimp_mybrush_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
#endif /* __GIMP_MYBRUSH_H__ */
|
136
app/paint/gimpmybrushoptions.c
Normal file
136
app/paint/gimpmybrushoptions.c
Normal file
@@ -0,0 +1,136 @@
|
||||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <gegl.h>
|
||||
|
||||
#include "libgimpconfig/gimpconfig.h"
|
||||
|
||||
#include "paint-types.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimppaintinfo.h"
|
||||
|
||||
#include "gimpmybrushoptions.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_RADIUS,
|
||||
PROP_HARDNESS,
|
||||
PROP_MYBRUSH
|
||||
};
|
||||
|
||||
|
||||
static void gimp_mybrush_options_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_mybrush_options_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpMybrushOptions, gimp_mybrush_options, GIMP_TYPE_PAINT_OPTIONS)
|
||||
|
||||
|
||||
static void
|
||||
gimp_mybrush_options_class_init (GimpMybrushOptionsClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->set_property = gimp_mybrush_options_set_property;
|
||||
object_class->get_property = gimp_mybrush_options_get_property;
|
||||
|
||||
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_RADIUS,
|
||||
"radius", _("Radius"),
|
||||
-2.0, 6.0, 1.0,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_HARDNESS,
|
||||
"hardness", NULL,
|
||||
0.0, 1.0, 1.0,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
GIMP_CONFIG_INSTALL_PROP_STRING (object_class, PROP_MYBRUSH,
|
||||
"mybrush", NULL,
|
||||
NULL,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_mybrush_options_init (GimpMybrushOptions *options)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_mybrush_options_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpMybrushOptions *options = GIMP_MYBRUSH_OPTIONS (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_RADIUS:
|
||||
options->radius = g_value_get_double (value);
|
||||
break;
|
||||
case PROP_HARDNESS:
|
||||
options->hardness = g_value_get_double (value);
|
||||
break;
|
||||
case PROP_MYBRUSH:
|
||||
g_free (options->mybrush);
|
||||
options->mybrush = g_value_dup_string (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_mybrush_options_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpMybrushOptions *options = GIMP_MYBRUSH_OPTIONS (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_RADIUS:
|
||||
g_value_set_double (value, options->radius);
|
||||
break;
|
||||
case PROP_HARDNESS:
|
||||
g_value_set_double (value, options->hardness);
|
||||
break;
|
||||
case PROP_MYBRUSH:
|
||||
g_value_set_string (value, options->mybrush);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
53
app/paint/gimpmybrushoptions.h
Normal file
53
app/paint/gimpmybrushoptions.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_MYBRUSH_OPTIONS_H__
|
||||
#define __GIMP_MYBRUSH_OPTIONS_H__
|
||||
|
||||
|
||||
#include "gimppaintoptions.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_MYBRUSH_OPTIONS (gimp_mybrush_options_get_type ())
|
||||
#define GIMP_MYBRUSH_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_MYBRUSH_OPTIONS, GimpMybrushOptions))
|
||||
#define GIMP_MYBRUSH_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_MYBRUSH_OPTIONS, GimpMybrushOptionsClass))
|
||||
#define GIMP_IS_MYBRUSH_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_MYBRUSH_OPTIONS))
|
||||
#define GIMP_IS_MYBRUSH_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_MYBRUSH_OPTIONS))
|
||||
#define GIMP_MYBRUSH_OPTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_MYBRUSH_OPTIONS, GimpMybrushOptionsClass))
|
||||
|
||||
|
||||
typedef struct _GimpMybrushOptionsClass GimpMybrushOptionsClass;
|
||||
|
||||
struct _GimpMybrushOptions
|
||||
{
|
||||
GimpPaintOptions parent_instance;
|
||||
|
||||
gdouble radius;
|
||||
gdouble hardness;
|
||||
gchar *mybrush;
|
||||
};
|
||||
|
||||
struct _GimpMybrushOptionsClass
|
||||
{
|
||||
GimpPaintOptionsClass parent_instance;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_mybrush_options_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
#endif /* __GIMP_MYBRUSH_OPTIONS_H__ */
|
@@ -36,6 +36,7 @@ typedef struct _GimpDodgeBurn GimpDodgeBurn;
|
||||
typedef struct _GimpEraser GimpEraser;
|
||||
typedef struct _GimpHeal GimpHeal;
|
||||
typedef struct _GimpInk GimpInk;
|
||||
typedef struct _GimpMybrush GimpMybrush;
|
||||
typedef struct _GimpPaintbrush GimpPaintbrush;
|
||||
typedef struct _GimpPencil GimpPencil;
|
||||
typedef struct _GimpPerspectiveClone GimpPerspectiveClone;
|
||||
@@ -53,6 +54,7 @@ typedef struct _GimpConvolveOptions GimpConvolveOptions;
|
||||
typedef struct _GimpDodgeBurnOptions GimpDodgeBurnOptions;
|
||||
typedef struct _GimpEraserOptions GimpEraserOptions;
|
||||
typedef struct _GimpInkOptions GimpInkOptions;
|
||||
typedef struct _GimpMybrushOptions GimpMybrushOptions;
|
||||
typedef struct _GimpPencilOptions GimpPencilOptions;
|
||||
typedef struct _GimpPerspectiveCloneOptions GimpPerspectiveCloneOptions;
|
||||
typedef struct _GimpSmudgeOptions GimpSmudgeOptions;
|
||||
|
@@ -219,9 +219,17 @@ libapptools_a_sources = \
|
||||
gimpwarptool.c \
|
||||
gimpwarptool.h
|
||||
|
||||
if HAVE_LIBMYPAINT
|
||||
mybrushtool_sources = \
|
||||
gimpmybrushoptions-gui.c \
|
||||
gimpmybrushoptions-gui.h \
|
||||
gimpmybrushtool.c \
|
||||
gimpmybrushtool.h
|
||||
endif
|
||||
|
||||
libapptools_a_built_sources = tools-enums.c
|
||||
|
||||
libapptools_a_SOURCES = $(libapptools_a_built_sources) $(libapptools_a_sources)
|
||||
libapptools_a_SOURCES = $(libapptools_a_built_sources) $(mybrushtool_sources) $(libapptools_a_sources)
|
||||
|
||||
#
|
||||
# rules to generate built sources
|
||||
|
@@ -71,6 +71,9 @@
|
||||
#include "gimpmagnifytool.h"
|
||||
#include "gimpmeasuretool.h"
|
||||
#include "gimpmovetool.h"
|
||||
#ifdef HAVE_LIBMYPAINT
|
||||
#include "gimpmybrushtool.h"
|
||||
#endif
|
||||
#include "gimpnpointdeformationtool.h"
|
||||
#include "gimppaintbrushtool.h"
|
||||
#include "gimppenciltool.h"
|
||||
@@ -144,6 +147,9 @@ gimp_tools_init (Gimp *gimp)
|
||||
gimp_perspective_clone_tool_register,
|
||||
gimp_heal_tool_register,
|
||||
gimp_clone_tool_register,
|
||||
#ifdef HAVE_LIBMYPAINT
|
||||
gimp_mybrush_tool_register,
|
||||
#endif
|
||||
gimp_ink_tool_register,
|
||||
gimp_airbrush_tool_register,
|
||||
gimp_eraser_tool_register,
|
||||
@@ -546,6 +552,12 @@ gimp_tools_register (GType tool_type,
|
||||
{
|
||||
paint_core_name = "gimp-ink";
|
||||
}
|
||||
#ifdef HAVE_LIBMYPAINT
|
||||
else if (tool_type == GIMP_TYPE_MYBRUSH_TOOL)
|
||||
{
|
||||
paint_core_name = "gimp-mybrush";
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
paint_core_name = "gimp-paintbrush";
|
||||
|
166
app/tools/gimpmybrushoptions-gui.c
Normal file
166
app/tools/gimpmybrushoptions-gui.c
Normal file
@@ -0,0 +1,166 @@
|
||||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "tools-types.h"
|
||||
|
||||
#include "paint/gimpmybrushoptions.h"
|
||||
|
||||
#include "widgets/gimppropwidgets.h"
|
||||
|
||||
#include "gimpmybrushoptions-gui.h"
|
||||
#include "gimppaintoptions-gui.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
static void
|
||||
gimp_mybrush_options_load_brush (const GimpDatafileData *file_data,
|
||||
gpointer user_data)
|
||||
{
|
||||
if (gimp_datafiles_check_extension (file_data->basename, ".myb"))
|
||||
{
|
||||
GtkListStore *store = user_data;
|
||||
GtkTreeIter iter = { 0, };
|
||||
GdkPixbuf *pixbuf = NULL;
|
||||
gchar *filename;
|
||||
gchar *basename;
|
||||
gchar *preview_filename;
|
||||
|
||||
filename = g_strdup (file_data->filename);
|
||||
g_object_weak_ref (G_OBJECT (store), (GWeakNotify) g_free, filename);
|
||||
|
||||
basename = g_strndup (filename, strlen (filename) - 4);
|
||||
preview_filename = g_strconcat (basename, "_prev.png", NULL);
|
||||
g_free (basename);
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_file (preview_filename, NULL);
|
||||
g_free (preview_filename);
|
||||
|
||||
if (pixbuf)
|
||||
{
|
||||
GdkPixbuf *scaled;
|
||||
gint width = gdk_pixbuf_get_width (pixbuf);
|
||||
gint height = gdk_pixbuf_get_height (pixbuf);
|
||||
gdouble factor = 48.0 / height;
|
||||
|
||||
scaled = gdk_pixbuf_scale_simple (pixbuf,
|
||||
width * factor,
|
||||
height * factor,
|
||||
GDK_INTERP_NEAREST);
|
||||
|
||||
g_object_unref (pixbuf);
|
||||
pixbuf = scaled;
|
||||
}
|
||||
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
GIMP_INT_STORE_LABEL, file_data->basename,
|
||||
GIMP_INT_STORE_PIXBUF, pixbuf,
|
||||
GIMP_INT_STORE_USER_DATA, filename,
|
||||
-1);
|
||||
|
||||
if (pixbuf)
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_mybrush_options_load_recursive (const GimpDatafileData *file_data,
|
||||
gpointer user_data)
|
||||
{
|
||||
gimp_datafiles_read_directories (file_data->filename,
|
||||
G_FILE_TEST_IS_REGULAR,
|
||||
gimp_mybrush_options_load_brush,
|
||||
user_data);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_mybrush_options_brush_changed (GtkComboBox *combo,
|
||||
GObject *config)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
|
||||
if (gtk_combo_box_get_active_iter (combo, &iter))
|
||||
{
|
||||
GtkTreeModel *model = gtk_combo_box_get_model (combo);
|
||||
const gchar *brush;
|
||||
|
||||
gtk_tree_model_get (model, &iter,
|
||||
GIMP_INT_STORE_USER_DATA, &brush,
|
||||
-1);
|
||||
|
||||
if (brush)
|
||||
g_object_set (config,
|
||||
"mybrush", brush,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gimp_mybrush_options_gui (GimpToolOptions *tool_options)
|
||||
{
|
||||
GObject *config = G_OBJECT (tool_options);
|
||||
GtkWidget *vbox = gimp_paint_options_gui (tool_options);
|
||||
GtkWidget *scale;
|
||||
GtkWidget *combo;
|
||||
GtkTreeModel *model;
|
||||
|
||||
/* radius */
|
||||
scale = gimp_prop_spin_scale_new (config, "radius",
|
||||
_("Radius"),
|
||||
0.1, 1.0, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
|
||||
gtk_widget_show (scale);
|
||||
|
||||
/* hardness */
|
||||
scale = gimp_prop_spin_scale_new (config, "hardness",
|
||||
_("Hardness"),
|
||||
0.1, 1.0, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
|
||||
gtk_widget_show (scale);
|
||||
|
||||
/* brushes */
|
||||
combo = g_object_new (GIMP_TYPE_INT_COMBO_BOX,
|
||||
"label", _("Brush"),
|
||||
"ellipsize", PANGO_ELLIPSIZE_END,
|
||||
NULL);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), combo, FALSE, FALSE, 0);
|
||||
gtk_widget_show (combo);
|
||||
|
||||
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
|
||||
|
||||
gimp_datafiles_read_directories ("/usr/share/mypaint/brushes",
|
||||
G_FILE_TEST_IS_DIR,
|
||||
gimp_mybrush_options_load_recursive,
|
||||
model);
|
||||
|
||||
g_signal_connect (combo, "changed",
|
||||
G_CALLBACK (gimp_mybrush_options_brush_changed),
|
||||
config);
|
||||
|
||||
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo), 0);
|
||||
|
||||
return vbox;
|
||||
}
|
25
app/tools/gimpmybrushoptions-gui.h
Normal file
25
app/tools/gimpmybrushoptions-gui.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_MYBRUSH_OPTIONS_GUI_H__
|
||||
#define __GIMP_MYBRUSH_OPTIONS_GUI_H__
|
||||
|
||||
|
||||
GtkWidget * gimp_mybrush_options_gui (GimpToolOptions *tool_options);
|
||||
|
||||
|
||||
#endif /* __GIMP_MYBRUSH_OPTIONS_GUI_H__ */
|
132
app/tools/gimpmybrushtool.c
Normal file
132
app/tools/gimpmybrushtool.c
Normal file
@@ -0,0 +1,132 @@
|
||||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "tools-types.h"
|
||||
|
||||
#include "config/gimpguiconfig.h" /* playground */
|
||||
|
||||
#include "paint/gimpmybrushoptions.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
|
||||
#include "gimpmybrushoptions-gui.h"
|
||||
#include "gimpmybrushtool.h"
|
||||
#include "gimptoolcontrol.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpMybrushTool, gimp_mybrush_tool, GIMP_TYPE_PAINT_TOOL)
|
||||
|
||||
#define parent_class gimp_mybrush_tool_parent_class
|
||||
|
||||
|
||||
static void gimp_mybrush_tool_options_notify (GimpTool *tool,
|
||||
GimpToolOptions *options,
|
||||
const GParamSpec *pspec);
|
||||
|
||||
static GimpCanvasItem * gimp_mybrush_tool_get_outline (GimpPaintTool *paint_tool,
|
||||
GimpDisplay *display,
|
||||
gdouble x,
|
||||
gdouble y);
|
||||
|
||||
|
||||
void
|
||||
gimp_mybrush_tool_register (GimpToolRegisterCallback callback,
|
||||
gpointer data)
|
||||
{
|
||||
/* we should not know that "data" is a Gimp*, but what the heck this
|
||||
* is experimental playground stuff
|
||||
*/
|
||||
if (GIMP_GUI_CONFIG (GIMP (data)->config)->playground_mybrush_tool)
|
||||
(* callback) (GIMP_TYPE_MYBRUSH_TOOL,
|
||||
GIMP_TYPE_MYBRUSH_OPTIONS,
|
||||
gimp_mybrush_options_gui,
|
||||
GIMP_CONTEXT_FOREGROUND_MASK |
|
||||
GIMP_CONTEXT_BACKGROUND_MASK |
|
||||
GIMP_CONTEXT_OPACITY_MASK |
|
||||
GIMP_CONTEXT_PAINT_MODE_MASK,
|
||||
"gimp-mybrush-tool",
|
||||
_("MyPaint Brush"),
|
||||
_("MyPaint Brush Tool: Use MyPaint brushes in GIMP"),
|
||||
N_("M_yPaint Brush"), "Y",
|
||||
NULL, GIMP_HELP_TOOL_MYBRUSH,
|
||||
GIMP_STOCK_TOOL_MYBRUSH,
|
||||
data);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_mybrush_tool_class_init (GimpMybrushToolClass *klass)
|
||||
{
|
||||
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
|
||||
GimpPaintToolClass *paint_tool_class = GIMP_PAINT_TOOL_CLASS (klass);
|
||||
|
||||
tool_class->options_notify = gimp_mybrush_tool_options_notify;
|
||||
|
||||
paint_tool_class->get_outline = gimp_mybrush_tool_get_outline;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_mybrush_tool_init (GimpMybrushTool *mybrush_tool)
|
||||
{
|
||||
GimpTool *tool = GIMP_TOOL (mybrush_tool);
|
||||
|
||||
gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_INK);
|
||||
gimp_tool_control_set_action_size (tool->control,
|
||||
"tools/tools-mybrush-radius-set");
|
||||
|
||||
gimp_paint_tool_enable_color_picker (GIMP_PAINT_TOOL (mybrush_tool),
|
||||
GIMP_COLOR_PICK_MODE_FOREGROUND);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_mybrush_tool_options_notify (GimpTool *tool,
|
||||
GimpToolOptions *options,
|
||||
const GParamSpec *pspec)
|
||||
{
|
||||
GIMP_TOOL_CLASS (parent_class)->options_notify (tool, options, pspec);
|
||||
|
||||
if (! strcmp (pspec->name, "radius"))
|
||||
{
|
||||
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
||||
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
||||
}
|
||||
}
|
||||
|
||||
static GimpCanvasItem *
|
||||
gimp_mybrush_tool_get_outline (GimpPaintTool *paint_tool,
|
||||
GimpDisplay *display,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
GimpMybrushOptions *options = GIMP_MYBRUSH_TOOL_GET_OPTIONS (paint_tool);
|
||||
|
||||
gimp_paint_tool_set_draw_circle (paint_tool, TRUE,
|
||||
exp (options->radius));
|
||||
|
||||
return NULL;
|
||||
}
|
55
app/tools/gimpmybrushtool.h
Normal file
55
app/tools/gimpmybrushtool.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_MYBRUSH_TOOL_H__
|
||||
#define __GIMP_MYBRUSH_TOOL_H__
|
||||
|
||||
|
||||
#include "gimppainttool.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_MYBRUSH_TOOL (gimp_mybrush_tool_get_type ())
|
||||
#define GIMP_MYBRUSH_TOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_MYBRUSH_TOOL, GimpMybrushTool))
|
||||
#define GIMP_MYBRUSH_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_MYBRUSH_TOOL, GimpMybrushToolClass))
|
||||
#define GIMP_IS_MYBRUSH_TOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_MYBRUSH_TOOL))
|
||||
#define GIMP_IS_MYBRUSH_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_MYBRUSH_TOOL))
|
||||
#define GIMP_MYBRUSH_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_MYBRUSH_TOOL, GimpMybrushToolClass))
|
||||
|
||||
#define GIMP_MYBRUSH_TOOL_GET_OPTIONS(t) (GIMP_MYBRUSH_OPTIONS (gimp_tool_get_options (GIMP_TOOL (t))))
|
||||
|
||||
|
||||
typedef struct _GimpMybrushTool GimpMybrushTool;
|
||||
typedef struct _GimpMybrushToolClass GimpMybrushToolClass;
|
||||
|
||||
struct _GimpMybrushTool
|
||||
{
|
||||
GimpPaintTool parent_instance;
|
||||
};
|
||||
|
||||
struct _GimpMybrushToolClass
|
||||
{
|
||||
GimpPaintToolClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
void gimp_mybrush_tool_register (GimpToolRegisterCallback callback,
|
||||
gpointer data);
|
||||
|
||||
GType gimp_mybrush_tool_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
#endif /* __GIMP_MYBRUSH_TOOL_H__ */
|
@@ -41,6 +41,9 @@
|
||||
#include "gimperasertool.h"
|
||||
#include "gimphealtool.h"
|
||||
#include "gimpinktool.h"
|
||||
#ifdef HAVE_LIBMYPAINT
|
||||
#include "gimpmybrushtool.h"
|
||||
#endif
|
||||
#include "gimppaintoptions-gui.h"
|
||||
#include "gimppenciltool.h"
|
||||
#include "gimpperspectiveclonetool.h"
|
||||
@@ -115,6 +118,9 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
|
||||
tool_type == GIMP_TYPE_CONVOLVE_TOOL ||
|
||||
tool_type == GIMP_TYPE_DODGE_BURN_TOOL ||
|
||||
tool_type == GIMP_TYPE_HEAL_TOOL ||
|
||||
#ifdef HAVE_LIBMYPAINT
|
||||
tool_type == GIMP_TYPE_MYBRUSH_TOOL ||
|
||||
#endif
|
||||
tool_type == GIMP_TYPE_SMUDGE_TOOL)
|
||||
{
|
||||
gtk_widget_set_sensitive (menu, FALSE);
|
||||
@@ -129,7 +135,11 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
|
||||
gtk_widget_show (scale);
|
||||
|
||||
/* temp debug foo */
|
||||
if (g_type_is_a (tool_type, GIMP_TYPE_PAINT_TOOL))
|
||||
if (g_type_is_a (tool_type, GIMP_TYPE_PAINT_TOOL)
|
||||
#ifdef HAVE_LIBMYPAINT
|
||||
&& tool_type != GIMP_TYPE_MYBRUSH_TOOL
|
||||
#endif
|
||||
)
|
||||
{
|
||||
GtkWidget *button;
|
||||
|
||||
|
@@ -330,6 +330,7 @@ gimp_action_is_gui_blacklisted (const gchar *action_name)
|
||||
"tools-ink-blob-size-",
|
||||
"tools-ink-blob-aspect-",
|
||||
"tools-ink-blob-angle-",
|
||||
"tools-mybrush-radius-",
|
||||
"tools-foreground-select-brush-size-",
|
||||
"tools-transform-preview-opacity-",
|
||||
"tools-warp-effect-size-"
|
||||
|
@@ -289,6 +289,7 @@
|
||||
#define GIMP_HELP_TOOL_LEVELS "gimp-tool-levels"
|
||||
#define GIMP_HELP_TOOL_MEASURE "gimp-tool-measure"
|
||||
#define GIMP_HELP_TOOL_MOVE "gimp-tool-move"
|
||||
#define GIMP_HELP_TOOL_MYBRUSH "gimp-tool-mybrush"
|
||||
#define GIMP_HELP_TOOL_N_POINT_DEFORMATION "gimp-tool-n-point-deformation"
|
||||
#define GIMP_HELP_TOOL_PATH "gimp-tool-path"
|
||||
#define GIMP_HELP_TOOL_PAINTBRUSH "gimp-tool-paintbrush"
|
||||
|
25
configure.ac
25
configure.ac
@@ -66,6 +66,7 @@ m4_define([poppler_required_version], [0.12.4])
|
||||
m4_define([poppler_data_required_version], [0.4.7])
|
||||
m4_define([libgudev_required_version], [167])
|
||||
m4_define([gexiv2_required_version], [0.6.1])
|
||||
m4_define([libmypaint_required_version], [1.1])
|
||||
m4_define([lcms_required_version], [2.6])
|
||||
m4_define([libpng_required_version], [1.2.37])
|
||||
m4_define([liblzma_required_version], [5.0.0])
|
||||
@@ -140,6 +141,7 @@ GEXIV2_REQUIRED_VERSION=gexiv2_required_version
|
||||
LCMS_REQUIRED_VERSION=lcms_required_version
|
||||
LIBPNG_REQUIRED_VERSION=libpng_required_version
|
||||
LIBLZMA_REQUIRED_VERSION=liblzma_required_version
|
||||
LIBMYPAINT_REQUIRED_VERSION=libmypaint_required_version
|
||||
PANGOCAIRO_REQUIRED_VERSION=pangocairo_required_version
|
||||
BABL_REQUIRED_VERSION=babl_required_version
|
||||
FONTCONFIG_REQUIRED_VERSION=fontconfig_required_version
|
||||
@@ -166,6 +168,7 @@ AC_SUBST(GEXIV2_REQUIRED_VERSION)
|
||||
AC_SUBST(LCMS_REQUIRED_VERSION)
|
||||
AC_SUBST(LIBPNG_REQUIRED_VERSION)
|
||||
AC_SUBST(LIBLZMA_REQUIRED_VERSION)
|
||||
AC_SUBST(LIBMYPAINT_REQUIRED_VERSION)
|
||||
AC_SUBST(PANGOCAIRO_REQUIRED_VERSION)
|
||||
AC_SUBST(BABL_REQUIRED_VERSION)
|
||||
AC_SUBST(FONTCONFIG_REQUIRED_VERSION)
|
||||
@@ -395,6 +398,7 @@ CFLAGS="$CFLAGS $extra_warnings"
|
||||
# We really don't want anyone using code with missing prototypes, which
|
||||
# can cause random behavior. If compile breaks due to the following,
|
||||
# come to us and we will point you to a newer version which works.
|
||||
#
|
||||
GIMP_DETECT_CFLAGS(extra_warnings, '-Werror=missing-prototypes')
|
||||
CFLAGS="$CFLAGS $extra_warnings"
|
||||
|
||||
@@ -1448,6 +1452,26 @@ AC_SUBST(FILE_EXR)
|
||||
|
||||
AM_CONDITIONAL(HAVE_OPENEXR, test "x$have_openexr" = xyes)
|
||||
|
||||
######################
|
||||
# Check for libmypaint
|
||||
######################
|
||||
|
||||
AC_ARG_WITH(libmypaint, [ --without-libmypaint build without libmypaint support])
|
||||
|
||||
have_libmypaint=no
|
||||
if test "x$with_libmypaint" != xno; then
|
||||
PKG_CHECK_MODULES(LIBMYPAINTGEGL,
|
||||
libmypaint-gegl >= libmypaint_required_version,
|
||||
AC_DEFINE(HAVE_LIBMYPAINT, 1, [Define to 1 if libmypaint-gegl is available])
|
||||
have_libmypaint=yes,
|
||||
[have_libmypaint="no (libmypaint-gegl not found)"])
|
||||
fi
|
||||
|
||||
AC_SUBST(LIBMYPAINTGEGL_CFLAGS)
|
||||
AC_SUBST(LIBMYPAINTGEGL_LIBS)
|
||||
|
||||
AM_CONDITIONAL(HAVE_LIBMYPAINT, test "x$have_libmypaint" = xyes)
|
||||
|
||||
|
||||
##################
|
||||
# Check for webkit
|
||||
@@ -2398,6 +2422,7 @@ Extra Binaries:
|
||||
|
||||
Optional Features:
|
||||
Language selection: $have_iso_codes
|
||||
MyPaint brushes: $have_libmypaint
|
||||
|
||||
Optional Plug-Ins:
|
||||
Ascii Art: $have_libaa
|
||||
|
BIN
icons/16/gimp-tool-mybrush.png
Normal file
BIN
icons/16/gimp-tool-mybrush.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
BIN
icons/22/gimp-tool-mybrush.png
Normal file
BIN
icons/22/gimp-tool-mybrush.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
@@ -188,6 +188,7 @@ icons16_DATA = \
|
||||
16/gimp-tool-levels.png \
|
||||
16/gimp-tool-measure.png \
|
||||
16/gimp-tool-move.png \
|
||||
16/gimp-tool-mybrush.png \
|
||||
16/gimp-tool-n-point-deformation.png \
|
||||
16/gimp-tool-options.png \
|
||||
16/gimp-tool-paintbrush.png \
|
||||
@@ -299,6 +300,7 @@ icons22_DATA = \
|
||||
22/gimp-tool-levels.png \
|
||||
22/gimp-tool-measure.png \
|
||||
22/gimp-tool-move.png \
|
||||
22/gimp-tool-mybrush.png \
|
||||
22/gimp-tool-n-point-deformation.png \
|
||||
22/gimp-tool-paintbrush.png \
|
||||
22/gimp-tool-path.png \
|
||||
|
@@ -263,6 +263,7 @@ static const GtkStockItem gimp_stock_items[] =
|
||||
{ GIMP_STOCK_TOOL_LEVELS, NULL, 0, 0, LIBGIMP_DOMAIN },
|
||||
{ GIMP_STOCK_TOOL_MEASURE, NULL, 0, 0, LIBGIMP_DOMAIN },
|
||||
{ GIMP_STOCK_TOOL_MOVE, NULL, 0, 0, LIBGIMP_DOMAIN },
|
||||
{ GIMP_STOCK_TOOL_MYBRUSH, NULL, 0, 0, LIBGIMP_DOMAIN },
|
||||
{ GIMP_STOCK_TOOL_N_POINT_DEFORMATION, NULL, 0, 0, LIBGIMP_DOMAIN },
|
||||
{ GIMP_STOCK_TOOL_PAINTBRUSH, NULL, 0, 0, LIBGIMP_DOMAIN },
|
||||
{ GIMP_STOCK_TOOL_PATH, NULL, 0, 0, LIBGIMP_DOMAIN },
|
||||
|
@@ -133,6 +133,7 @@ G_BEGIN_DECLS
|
||||
#define GIMP_STOCK_TOOL_LEVELS "gimp-tool-levels"
|
||||
#define GIMP_STOCK_TOOL_MEASURE "gimp-tool-measure"
|
||||
#define GIMP_STOCK_TOOL_MOVE "gimp-tool-move"
|
||||
#define GIMP_STOCK_TOOL_MYBRUSH "gimp-tool-mybrush"
|
||||
#define GIMP_STOCK_TOOL_N_POINT_DEFORMATION "gimp-tool-n-point-deformation"
|
||||
#define GIMP_STOCK_TOOL_PAINTBRUSH "gimp-tool-paintbrush"
|
||||
#define GIMP_STOCK_TOOL_PATH "gimp-tool-path"
|
||||
|
@@ -584,6 +584,9 @@
|
||||
<menuitem action="tools-eraser" />
|
||||
<menuitem action="tools-airbrush" />
|
||||
<menuitem action="tools-ink" />
|
||||
<!-- Enable when the tool leaves the playground
|
||||
<menuitem action="tools-mybrush" />
|
||||
-->
|
||||
<menuitem action="tools-clone" />
|
||||
<menuitem action="tools-heal" />
|
||||
<menuitem action="tools-perspective-clone" />
|
||||
|
Reference in New Issue
Block a user