Top | ![]() |
![]() |
![]() |
![]() |
struct | GimpRGB |
enum | GimpRGBCompositeMode |
#define | GIMP_RGB_LUMINANCE_RED |
#define | GIMP_RGB_LUMINANCE_GREEN |
#define | GIMP_RGB_LUMINANCE_BLUE |
#define | GIMP_TYPE_RGB |
#define | GIMP_TYPE_PARAM_RGB |
void gimp_rgb_set (GimpRGB *rgb
,gdouble red
,gdouble green
,gdouble blue
);
Sets the red, green and blue components of rgb
and leaves the
alpha component unchanged. The color values should be between 0.0
and 1.0 but there is no check to enforce this and the values are
set exactly as they are passed in.
rgb |
a GimpRGB struct |
|
red |
the red component |
|
green |
the green component |
|
blue |
the blue component |
void gimp_rgb_set_alpha (GimpRGB *rgb
,gdouble alpha
);
Sets the alpha component of rgb
and leaves the RGB components unchanged.
void gimp_rgb_set_pixel (GimpRGB *rgb
,const Babl *format
,gconstpointer pixel
);
Sets the red, green and blue components of rgb
from the color
stored in pixel
. The pixel format of pixel
is determined by
format
.
Since: 2.10
void gimp_rgb_get_pixel (const GimpRGB *rgb
,const Babl *format
,gpointer pixel
);
Writes the red, green, blue and alpha components of rgb
to the
color stored in pixel
. The pixel format of pixel
is determined by
format
.
rgb |
a GimpRGB struct |
|
format |
a Babl format |
|
pixel |
pointer to the destination pixel. |
[out caller-allocates] |
Since: 2.10
void gimp_rgb_set_uchar (GimpRGB *rgb
,guchar red
,guchar green
,guchar blue
);
Sets the red, green and blue components of rgb
from 8bit values
(0 to 255) and leaves the alpha component unchanged.
rgb |
a GimpRGB struct |
|
red |
the red component |
|
green |
the green component |
|
blue |
the blue component |
void gimp_rgb_get_uchar (const GimpRGB *rgb
,guchar *red
,guchar *green
,guchar *blue
);
Writes the red, green, blue and alpha components of rgb
to the
color components red
, green
and blue
.
rgb |
a GimpRGB struct |
|
red |
Location for red component, or |
[out][optional] |
green |
Location for green component, or |
[out][optional] |
blue |
Location for blue component, or |
[out][optional] |
gboolean gimp_rgb_parse_name (GimpRGB *rgb
,const gchar *name
,gint len
);
Attempts to parse a color name. This function accepts SVG 1.0 color keywords.
This function does not touch the alpha component of rgb
.
rgb |
a GimpRGB struct used to return the parsed color |
|
name |
a color name (in UTF-8 encoding). |
[array length=len] |
len |
the length of |
Since: 2.2
gboolean gimp_rgb_parse_hex (GimpRGB *rgb
,const gchar *hex
,gint len
);
Attempts to parse a string describing an RGB color in hexadecimal notation (optionally prefixed with a '#').
This function does not touch the alpha component of rgb
.
rgb |
a GimpRGB struct used to return the parsed color |
|
hex |
a string describing a color in hexadecimal notation. |
[array length=len] |
len |
the length of |
Since: 2.2
gboolean gimp_rgb_parse_css (GimpRGB *rgb
,const gchar *css
,gint len
);
Attempts to parse a string describing an RGB color in CSS
notation. This can be either a numerical representation
(rgb(255,0,0)
or rgb(100%,0%,0%)
)
or a hexadecimal notation as parsed by gimp_rgb_parse_hex()
(#ff0000
) or a color name as parsed by
gimp_rgb_parse_name()
(red
).
This function does not touch the alpha component of rgb
.
rgb |
a GimpRGB struct used to return the parsed color |
|
css |
a string describing a color in CSS notation. |
[array length=len] |
len |
the length of |
Since: 2.2
gint gimp_rgb_list_names (const gchar ***names
,GimpRGB **colors
);
Returns the list of SVG 1.0 color
keywords that is used by gimp_rgb_parse_name()
.
The returned strings are const and must not be freed. Only the two
arrays are allocated dynamically. You must call g_free()
on the
names
and colors
arrays when they are not any longer needed.
names |
return location for an array of color names. |
[out] |
colors |
return location for an array of GimpRGB structs. |
[out] |
Since: 2.2
void gimp_rgb_composite (GimpRGB *color1
,const GimpRGB *color2
,GimpRGBCompositeMode mode
);
void gimp_rgba_set (GimpRGB *rgba
,gdouble red
,gdouble green
,gdouble blue
,gdouble alpha
);
Sets the red, green, blue and alpha components of rgb
. The values
should be between 0.0 and 1.0 but there is no check to enforce this
and the values are set exactly as they are passed in.
rgba |
a GimpRGB struct |
|
red |
the red component |
|
green |
the green component |
|
blue |
the blue component |
|
alpha |
the alpha component |
void gimp_rgba_set_pixel (GimpRGB *rgba
,const Babl *format
,gconstpointer pixel
);
Sets the red, green, blue and alpha components of rgba
from the
color stored in pixel
. The pixel format of pixel
is determined
by format
.
Since: 2.10
void gimp_rgba_get_pixel (const GimpRGB *rgba
,const Babl *format
,gpointer pixel
);
Writes the red, green, blue and alpha components of rgba
to the
color stored in pixel
. The pixel format of pixel
is determined by
format
.
rgba |
a GimpRGB struct |
|
format |
a Babl format |
|
pixel |
pointer to the destination pixel. |
[out caller-allocates] |
Since: 2.10
void gimp_rgba_set_uchar (GimpRGB *rgba
,guchar red
,guchar green
,guchar blue
,guchar alpha
);
Sets the red, green, blue and alpha components of rgba
from 8bit
values (0 to 255).
rgba |
a GimpRGB struct |
|
red |
the red component |
|
green |
the green component |
|
blue |
the blue component |
|
alpha |
the alpha component |
void gimp_rgba_get_uchar (const GimpRGB *rgba
,guchar *red
,guchar *green
,guchar *blue
,guchar *alpha
);
Gets the 8bit red, green, blue and alpha components of rgba
.
rgba |
a GimpRGB struct |
|
red |
Location for the red component. |
[out][optional] |
green |
Location for the green component. |
[out][optional] |
blue |
Location for the blue component. |
[out][optional] |
alpha |
Location for the alpha component. |
[out][optional] |
gboolean gimp_rgba_parse_css (GimpRGB *rgba
,const gchar *css
,gint len
);
Similar to gimp_rgb_parse_css()
but handles RGB colors with alpha
channel in the numerical CSS notation (rgba(255,0,0,255)
or rgba(100%,0%,0%,1000%)
).
It doesn't handle the hexadecimal notation or color names because they leave the alpha channel unspecified.
rgba |
a GimpRGB struct used to return the parsed color |
|
css |
a string describing a color in CSS notation. |
[array length=len] |
len |
the length of |
Since: 2.2
GParamSpec * gimp_param_spec_rgb (const gchar *name
,const gchar *nick
,const gchar *blurb
,gboolean has_alpha
,const GimpRGB *default_value
,GParamFlags flags
);
Creates a param spec to hold an GimpRGB value.
See g_param_spec_internal()
for more information.
name |
Canonical name of the param |
|
nick |
Nickname of the param |
|
blurb |
Brief description of param. |
|
has_alpha |
|
|
default_value |
Value to use if none is assigned. |
|
flags |
a combination of GParamFlags |
Since: 2.4
void gimp_param_spec_rgb_get_default (GParamSpec *pspec
,GimpRGB *default_value
);
Returns the pspec
's default color value.
Since: 2.10.14
gboolean
gimp_param_spec_rgb_has_alpha (GParamSpec *pspec
);
Since: 2.4
#define GIMP_VALUE_HOLDS_RGB(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_RGB))