1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 * ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is Oracle Corporation code.
17 * The Initial Developer of the Original Code is Oracle Corporation.
18 * Portions created by the Initial Developer are Copyright (C) 2005
19 * the Initial Developer. All Rights Reserved.
22 * Stuart Parmenter <stuart@mozilla.com>
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
44 #include "gfxMatrix.h"
48 typedef struct _cairo_pattern cairo_pattern_t
;
51 class THEBES_API gfxPattern
{
52 THEBES_INLINE_DECL_REFCOUNTING(gfxPattern
)
55 gfxPattern(cairo_pattern_t
*aPattern
);
56 gfxPattern(const gfxRGBA
& aColor
);
57 gfxPattern(gfxASurface
*surface
); // from another surface
59 gfxPattern(gfxFloat x0
, gfxFloat y0
, gfxFloat x1
, gfxFloat y1
); // linear
60 gfxPattern(gfxFloat cx0
, gfxFloat cy0
, gfxFloat radius0
,
61 gfxFloat cx1
, gfxFloat cy1
, gfxFloat radius1
); // radial
62 virtual ~gfxPattern();
64 cairo_pattern_t
*CairoPattern();
65 void AddColorStop(gfxFloat offset
, const gfxRGBA
& c
);
67 void SetMatrix(const gfxMatrix
& matrix
);
68 gfxMatrix
GetMatrix() const;
76 // Our own private flag for setting either NONE or PAD,
77 // depending on what the platform does for NONE. This is only
78 // relevant for surface patterns; for all other patterns, it
79 // behaves identical to PAD. On MacOS X, this becomes "NONE",
80 // because Quartz does the thing that we want at image edges;
81 // similarily on the win32 printing surface, since
82 // everything's done with GDI there. On other platforms, it
83 // usually becomes PAD.
84 EXTEND_PAD_EDGE
= 1000
87 // none, repeat, reflect
88 void SetExtend(GraphicsExtend extend
);
89 GraphicsExtend
Extend() const;
91 enum GraphicsPatternType
{
98 GraphicsPatternType
GetType() const;
102 void SetFilter(int filter
);
105 /* returns TRUE if it succeeded */
106 PRBool
GetSolidColor(gfxRGBA
& aColor
);
108 already_AddRefed
<gfxASurface
> GetSurface();
111 cairo_pattern_t
*mPattern
;
114 #endif /* GFX_PATTERN_H */