diff options
author | Søren Sandmann Pedersen <ssp@redhat.com> | 2011-08-01 20:13:06 -0400 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@redhat.com> | 2011-08-01 20:13:06 -0400 |
commit | b35c4c031ae610bd21cf2dfd5876f54b2539079d (patch) | |
tree | 23e6acd830a65e03b0678f4cbc790bea088da636 /noise2.c | |
parent | 6073c155a3caf6feac4b19851777b53c70185e3f (diff) |
Move image support to separate file
Diffstat (limited to 'noise2.c')
-rw-r--r-- | noise2.c | 59 |
1 files changed, 1 insertions, 58 deletions
@@ -4,64 +4,7 @@ #include <gtk/gtk.h> #include <gdk/gdkpixbuf.h> #include "fft.h" - -typedef struct complex_image_t complex_image_t; -struct complex_image_t -{ - int width; - int height; - complex_t *red; - complex_t *green; - complex_t *blue; -}; - -static complex_image_t * -complex_image_new (int width, int height) -{ - complex_image_t *image = g_new0 (complex_image_t, 1); - - image->width = width; - image->height = height; - image->red = g_new0 (complex_t, width * height); - image->green = g_new0 (complex_t, width * height); - image->blue = g_new0 (complex_t, width * height); - - return image; -} - -static complex_image_t * -complex_image_copy (complex_image_t *image) -{ - complex_image_t *copy = complex_image_new (image->width, image->height); - int width = image->width; - int height = image->height; - - copy->red = g_memdup (image->red, width * height * sizeof (complex_t)); - copy->green = g_memdup (image->green, width * height * sizeof (complex_t)); - copy->blue = g_memdup (image->blue, width * height * sizeof (complex_t)); - - return copy; -} - -static void -complex_image_subtract (complex_image_t *image, complex_image_t *other) -{ - int i, j; - int h = image->height; - int w = image->width; - - for (i = 0; i < h; ++i) - { - for (j = 0; j < w; ++j) - { - int idx = i * w + j; - - image->red[idx] = complex_sub (image->red[idx], other->red[idx]); - image->green[idx] = complex_sub (image->green[idx], other->green[idx]); - image->blue[idx] = complex_sub (image->blue[idx], other->blue[idx]); - } - } -} +#include "image.h" static complex_image_t * complex_image_from_pixbuf (GdkPixbuf *pixbuf) |