cr-rgb.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
  2. /*
  3. * This file is part of The Croco Library
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of version 2.1 of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  17. * USA
  18. *
  19. * see COPYRIGHTS file for copyright information.
  20. */
  21. #ifndef __CR_RGB_H__
  22. #define __CR_RGB_H__
  23. #include <stdio.h>
  24. #include <glib.h>
  25. #include "cr-utils.h"
  26. #include "cr-parsing-location.h"
  27. G_BEGIN_DECLS
  28. typedef struct _CRRgb CRRgb ;
  29. struct _CRRgb
  30. {
  31. /*
  32. *the unit of the rgb.
  33. *Either NO_UNIT (integer) or
  34. *UNIT_PERCENTAGE (percentage).
  35. */
  36. const guchar *name ;
  37. glong red ;
  38. glong green ;
  39. glong blue ;
  40. gboolean is_percentage ;
  41. gboolean inherit ;
  42. gboolean is_transparent ;
  43. CRParsingLocation location ;
  44. } ;
  45. CRRgb * cr_rgb_new (void) ;
  46. CRRgb * cr_rgb_new_with_vals (gulong a_red, gulong a_green,
  47. gulong a_blue, gboolean a_is_percentage) ;
  48. CRRgb *cr_rgb_parse_from_buf(const guchar *a_str,
  49. enum CREncoding a_enc);
  50. enum CRStatus cr_rgb_compute_from_percentage (CRRgb *a_this) ;
  51. enum CRStatus cr_rgb_set (CRRgb *a_this, gulong a_red,
  52. gulong a_green, gulong a_blue,
  53. gboolean a_is_percentage) ;
  54. enum CRStatus cr_rgb_copy (CRRgb *a_dest, CRRgb const *a_src) ;
  55. enum CRStatus cr_rgb_set_to_inherit (CRRgb *a_this, gboolean a_inherit) ;
  56. gboolean cr_rgb_is_set_to_inherit (CRRgb const *a_this) ;
  57. gboolean cr_rgb_is_set_to_transparent (CRRgb const *a_this) ;
  58. enum CRStatus cr_rgb_set_to_transparent (CRRgb *a_this,
  59. gboolean a_is_transparent) ;
  60. enum CRStatus cr_rgb_set_from_rgb (CRRgb *a_this, CRRgb const *a_rgb) ;
  61. enum CRStatus cr_rgb_set_from_name (CRRgb *a_this, const guchar *a_color_name) ;
  62. enum CRStatus cr_rgb_set_from_hex_str (CRRgb *a_this, const guchar * a_hex_value) ;
  63. struct _CRTerm;
  64. enum CRStatus cr_rgb_set_from_term (CRRgb *a_this, const struct _CRTerm *a_value);
  65. guchar * cr_rgb_to_string (CRRgb const *a_this) ;
  66. void cr_rgb_dump (CRRgb const *a_this, FILE *a_fp) ;
  67. void cr_rgb_destroy (CRRgb *a_this) ;
  68. G_END_DECLS
  69. #endif /*__CR_RGB_H__*/