themes/Default/images/Makefile.am removed ...

2004-08-04  Sven Neumann  <sven@gimp.org>

	* themes/Default/images/Makefile.am
	* themes/Default/images/stock-brush-generated-*-16.png: removed ...

	* themes/Default/images/stock-shape-*-16.png: ... and added back
	with more generic names.

	* libgimpwidgets/gimpstock.[ch]
	* app/widgets/gimpbrusheditor.c: changed accordingly.

	* app/tools/gimpinkoptions-gui.c: use the new stock icons here as
	well.

	* app/widgets/Makefile.am
	* app/widgets/widgets-types.h
	* app/widgets/gimpblobeditor.[ch]: added a simple blob shape
	editor widget factored out of app/tools/gimpinkoptions-gui.c.
This commit is contained in:
Sven Neumann 2004-08-04 18:15:41 +00:00 committed by Sven Neumann
parent 428c4a8d60
commit 50c962af54
13 changed files with 511 additions and 354 deletions

View File

@ -1,3 +1,22 @@
2004-08-04 Sven Neumann <sven@gimp.org>
* themes/Default/images/Makefile.am
* themes/Default/images/stock-brush-generated-*-16.png: removed ...
* themes/Default/images/stock-shape-*-16.png: ... and added back
with more generic names.
* libgimpwidgets/gimpstock.[ch]
* app/widgets/gimpbrusheditor.c: changed accordingly.
* app/tools/gimpinkoptions-gui.c: use the new stock icons here as
well.
* app/widgets/Makefile.am
* app/widgets/widgets-types.h
* app/widgets/gimpblobeditor.[ch]: added a simple blob shape
editor widget factored out of app/tools/gimpinkoptions-gui.c.
2004-08-04 Simon Budig <simon@gimp.org>
* app/core/gimpbrushgenerated.c: Enhanced the range of the hardness

View File

@ -18,17 +18,17 @@
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "tools-types.h"
#include "paint/gimpink-blob.h"
#include "config/gimpconfig-utils.h"
#include "paint/gimpinkoptions.h"
#include "widgets/gimpblobeditor.h"
#include "widgets/gimppropwidgets.h"
#include "gimpinkoptions-gui.h"
@ -37,22 +37,20 @@
#include "gimp-intl.h"
static GtkWidget * brush_widget_new (GimpInkOptions *options);
static GtkWidget * blob_button_new (GimpInkBlobType blob_type);
static GtkWidget * blob_image_new (GimpInkBlobType blob_type);
GtkWidget *
gimp_ink_options_gui (GimpToolOptions *tool_options)
{
GObject *config;
GObject *config = G_OBJECT (tool_options);
GimpInkOptions *ink_options = GIMP_INK_OPTIONS (tool_options);
GtkWidget *table;
GtkWidget *vbox;
GtkWidget *brush_vbox;
GtkWidget *blob_vbox;
GtkWidget *hbox;
GtkWidget *frame;
GtkWidget *brush;
config = G_OBJECT (tool_options);
GtkWidget *editor;
vbox = gimp_paint_options_gui (tool_options);
@ -118,7 +116,7 @@ gimp_ink_options_gui (GimpToolOptions *tool_options)
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
/* Brush type radiobuttons */
/* Blob type radiobuttons */
frame = gimp_prop_enum_radio_frame_new (config, "blob-type",
_("Type"), 0, 0);
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
@ -136,14 +134,12 @@ gimp_ink_options_gui (GimpToolOptions *tool_options)
list;
list = g_list_next (list), blob_type++)
{
GtkWidget *radio;
GtkWidget *radio = GTK_WIDGET (list->data);
GtkWidget *blob;
radio = GTK_WIDGET (list->data);
gtk_container_remove (GTK_CONTAINER (radio), GTK_BIN (radio)->child);
blob = blob_button_new (blob_type);
blob = blob_image_new (blob_type);
gtk_container_add (GTK_CONTAINER (radio), blob);
gtk_widget_show (blob);
}
@ -151,352 +147,52 @@ gimp_ink_options_gui (GimpToolOptions *tool_options)
g_list_free (children);
}
/* Brush shape widget */
/* Blob shape widget */
frame = gimp_frame_new (_("Shape"));
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
gtk_widget_show (frame);
brush_vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (brush_vbox), 2);
gtk_container_add (GTK_CONTAINER (frame), brush_vbox);
gtk_widget_show (brush_vbox);
blob_vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (blob_vbox), 2);
gtk_container_add (GTK_CONTAINER (frame), blob_vbox);
gtk_widget_show (blob_vbox);
frame = gtk_aspect_frame_new (NULL, 0.0, 0.5, 1.0, FALSE);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (brush_vbox), frame, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (blob_vbox), frame, TRUE, TRUE, 0);
gtk_widget_show (frame);
brush = brush_widget_new (GIMP_INK_OPTIONS (tool_options));
gtk_container_add (GTK_CONTAINER (frame), brush);
gtk_widget_show (brush);
editor = gimp_blob_editor_new (ink_options->blob_type,
ink_options->blob_aspect,
ink_options->blob_angle);
gtk_widget_set_size_request (editor, 60, 60);
gtk_container_add (GTK_CONTAINER (frame), editor);
gtk_widget_show (editor);
gimp_config_connect (config, G_OBJECT (editor), NULL);
return vbox;
}
/* BrushWidget functions */
typedef struct _BrushWidget BrushWidget;
struct _BrushWidget
{
GtkWidget *widget;
gboolean active;
/* EEK */
GimpInkOptions *ink_options;
};
static void brush_widget_notify (GimpInkOptions *options,
GParamSpec *pspec,
BrushWidget *brush_widget);
static void brush_widget_active_rect (BrushWidget *brush_widget,
GtkWidget *widget,
GdkRectangle *rect);
static void brush_widget_realize (GtkWidget *widget);
static gboolean brush_widget_expose (GtkWidget *widget,
GdkEventExpose *event,
BrushWidget *brush_widget);
static gboolean brush_widget_button_press (GtkWidget *widget,
GdkEventButton *event,
BrushWidget *brush_widget);
static gboolean brush_widget_button_release (GtkWidget *widget,
GdkEventButton *event,
BrushWidget *brush_widget);
static gboolean brush_widget_motion_notify (GtkWidget *widget,
GdkEventMotion *event,
BrushWidget *brush_widget);
static void paint_blob (GdkDrawable *drawable,
GdkGC *gc,
Blob *blob);
static GtkWidget *
brush_widget_new (GimpInkOptions *options)
blob_image_new (GimpInkBlobType blob_type)
{
BrushWidget *brush_w;
brush_w = g_new (BrushWidget, 1);
brush_w->widget = gtk_drawing_area_new ();
brush_w->active = FALSE;
brush_w->ink_options = options;
gtk_widget_set_size_request (brush_w->widget, 60, 60);
gtk_widget_set_events (brush_w->widget,
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK |
GDK_EXPOSURE_MASK);
g_signal_connect (options, "notify",
G_CALLBACK (brush_widget_notify),
brush_w);
g_signal_connect (brush_w->widget, "button_press_event",
G_CALLBACK (brush_widget_button_press),
brush_w);
g_signal_connect (brush_w->widget, "button_release_event",
G_CALLBACK (brush_widget_button_release),
brush_w);
g_signal_connect (brush_w->widget, "motion_notify_event",
G_CALLBACK (brush_widget_motion_notify),
brush_w);
g_signal_connect (brush_w->widget, "expose_event",
G_CALLBACK (brush_widget_expose),
brush_w);
g_signal_connect (brush_w->widget, "realize",
G_CALLBACK (brush_widget_realize),
brush_w);
g_object_weak_ref (G_OBJECT (brush_w->widget),
(GWeakNotify) g_free, brush_w);
return brush_w->widget;
}
static void
brush_widget_notify (GimpInkOptions *options,
GParamSpec *pspec,
BrushWidget *brush_w)
{
if (! strncmp (pspec->name, "blob", 4))
gtk_widget_queue_draw (brush_w->widget);
}
static void
brush_widget_active_rect (BrushWidget *brush_widget,
GtkWidget *widget,
GdkRectangle *rect)
{
gint x,y;
gint r;
r = MIN (widget->allocation.width, widget->allocation.height) / 2;
x = (widget->allocation.width / 2 +
0.85 * r * brush_widget->ink_options->blob_aspect / 10.0 *
cos (brush_widget->ink_options->blob_angle));
y = (widget->allocation.height / 2 +
0.85 * r * brush_widget->ink_options->blob_aspect / 10.0 *
sin (brush_widget->ink_options->blob_angle));
rect->x = x - 5;
rect->y = y - 5;
rect->width = 10;
rect->height = 10;
}
static void
brush_widget_realize (GtkWidget *widget)
{
gtk_style_set_background (widget->style, widget->window, GTK_STATE_ACTIVE);
}
static void
brush_widget_draw_brush (BrushWidget *brush_widget,
GtkWidget *widget,
gdouble xc,
gdouble yc,
gdouble radius)
{
BlobFunc function = blob_ellipse;
Blob *blob;
switch (brush_widget->ink_options->blob_type)
{
case GIMP_INK_BLOB_TYPE_ELLIPSE:
function = blob_ellipse;
break;
case GIMP_INK_BLOB_TYPE_SQUARE:
function = blob_square;
break;
case GIMP_INK_BLOB_TYPE_DIAMOND:
function = blob_diamond;
break;
}
blob = (* function) (xc, yc,
radius * cos (brush_widget->ink_options->blob_angle),
radius * sin (brush_widget->ink_options->blob_angle),
(- (radius / brush_widget->ink_options->blob_aspect) *
sin (brush_widget->ink_options->blob_angle)),
((radius / brush_widget->ink_options->blob_aspect) *
cos (brush_widget->ink_options->blob_angle)));
paint_blob (widget->window, widget->style->fg_gc[widget->state], blob);
g_free (blob);
}
static gboolean
brush_widget_expose (GtkWidget *widget,
GdkEventExpose *event,
BrushWidget *brush_widget)
{
GdkRectangle rect;
gint r0;
r0 = MIN (widget->allocation.width, widget->allocation.height) / 2;
if (r0 < 2)
return TRUE;
brush_widget_draw_brush (brush_widget, widget,
widget->allocation.width / 2,
widget->allocation.height / 2,
0.9 * r0);
brush_widget_active_rect (brush_widget, widget, &rect);
gdk_draw_rectangle (widget->window, widget->style->bg_gc[GTK_STATE_NORMAL],
TRUE, /* filled */
rect.x, rect.y,
rect.width, rect.height);
gtk_paint_shadow (widget->style, widget->window, widget->state,
GTK_SHADOW_OUT,
NULL, widget, NULL,
rect.x, rect.y,
rect.width, rect.height);
return TRUE;
}
static gboolean
brush_widget_button_press (GtkWidget *widget,
GdkEventButton *event,
BrushWidget *brush_widget)
{
GdkRectangle rect;
brush_widget_active_rect (brush_widget, widget, &rect);
if ((event->x >= rect.x) && (event->x-rect.x < rect.width) &&
(event->y >= rect.y) && (event->y-rect.y < rect.height))
{
brush_widget->active = TRUE;
}
return TRUE;
}
static gboolean
brush_widget_button_release (GtkWidget *widget,
GdkEventButton *event,
BrushWidget *brush_widget)
{
brush_widget->active = FALSE;
return TRUE;
}
static gboolean
brush_widget_motion_notify (GtkWidget *widget,
GdkEventMotion *event,
BrushWidget *brush_widget)
{
if (brush_widget->active)
{
gint x;
gint y;
gint rsquare;
x = event->x - widget->allocation.width / 2;
y = event->y - widget->allocation.height / 2;
rsquare = x*x + y*y;
if (rsquare != 0)
{
gint r0;
gdouble angle;
gdouble aspect;
r0 = MIN (widget->allocation.width, widget->allocation.height) / 2;
angle = atan2 (y, x);
aspect = 10.0 * sqrt ((gdouble) rsquare / (r0 * r0)) / 0.85;
aspect = CLAMP (aspect, 1.0, 10.0);
g_object_set (brush_widget->ink_options,
"blob-angle", angle,
"blob-aspect", aspect,
NULL);
gtk_widget_queue_draw (widget);
}
}
return TRUE;
}
/* blob button functions */
static gboolean blob_button_expose (GtkWidget *widget,
GdkEventExpose *event,
BlobFunc function);
static GtkWidget *
blob_button_new (GimpInkBlobType blob_type)
{
GtkWidget *blob;
BlobFunc function = blob_ellipse;
const guchar *stock_id = NULL;
switch (blob_type)
{
case GIMP_INK_BLOB_TYPE_ELLIPSE:
function = blob_ellipse;
stock_id = GIMP_STOCK_SHAPE_CIRCLE;
break;
case GIMP_INK_BLOB_TYPE_SQUARE:
function = blob_square;
stock_id = GIMP_STOCK_SHAPE_SQUARE;
break;
case GIMP_INK_BLOB_TYPE_DIAMOND:
function = blob_diamond;
stock_id = GIMP_STOCK_SHAPE_DIAMOND;
break;
}
blob = gtk_drawing_area_new ();
gtk_widget_set_size_request (blob, 21, 21);
g_signal_connect (blob, "expose_event",
G_CALLBACK (blob_button_expose),
function);
return blob;
}
static gboolean
blob_button_expose (GtkWidget *widget,
GdkEventExpose *event,
BlobFunc function)
{
Blob *blob;
blob = (* function) (widget->allocation.width / 2,
widget->allocation.height / 2,
8, 0, 0, 8);
paint_blob (widget->window, widget->style->fg_gc[widget->state], blob);
g_free (blob);
return TRUE;
}
/* Draw a blob onto a drawable with the specified graphics context */
static void
paint_blob (GdkDrawable *drawable,
GdkGC *gc,
Blob *blob)
{
gint i;
for (i = 0; i < blob->height; i++)
if (blob->data[i].left <= blob->data[i].right)
gdk_draw_line (drawable, gc,
blob->data[i].left, i + blob->y,
blob->data[i].right + 1, i + blob->y);
return gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_MENU);
}

View File

@ -27,6 +27,8 @@ libappwidgets_a_sources = \
gimpactiongroup.h \
gimpactionview.c \
gimpactionview.h \
gimpblobeditor.c \
gimpblobeditor.h \
gimpbrusheditor.c \
gimpbrusheditor.h \
gimpbrushfactoryview.c \

View File

@ -0,0 +1,378 @@
/* The GIMP -- an 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "widgets-types.h"
#include "paint/gimpink-blob.h"
#include "gimpblobeditor.h"
enum
{
PROP_0,
PROP_TYPE,
PROP_ASPECT,
PROP_ANGLE
};
static void gimp_blob_editor_class_init (GimpBlobEditorClass *klass);
static void gimp_blob_editor_init (GimpBlobEditor *editor);
static void gimp_blob_editor_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_blob_editor_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static gboolean gimp_blob_editor_expose (GtkWidget *widget,
GdkEventExpose *event);
static gboolean gimp_blob_editor_button_press (GtkWidget *widget,
GdkEventButton *event);
static gboolean gimp_blob_editor_button_release (GtkWidget *widget,
GdkEventButton *event);
static gboolean gimp_blob_editor_motion_notify (GtkWidget *widget,
GdkEventMotion *event);
static void gimp_blob_editor_get_handle (GimpBlobEditor *editor,
GdkRectangle *rect);
static void gimp_blob_editor_draw_blob (GimpBlobEditor *editor,
gdouble xc,
gdouble yc,
gdouble radius);
static GtkDrawingAreaClass *parent_class = NULL;
GType
gimp_blob_editor_get_type (void)
{
static GType view_type = 0;
if (! view_type)
{
static const GTypeInfo view_info =
{
sizeof (GimpBlobEditorClass),
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gimp_blob_editor_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpBlobEditor),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_blob_editor_init
};
view_type = g_type_register_static (GTK_TYPE_DRAWING_AREA,
"GimpBlobEditor",
&view_info, 0);
}
return view_type;
}
static void
gimp_blob_editor_class_init (GimpBlobEditorClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->set_property = gimp_blob_editor_set_property;
object_class->get_property = gimp_blob_editor_get_property;
g_object_class_install_property (object_class, PROP_TYPE,
g_param_spec_enum ("blob-type",
NULL, NULL,
GIMP_TYPE_INK_BLOB_TYPE,
GIMP_INK_BLOB_TYPE_ELLIPSE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_ASPECT,
g_param_spec_double ("blob-aspect",
NULL, NULL,
1.0, 10.0, 1.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_ANGLE,
g_param_spec_double ("blob-angle",
NULL, NULL,
-90.0, 90.0, 0.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
widget_class->expose_event = gimp_blob_editor_expose;
widget_class->button_press_event = gimp_blob_editor_button_press;
widget_class->button_release_event = gimp_blob_editor_button_release;
widget_class->motion_notify_event = gimp_blob_editor_motion_notify;
}
static void
gimp_blob_editor_init (GimpBlobEditor *editor)
{
editor->active = FALSE;
gtk_widget_add_events (GTK_WIDGET (editor),
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK |
GDK_EXPOSURE_MASK);
}
GtkWidget *
gimp_blob_editor_new (GimpInkBlobType type,
gdouble aspect,
gdouble angle)
{
return g_object_new (GIMP_TYPE_BLOB_EDITOR,
"blob-type", type,
"blob-aspect", aspect,
"blob-angle", angle,
NULL);
}
static void
gimp_blob_editor_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GimpBlobEditor *editor = GIMP_BLOB_EDITOR (object);
switch (property_id)
{
case PROP_TYPE:
editor->type = g_value_get_enum (value);
break;
case PROP_ASPECT:
editor->aspect = g_value_get_double (value);
break;
case PROP_ANGLE:
editor->angle = g_value_get_double (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
gtk_widget_queue_draw (GTK_WIDGET (editor));
}
static void
gimp_blob_editor_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GimpBlobEditor *editor = GIMP_BLOB_EDITOR (object);
switch (property_id)
{
case PROP_TYPE:
g_value_set_enum (value, editor->type);
break;
case PROP_ASPECT:
g_value_set_double (value, editor->aspect);
break;
case PROP_ANGLE:
g_value_set_double (value, editor->angle);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static gboolean
gimp_blob_editor_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GimpBlobEditor *editor = GIMP_BLOB_EDITOR (widget);
GdkRectangle rect;
gint r0;
r0 = MIN (widget->allocation.width, widget->allocation.height) / 2;
if (r0 < 2)
return TRUE;
gimp_blob_editor_draw_blob (editor,
widget->allocation.width / 2,
widget->allocation.height / 2,
0.9 * r0);
gimp_blob_editor_get_handle (editor, &rect);
gdk_draw_rectangle (widget->window,
widget->style->bg_gc[widget->state],
TRUE, /* filled */
rect.x, rect.y,
rect.width, rect.height);
gtk_paint_shadow (widget->style, widget->window, widget->state,
GTK_SHADOW_OUT,
NULL, widget, NULL,
rect.x, rect.y,
rect.width, rect.height);
return TRUE;
}
static gboolean
gimp_blob_editor_button_press (GtkWidget *widget,
GdkEventButton *event)
{
GimpBlobEditor *editor = GIMP_BLOB_EDITOR (widget);
GdkRectangle rect;
gimp_blob_editor_get_handle (editor, &rect);
if ((event->x >= rect.x) && (event->x-rect.x < rect.width) &&
(event->y >= rect.y) && (event->y-rect.y < rect.height))
{
editor->active = TRUE;
}
return TRUE;
}
static gboolean
gimp_blob_editor_button_release (GtkWidget *widget,
GdkEventButton *event)
{
GimpBlobEditor *editor = GIMP_BLOB_EDITOR (widget);
editor->active = FALSE;
return TRUE;
}
static gboolean
gimp_blob_editor_motion_notify (GtkWidget *widget,
GdkEventMotion *event)
{
GimpBlobEditor *editor = GIMP_BLOB_EDITOR (widget);
if (editor->active)
{
gint x;
gint y;
gint rsquare;
x = event->x - widget->allocation.width / 2;
y = event->y - widget->allocation.height / 2;
rsquare = SQR (x) + SQR (y);
if (rsquare > 0)
{
gint r0;
gdouble angle;
gdouble aspect;
r0 = MIN (widget->allocation.width, widget->allocation.height) / 2;
angle = atan2 (y, x);
aspect = 10.0 * sqrt ((gdouble) rsquare / (r0 * r0)) / 0.85;
aspect = CLAMP (aspect, 1.0, 10.0);
g_object_set (editor,
"blob-angle", angle,
"blob-aspect", aspect,
NULL);
}
}
return TRUE;
}
static void
gimp_blob_editor_get_handle (GimpBlobEditor *editor,
GdkRectangle *rect)
{
GtkWidget *widget = GTK_WIDGET (editor);
gint x, y;
gint r;
r = MIN (widget->allocation.width, widget->allocation.height) / 2;
x = (widget->allocation.width / 2 +
0.85 * r *editor->aspect / 10.0 * cos (editor->angle));
y = (widget->allocation.height / 2 +
0.85 * r * editor->aspect / 10.0 * sin (editor->angle));
rect->x = x - 5;
rect->y = y - 5;
rect->width = 10;
rect->height = 10;
}
static void
gimp_blob_editor_draw_blob (GimpBlobEditor *editor,
gdouble xc,
gdouble yc,
gdouble radius)
{
GtkWidget *widget = GTK_WIDGET (editor);
Blob *blob;
BlobFunc function = blob_ellipse;
gint i;
switch (editor->type)
{
case GIMP_INK_BLOB_TYPE_ELLIPSE:
function = blob_ellipse;
break;
case GIMP_INK_BLOB_TYPE_SQUARE:
function = blob_square;
break;
case GIMP_INK_BLOB_TYPE_DIAMOND:
function = blob_diamond;
break;
}
blob = function (xc, yc,
radius * cos (editor->angle),
radius * sin (editor->angle),
(- (radius / editor->aspect) * sin (editor->angle)),
( (radius / editor->aspect) * cos (editor->angle)));
for (i = 0; i < blob->height; i++)
if (blob->data[i].left <= blob->data[i].right)
gdk_draw_line (widget->window,
widget->style->fg_gc[widget->state],
blob->data[i].left, i + blob->y,
blob->data[i].right + 1, i + blob->y);
g_free (blob);
}

View File

@ -0,0 +1,63 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpblobeditor.h
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_BLOB_EDITOR_H__
#define __GIMP_BLOB_EDITOR_H__
#include "gimpdataeditor.h"
#define GIMP_TYPE_BLOB_EDITOR (gimp_blob_editor_get_type ())
#define GIMP_BLOB_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_BLOB_EDITOR, GimpBlobEditor))
#define GIMP_BLOB_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_BLOB_EDITOR, GimpBlobEditorClass))
#define GIMP_IS_BLOB_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_BLOB_EDITOR))
#define GIMP_IS_BLOB_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BLOB_EDITOR))
#define GIMP_BLOB_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_BLOB_EDITOR, GimpBlobEditorClass))
typedef struct _GimpBlobEditorClass GimpBlobEditorClass;
struct _GimpBlobEditor
{
GtkDrawingArea parent_instance;
GimpInkBlobType type;
gdouble aspect;
gdouble angle;
/*< private >*/
gboolean active;
};
struct _GimpBlobEditorClass
{
GtkDrawingAreaClass parent_class;
};
GType gimp_blob_editor_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_blob_editor_new (GimpInkBlobType type,
gdouble aspect,
gdouble angle);
#endif /* __GIMP_BLOB_EDITOR_H__ */

View File

@ -133,7 +133,7 @@ gimp_brush_editor_init (GimpBrushEditor *editor)
/* Stock Box for the brush shape */
box = gimp_enum_stock_box_new (GIMP_TYPE_BRUSH_GENERATED_SHAPE,
"gimp-brush-generated",
"gimp-shape",
GTK_ICON_SIZE_MENU,
G_CALLBACK (gimp_brush_editor_update_brush_shape),
editor,

View File

@ -142,6 +142,7 @@ typedef struct _GimpFontSelect GimpFontSelect;
/* misc widgets */
typedef struct _GimpActionView GimpActionView;
typedef struct _GimpBlobEditor GimpBlobEditor;
typedef struct _GimpColorBar GimpColorBar;
typedef struct _GimpColorDisplayEditor GimpColorDisplayEditor;
typedef struct _GimpColorFrame GimpColorFrame;

View File

@ -237,9 +237,9 @@ static GtkStockItem gimp_stock_items[] =
{ GIMP_STOCK_WEB, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_VIDEO, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_BRUSH_GENERATED_CIRCLE, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_BRUSH_GENERATED_DIAMOND, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_BRUSH_GENERATED_SQUARE, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_SHAPE_CIRCLE, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_SHAPE_DIAMOND, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_SHAPE_SQUARE, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_CAP_BUTT, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_CAP_ROUND, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_CAP_SQUARE, NULL, 0, 0, LIBGIMP_DOMAIN },
@ -560,10 +560,9 @@ gimp_stock_menu_pixbufs[] =
{ GIMP_STOCK_WEB, stock_web_16 },
{ GIMP_STOCK_VIDEO, stock_video_16 },
{ GIMP_STOCK_BRUSH_GENERATED_CIRCLE, stock_brush_generated_circle_16 },
{ GIMP_STOCK_BRUSH_GENERATED_DIAMOND, stock_brush_generated_diamond_16 },
{ GIMP_STOCK_BRUSH_GENERATED_SQUARE, stock_brush_generated_square_16 },
{ GIMP_STOCK_SHAPE_CIRCLE, stock_shape_circle_16 },
{ GIMP_STOCK_SHAPE_SQUARE, stock_shape_square_16 },
{ GIMP_STOCK_SHAPE_DIAMOND, stock_shape_diamond_16 },
{ GIMP_STOCK_CAP_BUTT, stock_cap_butt_16 },
{ GIMP_STOCK_CAP_ROUND, stock_cap_round_16 },
{ GIMP_STOCK_CAP_SQUARE, stock_cap_square_16 },

View File

@ -208,10 +208,9 @@ G_BEGIN_DECLS
#define GIMP_STOCK_WEB "gimp-web"
#define GIMP_STOCK_VIDEO "gimp-video"
#define GIMP_STOCK_BRUSH_GENERATED_CIRCLE "gimp-brush-generated-circle"
#define GIMP_STOCK_BRUSH_GENERATED_DIAMOND "gimp-brush-generated-diamond"
#define GIMP_STOCK_BRUSH_GENERATED_SQUARE "gimp-brush-generated-square"
#define GIMP_STOCK_SHAPE_CIRCLE "gimp-shape-circle"
#define GIMP_STOCK_SHAPE_DIAMOND "gimp-shape-diamond"
#define GIMP_STOCK_SHAPE_SQUARE "gimp-shape-square"
#define GIMP_STOCK_CAP_BUTT "gimp-cap-butt"
#define GIMP_STOCK_CAP_ROUND "gimp-cap-round"
#define GIMP_STOCK_CAP_SQUARE "gimp-cap-square"

View File

@ -32,9 +32,6 @@ WILBER_VARIABLES = \
## Below are compiled in stock icons
STOCK_MENU_IMAGES = \
stock-brush-generated-circle-16.png \
stock-brush-generated-diamond-16.png \
stock-brush-generated-square-16.png \
stock-cap-butt-16.png \
stock-cap-round-16.png \
stock-cap-square-16.png \
@ -109,6 +106,9 @@ STOCK_MENU_IMAGES = \
stock-selection-none-16.png \
stock-selection-shrink-16.png \
stock-selection-border-16.png \
stock-shape-circle-16.png \
stock-shape-diamond-16.png \
stock-shape-square-16.png \
stock-swap-colors-12.png \
stock-template-16.png \
stock-text-layer-16.png \

View File

Before

Width:  |  Height:  |  Size: 155 B

After

Width:  |  Height:  |  Size: 155 B

View File

Before

Width:  |  Height:  |  Size: 124 B

After

Width:  |  Height:  |  Size: 124 B

View File

Before

Width:  |  Height:  |  Size: 86 B

After

Width:  |  Height:  |  Size: 86 B