images::TestImageDither Class Reference

#include <image_dither_unittest.h>

Collaboration diagram for images::TestImageDither:
Collaboration graph
[legend]

Public Member Functions

 TestImageDither (void)
 ~TestImageDither (void)
void set_image (const std::string &filepath)
void test (void)
 (1)Calling ImageDither to dither to 8bits. (2)Convert 8bits to 24bits for saving. (3)Save the image data in 24bits to file to verify.

Detailed Description

Definition at line 34 of file image_dither_unittest.h.


Constructor & Destructor Documentation

TestImageDither::TestImageDither ( void   ) 

Definition at line 34 of file image_dither_unittest.cpp.

00035 {
00036     g_type_init ();
00037 }

TestImageDither::~TestImageDither ( void   ) 

Definition at line 39 of file image_dither_unittest.cpp.

00040 {
00041 }


Member Function Documentation

void TestImageDither::set_image ( const std::string &  filepath  ) 

Definition at line 43 of file image_dither_unittest.cpp.

Referenced by main().

00044 {
00045     img_path = filepath;
00046 }

Here is the caller graph for this function:

void TestImageDither::test ( void   ) 

(1)Calling ImageDither to dither to 8bits. (2)Convert 8bits to 24bits for saving. (3)Save the image data in 24bits to file to verify.

Definition at line 48 of file image_dither_unittest.cpp.

References images::ImageDither::dither_to_8bits().

Referenced by main().

00049 {
00050     // Load the image.
00051     GdkPixbuf * pixbuf = gdk_pixbuf_new_from_file (img_path.c_str (), 0);
00052 
00053     // Set all fields of attrs_src.
00054     BitmapAttributes attrs_src, attrs_dst, attrs_tmp;
00055 
00056     attrs_src.width = gdk_pixbuf_get_width (pixbuf);
00057     attrs_src.height = gdk_pixbuf_get_height (pixbuf);
00058     attrs_src.rowstride = gdk_pixbuf_get_rowstride (pixbuf);
00059     attrs_src.data = gdk_pixbuf_get_pixels (pixbuf);
00060     attrs_src.bytes_per_pixel = gdk_pixbuf_get_n_channels (pixbuf);
00061 
00062     // Convert the image data to be in 8bits.
00063     ImageDither dither;
00064     dither.dither_to_8bits (&attrs_src, &attrs_dst);
00065 
00066     // Convert the image data to be in 24bits for saving.
00067     convert_8bits_to_24bits (&attrs_dst, &attrs_tmp);
00068 
00069     // Save to image file to verify.
00070     save_24bits_to_file (&attrs_tmp);
00071 
00072     // Free the memory.
00073     g_object_unref (pixbuf);
00074     delete [] attrs_dst.data;
00075     // delete [] attrs_tmp.data;
00076 }

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
Generated by  doxygen 1.6.2-20100208