You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

116 lines
3.4 KiB

  1. /* HSV color selector for GTK+
  2. *
  3. * Copyright (C) 1999 The Free Software Foundation
  4. *
  5. * Authors: Simon Budig <Simon.Budig@unix-ag.org> (original code)
  6. * Federico Mena-Quintero <federico@gimp.org> (cleanup for GTK+)
  7. * Jonathan Blandford <jrb@redhat.com> (cleanup for GTK+)
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation; either
  12. * version 2 of the License, or (at your option) any later version.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the
  21. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  22. * Boston, MA 02111-1307, USA.
  23. */
  24. /*
  25. * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
  26. * file for a list of people on the GTK+ Team. See the ChangeLog
  27. * files for a list of changes. These files are distributed with
  28. * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
  29. */
  30. #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
  31. #error "Only <gtk/gtk.h> can be included directly."
  32. #endif
  33. #ifndef __GTK_HSV_H__
  34. #define __GTK_HSV_H__
  35. #include <gtk/gtkwidget.h>
  36. G_BEGIN_DECLS
  37. #define GTK_TYPE_HSV (gtk_hsv_get_type ())
  38. #define GTK_HSV(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_HSV, GtkHSV))
  39. #define GTK_HSV_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_HSV, GtkHSVClass))
  40. #define GTK_IS_HSV(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_HSV))
  41. #define GTK_IS_HSV_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_HSV))
  42. #define GTK_HSV_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_HSV, GtkHSVClass))
  43. typedef struct _GtkHSV GtkHSV;
  44. typedef struct _GtkHSVClass GtkHSVClass;
  45. struct _GtkHSV
  46. {
  47. GtkWidget parent_instance;
  48. /* Private data */
  49. gpointer GSEAL (priv);
  50. };
  51. struct _GtkHSVClass
  52. {
  53. GtkWidgetClass parent_class;
  54. /* Notification signals */
  55. void (* changed) (GtkHSV *hsv);
  56. /* Keybindings */
  57. void (* move) (GtkHSV *hsv,
  58. GtkDirectionType type);
  59. /* Padding for future expansion */
  60. void (*_gtk_reserved1) (void);
  61. void (*_gtk_reserved2) (void);
  62. void (*_gtk_reserved3) (void);
  63. void (*_gtk_reserved4) (void);
  64. };
  65. GType gtk_hsv_get_type (void) G_GNUC_CONST;
  66. GtkWidget* gtk_hsv_new (void);
  67. void gtk_hsv_set_color (GtkHSV *hsv,
  68. double h,
  69. double s,
  70. double v);
  71. void gtk_hsv_get_color (GtkHSV *hsv,
  72. gdouble *h,
  73. gdouble *s,
  74. gdouble *v);
  75. void gtk_hsv_set_metrics (GtkHSV *hsv,
  76. gint size,
  77. gint ring_width);
  78. void gtk_hsv_get_metrics (GtkHSV *hsv,
  79. gint *size,
  80. gint *ring_width);
  81. gboolean gtk_hsv_is_adjusting (GtkHSV *hsv);
  82. /* Convert colors between the RGB and HSV color spaces */
  83. void gtk_hsv_to_rgb (gdouble h,
  84. gdouble s,
  85. gdouble v,
  86. gdouble *r,
  87. gdouble *g,
  88. gdouble *b);
  89. void gtk_rgb_to_hsv (gdouble r,
  90. gdouble g,
  91. gdouble b,
  92. gdouble *h,
  93. gdouble *s,
  94. gdouble *v);
  95. G_END_DECLS
  96. #endif /* __GTK_HSV_H__ */