Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

ImageFilterMirror Class Reference

Mirror the image in various ways. More...

Inheritance diagram for ImageFilterMirror:

Inheritance graph
[legend]
Collaboration diagram for ImageFilterMirror:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ImageFilterMirror ()
virtual ~ImageFilterMirror ()
char * GetDescription () const
void LeftRight (uint8_t *pixels, int width, int height, double position)
void RightLeft (uint8_t *pixels, int width, int height, double position)
void TopBottom (uint8_t *pixels, int width, int height, double position)
void BottomTop (uint8_t *pixels, int width, int height, double position)
void FilterFrame (uint8_t *pixels, int width, int height, double position, double frame_delta)
void AttachWidgets (GtkBin *bin)
void DetachWidgets (GtkBin *bin)

Private Attributes

GtkWidget * window
int type

Detailed Description

Mirror the image in various ways.

Definition at line 158 of file image_filters.cc.


Constructor & Destructor Documentation

ImageFilterMirror::ImageFilterMirror  )  [inline]
 

Definition at line 165 of file image_filters.cc.

References magick_glade, Repaint(), and window.

00166     {
00167         window = glade_xml_get_widget( magick_glade, "image_filter_mirror" );
00168         GtkWidget* widget = glade_xml_get_widget( magick_glade, "optionmenu_mirror" );
00169         g_signal_connect( G_OBJECT( widget ), "changed", G_CALLBACK( Repaint ), 0 );
00170     }

virtual ImageFilterMirror::~ImageFilterMirror  )  [inline, virtual]
 

Definition at line 172 of file image_filters.cc.

References window.

00173     {
00174         gtk_widget_destroy( window );
00175     }


Member Function Documentation

void ImageFilterMirror::AttachWidgets GtkBin *  bin  )  [inline, virtual]
 

Reimplemented from GDKImageFilter.

Definition at line 252 of file image_filters.cc.

References window.

00253     {
00254         gtk_widget_reparent( ( GTK_BIN( window ) ) ->child, GTK_WIDGET( bin ) );
00255     }

void ImageFilterMirror::BottomTop uint8_t *  pixels,
int  width,
int  height,
double  position
[inline]
 

Definition at line 225 of file image_filters.cc.

Referenced by FilterFrame().

00226     {
00227         uint8_t * p = pixels;
00228         for ( int y = 0; y < height / 2; y ++ )
00229         {
00230             uint8_t *i = p + ( height - y ) * width * 3;
00231             uint8_t *o = p + y * width * 3;
00232             memcpy( o, i, width * 3 );
00233         }
00234     }

void ImageFilterMirror::DetachWidgets GtkBin *  bin  )  [inline, virtual]
 

Reimplemented from GDKImageFilter.

Definition at line 257 of file image_filters.cc.

References window.

00258     {
00259         gtk_widget_reparent( ( GTK_BIN( bin ) ) ->child, GTK_WIDGET( window ) );
00260     }

void ImageFilterMirror::FilterFrame uint8_t *  pixels,
int  width,
int  height,
double  position,
double  frame_delta
[inline, virtual]
 

Implements ImageFilter.

Definition at line 236 of file image_filters.cc.

References BottomTop(), LeftRight(), lookup_widget(), RightLeft(), TopBottom(), type, and window.

00237     {
00238         GtkMenu * menu = GTK_MENU( gtk_option_menu_get_menu( GTK_OPTION_MENU( lookup_widget( window, "optionmenu_mirror" ) ) ) );
00239         GtkWidget *active_item = gtk_menu_get_active( menu );
00240         type = g_list_index ( GTK_MENU_SHELL ( menu ) ->children, active_item );
00241         
00242         if ( type == 0 )
00243             LeftRight( pixels, width, height, position );
00244         else if ( type == 1 )
00245             RightLeft( pixels, width, height, position );
00246         else if ( type == 2 )
00247             TopBottom( pixels, width, height, position );
00248         else if ( type == 3 )
00249             BottomTop( pixels, width, height, position );
00250     }

char* ImageFilterMirror::GetDescription  )  const [inline, virtual]
 

Implements ImageFilter.

Definition at line 177 of file image_filters.cc.

00178     {
00179         return _( "Mirror" );
00180     }

void ImageFilterMirror::LeftRight uint8_t *  pixels,
int  width,
int  height,
double  position
[inline]
 

Definition at line 182 of file image_filters.cc.

Referenced by FilterFrame().

00183     {
00184         uint8_t * p = pixels;
00185         for ( int y = 0; y < height; y ++ )
00186         {
00187             uint8_t *i = p + y * width * 3;
00188             uint8_t *o = p + ( y + 1 ) * width * 3 - 1;
00189             for ( ; o > i; o -= 3 )
00190             {
00191                 *( o - 2 ) = *i ++;
00192                 *( o - 1 ) = *i ++;
00193                 *o = *i ++;
00194             }
00195         }
00196     }

void ImageFilterMirror::RightLeft uint8_t *  pixels,
int  width,
int  height,
double  position
[inline]
 

Definition at line 198 of file image_filters.cc.

Referenced by FilterFrame().

00199     {
00200         uint8_t * p = pixels;
00201         for ( int y = 0; y < height; y ++ )
00202         {
00203             uint8_t *o = p + y * width * 3;
00204             uint8_t *i = p + ( y + 1 ) * width * 3 - 1;
00205             for ( ; i > o; i -= 3 )
00206             {
00207                 *o ++ = *( i - 2 );
00208                 *o ++ = *( i - 1 );
00209                 *o ++ = *i;
00210             }
00211         }
00212     }

void ImageFilterMirror::TopBottom uint8_t *  pixels,
int  width,
int  height,
double  position
[inline]
 

Definition at line 214 of file image_filters.cc.

Referenced by FilterFrame().

00215     {
00216         uint8_t * p = pixels;
00217         for ( int y = 0; y < height / 2; y ++ )
00218         {
00219             uint8_t *i = p + y * width * 3;
00220             uint8_t *o = p + ( height - y ) * width * 3;
00221             memcpy( o, i, width * 3 );
00222         }
00223     }


Member Data Documentation

int ImageFilterMirror::type [private]
 

Definition at line 162 of file image_filters.cc.

Referenced by FilterFrame().

GtkWidget* ImageFilterMirror::window [private]
 

Definition at line 161 of file image_filters.cc.

Referenced by AttachWidgets(), DetachWidgets(), FilterFrame(), ImageFilterMirror(), and ~ImageFilterMirror().


The documentation for this class was generated from the following file:
Generated on Sun Mar 11 22:13:04 2007 for Kino by  doxygen 1.4.2