1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* This file is part of the GtkHTML library.
4 * Copyright (C) 2000 Helix Code, Inc.
5 * Authors: Radek Doulik (rodo@helixcode.com)
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
26 #include "htmlcolor.h"
27 #include "htmlpainter.h"
32 HTMLColor
*nc
= g_new0 (HTMLColor
, 1);
40 html_color_new_from_gdk_color (const GdkColor
*color
)
42 HTMLColor
*nc
= html_color_new ();
50 html_color_new_from_rgb (gushort red
,
54 HTMLColor
*nc
= html_color_new ();
57 nc
->color
.green
= green
;
58 nc
->color
.blue
= blue
;
64 html_color_ref (HTMLColor
*color
)
72 html_color_unref (HTMLColor
*color
)
75 g_assert (color
->refcount
> 0);
79 if (!color
->refcount
) {
80 /* if (color->allocated)
81 * g_warning ("FIXME, color free\n"); */
82 /* FIXME commented out to catch g_asserts on refcount so we could hunt "too much unrefs" bugs */
88 html_color_alloc (HTMLColor
*color
,
93 if (!color
->allocated
) {
94 html_painter_alloc_color (painter
, &color
->color
);
95 color
->allocated
= TRUE
;
100 html_color_equal (HTMLColor
*color1
,
103 if (color1
== color2
)
105 if (!color1
|| !color2
)
108 return gdk_color_equal (&color1
->color
, &color2
->color
);
112 html_color_set (HTMLColor
*color
,
115 /* if (color->allocated)
116 * g_warning ("FIXME, color free\n"); */
117 color
->allocated
= FALSE
;