mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-21 03:52:33 +00:00
Added a tilt angle slider.
This commit is contained in:
parent
484e10ac36
commit
df3a07a932
|
@ -1,3 +1,8 @@
|
||||||
|
Wed Nov 25 22:26:11 1998 Raph Levien <raph@gimp.org>
|
||||||
|
|
||||||
|
* app/ink.c (ink_pen_ellipse): Added yet another slider, this time
|
||||||
|
for an angle adjustment.
|
||||||
|
|
||||||
Wed Nov 25 21:41:52 1998 Raph Levien <raph@gimp.org>
|
Wed Nov 25 21:41:52 1998 Raph Levien <raph@gimp.org>
|
||||||
|
|
||||||
* app/devices.c (devices_restore): Fixed a segv - now it returns
|
* app/devices.c (devices_restore): Fixed a segv - now it returns
|
||||||
|
|
41
app/ink.c
41
app/ink.c
|
@ -35,6 +35,10 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifndef M_PI
|
||||||
|
#define M_PI 3.14159265358979323846
|
||||||
|
#endif /* M_PI */
|
||||||
|
|
||||||
#define SUBSAMPLE 8
|
#define SUBSAMPLE 8
|
||||||
|
|
||||||
/* the Ink structures */
|
/* the Ink structures */
|
||||||
|
@ -59,6 +63,7 @@ struct _InkOptions
|
||||||
double angle;
|
double angle;
|
||||||
double sensitivity;
|
double sensitivity;
|
||||||
double tilt_sensitivity;
|
double tilt_sensitivity;
|
||||||
|
double tilt_angle;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _BrushWidget BrushWidget;
|
typedef struct _BrushWidget BrushWidget;
|
||||||
|
@ -161,6 +166,8 @@ create_ink_options ()
|
||||||
options->sensitivity = 1.0;
|
options->sensitivity = 1.0;
|
||||||
options->aspect = 1.0;
|
options->aspect = 1.0;
|
||||||
options->angle = 0.0;
|
options->angle = 0.0;
|
||||||
|
options->tilt_sensitivity = 1.0;
|
||||||
|
options->tilt_angle = 0.0;
|
||||||
|
|
||||||
/* the main vbox */
|
/* the main vbox */
|
||||||
vbox = gtk_vbox_new (FALSE, 1);
|
vbox = gtk_vbox_new (FALSE, 1);
|
||||||
|
@ -218,6 +225,22 @@ create_ink_options ()
|
||||||
(GtkSignalFunc) ink_scale_update,
|
(GtkSignalFunc) ink_scale_update,
|
||||||
&options->tilt_sensitivity);
|
&options->tilt_sensitivity);
|
||||||
|
|
||||||
|
/* angle adjust slider */
|
||||||
|
hbox = gtk_hbox_new (FALSE, 2);
|
||||||
|
gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
|
||||||
|
label = gtk_label_new (_("Angle adjust:"));
|
||||||
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2);
|
||||||
|
|
||||||
|
adj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, -90.0, 90.0, 1, 10.0, 0.0));
|
||||||
|
slider = gtk_hscale_new (adj);
|
||||||
|
gtk_box_pack_start (GTK_BOX (hbox), slider, TRUE, TRUE, 0);
|
||||||
|
gtk_scale_set_value_pos (GTK_SCALE (slider), GTK_POS_TOP);
|
||||||
|
|
||||||
|
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_DELAYED);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
|
||||||
|
(GtkSignalFunc) ink_scale_update,
|
||||||
|
&options->tilt_angle);
|
||||||
|
|
||||||
/* Brush shape widget */
|
/* Brush shape widget */
|
||||||
|
|
||||||
brush_widget = g_new (BrushWidget, 1);
|
brush_widget = g_new (BrushWidget, 1);
|
||||||
|
@ -413,15 +436,29 @@ ink_pen_ellipse (gdouble x_center, gdouble y_center,
|
||||||
double aspect, radmin;
|
double aspect, radmin;
|
||||||
double x,y;
|
double x,y;
|
||||||
double tscale;
|
double tscale;
|
||||||
|
double tscale_c;
|
||||||
|
double tscale_s;
|
||||||
|
|
||||||
size = ink_options->size * (1 + ink_options->sensitivity * (2*pressure - 1));
|
size = ink_options->size * (1 + ink_options->sensitivity * (2*pressure - 1));
|
||||||
if (size*SUBSAMPLE < 1) size = 1/SUBSAMPLE;
|
if (size*SUBSAMPLE < 1) size = 1/SUBSAMPLE;
|
||||||
|
|
||||||
/* Add brush angle/aspect to title vectorially */
|
/* Add brush angle/aspect to title vectorially */
|
||||||
|
|
||||||
|
/* I'm not happy with the way the brush widget info is combined with
|
||||||
|
tilt info from the brush. My personal feeling is that representing
|
||||||
|
both as affine transforms would make the most sense. -RLL */
|
||||||
|
|
||||||
tscale = ink_options->tilt_sensitivity * 10.0;
|
tscale = ink_options->tilt_sensitivity * 10.0;
|
||||||
x = ink_options->aspect*cos(ink_options->angle) + xtilt*tscale;
|
tscale_c = tscale * cos (ink_options->tilt_angle * M_PI / 180);
|
||||||
y = ink_options->aspect*sin(ink_options->angle) + ytilt*tscale;
|
tscale_s = tscale * sin (ink_options->tilt_angle * M_PI / 180);
|
||||||
|
x = ink_options->aspect*cos(ink_options->angle) +
|
||||||
|
xtilt * tscale_c - ytilt * tscale_s;
|
||||||
|
y = ink_options->aspect*sin(ink_options->angle) +
|
||||||
|
ytilt * tscale_c + xtilt * tscale_s;
|
||||||
|
#ifdef VERBOSE
|
||||||
|
g_print ("angle %g aspect %g; %g %g; %g %g\n",
|
||||||
|
ink_options->angle, ink_options->aspect, tscale_c, tscale_s, x, y);
|
||||||
|
#endif
|
||||||
aspect = sqrt(x*x+y*y);
|
aspect = sqrt(x*x+y*y);
|
||||||
|
|
||||||
if (aspect != 0)
|
if (aspect != 0)
|
||||||
|
|
|
@ -35,6 +35,10 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifndef M_PI
|
||||||
|
#define M_PI 3.14159265358979323846
|
||||||
|
#endif /* M_PI */
|
||||||
|
|
||||||
#define SUBSAMPLE 8
|
#define SUBSAMPLE 8
|
||||||
|
|
||||||
/* the Ink structures */
|
/* the Ink structures */
|
||||||
|
@ -59,6 +63,7 @@ struct _InkOptions
|
||||||
double angle;
|
double angle;
|
||||||
double sensitivity;
|
double sensitivity;
|
||||||
double tilt_sensitivity;
|
double tilt_sensitivity;
|
||||||
|
double tilt_angle;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _BrushWidget BrushWidget;
|
typedef struct _BrushWidget BrushWidget;
|
||||||
|
@ -161,6 +166,8 @@ create_ink_options ()
|
||||||
options->sensitivity = 1.0;
|
options->sensitivity = 1.0;
|
||||||
options->aspect = 1.0;
|
options->aspect = 1.0;
|
||||||
options->angle = 0.0;
|
options->angle = 0.0;
|
||||||
|
options->tilt_sensitivity = 1.0;
|
||||||
|
options->tilt_angle = 0.0;
|
||||||
|
|
||||||
/* the main vbox */
|
/* the main vbox */
|
||||||
vbox = gtk_vbox_new (FALSE, 1);
|
vbox = gtk_vbox_new (FALSE, 1);
|
||||||
|
@ -218,6 +225,22 @@ create_ink_options ()
|
||||||
(GtkSignalFunc) ink_scale_update,
|
(GtkSignalFunc) ink_scale_update,
|
||||||
&options->tilt_sensitivity);
|
&options->tilt_sensitivity);
|
||||||
|
|
||||||
|
/* angle adjust slider */
|
||||||
|
hbox = gtk_hbox_new (FALSE, 2);
|
||||||
|
gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
|
||||||
|
label = gtk_label_new (_("Angle adjust:"));
|
||||||
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2);
|
||||||
|
|
||||||
|
adj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, -90.0, 90.0, 1, 10.0, 0.0));
|
||||||
|
slider = gtk_hscale_new (adj);
|
||||||
|
gtk_box_pack_start (GTK_BOX (hbox), slider, TRUE, TRUE, 0);
|
||||||
|
gtk_scale_set_value_pos (GTK_SCALE (slider), GTK_POS_TOP);
|
||||||
|
|
||||||
|
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_DELAYED);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
|
||||||
|
(GtkSignalFunc) ink_scale_update,
|
||||||
|
&options->tilt_angle);
|
||||||
|
|
||||||
/* Brush shape widget */
|
/* Brush shape widget */
|
||||||
|
|
||||||
brush_widget = g_new (BrushWidget, 1);
|
brush_widget = g_new (BrushWidget, 1);
|
||||||
|
@ -413,15 +436,29 @@ ink_pen_ellipse (gdouble x_center, gdouble y_center,
|
||||||
double aspect, radmin;
|
double aspect, radmin;
|
||||||
double x,y;
|
double x,y;
|
||||||
double tscale;
|
double tscale;
|
||||||
|
double tscale_c;
|
||||||
|
double tscale_s;
|
||||||
|
|
||||||
size = ink_options->size * (1 + ink_options->sensitivity * (2*pressure - 1));
|
size = ink_options->size * (1 + ink_options->sensitivity * (2*pressure - 1));
|
||||||
if (size*SUBSAMPLE < 1) size = 1/SUBSAMPLE;
|
if (size*SUBSAMPLE < 1) size = 1/SUBSAMPLE;
|
||||||
|
|
||||||
/* Add brush angle/aspect to title vectorially */
|
/* Add brush angle/aspect to title vectorially */
|
||||||
|
|
||||||
|
/* I'm not happy with the way the brush widget info is combined with
|
||||||
|
tilt info from the brush. My personal feeling is that representing
|
||||||
|
both as affine transforms would make the most sense. -RLL */
|
||||||
|
|
||||||
tscale = ink_options->tilt_sensitivity * 10.0;
|
tscale = ink_options->tilt_sensitivity * 10.0;
|
||||||
x = ink_options->aspect*cos(ink_options->angle) + xtilt*tscale;
|
tscale_c = tscale * cos (ink_options->tilt_angle * M_PI / 180);
|
||||||
y = ink_options->aspect*sin(ink_options->angle) + ytilt*tscale;
|
tscale_s = tscale * sin (ink_options->tilt_angle * M_PI / 180);
|
||||||
|
x = ink_options->aspect*cos(ink_options->angle) +
|
||||||
|
xtilt * tscale_c - ytilt * tscale_s;
|
||||||
|
y = ink_options->aspect*sin(ink_options->angle) +
|
||||||
|
ytilt * tscale_c + xtilt * tscale_s;
|
||||||
|
#ifdef VERBOSE
|
||||||
|
g_print ("angle %g aspect %g; %g %g; %g %g\n",
|
||||||
|
ink_options->angle, ink_options->aspect, tscale_c, tscale_s, x, y);
|
||||||
|
#endif
|
||||||
aspect = sqrt(x*x+y*y);
|
aspect = sqrt(x*x+y*y);
|
||||||
|
|
||||||
if (aspect != 0)
|
if (aspect != 0)
|
||||||
|
|
|
@ -35,6 +35,10 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifndef M_PI
|
||||||
|
#define M_PI 3.14159265358979323846
|
||||||
|
#endif /* M_PI */
|
||||||
|
|
||||||
#define SUBSAMPLE 8
|
#define SUBSAMPLE 8
|
||||||
|
|
||||||
/* the Ink structures */
|
/* the Ink structures */
|
||||||
|
@ -59,6 +63,7 @@ struct _InkOptions
|
||||||
double angle;
|
double angle;
|
||||||
double sensitivity;
|
double sensitivity;
|
||||||
double tilt_sensitivity;
|
double tilt_sensitivity;
|
||||||
|
double tilt_angle;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _BrushWidget BrushWidget;
|
typedef struct _BrushWidget BrushWidget;
|
||||||
|
@ -161,6 +166,8 @@ create_ink_options ()
|
||||||
options->sensitivity = 1.0;
|
options->sensitivity = 1.0;
|
||||||
options->aspect = 1.0;
|
options->aspect = 1.0;
|
||||||
options->angle = 0.0;
|
options->angle = 0.0;
|
||||||
|
options->tilt_sensitivity = 1.0;
|
||||||
|
options->tilt_angle = 0.0;
|
||||||
|
|
||||||
/* the main vbox */
|
/* the main vbox */
|
||||||
vbox = gtk_vbox_new (FALSE, 1);
|
vbox = gtk_vbox_new (FALSE, 1);
|
||||||
|
@ -218,6 +225,22 @@ create_ink_options ()
|
||||||
(GtkSignalFunc) ink_scale_update,
|
(GtkSignalFunc) ink_scale_update,
|
||||||
&options->tilt_sensitivity);
|
&options->tilt_sensitivity);
|
||||||
|
|
||||||
|
/* angle adjust slider */
|
||||||
|
hbox = gtk_hbox_new (FALSE, 2);
|
||||||
|
gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
|
||||||
|
label = gtk_label_new (_("Angle adjust:"));
|
||||||
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2);
|
||||||
|
|
||||||
|
adj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, -90.0, 90.0, 1, 10.0, 0.0));
|
||||||
|
slider = gtk_hscale_new (adj);
|
||||||
|
gtk_box_pack_start (GTK_BOX (hbox), slider, TRUE, TRUE, 0);
|
||||||
|
gtk_scale_set_value_pos (GTK_SCALE (slider), GTK_POS_TOP);
|
||||||
|
|
||||||
|
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_DELAYED);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
|
||||||
|
(GtkSignalFunc) ink_scale_update,
|
||||||
|
&options->tilt_angle);
|
||||||
|
|
||||||
/* Brush shape widget */
|
/* Brush shape widget */
|
||||||
|
|
||||||
brush_widget = g_new (BrushWidget, 1);
|
brush_widget = g_new (BrushWidget, 1);
|
||||||
|
@ -413,15 +436,29 @@ ink_pen_ellipse (gdouble x_center, gdouble y_center,
|
||||||
double aspect, radmin;
|
double aspect, radmin;
|
||||||
double x,y;
|
double x,y;
|
||||||
double tscale;
|
double tscale;
|
||||||
|
double tscale_c;
|
||||||
|
double tscale_s;
|
||||||
|
|
||||||
size = ink_options->size * (1 + ink_options->sensitivity * (2*pressure - 1));
|
size = ink_options->size * (1 + ink_options->sensitivity * (2*pressure - 1));
|
||||||
if (size*SUBSAMPLE < 1) size = 1/SUBSAMPLE;
|
if (size*SUBSAMPLE < 1) size = 1/SUBSAMPLE;
|
||||||
|
|
||||||
/* Add brush angle/aspect to title vectorially */
|
/* Add brush angle/aspect to title vectorially */
|
||||||
|
|
||||||
|
/* I'm not happy with the way the brush widget info is combined with
|
||||||
|
tilt info from the brush. My personal feeling is that representing
|
||||||
|
both as affine transforms would make the most sense. -RLL */
|
||||||
|
|
||||||
tscale = ink_options->tilt_sensitivity * 10.0;
|
tscale = ink_options->tilt_sensitivity * 10.0;
|
||||||
x = ink_options->aspect*cos(ink_options->angle) + xtilt*tscale;
|
tscale_c = tscale * cos (ink_options->tilt_angle * M_PI / 180);
|
||||||
y = ink_options->aspect*sin(ink_options->angle) + ytilt*tscale;
|
tscale_s = tscale * sin (ink_options->tilt_angle * M_PI / 180);
|
||||||
|
x = ink_options->aspect*cos(ink_options->angle) +
|
||||||
|
xtilt * tscale_c - ytilt * tscale_s;
|
||||||
|
y = ink_options->aspect*sin(ink_options->angle) +
|
||||||
|
ytilt * tscale_c + xtilt * tscale_s;
|
||||||
|
#ifdef VERBOSE
|
||||||
|
g_print ("angle %g aspect %g; %g %g; %g %g\n",
|
||||||
|
ink_options->angle, ink_options->aspect, tscale_c, tscale_s, x, y);
|
||||||
|
#endif
|
||||||
aspect = sqrt(x*x+y*y);
|
aspect = sqrt(x*x+y*y);
|
||||||
|
|
||||||
if (aspect != 0)
|
if (aspect != 0)
|
||||||
|
|
|
@ -35,6 +35,10 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifndef M_PI
|
||||||
|
#define M_PI 3.14159265358979323846
|
||||||
|
#endif /* M_PI */
|
||||||
|
|
||||||
#define SUBSAMPLE 8
|
#define SUBSAMPLE 8
|
||||||
|
|
||||||
/* the Ink structures */
|
/* the Ink structures */
|
||||||
|
@ -59,6 +63,7 @@ struct _InkOptions
|
||||||
double angle;
|
double angle;
|
||||||
double sensitivity;
|
double sensitivity;
|
||||||
double tilt_sensitivity;
|
double tilt_sensitivity;
|
||||||
|
double tilt_angle;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _BrushWidget BrushWidget;
|
typedef struct _BrushWidget BrushWidget;
|
||||||
|
@ -161,6 +166,8 @@ create_ink_options ()
|
||||||
options->sensitivity = 1.0;
|
options->sensitivity = 1.0;
|
||||||
options->aspect = 1.0;
|
options->aspect = 1.0;
|
||||||
options->angle = 0.0;
|
options->angle = 0.0;
|
||||||
|
options->tilt_sensitivity = 1.0;
|
||||||
|
options->tilt_angle = 0.0;
|
||||||
|
|
||||||
/* the main vbox */
|
/* the main vbox */
|
||||||
vbox = gtk_vbox_new (FALSE, 1);
|
vbox = gtk_vbox_new (FALSE, 1);
|
||||||
|
@ -218,6 +225,22 @@ create_ink_options ()
|
||||||
(GtkSignalFunc) ink_scale_update,
|
(GtkSignalFunc) ink_scale_update,
|
||||||
&options->tilt_sensitivity);
|
&options->tilt_sensitivity);
|
||||||
|
|
||||||
|
/* angle adjust slider */
|
||||||
|
hbox = gtk_hbox_new (FALSE, 2);
|
||||||
|
gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
|
||||||
|
label = gtk_label_new (_("Angle adjust:"));
|
||||||
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2);
|
||||||
|
|
||||||
|
adj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, -90.0, 90.0, 1, 10.0, 0.0));
|
||||||
|
slider = gtk_hscale_new (adj);
|
||||||
|
gtk_box_pack_start (GTK_BOX (hbox), slider, TRUE, TRUE, 0);
|
||||||
|
gtk_scale_set_value_pos (GTK_SCALE (slider), GTK_POS_TOP);
|
||||||
|
|
||||||
|
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_DELAYED);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
|
||||||
|
(GtkSignalFunc) ink_scale_update,
|
||||||
|
&options->tilt_angle);
|
||||||
|
|
||||||
/* Brush shape widget */
|
/* Brush shape widget */
|
||||||
|
|
||||||
brush_widget = g_new (BrushWidget, 1);
|
brush_widget = g_new (BrushWidget, 1);
|
||||||
|
@ -413,15 +436,29 @@ ink_pen_ellipse (gdouble x_center, gdouble y_center,
|
||||||
double aspect, radmin;
|
double aspect, radmin;
|
||||||
double x,y;
|
double x,y;
|
||||||
double tscale;
|
double tscale;
|
||||||
|
double tscale_c;
|
||||||
|
double tscale_s;
|
||||||
|
|
||||||
size = ink_options->size * (1 + ink_options->sensitivity * (2*pressure - 1));
|
size = ink_options->size * (1 + ink_options->sensitivity * (2*pressure - 1));
|
||||||
if (size*SUBSAMPLE < 1) size = 1/SUBSAMPLE;
|
if (size*SUBSAMPLE < 1) size = 1/SUBSAMPLE;
|
||||||
|
|
||||||
/* Add brush angle/aspect to title vectorially */
|
/* Add brush angle/aspect to title vectorially */
|
||||||
|
|
||||||
|
/* I'm not happy with the way the brush widget info is combined with
|
||||||
|
tilt info from the brush. My personal feeling is that representing
|
||||||
|
both as affine transforms would make the most sense. -RLL */
|
||||||
|
|
||||||
tscale = ink_options->tilt_sensitivity * 10.0;
|
tscale = ink_options->tilt_sensitivity * 10.0;
|
||||||
x = ink_options->aspect*cos(ink_options->angle) + xtilt*tscale;
|
tscale_c = tscale * cos (ink_options->tilt_angle * M_PI / 180);
|
||||||
y = ink_options->aspect*sin(ink_options->angle) + ytilt*tscale;
|
tscale_s = tscale * sin (ink_options->tilt_angle * M_PI / 180);
|
||||||
|
x = ink_options->aspect*cos(ink_options->angle) +
|
||||||
|
xtilt * tscale_c - ytilt * tscale_s;
|
||||||
|
y = ink_options->aspect*sin(ink_options->angle) +
|
||||||
|
ytilt * tscale_c + xtilt * tscale_s;
|
||||||
|
#ifdef VERBOSE
|
||||||
|
g_print ("angle %g aspect %g; %g %g; %g %g\n",
|
||||||
|
ink_options->angle, ink_options->aspect, tscale_c, tscale_s, x, y);
|
||||||
|
#endif
|
||||||
aspect = sqrt(x*x+y*y);
|
aspect = sqrt(x*x+y*y);
|
||||||
|
|
||||||
if (aspect != 0)
|
if (aspect != 0)
|
||||||
|
|
Loading…
Reference in a new issue