fix build for --disable-gtk-doc
[swfdec.git] / swfdec / swfdec_color.h
blob1c0e70accf9329ac075bc41f23f88ff33ffb0407
1 /* Swfdec
2 * Copyright (C) 2003-2006 David Schleef <ds@schleef.org>
3 * 2005-2006 Eric Anholt <eric@anholt.net>
4 * 2006-2007 Benjamin Otte <otte@gnome.org>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301 USA
22 #ifndef __SWFDEC_COLOR_H__
23 #define __SWFDEC_COLOR_H__
25 #include <swfdec/swfdec_types.h>
27 G_BEGIN_DECLS
29 struct _SwfdecColorTransform {
30 gboolean mask; /* TRUE if this is a mask - masks are always black */
31 /* naming here is taken from ActionScript, where ?a is the multiplier and ?b the offset */
32 int ra, rb, ga, gb, ba, bb, aa, ab;
35 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
36 #define SWFDEC_COLOR_INDEX_ALPHA (3)
37 #define SWFDEC_COLOR_INDEX_RED (2)
38 #define SWFDEC_COLOR_INDEX_GREEN (1)
39 #define SWFDEC_COLOR_INDEX_BLUE (0)
40 #elif G_BYTE_ORDER == G_BIG_ENDIAN
41 #define SWFDEC_COLOR_INDEX_ALPHA (0)
42 #define SWFDEC_COLOR_INDEX_RED (1)
43 #define SWFDEC_COLOR_INDEX_GREEN (2)
44 #define SWFDEC_COLOR_INDEX_BLUE (3)
45 #else
46 #error "Unknown byte order"
47 #endif
49 #define SWFDEC_COLOR_COMBINE(r,g,b,a) ((SwfdecColor) (((a)<<24) | ((r)<<16) | ((g)<<8) | (b)))
50 #define SWFDEC_COLOR_OPAQUE(color) ((SwfdecColor) ((color) | SWFDEC_COLOR_COMBINE (0, 0, 0, 0xFF)))
51 #define SWFDEC_COLOR_ALPHA(x) (((x)>>24)&0xff)
52 #define SWFDEC_COLOR_RED(x) (((x)>>16)&0xff)
53 #define SWFDEC_COLOR_GREEN(x) (((x)>>8)&0xff)
54 #define SWFDEC_COLOR_BLUE(x) ((x)&0xff)
56 #define SWFDEC_COLOR_WHITE SWFDEC_COLOR_COMBINE (0xFF, 0xFF, 0xFF, 0xFF)
58 SwfdecColor swfdec_color_apply_morph (SwfdecColor start,
59 SwfdecColor end,
60 guint ratio);
61 void swfdec_color_set_source (cairo_t * cr,
62 SwfdecColor color);
63 void swfdec_color_transform_init_identity (SwfdecColorTransform * trans);
64 void swfdec_color_transform_init_mask (SwfdecColorTransform * trans);
65 void swfdec_color_transform_init_color (SwfdecColorTransform * trans,
66 SwfdecColor color);
67 gboolean swfdec_color_transform_is_identity (const SwfdecColorTransform * trans);
68 gboolean swfdec_color_transform_is_alpha (const SwfdecColorTransform * trans);
69 #define swfdec_color_transform_is_mask(trans) ((trans)->mask)
70 void swfdec_color_transform_chain (SwfdecColorTransform * dest,
71 const SwfdecColorTransform * last,
72 const SwfdecColorTransform * first);
73 SwfdecColor swfdec_color_apply_transform (SwfdecColor in,
74 const SwfdecColorTransform * trans);
75 SwfdecColor swfdec_color_apply_transform_premultiplied (SwfdecColor in,
76 const SwfdecColorTransform * trans);
78 void swfdec_matrix_ensure_invertible (cairo_matrix_t * matrix,
79 cairo_matrix_t * inverse);
80 double swfdec_matrix_get_xscale (const cairo_matrix_t * matrix);
81 double swfdec_matrix_get_yscale (const cairo_matrix_t * matrix);
82 double swfdec_matrix_get_rotation (const cairo_matrix_t * matrix);
83 void swfdec_matrix_morph (cairo_matrix_t * dest,
84 const cairo_matrix_t * start,
85 const cairo_matrix_t * end,
86 guint ratio);
89 G_END_DECLS
90 #endif