aboutsummaryrefslogtreecommitdiffstats
path: root/src/camorama-filter-mirror.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/camorama-filter-mirror.c')
-rw-r--r--src/camorama-filter-mirror.c64
1 files changed, 35 insertions, 29 deletions
diff --git a/src/camorama-filter-mirror.c b/src/camorama-filter-mirror.c
index 9ed5724..a7dc6cc 100644
--- a/src/camorama-filter-mirror.c
+++ b/src/camorama-filter-mirror.c
@@ -30,41 +30,47 @@
#include <glib/gi18n.h>
/* GType stuff for CamoramaFilterMirror */
-typedef struct _CamoramaFilter CamoramaFilterMirror;
+typedef struct _CamoramaFilter CamoramaFilterMirror;
typedef struct _CamoramaFilterClass CamoramaFilterMirrorClass;
-G_DEFINE_TYPE(CamoramaFilterMirror, camorama_filter_mirror, CAMORAMA_TYPE_FILTER);
+G_DEFINE_TYPE(CamoramaFilterMirror, camorama_filter_mirror,
+ CAMORAMA_TYPE_FILTER);
-static void
-camorama_filter_mirror_init(CamoramaFilterMirror* self) {}
+static void camorama_filter_mirror_init(CamoramaFilterMirror *self)
+{
+}
-static void
-camorama_filter_mirror_filter(CamoramaFilter* filter, guchar *image, gint width, gint height, gint depth) {
- gint x, z, row_length, image_length, new_row, next_row, half_row, index1, index2;
- guchar temp;
+static void camorama_filter_mirror_filter(void *filter, guchar *image,
+ gint width, gint height,
+ gint depth)
+{
+ gint x, z, row_length, image_length, new_row, next_row, half_row;
+ gint index1, index2;
+ guchar temp;
- row_length = width * depth;
- image_length = row_length * height;
- half_row = ((width+1)/2)*depth;
- for(new_row = 0; new_row < image_length; new_row = next_row) { // 0, 320*depth, 640*depth, 960*depth, ...
- next_row = new_row + row_length;
- for (x = 0; x < half_row; x+=depth) { // 0, 3, 6, ..., 160*depth
- index1 = new_row + x; // 0, 3, 6, ..., 160*depth
- index2 = next_row - x - depth;// 320, 319, 318, ..., 161*depth
- for (z = 0; z < depth; z++) { // 0, ..., depth
- temp = image[index1 + z];
- image[index1 + z] = image[index2 + z];
- image[index2 + z] = temp;
- }
- }
- }
+ row_length = width * depth;
+ image_length = row_length * height;
+ half_row = ((width + 1) / 2) * depth;
+
+ // 0, 320*depth, 640*depth, 960*depth, ...
+ for (new_row = 0; new_row < image_length; new_row = next_row) {
+ next_row = new_row + row_length;
+ for (x = 0; x < half_row; x += depth) { // 0, 3, 6, ..., 160*depth
+ index1 = new_row + x; // 0, 3, 6, ..., 160*depth
+ index2 = next_row - x - depth; // 320, 319, 318, ..., 161*depth
+ for (z = 0; z < depth; z++) { // 0, ..., depth
+ temp = image[index1 + z];
+ image[index1 + z] = image[index2 + z];
+ image[index2 + z] = temp;
+ }
+ }
+ }
}
static void
-camorama_filter_mirror_class_init(CamoramaFilterMirrorClass* self_class) {
- self_class->filter = camorama_filter_mirror_filter;
- // TRANSLATORS: This is a noun
- self_class->name = _("Mirror");
+camorama_filter_mirror_class_init(CamoramaFilterMirrorClass *self_class)
+{
+ self_class->filter = camorama_filter_mirror_filter;
+ // TRANSLATORS: This is a noun
+ self_class->name = _("Mirror");
}
-
-

Privacy Policy