2
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
4
* This is a plug-in for the GIMP.
6
* Colormap-Rotation plug-in. Exchanges two color ranges.
8
* Copyright (C) 1999 Sven Anders (anderss@fmi.uni-passau.de)
9
* Based on code from Pavel Grinfeld (pavel@ml.com)
12
* This program is free software; you can redistribute it and/or modify
13
* it under the terms of the GNU General Public License as published by
14
* the Free Software Foundation; either version 2 of the License, or
15
* (at your option) any later version.
17
* This program is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
* GNU General Public License for more details.
22
* You should have received a copy of the GNU General Public License
23
* along with this program; if not, write to the Free Software
24
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27
/*----------------------------------------------------------------------------
30
* Version 2.0, 04 April 1999.
31
* Nearly complete rewrite, made plug-in stable.
32
* (Works with GIMP 1.1 and GTK+ 1.2)
34
* Version 1.0, 27 March 1997.
35
* Initial (unstable) release by Pavel Grinfeld
37
*----------------------------------------------------------------------------*/
44
#include <libgimp/gimp.h>
45
#include <libgimp/gimpui.h>
49
#include "rcm_dialog.h"
53
/* Global variables */
58
/* Drawing routines */
61
rcm_draw_little_circle (GdkWindow *window,
68
x = GRAY_CENTER + GRAY_RADIUS * satur * cos(hue);
69
y = GRAY_CENTER - GRAY_RADIUS * satur * sin(hue);
71
gdk_draw_arc (window, color, 0, x-LITTLE_RADIUS, y-LITTLE_RADIUS,
72
2*LITTLE_RADIUS, 2*LITTLE_RADIUS, 0, 360*64);
76
rcm_draw_large_circle (GdkWindow *window,
85
gdk_draw_arc (window, color, 0,
86
ROUND (x - GRAY_RADIUS * gray_sat),
87
ROUND (y - GRAY_RADIUS * gray_sat),
88
ROUND (2 * GRAY_RADIUS * gray_sat),
89
ROUND (2 * GRAY_RADIUS * gray_sat),
99
rcm_draw_arrows (GdkWindow *window,
104
gfloat alpha, beta, cw_ccw, delta;
106
alpha = angle->alpha;
108
cw_ccw = angle->cw_ccw;
109
delta = angle_mod_2PI(beta - alpha);
114
gdk_draw_line (window,color,
117
ROUND (CENTER + RADIUS * cos(alpha)),
118
ROUND (CENTER - RADIUS * sin(alpha)));
120
gdk_draw_line( window,color,
121
CENTER + RADIUS * cos(alpha),
122
CENTER - RADIUS * sin(alpha),
123
ROUND (CENTER + RADIUS * REL * cos(alpha - DEL)),
124
ROUND (CENTER - RADIUS * REL * sin(alpha - DEL)));
126
gdk_draw_line (window,color,
127
CENTER + RADIUS * cos(alpha),
128
CENTER - RADIUS * sin(alpha),
129
ROUND (CENTER + RADIUS * REL * cos(alpha + DEL)),
130
ROUND (CENTER - RADIUS * REL * sin(alpha + DEL)));
132
gdk_draw_line (window,color,
135
ROUND (CENTER + RADIUS * cos(beta)),
136
ROUND (CENTER - RADIUS * sin(beta)));
138
gdk_draw_line (window,color,
139
CENTER + RADIUS * cos(beta),
140
CENTER - RADIUS * sin(beta),
141
ROUND (CENTER + RADIUS * REL * cos(beta - DEL)),
142
ROUND (CENTER - RADIUS * REL * sin(beta - DEL)));
144
gdk_draw_line (window,color,
145
CENTER + RADIUS * cos(beta),
146
CENTER - RADIUS * sin(beta),
147
ROUND (CENTER + RADIUS * REL * cos(beta + DEL)),
148
ROUND (CENTER - RADIUS * REL * sin(beta + DEL)));
150
dist = RADIUS * EACH_OR_BOTH;
152
gdk_draw_line (window,color,
153
CENTER + dist * cos(beta),
154
CENTER - dist * sin(beta),
155
ROUND (CENTER + dist * cos(beta) + cw_ccw * TICK * sin(beta)),
156
ROUND (CENTER - dist * sin(beta) + cw_ccw * TICK * cos(beta)));
158
alpha *= 180 * 64 / G_PI;
159
delta *= 180 * 64 / G_PI;
161
gdk_draw_arc (window, color, 0, CENTER - dist, CENTER - dist,
162
2*dist, 2*dist, alpha, delta);