Panda3D
Loading...
Searching...
No Matches
pnmTextGlyph.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file pnmTextGlyph.h
10 * @author drose
11 * @date 2002-04-03
12 */
13
14#ifndef PNMTEXTGLYPH_H
15#define PNMTEXTGLYPH_H
16
17#include "pandabase.h"
18
19#include "pnmImage.h"
20#include "vector_int.h"
21
22/**
23 * A single glyph in a PNMTextMaker.
24 */
25class EXPCL_PANDA_PNMTEXT PNMTextGlyph {
26PUBLISHED:
27 explicit PNMTextGlyph(double advance);
28 ~PNMTextGlyph();
29
30 INLINE int get_advance() const;
31
32 void place(PNMImage &dest_image, int xp, int yp,
33 const LColor &fg);
34 void place(PNMImage &dest_image, int xp, int yp,
35 const LColor &fg, const LColor &interior);
36
37 INLINE int get_left() const;
38 INLINE int get_right() const;
39 INLINE int get_bottom() const;
40 INLINE int get_top() const;
41
42 INLINE int get_height() const;
43 INLINE int get_width() const;
44 INLINE double get_value(int x, int y) const;
45 INLINE bool get_interior_flag(int x, int y) const;
46
47private:
48 void determine_interior();
49 void scan_interior(int x, int y, xelval new_code, bool neighbor_dark,
50 int recurse_level);
51 void rescale(double scale_factor);
52
53 PNMImage _image;
54 int _top;
55 int _left;
56 double _advance;
57 int _int_advance;
58 vector_int _scan_interior_points;
59
60 friend class PNMTextMaker;
61};
62
63#include "pnmTextGlyph.I"
64
65#endif
The name of this class derives from the fact that we originally implemented it as a layer on top of t...
Definition pnmImage.h:58
int get_top() const
Returns the y coordinate of the topmost pixel in the glyph.
int get_advance() const
Returns the number of pixels by which the pen should be advanced after rendering this glyph.
bool get_interior_flag(int x, int y) const
Returns true if the indicated pixel represents a pixel in the interior of a hollow font,...
int get_width() const
Returns the width of the glyph in pixels.
int get_left() const
Returns the x coordinate of the leftmost pixel in the glyph.
void place(PNMImage &dest_image, int xp, int yp, const LColor &fg)
Copies the glyph to the indicated destination image at the indicated origin.
double get_value(int x, int y) const
Returns the value of the indicated pixel of the glyph.
int get_height() const
Returns the height of the glyph in pixels.
int get_bottom() const
Returns the y coordinate of the bottommost pixel in the glyph.
int get_right() const
Returns the x coordinate of the rightmost pixel in the glyph.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.