libeek: define new boxed type EekColor for colors
This commit is contained in:
@ -145,3 +145,46 @@ eek_outline_get_type (void)
|
|||||||
(GBoxedFreeFunc)eek_outline_free);
|
(GBoxedFreeFunc)eek_outline_free);
|
||||||
return our_type;
|
return our_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* EekColor */
|
||||||
|
static EekColor *
|
||||||
|
eek_color_copy (const EekColor *color)
|
||||||
|
{
|
||||||
|
return g_slice_dup (EekColor, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
eek_color_free (EekColor *color)
|
||||||
|
{
|
||||||
|
g_slice_free (EekColor, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
GType
|
||||||
|
eek_color_get_type (void)
|
||||||
|
{
|
||||||
|
static GType our_type = 0;
|
||||||
|
|
||||||
|
if (our_type == 0)
|
||||||
|
our_type =
|
||||||
|
g_boxed_type_register_static ("EekColor",
|
||||||
|
(GBoxedCopyFunc)eek_color_copy,
|
||||||
|
(GBoxedFreeFunc)eek_color_free);
|
||||||
|
return our_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
EekColor *
|
||||||
|
eek_color_new (gdouble red,
|
||||||
|
gdouble green,
|
||||||
|
gdouble blue,
|
||||||
|
gdouble alpha)
|
||||||
|
{
|
||||||
|
EekColor *color;
|
||||||
|
|
||||||
|
color = g_slice_new (EekColor);
|
||||||
|
color->red = red;
|
||||||
|
color->green = green;
|
||||||
|
color->blue = blue;
|
||||||
|
color->alpha = alpha;
|
||||||
|
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|||||||
@ -28,6 +28,7 @@ G_BEGIN_DECLS
|
|||||||
#define EEK_TYPE_POINT (eek_point_get_type ())
|
#define EEK_TYPE_POINT (eek_point_get_type ())
|
||||||
#define EEK_TYPE_BOUNDS (eek_bounds_get_type ())
|
#define EEK_TYPE_BOUNDS (eek_bounds_get_type ())
|
||||||
#define EEK_TYPE_OUTLINE (eek_outline_get_type ())
|
#define EEK_TYPE_OUTLINE (eek_outline_get_type ())
|
||||||
|
#define EEK_TYPE_COLOR (eek_color_get_type ())
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,6 +56,7 @@ typedef struct _EekKeysymMatrix EekKeysymMatrix;
|
|||||||
typedef struct _EekPoint EekPoint;
|
typedef struct _EekPoint EekPoint;
|
||||||
typedef struct _EekBounds EekBounds;
|
typedef struct _EekBounds EekBounds;
|
||||||
typedef struct _EekOutline EekOutline;
|
typedef struct _EekOutline EekOutline;
|
||||||
|
typedef struct _EekColor EekColor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EekKeysymMatrix:
|
* EekKeysymMatrix:
|
||||||
@ -133,5 +135,29 @@ struct _EekOutline
|
|||||||
|
|
||||||
GType eek_outline_get_type (void) G_GNUC_CONST;
|
GType eek_outline_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EekColor:
|
||||||
|
* @red: red component of color, between 0.0 and 1.0
|
||||||
|
* @green: green component of color, between 0.0 and 1.0
|
||||||
|
* @blue: blue component of color, between 0.0 and 1.0
|
||||||
|
* @alpha: alpha component of color, between 0.0 and 1.0
|
||||||
|
*
|
||||||
|
* Color used for drawing.
|
||||||
|
*/
|
||||||
|
struct _EekColor
|
||||||
|
{
|
||||||
|
gdouble red;
|
||||||
|
gdouble green;
|
||||||
|
gdouble blue;
|
||||||
|
gdouble alpha;
|
||||||
|
};
|
||||||
|
|
||||||
|
GType eek_color_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
EekColor *eek_color_new (gdouble red,
|
||||||
|
gdouble green,
|
||||||
|
gdouble blue,
|
||||||
|
gdouble alpha);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
#endif /* EEK_TYPES_H */
|
#endif /* EEK_TYPES_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user