00001 /* 00002 * File Name: image_dither_unittest.h 00003 */ 00004 00005 /* 00006 * This file is part of uds-plugin-images. 00007 * 00008 * uds-plugin-images is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation, either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * uds-plugin-images is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00020 */ 00021 00022 /** 00023 * Copyright (C) 2008 iRex Technologies B.V. 00024 * All rights reserved. 00025 */ 00026 00027 #ifndef _TEST_IMAGE_DITHER_H_ 00028 #define _TEST_IMAGE_DITHER_H_ 00029 00030 #include "image_dither.h" 00031 00032 namespace images 00033 { 00034 class TestImageDither 00035 { 00036 public: 00037 TestImageDither (void); 00038 ~TestImageDither (void); 00039 00040 public: 00041 void set_image(const std::string & filepath); 00042 00043 /** 00044 * @brief (1)Calling ImageDither to dither to 8bits. 00045 * (2)Convert 8bits to 24bits for saving. 00046 * (3)Save the image data in 24bits to file to verify. 00047 */ 00048 void test (void); 00049 00050 private: 00051 /** 00052 * @brief Convert the image data in 8bits 00053 * to the image data in 24bits. 00054 * @param 00055 * @return 00056 */ 00057 void convert_8bits_to_24bits (const BitmapAttributes * attrs_src, 00058 BitmapAttributes * attrs_dst); 00059 00060 unsigned char *_convert_8bits_to_24bits(const unsigned char *data, 00061 int w, int h); 00062 00063 /** 00064 * @brief Save the image data in 24bits into a file 00065 * @param 00066 * @return 00067 */ 00068 void save_24bits_to_file (const BitmapAttributes * attrs); 00069 00070 private: 00071 std::string img_path; 00072 }; 00073 00074 } 00075 00076 #endif// _TEST_IMAGE_DITHER_H_ 00077
1.6.2-20100208