babl r339 - in trunk: . extensions
- From: ok svn gnome org
- To: svn-commits-list gnome org
- Subject: babl r339 - in trunk: . extensions
- Date: Fri, 13 Jun 2008 20:32:09 +0000 (UTC)
Author: ok
Date: Fri Jun 13 20:32:08 2008
New Revision: 339
URL: http://svn.gnome.org/viewvc/babl?rev=339&view=rev
Log:
* extensions/frequency.c: added dummy model "frequency" and dummy
format "frequency float" to be used purely for creating, storing,
accessing but not converting to and from normal tristimulus spaces.
can be used by GeglBuffer to create frequency domain buffers that
are processed in a similar manner to normal buffers.
Added:
trunk/extensions/frequency.c
Modified:
trunk/ChangeLog
Added: trunk/extensions/frequency.c
==============================================================================
--- (empty file)
+++ trunk/extensions/frequency.c Fri Jun 13 20:32:08 2008
@@ -0,0 +1,125 @@
+/* babl - dynamically extendable universal pixel conversion library.
+ * Copyright (C) 2005-2008 Ãyvind KolÃs.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * This file contains a pseudo model and format for storing frequency domain buffers,
+ * the main purpose is registering a fully decorated introspectable format. It currently
+ * provides nop conversions when registering when conversions to or from this conversion
+ * is requested nothing is done.
+ *
+ * Added as a potential aid for summer of code project adding frequency domain processing
+ * to GEGL
+ */
+
+#include "config.h"
+
+#include <math.h>
+#include <string.h>
+
+#include "babl.h"
+
+
+static long rgba_to_frequency (char *src,
+ char *dst,
+ long n);
+
+static long frequency_to_rgba (char *src,
+ char *dst,
+ long n);
+
+int init (void);
+
+int
+init (void)
+{
+ babl_component_new ("Rr", NULL);
+ babl_component_new ("Gr", NULL);
+ babl_component_new ("Br", NULL);
+ babl_component_new ("Ar", NULL);
+ babl_component_new ("Ri", NULL);
+ babl_component_new ("Gi", NULL);
+ babl_component_new ("Bi", NULL);
+ babl_component_new ("Ai", NULL);
+
+ babl_model_new (
+ "name", "frequency",
+ babl_component ("Rr"),
+ babl_component ("Gr"),
+ babl_component ("Br"),
+ babl_component ("Ar"),
+ babl_component ("Ri"),
+ babl_component ("Gi"),
+ babl_component ("Bi"),
+ babl_component ("Ai"),
+ NULL
+ );
+
+ babl_conversion_new (
+ babl_model ("RGBA"),
+ babl_model ("frequency"),
+ "linear", rgba_to_frequency,
+ NULL
+ );
+
+ babl_conversion_new (
+ babl_model ("frequency"),
+ babl_model ("RGBA"),
+ "linear", frequency_to_rgba,
+ NULL
+ );
+
+ babl_format_new (
+ "name", "frequency float",
+ babl_model ("frequency"),
+ babl_type ("float"),
+ babl_component ("Rr"),
+ babl_component ("Gr"),
+ babl_component ("Br"),
+ babl_component ("Ar"),
+ babl_component ("Ri"),
+ babl_component ("Gi"),
+ babl_component ("Bi"),
+ babl_component ("Ai"),
+ NULL
+ );
+
+ return 0;
+}
+
+
+static long
+rgba_to_frequency (char *src,
+ char *dst,
+ long n)
+{
+ /* we don't do any conversion, which will be registered as the only valid conversion in babl to go to RGB, it won't work though and
+ * the buffer is left untouched without complaints from babl.
+ */
+ return n;
+}
+
+static long
+frequency_to_rgba (char *src,
+ char *dst,
+ long n)
+{
+ /* we don't do any conversion, which will be registered as the only valid conversion in babl to go to RGB, it won't work though and
+ * the buffer is left untouched without complaints from babl.
+ */
+ return n;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]