#include <OSGTextPixmapGlyph.h>

Definition at line 61 of file OSGTextPixmapGlyph.h.
typedef Int32 osg::TextGlyph::Index [inherited] |
Defines the glyph index
Definition at line 65 of file OSGTextGlyph.h.
anonymous enum [inherited] |
Defines the invalid glyph index
Definition at line 68 of file OSGTextGlyph.h.
00068 { INVALID_INDEX = -1 };
| osg::TextPixmapGlyph::~TextPixmapGlyph | ( | ) | [virtual] |
Destroys the TextPixmapGlyph object.
Definition at line 52 of file OSGTextPixmapGlyph.cpp.
References _pixmap.
00053 { delete [] _pixmap; }
| osg::TextPixmapGlyph::TextPixmapGlyph | ( | ) | [inline, protected] |
Creates a new TextPixmapGlyph object.
Definition at line 68 of file OSGTextPixmapGlyph.inl.
00069 : TextGlyph(), _width(0), _pitch(0), _height(0), _horiBearingX(0), _horiBearingY(0), _vertBearingX(0), _vertBearingY(0), _pixmap(0) 00070 {}
| osg::TextPixmapGlyph::TextPixmapGlyph | ( | const TextPixmapGlyph & | ) | [private] |
Copy constructor (not implemented!)
| Real32 osg::TextPixmapGlyph::getWidth | ( | void | ) | const [virtual] |
Returns the width of the glyph.
Implements osg::TextGlyph.
Definition at line 60 of file OSGTextPixmapGlyph.cpp.
References _width.
| Real32 osg::TextPixmapGlyph::getHeight | ( | void | ) | const [virtual] |
Returns the height of the glyph.
Implements osg::TextGlyph.
Definition at line 68 of file OSGTextPixmapGlyph.cpp.
References _height.
| Real32 osg::TextPixmapGlyph::getHoriBearingX | ( | ) | const [virtual] |
Returns the x bearing of the glyph for horizontal layout. The x bearing is the distance from the origin to the left border of the glyph.
Implements osg::TextGlyph.
Definition at line 76 of file OSGTextPixmapGlyph.cpp.
References _horiBearingX.
00077 { return static_cast<Real32>(_horiBearingX); }
| Real32 osg::TextPixmapGlyph::getHoriBearingY | ( | ) | const [virtual] |
Returns the y bearing of the glyph for horizontal layout. The y bearing is the distance from the origin to the top border of the glyph.
Implements osg::TextGlyph.
Definition at line 84 of file OSGTextPixmapGlyph.cpp.
References _horiBearingY.
00085 { return static_cast<Real32>(_horiBearingY); }
| Real32 osg::TextPixmapGlyph::getVertBearingX | ( | ) | const [virtual] |
Returns the x bearing of the glyph for vertical layout. The x bearing is the distance from the origin to the left border of the glyph.
Implements osg::TextGlyph.
Definition at line 92 of file OSGTextPixmapGlyph.cpp.
References _vertBearingX.
00093 { return static_cast<Real32>(_vertBearingX); }
| Real32 osg::TextPixmapGlyph::getVertBearingY | ( | ) | const [virtual] |
Returns the y bearing of the glyph for vertical layout. The y bearing is the distance from the origin to the top border of the glyph.
Implements osg::TextGlyph.
Definition at line 100 of file OSGTextPixmapGlyph.cpp.
References _vertBearingY.
00101 { return static_cast<Real32>(_vertBearingY); }
| UInt32 osg::TextPixmapGlyph::getPixmapWidth | ( | ) | const [inline] |
Returns the width of the pixmap in pixels.
Definition at line 43 of file OSGTextPixmapGlyph.inl.
References _width.
00043 { return _width; }
| UInt32 osg::TextPixmapGlyph::getPixmapPitch | ( | ) | const [inline] |
Returns the pitch of the pixmap (the number of bytes per row).
Definition at line 46 of file OSGTextPixmapGlyph.inl.
References _pitch.
00046 { return _pitch; }
| UInt32 osg::TextPixmapGlyph::getPixmapHeight | ( | ) | const [inline] |
Returns the height of the pixmap in pixels.
Definition at line 49 of file OSGTextPixmapGlyph.inl.
References _height.
00049 { return _height; }
| const UInt8 * osg::TextPixmapGlyph::getPixmap | ( | ) | const [inline] |
Returns the x bearing of the glyph in pixels for horizontal layout. The x bearing is the distance from the origin to the left border of the glyph.
The y bearing of the glyph for horizontal layout Returns the x bearing of the glyph in pixels for vertical layout. The x bearing is the distance from the origin to the left border of the glyph.
The x bearing of the glyph for verical layout Returns the y bearing of the glyph in pixels for vertical layout. The y bearing is the distance from the origin to the top border of the glyph.
The y bearing of the glyph for vertical layout Returns the pixmap.
The pixmap
Definition at line 65 of file OSGTextPixmapGlyph.inl.
References _pixmap.
00065 { return _pixmap; }
| void osg::TextPixmapGlyph::putPixmap | ( | Int32 | x, | |
| Int32 | y, | |||
| UInt8 * | tex, | |||
| UInt32 | width, | |||
| UInt32 | height | |||
| ) | const |
Copies the glyph pixmap into a texture.
| x | The x position in the texture in pixels | |
| y | The y position in the texture in pixels | |
| tex | The texture | |
| width | The width of the texture in pixels | |
| height | The height of the texture in pixels |
Definition at line 108 of file OSGTextPixmapGlyph.cpp.
References _height, _pitch, _pixmap, _width, and p.
Referenced by osg::TextPixmapFace::makeImage().
00110 { 00111 if (_pixmap != 0) 00112 { 00113 // Clip the glyph at the left border of the texture 00114 int left = 0; 00115 int glyphWidth = _width; 00116 int src = 0; 00117 int dst = 0; 00118 int delta = x; 00119 if (delta < left) 00120 { 00121 delta = left - delta; 00122 src += delta; 00123 glyphWidth -= delta; 00124 delta = left; 00125 } 00126 dst += delta; 00127 00128 // Clip the glyph at the right border of the texture 00129 int right = width; 00130 delta = right - dst; 00131 if (delta < glyphWidth) 00132 glyphWidth = delta; 00133 00134 // Clip the glyph at the bottom border of the texture 00135 int bottom = 0; 00136 int glyphHeight = _height; 00137 delta = y - _height; 00138 if (delta < bottom) 00139 { 00140 delta = bottom - delta; 00141 src += delta * _pitch; 00142 glyphHeight -= delta; 00143 delta = bottom; 00144 } 00145 dst += delta * width; 00146 00147 // Clip the glyph at the top border of the texture 00148 int top = height; 00149 delta = top - y /*- _horiBearingY*/; 00150 if (delta < 0) 00151 glyphHeight += delta; 00152 00153 int xi, yi; 00154 for (yi = glyphHeight; yi > 0; --yi) 00155 { 00156 unsigned char *srcPtr = &(_pixmap[src]); 00157 unsigned char *dstPtr = &(tex[dst]); 00158 for (xi = glyphWidth; xi > 0; --xi) 00159 { 00160 unsigned char p = 255 - ((255 - *dstPtr) * (255 - *srcPtr) / 255); 00161 *dstPtr++ = p; 00162 srcPtr++; 00163 } 00164 src += _pitch; 00165 dst += width; 00166 } 00167 } 00168 }
| void osg::TextPixmapGlyph::flipPixmap | ( | ) | [protected] |
Flips the glyph pixmap around the x axis.
Definition at line 175 of file OSGTextPixmapGlyph.cpp.
References _height, _pitch, _pixmap, and _width.
00176 { 00177 if (_pixmap == 0) 00178 return; 00179 unsigned char *ptr1 = _pixmap; 00180 unsigned char *ptr2 = _pixmap + _pitch * (_height - 1); 00181 unsigned int x, y; 00182 for (y = _height >> 1; y > 0; --y) 00183 { 00184 for (x = 0; x < _width; ++x) 00185 { 00186 unsigned char h = ptr1[x]; 00187 ptr1[x] = ptr2[x]; 00188 ptr2[x] = h; 00189 } 00190 ptr1 += _pitch; 00191 ptr2 -= _pitch; 00192 } 00193 }
| const TextPixmapGlyph& osg::TextPixmapGlyph::operator= | ( | const TextPixmapGlyph & | ) | [private] |
Copy operator (not implemented!)
| TextGlyph::Index osg::TextGlyph::getGlyphIndex | ( | ) | const [inline, inherited] |
Returns the index of the glyph.
Definition at line 43 of file OSGTextGlyph.inl.
References osg::TextGlyph::_glyphIndex.
00043 { return _glyphIndex; }
| Real32 osg::TextGlyph::getHoriAdvance | ( | ) | const [inline, inherited] |
Returns the advance of the glyph for horizontal layout. The advance is the distance to the next character on the base line.
Definition at line 46 of file OSGTextGlyph.inl.
References osg::TextGlyph::_horiAdvance.
00046 { return _horiAdvance; }
| Real32 osg::TextGlyph::getVertAdvance | ( | ) | const [inline, inherited] |
Returns the advance of the glyph for vertical layout. The advance is the distance to the next character on the base line. This value is usually negative!
Definition at line 49 of file OSGTextGlyph.inl.
References osg::TextGlyph::_vertAdvance.
00049 { return _vertAdvance; }
friend class TextPixmapFace [friend] |
Needs access to constructor
Definition at line 65 of file OSGTextPixmapGlyph.h.
UInt32 osg::TextPixmapGlyph::_width [protected] |
The width of the pixmap in pixels
Definition at line 195 of file OSGTextPixmapGlyph.h.
Referenced by flipPixmap(), getPixmapWidth(), getWidth(), and putPixmap().
UInt32 osg::TextPixmapGlyph::_pitch [protected] |
The pitch of the pixmap (number of bytes per row)
Definition at line 198 of file OSGTextPixmapGlyph.h.
Referenced by flipPixmap(), getPixmapPitch(), and putPixmap().
UInt32 osg::TextPixmapGlyph::_height [protected] |
The height of the pixmap in pixels
Definition at line 201 of file OSGTextPixmapGlyph.h.
Referenced by flipPixmap(), getHeight(), getPixmapHeight(), and putPixmap().
Int32 osg::TextPixmapGlyph::_horiBearingX [protected] |
The x bearing of the pixmap in pixels for horizontal layout
Definition at line 204 of file OSGTextPixmapGlyph.h.
Referenced by getHoriBearingX().
Int32 osg::TextPixmapGlyph::_horiBearingY [protected] |
The y bearing of the pixmap in pixels for horizontal layout
Definition at line 207 of file OSGTextPixmapGlyph.h.
Referenced by getHoriBearingY().
Int32 osg::TextPixmapGlyph::_vertBearingX [protected] |
The x bearing of the pixmap in pixels for vertical layout
Definition at line 210 of file OSGTextPixmapGlyph.h.
Referenced by getVertBearingX().
Int32 osg::TextPixmapGlyph::_vertBearingY [protected] |
The y bearing of the pixmap in pixels for vertical layout
Definition at line 213 of file OSGTextPixmapGlyph.h.
Referenced by getVertBearingY().
UInt8* osg::TextPixmapGlyph::_pixmap [protected] |
The pixmap
Definition at line 216 of file OSGTextPixmapGlyph.h.
Referenced by flipPixmap(), getPixmap(), putPixmap(), and ~TextPixmapGlyph().
Index osg::TextGlyph::_glyphIndex [protected, inherited] |
The index of the glyph
Definition at line 145 of file OSGTextGlyph.h.
Referenced by osg::TextGlyph::getGlyphIndex().
Real32 osg::TextGlyph::_horiAdvance [protected, inherited] |
The advance of the glyph for horizontal layout
Definition at line 148 of file OSGTextGlyph.h.
Referenced by osg::TextGlyph::getHoriAdvance().
Real32 osg::TextGlyph::_vertAdvance [protected, inherited] |
The advance of the glyph for vertical layout
Definition at line 151 of file OSGTextGlyph.h.
Referenced by osg::TextGlyph::getVertAdvance().
1.5.5