Okay I have committed the ugly airbrush now

This commit is contained in:
Olof S Kylander/GIMP 1999-09-07 01:33:44 +00:00
parent f58c6dcc55
commit 44d41b19b5
14 changed files with 8964 additions and 22 deletions

View File

@ -1,3 +1,16 @@
Tue Sep 7 03:15:20 CEST 1999 Olof S Kylander <olof@frozenriver.com>
* app/airbrush_blob.[ch] new file
* app/xinput_airbrush.[ch] new file
* gimp/app/Makefile.am
* gimp/app/pixmaps2.h
* gimp/app/tool_options.c
* gimp/app/tools.c
* gimp/app/toolsF.h
Added my far from finished xinput airbrush tool please read
my dev-mail about it.
Tue Sep 7 03:16:56 MEST 1999 Sven Neumann <sven@gimp.org>
* configure.in: build the Makefile in plug-ins/gflare/gflares.

View File

@ -34,6 +34,8 @@ gimp_SOURCES = \
actionarea.h \
airbrush.c \
airbrush.h \
airbrush_blob.c \
airbrush_blob.h \
app_procs.c \
app_procs.h \
appenv.h \
@ -417,7 +419,9 @@ gimp_SOURCES = \
vector2d.c \
vector2d.h \
xcf.c \
xcf.h
xcf.h \
xinput_airbrush.c \
xinput_airbrush.h
EXTRA_DIST = \
makefile.cygwin \

1797
app/airbrush_blob.c Normal file

File diff suppressed because it is too large Load Diff

154
app/airbrush_blob.h Normal file
View File

@ -0,0 +1,154 @@
/* airbrush_blob.h: routines for manipulating scan converted convex
* polygons.
*
* Copyright 1998, Owen Taylor <otaylor@gtk.org>
*
* > Please contact the above author before modifying the copy <
* > of this file in the GIMP distribution. Thanks. <
*
* 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 __AIRBRUSHBLOB_H__
#define __AIRBRUSHBLOB_H__
typedef enum {
CROSS = 0,
CROSS_LEFT = 1,
CROSS_RIGHT = 2,
CROSS_WHOLE_LINE = 3,
CROSS_NORMAL = 4
} CrossType;
typedef enum {
RIGHT_LEFT = 0,
LEFT_RIGHT = 1,
TOP_BOT = 2,
BOT_TOP = 3,
NONE = 4
} MoveType;
/* The AirBlob, which is a abstract of a real AirBrushBlob */
typedef struct _AirBlob AirBlob;
typedef struct _AirPoint AirPoint;
typedef struct _SupportLine SupportLine;
struct _AirPoint {
int x;
int y;
};
struct _SupportLine {
double size;
double dist;
};
struct _AirBlob {
double direction_abs;
double direction;
double ycenter;
double xcenter;
SupportLine main_line;
SupportLine minor_line;
SupportLine maincross_line;
SupportLine minorcross_line;
};
/* The AirLine is a reslut of a AirBlob */
typedef struct _AirLine AirLine;
struct _AirLine {
int xcenter;
int ycenter;
AirPoint line[16];
int min_x, min_y;
int max_x, max_y;
int width, height;
int nlines;
};
typedef struct _AirBrushBlobPoint AirBrushBlobPoint;
typedef struct _AirBrushBlobSpan AirBrushBlobSpan;
typedef struct _AirBrushBlob AirBrushBlob;
struct _AirBrushBlobPoint {
int x;
int y;
};
struct _AirBrushBlobSpan {
int left;
double angle_left;
double angle_left_abs;
double dist_left;
int right;
double angle_right;
double angle_right_abs;
double dist_right;
CrossType cross_type;
int x_cross;
int center;
double dist;
};
struct _AirBrushBlob {
int y;
int height;
int width;
int min_x;
int max_x;
MoveType move;
double direction_abs;
double direction;
CrossType cross;
AirBrushBlobSpan data[1];
};
typedef struct _AirBrush AirBrush;
struct _AirBrush {
AirBrushBlob airbrush_blob;
AirBlob airblob;
};
AirBlob *create_air_blob (double xc, double yc, double xt, double yt, double xr, double yr, double xb, double yb, double xl, double yl, double direction_abs, double direction);
AirBlob *trans_air_blob(AirBlob *airblob_last, AirBlob *airblob_present, double dist, int xc, int yc);
AirLine *create_air_line(AirBlob *airblob);
int number_of_steps(int x0, int y0, int x1, int y1);
AirBrushBlob *airbrush_blob_convex_union (AirBrushBlob *b1, AirBrushBlob *b2);
AirBrushBlob *airbrush_blob_ellipse (double xc, double yc, double xt, double yt, double xr, double yr, double xb, double yb, double xl, double yl);
void airbrush_blob_bounds (AirBrushBlob *b, int *x, int *y, int *width, int *height);
#endif /* __AIRBRUSHBLOB_H__ */

View File

@ -972,3 +972,35 @@ static char *measure_bits [] =
"....a............a....",
"......................"
};
/* GIMP icon image format -- S. Kimball, P. Mattis */
/* Image name: xinput_airbrush */
#define xinput_airbrush_width 22
#define xinput_airbrush_height 22
static char *xinput_airbrush_bits [] =
{
"......................",
"........aaaaaa........",
".......adddddda.......",
"......affffffffa......",
".......dddddddd.......",
"......affffffffa......",
".......daaadddd.......",
"......affafffffa......",
".......afaffffa.......",
"..aaaaaaaaaaaaaaaaaa..",
".aahhhhhhaaaaaaaaaaaa.",
".aaggggggaaaaaaaaaaaaa",
"..aaaaaaaaaaaaaaaaaaa.",
"......adeagggeda......",
".....addeagggedda.....",
"....aadeeaaageedaa....",
"....acdegggaggedca....",
"...aaccegaagggeccaa...",
"...aaccegaggggeccaa...",
"...aaccegaaaggeccaa...",
"...aaccegggaggeccaa...",
"......................"
};

View File

@ -53,6 +53,7 @@
#include "rect_select.h"
#include "session.h"
#include "smudge.h"
#include "xinput_airbrush.h"
#include "text_tool.h"
#include "threshold.h"
#include "tools.h"
@ -488,7 +489,7 @@ ToolInfo tool_info[] =
24,
N_("/Tools/Measure"),
"",
(char **) measure_bits,
(char **) measure_bits,
N_("Measure distances and angles"),
"ContextHelp/measure",
MEASURE,
@ -497,11 +498,27 @@ ToolInfo tool_info[] =
NULL
},
{
NULL,
N_("Xinput Airbrush"),
25,
N_("/Tools/XinputAirbrush"),
"<shift>A",
(char **) xinput_airbrush_bits,
N_("Natural Airbrush"),
"ContextHelp/xinput_airbrush",
XINPUT_AIRBRUSH,
tools_new_xinput_airbrush,
tools_free_xinput_airbrush,
NULL
},
/* Non-toolbox tools */
{
NULL,
N_("By Color Select"),
25,
26,
N_("/Select/By Color..."),
NULL,
NULL,
@ -516,7 +533,7 @@ ToolInfo tool_info[] =
{
NULL,
N_("Color Balance"),
26,
27,
N_("/Image/Colors/Color Balance"),
NULL,
NULL,
@ -531,7 +548,7 @@ ToolInfo tool_info[] =
{
NULL,
N_("Brightness-Contrast"),
27,
28,
N_("/Image/Colors/Brightness-Contrast"),
NULL,
NULL,
@ -546,7 +563,7 @@ ToolInfo tool_info[] =
{
NULL,
N_("Hue-Saturation"),
28,
29,
N_("/Image/Colors/Hue-Saturation"),
NULL,
NULL,
@ -561,7 +578,7 @@ ToolInfo tool_info[] =
{
NULL,
N_("Posterize"),
29,
30,
N_("/Image/Colors/Posterize"),
NULL,
NULL,
@ -576,7 +593,7 @@ ToolInfo tool_info[] =
{
NULL,
N_("Threshold"),
30,
31,
N_("/Image/Colors/Threshold"),
NULL,
NULL,
@ -591,7 +608,7 @@ ToolInfo tool_info[] =
{
NULL,
N_("Curves"),
31,
32,
N_("/Image/Colors/Curves"),
NULL,
NULL,
@ -606,7 +623,7 @@ ToolInfo tool_info[] =
{
NULL,
N_("Levels"),
32,
33,
N_("/Image/Colors/Levels"),
NULL,
NULL,
@ -621,7 +638,7 @@ ToolInfo tool_info[] =
{
NULL,
N_("Histogram"),
33,
34,
N_("/Image/Histogram"),
NULL,
NULL,

1797
app/tools/airbrush_blob.c Normal file

File diff suppressed because it is too large Load Diff

154
app/tools/airbrush_blob.h Normal file
View File

@ -0,0 +1,154 @@
/* airbrush_blob.h: routines for manipulating scan converted convex
* polygons.
*
* Copyright 1998, Owen Taylor <otaylor@gtk.org>
*
* > Please contact the above author before modifying the copy <
* > of this file in the GIMP distribution. Thanks. <
*
* 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 __AIRBRUSHBLOB_H__
#define __AIRBRUSHBLOB_H__
typedef enum {
CROSS = 0,
CROSS_LEFT = 1,
CROSS_RIGHT = 2,
CROSS_WHOLE_LINE = 3,
CROSS_NORMAL = 4
} CrossType;
typedef enum {
RIGHT_LEFT = 0,
LEFT_RIGHT = 1,
TOP_BOT = 2,
BOT_TOP = 3,
NONE = 4
} MoveType;
/* The AirBlob, which is a abstract of a real AirBrushBlob */
typedef struct _AirBlob AirBlob;
typedef struct _AirPoint AirPoint;
typedef struct _SupportLine SupportLine;
struct _AirPoint {
int x;
int y;
};
struct _SupportLine {
double size;
double dist;
};
struct _AirBlob {
double direction_abs;
double direction;
double ycenter;
double xcenter;
SupportLine main_line;
SupportLine minor_line;
SupportLine maincross_line;
SupportLine minorcross_line;
};
/* The AirLine is a reslut of a AirBlob */
typedef struct _AirLine AirLine;
struct _AirLine {
int xcenter;
int ycenter;
AirPoint line[16];
int min_x, min_y;
int max_x, max_y;
int width, height;
int nlines;
};
typedef struct _AirBrushBlobPoint AirBrushBlobPoint;
typedef struct _AirBrushBlobSpan AirBrushBlobSpan;
typedef struct _AirBrushBlob AirBrushBlob;
struct _AirBrushBlobPoint {
int x;
int y;
};
struct _AirBrushBlobSpan {
int left;
double angle_left;
double angle_left_abs;
double dist_left;
int right;
double angle_right;
double angle_right_abs;
double dist_right;
CrossType cross_type;
int x_cross;
int center;
double dist;
};
struct _AirBrushBlob {
int y;
int height;
int width;
int min_x;
int max_x;
MoveType move;
double direction_abs;
double direction;
CrossType cross;
AirBrushBlobSpan data[1];
};
typedef struct _AirBrush AirBrush;
struct _AirBrush {
AirBrushBlob airbrush_blob;
AirBlob airblob;
};
AirBlob *create_air_blob (double xc, double yc, double xt, double yt, double xr, double yr, double xb, double yb, double xl, double yl, double direction_abs, double direction);
AirBlob *trans_air_blob(AirBlob *airblob_last, AirBlob *airblob_present, double dist, int xc, int yc);
AirLine *create_air_line(AirBlob *airblob);
int number_of_steps(int x0, int y0, int x1, int y1);
AirBrushBlob *airbrush_blob_convex_union (AirBrushBlob *b1, AirBrushBlob *b2);
AirBrushBlob *airbrush_blob_ellipse (double xc, double yc, double xt, double yt, double xr, double yr, double xb, double yb, double xl, double yl);
void airbrush_blob_bounds (AirBrushBlob *b, int *x, int *y, int *width, int *height);
#endif /* __AIRBRUSHBLOB_H__ */

View File

@ -53,6 +53,7 @@
#include "rect_select.h"
#include "session.h"
#include "smudge.h"
#include "xinput_airbrush.h"
#include "text_tool.h"
#include "threshold.h"
#include "tools.h"
@ -488,7 +489,7 @@ ToolInfo tool_info[] =
24,
N_("/Tools/Measure"),
"",
(char **) measure_bits,
(char **) measure_bits,
N_("Measure distances and angles"),
"ContextHelp/measure",
MEASURE,
@ -497,11 +498,27 @@ ToolInfo tool_info[] =
NULL
},
{
NULL,
N_("Xinput Airbrush"),
25,
N_("/Tools/XinputAirbrush"),
"<shift>A",
(char **) xinput_airbrush_bits,
N_("Natural Airbrush"),
"ContextHelp/xinput_airbrush",
XINPUT_AIRBRUSH,
tools_new_xinput_airbrush,
tools_free_xinput_airbrush,
NULL
},
/* Non-toolbox tools */
{
NULL,
N_("By Color Select"),
25,
26,
N_("/Select/By Color..."),
NULL,
NULL,
@ -516,7 +533,7 @@ ToolInfo tool_info[] =
{
NULL,
N_("Color Balance"),
26,
27,
N_("/Image/Colors/Color Balance"),
NULL,
NULL,
@ -531,7 +548,7 @@ ToolInfo tool_info[] =
{
NULL,
N_("Brightness-Contrast"),
27,
28,
N_("/Image/Colors/Brightness-Contrast"),
NULL,
NULL,
@ -546,7 +563,7 @@ ToolInfo tool_info[] =
{
NULL,
N_("Hue-Saturation"),
28,
29,
N_("/Image/Colors/Hue-Saturation"),
NULL,
NULL,
@ -561,7 +578,7 @@ ToolInfo tool_info[] =
{
NULL,
N_("Posterize"),
29,
30,
N_("/Image/Colors/Posterize"),
NULL,
NULL,
@ -576,7 +593,7 @@ ToolInfo tool_info[] =
{
NULL,
N_("Threshold"),
30,
31,
N_("/Image/Colors/Threshold"),
NULL,
NULL,
@ -591,7 +608,7 @@ ToolInfo tool_info[] =
{
NULL,
N_("Curves"),
31,
32,
N_("/Image/Colors/Curves"),
NULL,
NULL,
@ -606,7 +623,7 @@ ToolInfo tool_info[] =
{
NULL,
N_("Levels"),
32,
33,
N_("/Image/Colors/Levels"),
NULL,
NULL,
@ -621,7 +638,7 @@ ToolInfo tool_info[] =
{
NULL,
N_("Histogram"),
33,
34,
N_("/Image/Histogram"),
NULL,
NULL,

2448
app/tools/xinput_airbrush.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,30 @@
/* 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.
*/
#ifndef __XINPUTAIRBRUSH_H__
#define __XINPUTAIRBRUSH_H__
#include "tools.h"
#include "procedural_db.h"
Tool * tools_new_xinput_airbrush (void);
void tools_free_xinput_airbrush (Tool *);
/* Procedure definition and marshalling function */
extern ProcRecord xinput_airbrush_proc;
#endif /* __XINPUTAIRBRUSH_H__ */

View File

@ -65,7 +65,8 @@ typedef enum
DODGEBURN,
SMUDGE,
MEASURE,
LAST_TOOLBOX_TOOL = MEASURE,
XINPUT_AIRBRUSH,
LAST_TOOLBOX_TOOL = XINPUT_AIRBRUSH,
/* Non-toolbox tools */
BY_COLOR_SELECT,

2448
app/xinput_airbrush.c Normal file

File diff suppressed because it is too large Load Diff

30
app/xinput_airbrush.h Normal file
View File

@ -0,0 +1,30 @@
/* 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.
*/
#ifndef __XINPUTAIRBRUSH_H__
#define __XINPUTAIRBRUSH_H__
#include "tools.h"
#include "procedural_db.h"
Tool * tools_new_xinput_airbrush (void);
void tools_free_xinput_airbrush (Tool *);
/* Procedure definition and marshalling function */
extern ProcRecord xinput_airbrush_proc;
#endif /* __XINPUTAIRBRUSH_H__ */