2
* * Copyright (C) 2006-2011 Anders Brander <anders@brander.dk>,
3
* * Anders Kvist <akv@lnxbx.dk> and Klaus Post <klauspost@gmail.com>
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23
#include "rawstudio.h"
24
#include <glib-object.h>
29
* Convenience macro to define generic output module
31
#define RS_DEFINE_OUTPUT(type_name, TypeName) \
32
static GType type_name##_get_type (GTypeModule *module); \
33
static void type_name##_class_init(TypeName##Class *klass); \
34
static void type_name##_init(TypeName *output); \
35
static GType type_name##_type = 0; \
37
type_name##_get_type(GTypeModule *module) \
39
if (!type_name##_type) \
41
static const GTypeInfo output_info = \
43
sizeof (TypeName##Class), \
44
(GBaseInitFunc) NULL, \
45
(GBaseFinalizeFunc) NULL, \
46
(GClassInitFunc) type_name##_class_init, \
51
(GInstanceInitFunc) type_name##_init \
54
type_name##_type = g_type_module_register_type( \
61
return type_name##_type; \
64
#define RS_TYPE_OUTPUT rs_output_get_type()
65
#define RS_OUTPUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RS_TYPE_OUTPUT, RSOutput))
66
#define RS_OUTPUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RS_TYPE_OUTPUT, RSOutputClass))
67
#define RS_IS_OUTPUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RS_TYPE_OUTPUT))
68
#define RS_IS_OUTPUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RS_TYPE_OUTPUT))
69
#define RS_OUTPUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RS_TYPE_OUTPUT, RSOutputClass))
71
#define RS_OUTPUT_NAME(output) (((output)) ? g_type_name(G_TYPE_FROM_CLASS(RS_OUTPUT_GET_CLASS ((output)))) : "(nil)")
73
typedef struct _RSOutput RSOutput;
74
typedef struct _RSOutputClass RSOutputClass;
80
struct _RSOutputClass {
81
GObjectClass parent_class;
84
gboolean (*execute)(RSOutput *output, RSFilter *filter);
87
GType rs_output_get_type(void) G_GNUC_CONST;
90
* Instantiate a new RSOutput type
91
* @param identifier A string representing a type, for example "RSJpegfile"
92
* @return A new RSOutput or NULL on failure
95
rs_output_new(const gchar *identifier);
98
* Get a filename extension as announced by a RSOutput module
99
* @param output A RSOutput
100
* @return A proposed filename extension excluding the ., this should not be freed.
103
rs_output_get_extension(RSOutput *output);
106
* Actually execute the saver
107
* @param output A RSOutput
108
* @param filter A RSFilter to get image data from
109
* @return TRUE on success, FALSE on error
112
rs_output_execute(RSOutput *output, RSFilter *filter);
115
* Load parameters from config for a RSOutput
116
* @param output A RSOutput
117
* @param conf_prefix The prefix to prepend on config-keys.
120
rs_output_set_from_conf(RSOutput *output, const gchar *conf_prefix);
123
* Build a GtkWidget that can edit parameters of a RSOutput
124
* @param output A RSOutput
125
* @param conf_prefix If this is non-NULL, the value will be saved in config,
126
* and reloaded next time.
127
* @return A new GtkWidget representing all parameters of output
130
rs_output_get_parameter_widget(RSOutput *output, const gchar *conf_prefix);
134
#endif /* RS_OUTPUT_H */