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

ImageFilterSwap Class Reference

Swap the image left to right. More...

Inheritance diagram for ImageFilterSwap:

Inheritance graph
[legend]
Collaboration diagram for ImageFilterSwap:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ImageFilterSwap ()
virtual ~ImageFilterSwap ()
char * GetDescription () const
void LeftRight (uint8_t *pixels, int width, int height, double position)
void TopBottom (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

Swap the image left to right.

Definition at line 459 of file image_filters.cc.


Constructor & Destructor Documentation

ImageFilterSwap::ImageFilterSwap  )  [inline]
 

Definition at line 466 of file image_filters.cc.

References magick_glade, Repaint(), and window.

00467     {
00468         window = glade_xml_get_widget( magick_glade, "image_filter_swap" );
00469         GtkWidget* widget = glade_xml_get_widget( magick_glade, "optionmenu_swap" );
00470         g_signal_connect( G_OBJECT( widget ), "changed", G_CALLBACK( Repaint ), 0 );
00471     }

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

Definition at line 473 of file image_filters.cc.

References window.

00474     {
00475         gtk_widget_destroy( window );
00476     }


Member Function Documentation

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

Reimplemented from GDKImageFilter.

Definition at line 532 of file image_filters.cc.

References window.

00533     {
00534         gtk_widget_reparent( ( GTK_BIN( window ) ) ->child, GTK_WIDGET( bin ) );
00535     }

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

Reimplemented from GDKImageFilter.

Definition at line 537 of file image_filters.cc.

References window.

00538     {
00539         gtk_widget_reparent( ( GTK_BIN( bin ) ) ->child, GTK_WIDGET( window ) );
00540     }

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

Implements ImageFilter.

Definition at line 520 of file image_filters.cc.

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

00521     {
00522         GtkMenu * menu = GTK_MENU( gtk_option_menu_get_menu( GTK_OPTION_MENU( lookup_widget( window, "optionmenu_swap" ) ) ) );
00523         GtkWidget *active_item = gtk_menu_get_active( menu );
00524         type = g_list_index ( GTK_MENU_SHELL ( menu ) ->children, active_item );
00525         
00526         if ( type == 0 )
00527             LeftRight( pixels, width, height, position );
00528         else if ( type == 1 )
00529             TopBottom( pixels, width, height, position );
00530     }

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

Implements ImageFilter.

Definition at line 478 of file image_filters.cc.

00479     {
00480         return _( "Flip" );
00481     }

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

Definition at line 483 of file image_filters.cc.

Referenced by FilterFrame().

00484     {
00485         uint8_t r, g, b;
00486         uint8_t *p = pixels;
00487         for ( int y = 0; y < height; y ++ )
00488         {
00489             uint8_t *i = p + y * width * 3;
00490             uint8_t *o = p + ( y + 1 ) * width * 3 - 1;
00491             for ( int x = 0; x < width / 2; x ++ )
00492             {
00493                 r = *i;
00494                 g = *( i + 1 );
00495                 b = *( i + 2 );
00496                 *i ++ = *( o - 2 );
00497                 *i ++ = *( o - 1 );
00498                 *i ++ = *o;
00499                 *o -- = b;
00500                 *o -- = g;
00501                 *o -- = r;
00502             }
00503         }
00504     }

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

Definition at line 506 of file image_filters.cc.

Referenced by FilterFrame().

00507     {
00508         uint8_t * p = pixels;
00509         uint8_t keyFrame[ 720 * 3 ];
00510         for ( int y = 0; y < height / 2; y ++ )
00511         {
00512             uint8_t *i = p + y * width * 3;
00513             uint8_t *o = p + ( height - y - 1 ) * width * 3;
00514             memcpy( keyFrame, i, width * 3 );
00515             memcpy( i, o, width * 3 );
00516             memcpy( o, keyFrame, width * 3 );
00517         }
00518     }


Member Data Documentation

int ImageFilterSwap::type [private]
 

Definition at line 463 of file image_filters.cc.

Referenced by FilterFrame().

GtkWidget* ImageFilterSwap::window [private]
 

Definition at line 462 of file image_filters.cc.

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


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