|
Packit |
bc1512 |
/* This file is part of GEGL
|
|
Packit |
bc1512 |
*
|
|
Packit |
bc1512 |
* GEGL is free software; you can redistribute it and/or
|
|
Packit |
bc1512 |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit |
bc1512 |
* License as published by the Free Software Foundation; either
|
|
Packit |
bc1512 |
* version 3 of the License, or (at your option) any later version.
|
|
Packit |
bc1512 |
*
|
|
Packit |
bc1512 |
* GEGL is distributed in the hope that it will be useful,
|
|
Packit |
bc1512 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
bc1512 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
bc1512 |
* Lesser General Public License for more details.
|
|
Packit |
bc1512 |
*
|
|
Packit |
bc1512 |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit |
bc1512 |
* License along with GEGL; if not, see <http://www.gnu.org/licenses/>.
|
|
Packit |
bc1512 |
*
|
|
Packit |
bc1512 |
* Copyright 2006 Martin Nordholts <enselic@hotmail.com>
|
|
Packit |
bc1512 |
*/
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
#ifndef __GEGL_COLOR_H__
|
|
Packit |
bc1512 |
#define __GEGL_COLOR_H__
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
#include <glib-object.h>
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
G_BEGIN_DECLS
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
#define GEGL_TYPE_COLOR (gegl_color_get_type ())
|
|
Packit |
bc1512 |
#define GEGL_COLOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_COLOR, GeglColor))
|
|
Packit |
bc1512 |
#define GEGL_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEGL_TYPE_COLOR, GeglColorClass))
|
|
Packit |
bc1512 |
#define GEGL_IS_COLOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_COLOR))
|
|
Packit |
bc1512 |
#define GEGL_IS_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEGL_TYPE_COLOR))
|
|
Packit |
bc1512 |
#define GEGL_COLOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEGL_TYPE_COLOR, GeglColorClass))
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
typedef struct _GeglColorClass GeglColorClass;
|
|
Packit |
bc1512 |
typedef struct _GeglColorPrivate GeglColorPrivate;
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
struct _GeglColor
|
|
Packit |
bc1512 |
{
|
|
Packit |
bc1512 |
GObject parent_instance;
|
|
Packit |
bc1512 |
GeglColorPrivate *priv;
|
|
Packit |
bc1512 |
};
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
struct _GeglColorClass
|
|
Packit |
bc1512 |
{
|
|
Packit |
bc1512 |
GObjectClass parent_class;
|
|
Packit |
bc1512 |
};
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
GType gegl_color_get_type (void) G_GNUC_CONST;
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
/***
|
|
Packit |
bc1512 |
* GeglColor:
|
|
Packit |
bc1512 |
*
|
|
Packit |
bc1512 |
* GeglColor is an object containing a color at the moment only RGB colors
|
|
Packit |
bc1512 |
* are supported, in the future a GeglColor might also indicate other
|
|
Packit |
bc1512 |
* enumerated or natively in other color representations colors.
|
|
Packit |
bc1512 |
*/
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
/**
|
|
Packit |
bc1512 |
* gegl_color_new:
|
|
Packit |
bc1512 |
* @string: a string describing the color to be created.
|
|
Packit |
bc1512 |
*
|
|
Packit |
bc1512 |
* Creates a new #GeglColor.
|
|
Packit |
bc1512 |
*
|
|
Packit |
bc1512 |
* Returns the newly created #GeglColor.
|
|
Packit |
bc1512 |
*/
|
|
Packit |
bc1512 |
GeglColor * gegl_color_new (const gchar *string);
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
/**
|
|
Packit |
bc1512 |
* gegl_color_get_rgba:
|
|
Packit |
bc1512 |
* @color: a #GeglColor
|
|
Packit |
bc1512 |
* @red: red return location.
|
|
Packit |
bc1512 |
* @green: green return location.
|
|
Packit |
bc1512 |
* @blue: blue return location.
|
|
Packit |
bc1512 |
* @alpha: alpha return location.
|
|
Packit |
bc1512 |
*
|
|
Packit |
bc1512 |
* Retrieves the current set color as linear light non premultipled RGBA data,
|
|
Packit |
bc1512 |
* any of the return pointers can be omitted.
|
|
Packit |
bc1512 |
*/
|
|
Packit |
bc1512 |
void gegl_color_get_rgba (GeglColor *color,
|
|
Packit |
bc1512 |
gdouble *red,
|
|
Packit |
bc1512 |
gdouble *green,
|
|
Packit |
bc1512 |
gdouble *blue,
|
|
Packit |
bc1512 |
gdouble *alpha);
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
/**
|
|
Packit |
bc1512 |
* gegl_color_set_rgba:
|
|
Packit |
bc1512 |
* @color: a #GeglColor
|
|
Packit |
bc1512 |
* @red: red value
|
|
Packit |
bc1512 |
* @green: green value
|
|
Packit |
bc1512 |
* @blue: blue value
|
|
Packit |
bc1512 |
* @alpha: alpha value
|
|
Packit |
bc1512 |
*
|
|
Packit |
bc1512 |
* Retrieves the current set color as linear light non premultipled RGBA data
|
|
Packit |
bc1512 |
*/
|
|
Packit |
bc1512 |
void gegl_color_set_rgba (GeglColor *color,
|
|
Packit |
bc1512 |
gdouble red,
|
|
Packit |
bc1512 |
gdouble green,
|
|
Packit |
bc1512 |
gdouble blue,
|
|
Packit |
bc1512 |
gdouble alpha);
|
|
Packit |
bc1512 |
/**
|
|
Packit |
bc1512 |
* gegl_color_set_pixel:
|
|
Packit |
bc1512 |
* @color: a #GeglColor
|
|
Packit |
bc1512 |
* @format: a babl pixel format
|
|
Packit |
bc1512 |
* @pixel: pointer to a pixel
|
|
Packit |
bc1512 |
*
|
|
Packit |
bc1512 |
* Set a GeglColor from a pointer to a pixel and it's babl format.
|
|
Packit |
bc1512 |
*/
|
|
Packit |
bc1512 |
void gegl_color_set_pixel (GeglColor *color,
|
|
Packit |
bc1512 |
const Babl *format,
|
|
Packit |
bc1512 |
const void *pixel);
|
|
Packit |
bc1512 |
/**
|
|
Packit |
bc1512 |
* gegl_color_get_pixel:
|
|
Packit |
bc1512 |
* @color: a #GeglColor
|
|
Packit |
bc1512 |
* @format: a babl pixel format
|
|
Packit |
bc1512 |
* @pixel: pointer to a pixel
|
|
Packit |
bc1512 |
*
|
|
Packit |
bc1512 |
* Store the color in a pixel in the given format.
|
|
Packit |
bc1512 |
*/
|
|
Packit |
bc1512 |
void gegl_color_get_pixel (GeglColor *color,
|
|
Packit |
bc1512 |
const Babl *format,
|
|
Packit |
bc1512 |
void *pixel);
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
/***
|
|
Packit |
bc1512 |
*/
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
#define GEGL_TYPE_PARAM_COLOR (gegl_param_color_get_type ())
|
|
Packit |
bc1512 |
#define GEGL_IS_PARAM_SPEC_COLOR(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GEGL_TYPE_PARAM_COLOR))
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
GType gegl_param_color_get_type (void) G_GNUC_CONST;
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
GParamSpec * gegl_param_spec_color (const gchar *name,
|
|
Packit |
bc1512 |
const gchar *nick,
|
|
Packit |
bc1512 |
const gchar *blurb,
|
|
Packit |
bc1512 |
GeglColor *default_color,
|
|
Packit |
bc1512 |
GParamFlags flags);
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
GParamSpec * gegl_param_spec_color_from_string (const gchar *name,
|
|
Packit |
bc1512 |
const gchar *nick,
|
|
Packit |
bc1512 |
const gchar *blurb,
|
|
Packit |
bc1512 |
const gchar *default_color_string,
|
|
Packit |
bc1512 |
GParamFlags flags);
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
G_END_DECLS
|
|
Packit |
bc1512 |
|
|
Packit |
bc1512 |
#endif /* __GEGL_COLOR_H__ */
|