[gimp/soc-2010-cage] gimpcage data structure: - fix of the iteration of the buffers - missing term in the computing - exp
- From: Michael Muré <mmure src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/soc-2010-cage] gimpcage data structure: - fix of the iteration of the buffers - missing term in the computing - exp
- Date: Tue, 13 Jul 2010 14:12:24 +0000 (UTC)
commit 4ba768bd063a6056e130b4f820dae21c3d800a9d
Author: Michael Muré <batolettre gmail com>
Date: Tue Jul 13 01:01:29 2010 +0200
gimpcage data structure:
- fix of the iteration of the buffers
- missing term in the computing
- expose the compute coefficient function
app/core/gimpcage.c | 12 ++++++------
app/core/gimpcage.h | 2 ++
2 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/app/core/gimpcage.c b/app/core/gimpcage.c
index 822ccfa..d690574 100644
--- a/app/core/gimpcage.c
+++ b/app/core/gimpcage.c
@@ -32,7 +32,6 @@ G_DEFINE_TYPE (GimpCage, gimp_cage, G_TYPE_OBJECT)
#define N_ITEMS_PER_ALLOC 10
static void gimp_cage_finalize (GObject *object);
-static void gimp_cage_compute_coefficient (GimpCage *gc);
static void
gimp_cage_class_init (GimpCageClass *klass)
@@ -57,7 +56,6 @@ gimp_cage_init (GimpCage *self)
self->cage_vertices_coef = NULL;
self->cage_edges_coef = NULL;
- //gimp_cage_compute_coefficient (self);
}
static void
@@ -80,7 +78,7 @@ gimp_cage_finalize (GObject *object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
-static void
+void
gimp_cage_compute_coefficient (GimpCage *gc)
{
Babl *format;
@@ -122,6 +120,7 @@ gimp_cage_compute_coefficient (GimpCage *gc)
gint x = i->roi->x; /* initial x */
gint y = i->roi->y; /* and y coordinates */
+
while(n_pixels--)
{
for( j = 0; j < gc->cage_vertice_number; j++)
@@ -138,6 +137,7 @@ gimp_cage_compute_coefficient (GimpCage *gc)
b.y = v1.y - y;
Q = a.x * a.x + a.y * a.y;
S = b.x * b.x + b.y * b.y;
+ R = 2.0 * (a.x * b.x + a.y * b.y);
BA = b.x * a.y - b.y * a.x;
SRT = sqrt(4.0 * S * Q - R * R);
L0 = log(S);
@@ -151,11 +151,11 @@ gimp_cage_compute_coefficient (GimpCage *gc)
vertice_coef[j] += BA / (2.0 * M_PI) * (L10 /(2.0*Q) - A10 * (2.0 + R / Q));
vertice_coef[(j+1)%gc->cage_vertice_number] -= BA / (2.0 * M_PI) * (L10 / (2.0 * Q) - A10 * R / Q);
-
- vertice_coef += gc->cage_vertice_number;
- edge_coef += gc->cage_vertice_number;
}
+ vertice_coef += gc->cage_vertice_number;
+ edge_coef += gc->cage_vertice_number;
+
/* update x and y coordinates */
x++;
if (x >= (i->roi->x + i->roi->width))
diff --git a/app/core/gimpcage.h b/app/core/gimpcage.h
index 7a2ec3d..00b6763 100644
--- a/app/core/gimpcage.h
+++ b/app/core/gimpcage.h
@@ -84,4 +84,6 @@ void gimp_cage_move_cage_point (GimpCage *cage,
gdouble x,
gdouble y);
+void gimp_cage_compute_coefficient (GimpCage *gc);
+
#endif /* __GIMP_CAGE_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]