2011-06-24 21:41:16 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is Mozilla Corporation code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Mozilla Foundation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2011
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Bas Schouten <bschouten@mozilla.com>
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
#ifndef MOZILLA_GFX_TYPES_H_
|
|
|
|
#define MOZILLA_GFX_TYPES_H_
|
|
|
|
|
2012-03-01 07:56:43 +04:00
|
|
|
#include "mozilla/StandardInteger.h"
|
2011-06-24 21:41:16 +04:00
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace gfx {
|
|
|
|
|
|
|
|
typedef float Float;
|
|
|
|
|
|
|
|
enum SurfaceType
|
|
|
|
{
|
|
|
|
SURFACE_DATA, /* Data surface - bitmap in memory */
|
|
|
|
SURFACE_D2D1_BITMAP, /* Surface wrapping a ID2D1Bitmap */
|
|
|
|
SURFACE_D2D1_DRAWTARGET, /* Surface made from a D2D draw target */
|
|
|
|
SURFACE_CAIRO, /* Surface wrapping a cairo surface */
|
2011-12-28 09:56:11 +04:00
|
|
|
SURFACE_CAIRO_IMAGE, /* Data surface wrapping a cairo image surface */
|
2011-11-02 23:55:03 +04:00
|
|
|
SURFACE_COREGRAPHICS_IMAGE, /* Surface wrapping a CoreGraphics Image */
|
2012-01-31 10:46:54 +04:00
|
|
|
SURFACE_COREGRAPHICS_CGCONTEXT, /* Surface wrapping a CG context */
|
2012-04-04 00:25:52 +04:00
|
|
|
SURFACE_SKIA, /* Surface wrapping a Skia bitmap */
|
|
|
|
SURFACE_DUAL_DT /* Snapshot of a dual drawtarget */
|
2011-06-24 21:41:16 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
enum SurfaceFormat
|
|
|
|
{
|
|
|
|
FORMAT_B8G8R8A8,
|
|
|
|
FORMAT_B8G8R8X8,
|
2011-11-02 23:55:03 +04:00
|
|
|
FORMAT_R5G6B5,
|
2011-06-24 21:41:16 +04:00
|
|
|
FORMAT_A8
|
|
|
|
};
|
|
|
|
|
|
|
|
enum BackendType
|
|
|
|
{
|
2012-01-28 02:38:00 +04:00
|
|
|
BACKEND_NONE,
|
2011-06-24 21:41:16 +04:00
|
|
|
BACKEND_DIRECT2D,
|
|
|
|
BACKEND_COREGRAPHICS,
|
2011-11-02 23:55:03 +04:00
|
|
|
BACKEND_CAIRO,
|
|
|
|
BACKEND_SKIA
|
2011-06-24 21:41:16 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
enum FontType
|
|
|
|
{
|
2011-11-02 23:55:03 +04:00
|
|
|
FONT_DWRITE,
|
2011-11-18 08:00:37 +04:00
|
|
|
FONT_GDI,
|
2011-11-02 23:55:03 +04:00
|
|
|
FONT_MAC,
|
2012-01-10 22:26:59 +04:00
|
|
|
FONT_SKIA,
|
2012-01-09 22:54:44 +04:00
|
|
|
FONT_CAIRO,
|
|
|
|
FONT_COREGRAPHICS
|
2011-06-24 21:41:16 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
enum NativeSurfaceType
|
|
|
|
{
|
2012-01-10 01:50:01 +04:00
|
|
|
NATIVE_SURFACE_D3D10_TEXTURE,
|
2012-01-09 22:54:44 +04:00
|
|
|
NATIVE_SURFACE_CAIRO_SURFACE,
|
|
|
|
NATIVE_SURFACE_CGCONTEXT
|
2011-06-24 21:41:16 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
enum NativeFontType
|
|
|
|
{
|
2011-11-02 23:55:03 +04:00
|
|
|
NATIVE_FONT_DWRITE_FONT_FACE,
|
2011-11-18 08:00:37 +04:00
|
|
|
NATIVE_FONT_GDI_FONT_FACE,
|
2011-11-02 23:55:03 +04:00
|
|
|
NATIVE_FONT_MAC_FONT_FACE,
|
2012-01-10 22:26:59 +04:00
|
|
|
NATIVE_FONT_SKIA_FONT_FACE,
|
|
|
|
NATIVE_FONT_CAIRO_FONT_FACE
|
2011-06-24 21:41:16 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
enum CompositionOp { OP_OVER, OP_ADD, OP_ATOP, OP_OUT, OP_IN, OP_SOURCE, OP_DEST_IN, OP_DEST_OUT, OP_DEST_OVER, OP_DEST_ATOP, OP_XOR, OP_COUNT };
|
2011-12-28 09:56:11 +04:00
|
|
|
enum ExtendMode { EXTEND_CLAMP, EXTEND_REPEAT, EXTEND_REFLECT };
|
2011-06-24 21:41:16 +04:00
|
|
|
enum FillRule { FILL_WINDING, FILL_EVEN_ODD };
|
|
|
|
enum AntialiasMode { AA_NONE, AA_GRAY, AA_SUBPIXEL };
|
|
|
|
enum Snapping { SNAP_NONE, SNAP_ALIGNED };
|
|
|
|
enum Filter { FILTER_LINEAR, FILTER_POINT };
|
|
|
|
enum PatternType { PATTERN_COLOR, PATTERN_SURFACE, PATTERN_LINEAR_GRADIENT, PATTERN_RADIAL_GRADIENT };
|
|
|
|
enum JoinStyle { JOIN_BEVEL, JOIN_ROUND, JOIN_MITER, JOIN_MITER_OR_BEVEL };
|
|
|
|
enum CapStyle { CAP_BUTT, CAP_ROUND, CAP_SQUARE };
|
2011-12-28 09:56:11 +04:00
|
|
|
enum SamplingBounds { SAMPLING_UNBOUNDED, SAMPLING_BOUNDED };
|
2011-06-24 21:41:16 +04:00
|
|
|
|
2011-09-24 19:51:29 +04:00
|
|
|
/* Color is stored in non-premultiplied form */
|
2011-06-24 21:41:16 +04:00
|
|
|
struct Color
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Color()
|
|
|
|
: r(0.0f), g(0.0f), b(0.0f), a(0.0f)
|
|
|
|
{}
|
|
|
|
Color(Float aR, Float aG, Float aB, Float aA)
|
|
|
|
: r(aR), g(aG), b(aB), a(aA)
|
|
|
|
{}
|
|
|
|
Color(Float aR, Float aG, Float aB)
|
|
|
|
: r(aR), g(aG), b(aB), a(1.0f)
|
|
|
|
{}
|
|
|
|
|
|
|
|
static Color FromABGR(uint32_t aColor)
|
|
|
|
{
|
|
|
|
Color newColor(((aColor >> 0) & 0xff) * (1.0f / 255.0f),
|
|
|
|
((aColor >> 8) & 0xff) * (1.0f / 255.0f),
|
|
|
|
((aColor >> 16) & 0xff) * (1.0f / 255.0f),
|
|
|
|
((aColor >> 24) & 0xff) * (1.0f / 255.0f));
|
|
|
|
|
|
|
|
return newColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
Float r, g, b, a;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct GradientStop
|
|
|
|
{
|
2011-11-02 23:55:03 +04:00
|
|
|
bool operator<(const GradientStop& aOther) const {
|
|
|
|
return offset < aOther.offset;
|
|
|
|
}
|
|
|
|
|
2011-06-24 21:41:16 +04:00
|
|
|
Float offset;
|
|
|
|
Color color;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-03 23:21:52 +04:00
|
|
|
#ifdef XP_WIN
|
|
|
|
#ifdef GFX2D_INTERNAL
|
|
|
|
#define GFX2D_API __declspec(dllexport)
|
|
|
|
#else
|
|
|
|
#define GFX2D_API __declspec(dllimport)
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#define GFX2D_API
|
|
|
|
#endif
|
|
|
|
|
2011-06-24 21:41:16 +04:00
|
|
|
// Side constants for use in various places
|
|
|
|
namespace mozilla {
|
|
|
|
namespace css {
|
|
|
|
enum Side {eSideTop, eSideRight, eSideBottom, eSideLeft};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// XXX - These don't really belong here. But for now this is where they go.
|
|
|
|
#define NS_SIDE_TOP mozilla::css::eSideTop
|
|
|
|
#define NS_SIDE_RIGHT mozilla::css::eSideRight
|
|
|
|
#define NS_SIDE_BOTTOM mozilla::css::eSideBottom
|
|
|
|
#define NS_SIDE_LEFT mozilla::css::eSideLeft
|
|
|
|
|
|
|
|
#endif /* MOZILLA_GFX_TYPES_H_ */
|