Rescale points and use its individual scale to show image
authorThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Sat, 16 Aug 2008 15:11:49 +0000 (12:11 -0300)
committerThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Sat, 16 Aug 2008 15:11:49 +0000 (12:11 -0300)
gdk.c
movie.c
point.h

diff --git a/gdk.c b/gdk.c
index 541fbe5..780e2ba 100644 (file)
--- a/gdk.c
+++ b/gdk.c
@@ -59,7 +59,7 @@ expose (GtkWidget *widget, GdkEventExpose *event, gpointer data)
   gdk_pixbuf_scale (ctx->picture, screen, 0, 0,
                     event->area.width, event->area.height,
                    -point.x + event->area.width/2, -point.y + event->area.height/2,
-                   1.0, 1.0, GDK_INTERP_HYPER);
+                   point.rx, point.ry, GDK_INTERP_HYPER);
   gdk_draw_pixbuf (widget->window, NULL, screen, 0, 0, 0, 0, -1, -1,
                    GDK_RGB_DITHER_NONE, 0, 0);
   gdk_pixbuf_unref (screen);
@@ -91,6 +91,7 @@ main (int argc, char **argv)
   else
     filename = argv[1];
   ctx.points = ReadPoints ("pro-gnu");
+  rescale_points (ctx.points);
   ctx.picture = gdk_pixbuf_new_from_file (filename, NULL);
   ctx.i = ctx.points->len;
   colorspace = gdk_pixbuf_get_colorspace (ctx.picture);
diff --git a/movie.c b/movie.c
index 8fbbf6a..4ff67db 100644 (file)
--- a/movie.c
+++ b/movie.c
@@ -102,3 +102,18 @@ ReadPoints (char *filename)
   fclose (file);
   return points;
 }
+
+void
+rescale_points (GArray *points)
+{
+  Point *point;
+  int i;
+  for (i = 0; i < points->len; i++)
+    {
+      point = &(g_array_index (points, Point, i));
+      point->rx = 4.0;
+      point->ry = 4.0;
+      point->x *= point->rx;
+      point->y *= point->ry;
+    }
+}
diff --git a/point.h b/point.h
index f503922..fc27a9b 100644 (file)
--- a/point.h
+++ b/point.h
 typedef struct
 {
   int x, y;
+  double rx, ry;
   char *name;
 } Point;
 
 GArray * ReadPoints (char *);
+void rescale_points (GArray *);
 
 #endif