00001 // Filename: charLayout.h 00002 // Created by: drose (16Feb01) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef CHARLAYOUT_H 00020 #define CHARLAYOUT_H 00021 00022 #include <pandatoolbase.h> 00023 00024 #include "charPlacement.h" 00025 00026 #include "pvector.h" 00027 00028 class CharPlacement; 00029 00030 //////////////////////////////////////////////////////////////////// 00031 // Class : CharLayout 00032 // Description : This represents the arrangement of all characters on 00033 // a working bitmap of a given size. Either all 00034 // characters fit or they don't. 00035 //////////////////////////////////////////////////////////////////// 00036 class CharLayout { 00037 public: 00038 void reset(int working_xsize, int working_ysize, 00039 int working_buffer_pixels); 00040 00041 bool place_character(const CharBitmap *bm); 00042 00043 typedef pvector<CharPlacement> Placements; 00044 Placements _placements; 00045 00046 int _working_xsize, _working_ysize; 00047 int _working_buffer_pixels; 00048 int _cx, _cy, _nexty; 00049 00050 private: 00051 bool find_hole(int &x, int &y, int x_size, int y_size) const; 00052 const CharPlacement *find_overlap(int x, int y, int x_size, int y_size) const; 00053 }; 00054 00055 #endif