summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippo Argiolas <filippo.argiolas@gmail.com>2010-08-05 12:25:04 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2010-08-09 19:25:53 +0200
commit27134c6e389e6c8ea426888deb4f0ce0558e386c (patch)
tree4fcca58db9bad972c599ed8f4abf09f60d8de7e3
parent629b6ff099cadc03eb3f252e1c31e9adf732e67b (diff)
geometrictransform: make stretch "radius" customizable
https://bugzilla.gnome.org/show_bug.cgi?id=625908
-rw-r--r--gst/geometrictransform/gststretch.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/gst/geometrictransform/gststretch.c b/gst/geometrictransform/gststretch.c
index 0e826c8a48..8823ac2ad1 100644
--- a/gst/geometrictransform/gststretch.c
+++ b/gst/geometrictransform/gststretch.c
@@ -95,24 +95,16 @@ stretch_map (GstGeometricTransform * gt, gint x, gint y, gdouble * in_x,
norm_x = 2.0 * (x / width - cgt->x_center);
norm_y = 2.0 * (y / height - cgt->y_center);
- r = sqrt (norm_x * norm_x + norm_y * norm_y);
-
- /* TODO: make it customizable, 0.7 is the radius of the stretch
- * ellipse, with current way of setting radius (absolute value) it
- * would be sqrt(hw*hw + hh*hh)/radius*radius but currently I prefer
- * leaving it hardcoded because I don't think absolute radius makes
- * any sense: the user either knows the video size and can easily
- * calculate the fractional radius and set that or doesn't know the
- * size a priori and wants to obtain the same effect no matter of
- * the video dimensions */
+ /* calculate radius, normalize to 1 for future convenience */
+ r = sqrt (0.5 * (norm_x * norm_x + norm_y * norm_y));
/* actually "stretch" name is a bit misleading, what the transform
* really does is shrink the center and gradually return to normal
* size while r increases. The shrink thing drags pixels giving
* stretching the image around the center */
/* 2.0 is the shrink amount. Make it customizable? */
- norm_x *= 2.0 - smoothstep (0.0, 0.7, r);
- norm_y *= 2.0 - smoothstep (0.0, 0.7, r);
+ norm_x *= 2.0 - smoothstep (0.0, cgt->radius, r);
+ norm_y *= 2.0 - smoothstep (0.0, cgt->radius, r);
/* unnormalize */
*in_x = (0.5 * norm_x + cgt->x_center) * width;