| author | Matt Plumtree <matt.plumtree@nokia.com> |
| Mon, 15 Nov 2010 09:56:25 +0000 | |
| branch | bug235_bringup_0 |
| changeset 77 | b0395290e61f |
| parent 56 | 40cc73c24bf8 |
| permissions | -rw-r--r-- |
| 24 | 1 |
#ifndef __RIFONT_H |
2 |
#define __RIFONT_H |
|
3 |
||
4 |
/*------------------------------------------------------------------------ |
|
5 |
* |
|
6 |
* OpenVG 1.1 Reference Implementation |
|
7 |
* ----------------------------------- |
|
8 |
* |
|
9 |
* Copyright (c) 2007 The Khronos Group Inc. |
|
10 |
* |
|
11 |
* Permission is hereby granted, free of charge, to any person obtaining a |
|
12 |
* copy of this software and /or associated documentation files |
|
13 |
* (the "Materials "), to deal in the Materials without restriction, |
|
14 |
* including without limitation the rights to use, copy, modify, merge, |
|
15 |
* publish, distribute, sublicense, and/or sell copies of the Materials, |
|
16 |
* and to permit persons to whom the Materials are furnished to do so, |
|
17 |
* subject to the following conditions: |
|
18 |
* |
|
19 |
* The above copyright notice and this permission notice shall be included |
|
20 |
* in all copies or substantial portions of the Materials. |
|
21 |
* |
|
22 |
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|
23 |
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|
24 |
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|
25 |
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
|
26 |
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
|
27 |
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR |
|
28 |
* THE USE OR OTHER DEALINGS IN THE MATERIALS. |
|
29 |
* |
|
30 |
*//** |
|
31 |
* \file |
|
32 |
* \brief VGContext class. Used for storing OpenVG state. |
|
33 |
* \note |
|
34 |
*//*-------------------------------------------------------------------*/ |
|
35 |
||
36 |
#ifndef _OPENVG_H |
|
|
56
40cc73c24bf8
Host components now buildable in their correct locations (although stil using CMake). Use build.bat in package root.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
53
diff
changeset
|
37 |
#include "VG/openvg.h" |
| 24 | 38 |
#endif |
39 |
||
40 |
#ifndef __RIMATH_H |
|
41 |
#include "riMath.h" |
|
42 |
#endif |
|
43 |
||
44 |
#ifndef __RIARRAY_H |
|
45 |
#include "riArray.h" |
|
46 |
#endif |
|
47 |
||
48 |
#ifndef __RIPATH_H |
|
49 |
#include "riPath.h" |
|
50 |
#endif |
|
51 |
||
52 |
#ifndef __RIIMAGE_H |
|
53 |
#include "riImage.h" |
|
54 |
#endif |
|
55 |
||
56 |
//============================================================================================== |
|
57 |
||
58 |
namespace OpenVGRI |
|
59 |
{
|
|
60 |
||
61 |
/*-------------------------------------------------------------------*//*! |
|
62 |
* \brief Storage and operations for VGFont. |
|
63 |
* \param |
|
64 |
* \return |
|
65 |
* \note |
|
66 |
*//*-------------------------------------------------------------------*/ |
|
67 |
||
68 |
class Font |
|
69 |
{
|
|
70 |
public: |
|
71 |
struct Glyph |
|
72 |
{
|
|
73 |
enum State |
|
74 |
{
|
|
75 |
GLYPH_UNINITIALIZED = 0, |
|
76 |
GLYPH_PATH = 1, |
|
77 |
GLYPH_IMAGE = 2 |
|
78 |
}; |
|
79 |
Glyph() { m_state = GLYPH_UNINITIALIZED; m_path = m_image = VG_INVALID_HANDLE; m_isHinted = false; m_origin.set(0.0f, 0.0f); m_escapement.set(0.0f, 0.0f); }
|
|
80 |
unsigned int m_index; |
|
81 |
State m_state; |
|
82 |
VGPath m_path; |
|
83 |
VGImage m_image; |
|
84 |
bool m_isHinted; |
|
85 |
Vector2 m_origin; |
|
86 |
Vector2 m_escapement; |
|
87 |
}; |
|
88 |
||
89 |
Font(int capacityHint); //throws bad_alloc |
|
90 |
~Font(); |
|
91 |
||
92 |
int getNumGlyphs() const { int n=0; for(int i=0;i<m_glyphs.size();i++) { if(m_glyphs[i].m_state != Glyph::GLYPH_UNINITIALIZED) n++; } return n; }
|
|
93 |
void addReference() { m_referenceCount++; }
|
|
94 |
int removeReference() { m_referenceCount--; RI_ASSERT(m_referenceCount >= 0); return m_referenceCount; }
|
|
95 |
||
96 |
void setGlyphToPath(unsigned int index, VGPath path, bool isHinted, const Vector2& origin, const Vector2& escapement); //throws bad_alloc |
|
97 |
void setGlyphToImage(unsigned int index, VGImage image, const Vector2& origin, const Vector2& escapement); //throws bad_alloc |
|
98 |
Glyph* findGlyph(unsigned int index); |
|
99 |
void clearGlyph(Glyph* g); |
|
100 |
private: |
|
101 |
Font(const Font&); //!< Not allowed. |
|
102 |
void operator=(const Font&); //!< Not allowed. |
|
103 |
||
104 |
Glyph* newGlyph(); //throws bad_alloc |
|
105 |
||
106 |
int m_referenceCount; |
|
107 |
Array<Glyph> m_glyphs; |
|
108 |
}; |
|
109 |
||
110 |
//======================================================================= |
|
111 |
||
112 |
} //namespace OpenVGRI |
|
113 |
||
114 |
//======================================================================= |
|
115 |
||
116 |
#endif /* __RIFONT_H */ |