[gimp/soc-2009-dynamics] Adding the sub files for dynamics save and load



commit 455e5239cbb9809ce4576de229fa73505825a579
Author: Alexia Death <alexiadeath gmail com>
Date:   Thu Aug 20 12:34:45 2009 +0300

    Adding the sub files for dynamics save and load

 app/core/gimpdynamics-load.c |   64 ++++++++++++++++++++++++++++++++++++++++++
 app/core/gimpdynamics-load.h |   29 +++++++++++++++++++
 app/core/gimpdynamics-save.c |   63 +++++++++++++++++++++++++++++++++++++++++
 app/core/gimpdynamics-save.h |   27 +++++++++++++++++
 4 files changed, 183 insertions(+), 0 deletions(-)
---
diff --git a/app/core/gimpdynamics-load.c b/app/core/gimpdynamics-load.c
new file mode 100644
index 0000000..83175bd
--- /dev/null
+++ b/app/core/gimpdynamics-load.c
@@ -0,0 +1,64 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <errno.h>
+
+#include <glib-object.h>
+#include <glib/gstdio.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#ifdef G_OS_WIN32
+#include "libgimpbase/gimpwin32-io.h"
+#endif
+
+#include "core-types.h"
+
+#include "gimpdynamics.h"
+#include "gimpdynamics-load.h"
+
+#include "gimp-intl.h"
+
+
+GList *
+gimp_dynamics_load (const gchar  *filename,
+                    GError      **error)
+{
+  FILE *file;
+
+  g_return_val_if_fail (filename != NULL, NULL);
+  g_return_val_if_fail (g_path_is_absolute (filename), NULL);
+  g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+  file = g_fopen (filename, "rb");
+
+  if (! file)
+    {
+      g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN,
+                   _("Could not open '%s' for reading: %s"),
+                   gimp_filename_to_utf8 (filename), g_strerror (errno));
+      return NULL;
+    }
+
+  /* load dynamics */
+
+  fclose (file);
+
+  return NULL;
+}
diff --git a/app/core/gimpdynamics-load.h b/app/core/gimpdynamics-load.h
new file mode 100644
index 0000000..e7321c6
--- /dev/null
+++ b/app/core/gimpdynamics-load.h
@@ -0,0 +1,29 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_DYNAMICS_LOAD_H__
+#define __GIMP_DYNAMICS_LOAD_H__
+
+
+#define GIMP_DYNAMICS_FILE_EXTENSION ".gdyn"
+
+
+GList * gimp_dynamics_load (const gchar  *filename,
+                            GError      **error);
+
+
+#endif /* __GIMP_DYNAMICS_LOAD_H__ */
diff --git a/app/core/gimpdynamics-save.c b/app/core/gimpdynamics-save.c
new file mode 100644
index 0000000..f435ef3
--- /dev/null
+++ b/app/core/gimpdynamics-save.c
@@ -0,0 +1,63 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <errno.h>
+
+#include <glib-object.h>
+#include <glib/gstdio.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "core-types.h"
+
+#include "gimpdynamics.h"
+#include "gimpdynamics-save.h"
+
+#include "gimp-intl.h"
+
+
+gboolean
+gimp_curve_save (GimpData  *data,
+                 GError   **error)
+{
+  GimpDynamics *dynamics;
+  FILE         *file;
+
+  g_return_val_if_fail (GIMP_IS_DYNAMICS (data), FALSE);
+  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+  dynamics = GIMP_DYNAMICS (data);
+
+  file = g_fopen (data->filename, "wb");
+
+  if (! file)
+    {
+      g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN,
+                   _("Could not open '%s' for writing: %s"),
+                   gimp_filename_to_utf8 (data->filename),
+                   g_strerror (errno));
+      return FALSE;
+    }
+
+  /* FIXME: write dynamics */
+
+  fclose (file);
+
+  return TRUE;
+}
diff --git a/app/core/gimpdynamics-save.h b/app/core/gimpdynamics-save.h
new file mode 100644
index 0000000..c4a6976
--- /dev/null
+++ b/app/core/gimpdynamics-save.h
@@ -0,0 +1,27 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_DYNAMICS_SAVE_H__
+#define __GIMP_DYNAMICS_SAVE_H__
+
+
+/*  don't call this function directly, use gimp_data_save() instead  */
+gboolean   gimp_dynamics_save (GimpData  *data,
+                               GError   **error);
+
+
+#endif /* __GIMP_DYNAMICS_SAVE_H__ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]