Author: abrander
Date: 2009-07-05 21:34:52 +0200 (Sun, 05 Jul 2009)
New Revision: 2555

Added:
   trunk/librawstudio/rs-filter-param.c
   trunk/librawstudio/rs-filter-param.h
Modified:
   trunk/librawstudio/Makefile.am
   trunk/librawstudio/rawstudio.h
Log:
Added RSFilterParam type.

Modified: trunk/librawstudio/Makefile.am
===================================================================
--- trunk/librawstudio/Makefile.am      2009-07-05 18:28:59 UTC (rev 2554)
+++ trunk/librawstudio/Makefile.am      2009-07-05 19:34:52 UTC (rev 2555)
@@ -19,6 +19,7 @@
        rs-metadata.h \
        rs-filetypes.h \
        rs-filter.h \
+       rs-filter-param.h \
        rs-output.h \
        rs-plugin-manager.h \
        rs-job-queue.h \
@@ -44,6 +45,7 @@
        rs-metadata.c rs-metadata.h \
        rs-filetypes.c rs-filetypes.h \
        rs-filter.c rs-filter.h \
+       rs-filter-param.c rs-filter-param.h \
        rs-output.c rs-output.h \
        rs-plugin-manager.c rs-plugin-manager.h \
        rs-job-queue.c rs-job-queue.h \

Modified: trunk/librawstudio/rawstudio.h
===================================================================
--- trunk/librawstudio/rawstudio.h      2009-07-05 18:28:59 UTC (rev 2554)
+++ trunk/librawstudio/rawstudio.h      2009-07-05 19:34:52 UTC (rev 2555)
@@ -39,6 +39,7 @@
 #include "rs-lens-db.h"
 #include "rs-filetypes.h"
 #include "rs-plugin.h"
+#include "rs-filter-param.h"
 #include "rs-filter.h"
 #include "rs-output.h"
 #include "rs-plugin-manager.h"

Added: trunk/librawstudio/rs-filter-param.c
===================================================================
--- trunk/librawstudio/rs-filter-param.c                                (rev 0)
+++ trunk/librawstudio/rs-filter-param.c        2009-07-05 19:34:52 UTC (rev 
2555)
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2006-2009 Anders Brander <[email protected]> and 
+ * Anders Kvist <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA.
+ */
+
+#include <gtk/gtk.h>
+#include "rs-filter-param.h"
+
+struct _RSFilterParam {
+       GObject parent;
+       gboolean roi_set;
+       GdkRectangle roi;
+};
+
+G_DEFINE_TYPE(RSFilterParam, rs_filter_param, G_TYPE_OBJECT)
+
+static void
+rs_filter_param_finalize(GObject *object)
+{
+       G_OBJECT_CLASS (rs_filter_param_parent_class)->finalize (object);
+}
+
+static void
+rs_filter_param_class_init(RSFilterParamClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+       object_class->finalize = rs_filter_param_finalize;
+}
+
+static void
+rs_filter_param_init(RSFilterParam *filter_param)
+{
+       filter_param->roi_set = FALSE;
+}
+
+/**
+ * Instantiate a new RSFilterParam
+ * @return A new RSFilterParam with a refcount of 1
+ */
+RSFilterParam *
+rs_filter_param_new(void)
+{
+       return g_object_new(RS_TYPE_FILTER_PARAM, NULL);
+}
+
+/**
+ * Clone a RSFilterParam
+ * @param filter_param A RSFilterParam
+ * @return A new RSFilterParam with a refcount of 1 with the same settings as
+ *         filter_param
+ */
+RSFilterParam *
+rs_filter_param_clone(const RSFilterParam *filter_param)
+{
+       RSFilterParam *new_filter_param = rs_filter_param_new();
+
+       if (RS_IS_FILTER_PARAM(filter_param))
+       {
+               new_filter_param->roi_set = filter_param->roi_set;
+               new_filter_param->roi = filter_param->roi;
+       }
+
+       return new_filter_param;
+}
+
+/**
+ * Set a region of interest
+ * @param filter_param A RSFilterParam
+ * @param roi A GdkRectangle describing the ROI or NULL to disable
+ */
+void
+rs_filter_param_set_roi(RSFilterParam *filter_param, GdkRectangle *roi)
+{
+       g_assert(RS_IS_FILTER_PARAM(filter_param));
+
+       filter_param->roi_set = FALSE;
+
+       if (roi)
+       {
+               filter_param->roi_set = TRUE;
+               filter_param->roi = *roi;
+       }
+}
+
+/**
+ * Get the region of interest from a RSFilterParam
+ * @param filter_param A RSFilterParam
+ * @return A GdkRectangle describing the ROI or NULL if none is set, the
+ *         GdkRectangle belongs to the filter_param and should not be freed
+ */
+GdkRectangle *
+rs_filter_param_get_roi(const RSFilterParam *filter_param)
+{
+       GdkRectangle *ret = NULL;
+
+       if (RS_IS_FILTER_PARAM(filter_param) && filter_param->roi_set)
+               ret = &RS_FILTER_PARAM(filter_param)->roi;
+
+       return ret;
+}

Added: trunk/librawstudio/rs-filter-param.h
===================================================================
--- trunk/librawstudio/rs-filter-param.h                                (rev 0)
+++ trunk/librawstudio/rs-filter-param.h        2009-07-05 19:34:52 UTC (rev 
2555)
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2006-2009 Anders Brander <[email protected]> and 
+ * Anders Kvist <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA.
+ */
+
+#ifndef RS_FILTER_PARAM_H
+#define RS_FILTER_PARAM_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define RS_TYPE_FILTER_PARAM rs_filter_param_get_type()
+#define RS_FILTER_PARAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
RS_TYPE_FILTER_PARAM, RSFilterParam))
+#define RS_FILTER_PARAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), 
RS_TYPE_FILTER_PARAM, RSFilterParamClass))
+#define RS_IS_FILTER_PARAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
RS_TYPE_FILTER_PARAM))
+#define RS_IS_FILTER_PARAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), 
RS_TYPE_FILTER_PARAM))
+#define RS_FILTER_PARAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), 
RS_TYPE_FILTER_PARAM, RSFilterParamClass))
+
+typedef struct _RSFilterParam RSFilterParam;
+
+typedef struct {
+       GObjectClass parent_class;
+} RSFilterParamClass;
+
+GType rs_filter_param_get_type(void);
+
+/**
+ * Instantiate a new RSFilterParam
+ * @return A new RSFilterParam with a refcount of 1
+ */
+RSFilterParam *rs_filter_param_new(void);
+
+/**
+ * Clone a RSFilterParam
+ * @param filter_param A RSFilterParam
+ * @return A new RSFilterParam with a refcount of 1 with the same settings as
+ *         filter_param
+ */
+RSFilterParam *rs_filter_param_clone(const RSFilterParam *filter_param);
+
+/**
+ * Set a region of interest
+ * @param filter_param A RSFilterParam
+ * @param roi A GdkRectangle describing the ROI or NULL to disable
+ */
+void rs_filter_param_set_roi(RSFilterParam *filter_param, GdkRectangle *roi);
+
+/**
+ * Get the region of interest from a RSFilterParam
+ * @param filter_param A RSFilterParam
+ * @return A GdkRectangle describing the ROI or NULL if none is set, the
+ *         GdkRectangle belongs to the filter_param and should not be freed
+ */
+GdkRectangle *rs_filter_param_get_roi(const RSFilterParam *filter_param);
+
+G_END_DECLS
+
+#endif /* RS_FILTER_PARAM_H */


_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit

Reply via email to