mirror of https://github.com/GNOME/gimp.git
app: add gimp_display_shell_constrain_angle()
... which constrains an angle to discrete increments in screen space, similarly to gimp_display_shell_constrain_line().
This commit is contained in:
parent
06a2b4f338
commit
8c1a277007
|
@ -89,6 +89,26 @@ gimp_display_shell_constrain_line (GimpDisplayShell *shell,
|
|||
xres, yres);
|
||||
}
|
||||
|
||||
gdouble
|
||||
gimp_display_shell_constrain_angle (GimpDisplayShell *shell,
|
||||
gdouble angle,
|
||||
gint n_snap_lines)
|
||||
{
|
||||
gdouble x, y;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), 0.0);
|
||||
|
||||
x = cos (angle);
|
||||
y = sin (angle);
|
||||
|
||||
gimp_display_shell_constrain_line (shell,
|
||||
0.0, 0.0,
|
||||
&x, &y,
|
||||
n_snap_lines);
|
||||
|
||||
return atan2 (y, x);
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_display_shell_get_line_status:
|
||||
* @status: initial status text.
|
||||
|
|
|
@ -29,6 +29,10 @@ void gimp_display_shell_constrain_line (GimpDisplayShell *shell,
|
|||
gdouble *end_x,
|
||||
gdouble *end_y,
|
||||
gint n_snap_lines);
|
||||
gdouble gimp_display_shell_constrain_angle (GimpDisplayShell *shell,
|
||||
gdouble angle,
|
||||
gint n_snap_lines);
|
||||
|
||||
gchar * gimp_display_shell_get_line_status (GimpDisplayShell *shell,
|
||||
const gchar *status,
|
||||
const gchar *separator,
|
||||
|
|
Loading…
Reference in New Issue