Panda3D

pnmTextGlyph.h

00001 // Filename: pnmTextGlyph.h
00002 // Created by:  drose (03Apr02)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef PNMTEXTGLYPH_H
00016 #define PNMTEXTGLYPH_H
00017 
00018 #include "pandabase.h"
00019 
00020 #include "pnmImage.h"
00021 #include "vector_int.h"
00022 
00023 ////////////////////////////////////////////////////////////////////
00024 //       Class : PNMTextGlyph
00025 // Description : A single glyph in a PNMTextMaker.
00026 ////////////////////////////////////////////////////////////////////
00027 class EXPCL_PANDA_PNMTEXT PNMTextGlyph {
00028 PUBLISHED:
00029   PNMTextGlyph(double advance);
00030   ~PNMTextGlyph();
00031 
00032   INLINE int get_advance() const;
00033 
00034   void place(PNMImage &dest_image, int xp, int yp, 
00035              const LColor &fg);
00036   void place(PNMImage &dest_image, int xp, int yp, 
00037              const LColor &fg, const LColor &interior);
00038 
00039   INLINE int get_left() const;
00040   INLINE int get_right() const;
00041   INLINE int get_bottom() const;
00042   INLINE int get_top() const;
00043 
00044   INLINE int get_height() const;
00045   INLINE int get_width() const;
00046   INLINE double get_value(int x, int y) const;
00047   INLINE bool get_interior_flag(int x, int y) const;
00048 
00049 private:
00050   void determine_interior();
00051   void scan_interior(int x, int y, xelval new_code, bool neighbor_dark,
00052                      int recurse_level);
00053   void rescale(double scale_factor);
00054 
00055   PNMImage _image;
00056   int _top;
00057   int _left;
00058   double _advance;
00059   int _int_advance;
00060   vector_int _scan_interior_points;
00061 
00062   friend class PNMTextMaker;
00063 };
00064 
00065 #include "pnmTextGlyph.I"
00066 
00067 #endif
 All Classes Functions Variables Enumerations