1 /* 2 * band.h (C) 2006, Aurélien Croc (AP²C) 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; version 2 of the License. 7 * 8 * This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU General Public License for more details. 12 * 13 * You should have received a copy of the GNU General Public License 14 * along with this program; if not, write to the 15 * Free Software Foundation, Inc., 16 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 * 18 * $Id$ 19 * 20 */ 21 #ifndef BAND_H_ 22 #define BAND_H_ 23 24 #include <sys/types.h> 25 #include <stdint.h> 26 27 class Band 28 { 29 protected: 30 unsigned char* _band; 31 unsigned long _width; 32 unsigned long _height; 33 unsigned long _line; 34 unsigned long _clipping; 35 bool _empty; 36 37 protected: 38 unsigned char* _algorithm0(size_t *size); 39 unsigned char* _algorithm11(size_t *size); 40 41 public: 42 Band(unsigned long bandWidth, unsigned long bandHeight); 43 virtual ~Band(); 44 45 public: width()46 unsigned long width() const {return _width * 8;} height()47 unsigned long height() const {return _height;} line()48 unsigned long line() const {return _line;} clipping()49 unsigned long clipping() const {return _clipping * 8;} band()50 unsigned char* band() {return _band;} isEmpty()51 bool isEmpty() const {return _empty;} 52 setEmpty()53 void setEmpty() {_empty = true;} setLine(unsigned long line)54 void setLine(unsigned long line) {_line = line;} setClipping(unsigned long c)55 void setClipping(unsigned long c) 56 {_clipping = (c + 7) / 8;} 57 58 59 clean()60 void clean() {_line = 0;} 61 int addLine(unsigned char *line, 62 unsigned long width); 63 64 unsigned char* exportBand(int algorithm, size_t *size); 65 isFull()66 bool isFull() const 67 {return _line == _height ? true : false;} 68 }; 69 70 #endif /* BAND_H_ */ 71 72 /* vim: set expandtab tabstop=4 shiftwidth=4 smarttab tw=80 cin enc=utf8: */ 73 74