1 /*
2  * 	    algorithm.h               (C) 2006-2008, 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 _ALGORITHM_H_
22 #define _ALGORITHM_H_
23 
24 class Request;
25 class BandPlane;
26 
27 /**
28   * @brief This super class is an interface to implement a compression
29   *        algorithm.
30   */
31 class Algorithm
32 {
33     protected:
34 
35     public:
36         /**
37           * Initialize the instance.
38           */
39         Algorithm();
40         /**
41           * Destroy the instance.
42           */
43         virtual ~Algorithm();
44 
45     public:
46         /**
47           * Compress data.
48           * @param request the request instance
49           * @param data the data to compress
50           * @param width the width of the data / band / page
51           * @param height the height of the data / band / page
52           * @return a pointer to a @ref BandPlane instance or NULL.
53           */
54         virtual BandPlane*      compress(const Request& request,
55                                     unsigned char *data, unsigned long width,
56                                     unsigned long height) = 0;
57         /**
58           * Reverse line and column.
59           * the byte at (x=1, y=0) is placed at (x=0, y=1) etc.
60           * This is used by algorithm 0x11 (at least).
61           * @return TRUE if this operation is needed. Otherwise returns FALSE.
62           */
reverseLineColumn()63         virtual bool            reverseLineColumn() {return false;}
64         /**
65           * Inverse the byte.
66           * Do a NOT operation on each byte.
67           * @return TRUE if this operation is needed. Otherwise returns FALSE.
68           */
inverseByte()69         virtual bool            inverseByte() {return false;}
70         /**
71           * Split into bands
72           * @return TRUE if each planes has to ben split into bands. Otherwise
73           *         it returns FALSE.
74           */
splitIntoBands()75         virtual bool            splitIntoBands() {return false;}
76 };
77 
78 #endif /* _ALGORITHM_H_ */
79 
80 /* vim: set expandtab tabstop=4 shiftwidth=4 smarttab tw=80 cin enc=utf8: */
81 
82