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