[gnome-photos/wip/rishi/buffer-decoder: 7/15] gegl: Add a function to calculate the inverse Jacobian for zooming
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/buffer-decoder: 7/15] gegl: Add a function to calculate the inverse Jacobian for zooming
- Date: Fri, 23 Nov 2018 21:22:17 +0000 (UTC)
commit b2a49c03654c133a48af26270a6f5ac3cb1936e5
Author: Debarshi Ray <debarshir gnome org>
Date: Mon Sep 24 11:36:21 2018 +0200
gegl: Add a function to calculate the inverse Jacobian for zooming
This will be necessary to support arbitrary downscales, without keeping
the aspect ratio, in the new codec API for GeglBuffer. It is something
that every codec will need and is, therefore, useful to have as a
separate utility function.
https://gitlab.gnome.org/GNOME/gnome-photos/issues/63
src/photos-gegl.c | 20 ++++++++++++++++++++
src/photos-gegl.h | 4 ++++
2 files changed, 24 insertions(+)
---
diff --git a/src/photos-gegl.c b/src/photos-gegl.c
index 7788b758..f7b38ec5 100644
--- a/src/photos-gegl.c
+++ b/src/photos-gegl.c
@@ -650,6 +650,26 @@ photos_gegl_init_fishes (void)
}
+void
+photos_gegl_inverse_jacobian_zoom (GeglMatrix2 *inverse_jacobian, gdouble zoom_x, gdouble zoom_y)
+{
+ GeglMatrix3 tmp;
+
+ g_return_if_fail (inverse_jacobian != NULL);
+
+ gegl_matrix3_identity (&tmp);
+ tmp.coeff[0][0] = zoom_x;
+ tmp.coeff[1][1] = zoom_y;
+
+ gegl_matrix3_invert (&tmp);
+
+ inverse_jacobian->coeff[0][0] = tmp.coeff[0][0];
+ inverse_jacobian->coeff[0][1] = tmp.coeff[0][1];
+ inverse_jacobian->coeff[1][0] = tmp.coeff[1][0];
+ inverse_jacobian->coeff[1][1] = tmp.coeff[1][1];
+}
+
+
static gboolean
photos_gegl_processor_process_idle (gpointer user_data)
{
diff --git a/src/photos-gegl.h b/src/photos-gegl.h
index d902300b..5e49169c 100644
--- a/src/photos-gegl.h
+++ b/src/photos-gegl.h
@@ -51,6 +51,10 @@ void photos_gegl_init (void);
void photos_gegl_init_fishes (void);
+void photos_gegl_inverse_jacobian_zoom (GeglMatrix2 *out_inverse_jacobian,
+ gdouble zoom_x,
+ gdouble zoom_y);
+
void photos_gegl_processor_process_async (GeglProcessor *processor,
GCancellable *cancellable,
GAsyncReadyCallback callback,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]