aboutsummaryrefslogtreecommitdiffstats
path: root/src/camorama-filter-chain.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/camorama-filter-chain.c')
-rw-r--r--src/camorama-filter-chain.c109
1 files changed, 62 insertions, 47 deletions
diff --git a/src/camorama-filter-chain.c b/src/camorama-filter-chain.c
index 78f9092..92c6f03 100644
--- a/src/camorama-filter-chain.c
+++ b/src/camorama-filter-chain.c
@@ -21,69 +21,84 @@
* USA
*/
+#include "v4l.h"
#include "camorama-filter-chain.h"
#include "filter.h"
struct CamoramaImage {
- guchar* buf;
- gint width;
- gint height;
- gint depth;
+ guchar *buf;
+ gint width;
+ gint height;
+ gint depth;
};
-CamoramaFilterChain*
-camorama_filter_chain_new(void) {
- return g_object_new(CAMORAMA_TYPE_FILTER_CHAIN, NULL);
+CamoramaFilterChain *camorama_filter_chain_new(void)
+{
+ return g_object_new(CAMORAMA_TYPE_FILTER_CHAIN, NULL);
}
-void
-camorama_filter_chain_append(CamoramaFilterChain* self, GType filter_type) {
- GtkTreeIter iter;
- GtkListStore* store;
- CamoramaFilter* filter;
- g_return_if_fail(g_type_is_a(filter_type, CAMORAMA_TYPE_FILTER));
-
- store = GTK_LIST_STORE(self);
- gtk_list_store_append(store, &iter);
- filter = g_object_new(filter_type, NULL);
- gtk_list_store_set(store, &iter,
- CAMORAMA_FILTER_CHAIN_COL_FILTER, filter,
- CAMORAMA_FILTER_CHAIN_COL_NAME, camorama_filter_get_name(filter),
- -1);
- g_object_unref(filter);
+void camorama_filter_chain_append(CamoramaFilterChain *self,
+ GType filter_type)
+{
+ GtkTreeIter iter;
+ GtkListStore *store;
+ CamoramaFilter *filter;
+
+ g_return_if_fail(g_type_is_a(filter_type, CAMORAMA_TYPE_FILTER));
+
+ store = GTK_LIST_STORE(self);
+ gtk_list_store_append(store, &iter);
+ filter = g_object_new(filter_type, NULL);
+ gtk_list_store_set(store, &iter,
+ CAMORAMA_FILTER_CHAIN_COL_FILTER, filter,
+ CAMORAMA_FILTER_CHAIN_COL_NAME,
+ camorama_filter_get_name(filter), -1);
+ g_object_unref(filter);
}
-static gboolean
-camorama_filter_chain_apply_filter(GtkTreeModel* model, GtkTreePath* path, GtkTreeIter* iter, gpointer user_data) {
- struct CamoramaImage* img = user_data;
- CamoramaFilter* filter = NULL;
- gtk_tree_model_get(model, iter,
- CAMORAMA_FILTER_CHAIN_COL_FILTER, &filter,
- -1);
- camorama_filter_apply(filter, img->buf, img->width, img->height, img->depth);
+static gboolean camorama_filter_chain_apply_filter(GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ gpointer user_data)
+{
+ struct CamoramaImage *img = user_data;
+ CamoramaFilter *filter = NULL;
- return FALSE;
+ gtk_tree_model_get(model, iter,
+ CAMORAMA_FILTER_CHAIN_COL_FILTER, &filter, -1);
+ camorama_filter_apply(filter, img->buf, img->width, img->height,
+ img->depth);
+
+ return FALSE;
}
-void
-camorama_filter_chain_apply(CamoramaFilterChain* self, guchar* image, gint width, gint height, gint depth) {
- struct CamoramaImage img = {image, width, height, depth};
-
- gtk_tree_model_foreach(GTK_TREE_MODEL(self), camorama_filter_chain_apply_filter, &img);
+void camorama_filter_chain_apply(CamoramaFilterChain *self,
+ guchar *image, gint width, gint height,
+ gint depth)
+{
+ struct CamoramaImage img = { image, width, height, depth };
+
+ gtk_tree_model_foreach(GTK_TREE_MODEL(self),
+ camorama_filter_chain_apply_filter, &img);
}
/* GType stuff */
-G_DEFINE_TYPE(CamoramaFilterChain, camorama_filter_chain, GTK_TYPE_LIST_STORE);
-
-static void
-camorama_filter_chain_init(CamoramaFilterChain* self) {
- GType column_types[CAMORAMA_FILTER_CHAIN_N_COLUMNS];
- column_types[CAMORAMA_FILTER_CHAIN_COL_NAME] = G_TYPE_STRING;
- column_types[CAMORAMA_FILTER_CHAIN_COL_FILTER] = G_TYPE_OBJECT;
- gtk_list_store_set_column_types(GTK_LIST_STORE(self), CAMORAMA_FILTER_CHAIN_N_COLUMNS, column_types);
-}
+G_DEFINE_TYPE(CamoramaFilterChain, camorama_filter_chain,
+ GTK_TYPE_LIST_STORE);
+
+static void camorama_filter_chain_init(CamoramaFilterChain *self)
+{
+ GType column_types[CAMORAMA_FILTER_CHAIN_N_COLUMNS];
-static void
-camorama_filter_chain_class_init(CamoramaFilterChainClass* self) {}
+ column_types[CAMORAMA_FILTER_CHAIN_COL_NAME] = G_TYPE_STRING;
+ column_types[CAMORAMA_FILTER_CHAIN_COL_FILTER] = G_TYPE_OBJECT;
+ gtk_list_store_set_column_types(GTK_LIST_STORE(self),
+ CAMORAMA_FILTER_CHAIN_N_COLUMNS,
+ column_types);
+}
+static void camorama_filter_chain_class_init(CamoramaFilterChainClass *
+ self)
+{
+}

Privacy Policy