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);
|
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:
|
* gimp_display_shell_get_line_status:
|
||||||
* @status: initial status text.
|
* @status: initial status text.
|
||||||
|
|
|
@ -19,23 +19,27 @@
|
||||||
#define __GIMP_DISPLAY_SHELL_UTILS_H__
|
#define __GIMP_DISPLAY_SHELL_UTILS_H__
|
||||||
|
|
||||||
|
|
||||||
void gimp_display_shell_get_constrained_line_params (GimpDisplayShell *shell,
|
void gimp_display_shell_get_constrained_line_params (GimpDisplayShell *shell,
|
||||||
gdouble *offset_angle,
|
gdouble *offset_angle,
|
||||||
gdouble *xres,
|
gdouble *xres,
|
||||||
gdouble *yres);
|
gdouble *yres);
|
||||||
void gimp_display_shell_constrain_line (GimpDisplayShell *shell,
|
void gimp_display_shell_constrain_line (GimpDisplayShell *shell,
|
||||||
gdouble start_x,
|
gdouble start_x,
|
||||||
gdouble start_y,
|
gdouble start_y,
|
||||||
gdouble *end_x,
|
gdouble *end_x,
|
||||||
gdouble *end_y,
|
gdouble *end_y,
|
||||||
gint n_snap_lines);
|
gint n_snap_lines);
|
||||||
gchar * gimp_display_shell_get_line_status (GimpDisplayShell *shell,
|
gdouble gimp_display_shell_constrain_angle (GimpDisplayShell *shell,
|
||||||
const gchar *status,
|
gdouble angle,
|
||||||
const gchar *separator,
|
gint n_snap_lines);
|
||||||
gdouble x1,
|
|
||||||
gdouble y1,
|
gchar * gimp_display_shell_get_line_status (GimpDisplayShell *shell,
|
||||||
gdouble x2,
|
const gchar *status,
|
||||||
gdouble y2);
|
const gchar *separator,
|
||||||
|
gdouble x1,
|
||||||
|
gdouble y1,
|
||||||
|
gdouble x2,
|
||||||
|
gdouble y2);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIMP_DISPLAY_SHELL_UTILS_H__ */
|
#endif /* __GIMP_DISPLAY_SHELL_UTILS_H__ */
|
||||||
|
|
Loading…
Reference in New Issue