degate  0.1.2
PixelPolicies.h
Go to the documentation of this file.
00001 /* -*-c++-*-
00002 
00003  This file is part of the IC reverse engineering tool degate.
00004 
00005  Copyright 2008, 2009, 2010 by Martin Schobert
00006 
00007  Degate is free software: you can redistribute it and/or modify
00008  it under the terms of the GNU General Public License as published by
00009  the Free Software Foundation, either version 3 of the License, or
00010  any later version.
00011 
00012  Degate is distributed in the hope that it will be useful,
00013  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  GNU General Public License for more details.
00016 
00017  You should have received a copy of the GNU General Public License
00018  along with degate. If not, see <http://www.gnu.org/licenses/>.
00019 
00020 */
00021 
00022 #ifndef __PIXELPOLICIES_H__
00023 #define __PIXELPOLICIES_H__
00024 
00025 #include "globals.h"
00026 #include "MemoryMap.h"
00027 
00028 namespace degate {
00029 
00030   enum IMAGE_TYPE {
00031     IMAGE_TYPE_GS_BYTE = 1,
00032     IMAGE_TYPE_GS_DOUBLE = 2,
00033     IMAGE_TYPE_RGBA = 3
00034   };
00035 
00036   typedef uint8_t gs_byte_pixel_t;
00037   typedef double gs_double_pixel_t;
00038   typedef uint32_t rgba_pixel_t;
00039 
00040   /* -------------------------------------------------------------------------- *
00041    * pixel type policies
00042    * -------------------------------------------------------------------------- */
00043 
00044 
00045   /**
00046    * Base class for image policies.
00047    */
00048   class PixelPolicy_Base {
00049   };
00050 
00051   /*
00052    * Image policy for RGBA images. Each channel is a 8 bit value.
00053    */
00054 
00055   class PixelPolicy_RGBA : public PixelPolicy_Base {
00056   protected:
00057     static const IMAGE_TYPE image_type = IMAGE_TYPE_RGBA;
00058 
00059   public:
00060     typedef rgba_pixel_t pixel_type;
00061     static bool is_multi_channel() { return true; }
00062 
00063   };
00064 
00065   /**
00066    * Represents a greyscale image pixel policy. Each pixel value is a double.
00067    */
00068 
00069   class PixelPolicy_GS_DOUBLE : public PixelPolicy_Base {
00070   protected:
00071     static const IMAGE_TYPE image_type = IMAGE_TYPE_GS_DOUBLE;
00072   public:
00073     typedef gs_double_pixel_t pixel_type;
00074     static bool is_single_channel() { return true; }
00075   };
00076 
00077   /**
00078    * Represents a greyscale image pixel policy. Each pixel value is a 8 bit value.
00079    */
00080 
00081   class PixelPolicy_GS_BYTE : public PixelPolicy_Base {
00082   protected:
00083     static const IMAGE_TYPE image_type = IMAGE_TYPE_GS_BYTE;
00084   public:
00085     typedef gs_byte_pixel_t pixel_type;
00086     static bool is_single_channel() { return true; }
00087   };
00088 
00089 }
00090 
00091 #endif