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

ImageFilterKaleidoscope Class Reference

Kaleidoscope the image. More...

Inheritance diagram for ImageFilterKaleidoscope:

Inheritance graph
[legend]
Collaboration diagram for ImageFilterKaleidoscope:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ImageFilterKaleidoscope ()
virtual ~ImageFilterKaleidoscope ()
char * GetDescription () const
void TopLeft (uint8_t *pixels, int width, int height, double position)
void TopRight (uint8_t *pixels, int width, int height, double position)
void BottomLeft (uint8_t *pixels, int width, int height, double position)
void BottomRight (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

Kaleidoscope the image.

Definition at line 266 of file image_filters.cc.


Constructor & Destructor Documentation

ImageFilterKaleidoscope::ImageFilterKaleidoscope  )  [inline]
 

Definition at line 273 of file image_filters.cc.

References magick_glade, Repaint(), and window.

00274     {
00275         window = glade_xml_get_widget( magick_glade, "image_filter_kaleidoscope" );
00276         GtkWidget* widget = glade_xml_get_widget( magick_glade, "optionmenu_kaleidoscope" );
00277         g_signal_connect( G_OBJECT( widget ), "changed", G_CALLBACK( Repaint ), 0 );
00278     }

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

Definition at line 280 of file image_filters.cc.

References window.

00281     {
00282         gtk_widget_destroy( window );
00283     }


Member Function Documentation

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

Reimplemented from GDKImageFilter.

Definition at line 418 of file image_filters.cc.

References window.

00419     {
00420         gtk_widget_reparent( ( GTK_BIN( window ) ) ->child, GTK_WIDGET( bin ) );
00421     }

void ImageFilterKaleidoscope::BottomLeft uint8_t *  pixels,
int  width,
int  height,
double  position
[inline]
 

Definition at line 346 of file image_filters.cc.

Referenced by FilterFrame().

00347     {
00348         uint8_t r, g, b;
00349         uint8_t *p = pixels;
00350         for ( int y = 0; y <= height / 2; y ++ )
00351         {
00352             uint8_t *o1 = p + y * width * 3;
00353             uint8_t *o2 = p + ( y + 1 ) * width * 3 - 1;
00354             uint8_t *i = p + ( height - y ) * width * 3;
00355             uint8_t *o = p + ( height - y + 1 ) * width * 3 - 1;
00356             while ( o > i )
00357             {
00358                 r = *i ++;
00359                 g = *i ++;
00360                 b = *i ++;
00361                 *o -- = b;
00362                 *o -- = g;
00363                 *o -- = r;
00364                 *o1 ++ = r;
00365                 *o1 ++ = g;
00366                 *o1 ++ = b;
00367                 *o2 -- = b;
00368                 *o2 -- = g;
00369                 *o2 -- = r;
00370             }
00371         }
00372     }

void ImageFilterKaleidoscope::BottomRight uint8_t *  pixels,
int  width,
int  height,
double  position
[inline]
 

Definition at line 374 of file image_filters.cc.

Referenced by FilterFrame().

00375     {
00376         uint8_t r, g, b;
00377         uint8_t *p = pixels;
00378         for ( int y = 0; y <= height / 2; y ++ )
00379         {
00380             uint8_t *o2 = p + ( y + 1 ) * width * 3 - 1;
00381             uint8_t *o1 = p + y * width * 3;
00382             uint8_t *o = p + ( height - y ) * width * 3;
00383             uint8_t *i = p + ( height - y + 1 ) * width * 3 - 1;
00384             while ( i > o )
00385             {
00386                 b = *i --;
00387                 g = *i --;
00388                 r = *i --;
00389                 *o ++ = r;
00390                 *o ++ = g;
00391                 *o ++ = b;
00392                 *o1 ++ = r;
00393                 *o1 ++ = g;
00394                 *o1 ++ = b;
00395                 *o2 -- = b;
00396                 *o2 -- = g;
00397                 *o2 -- = r;
00398             }
00399         }
00400     }

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

Reimplemented from GDKImageFilter.

Definition at line 423 of file image_filters.cc.

References window.

00424     {
00425         gtk_widget_reparent( ( GTK_BIN( bin ) ) ->child, GTK_WIDGET( window ) );
00426     }

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

Implements ImageFilter.

Definition at line 402 of file image_filters.cc.

References BottomLeft(), BottomRight(), lookup_widget(), TopLeft(), TopRight(), type, and window.

00403     {
00404         GtkMenu * menu = GTK_MENU( gtk_option_menu_get_menu( GTK_OPTION_MENU( lookup_widget( window, "optionmenu_kaleidoscope" ) ) ) );
00405         GtkWidget *active_item = gtk_menu_get_active( menu );
00406         type = g_list_index ( GTK_MENU_SHELL ( menu ) ->children, active_item );
00407         
00408         if ( type == 0 )
00409             TopLeft( pixels, width, height, position );
00410         else if ( type == 1 )
00411             TopRight( pixels, width, height, position );
00412         else if ( type == 2 )
00413             BottomLeft( pixels, width, height, position );
00414         else if ( type == 3 )
00415             BottomRight( pixels, width, height, position );
00416     }

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

Implements ImageFilter.

Definition at line 285 of file image_filters.cc.

00286     {
00287         return _( "Kaleidoscope" );
00288     }

void ImageFilterKaleidoscope::TopLeft uint8_t *  pixels,
int  width,
int  height,
double  position
[inline]
 

Definition at line 290 of file image_filters.cc.

Referenced by FilterFrame().

00291     {
00292         uint8_t r, g, b;
00293         uint8_t *p = pixels;
00294         for ( int y = 0; y <= height / 2; y ++ )
00295         {
00296             uint8_t *i = p + y * width * 3;
00297             uint8_t *o = p + ( y + 1 ) * width * 3 - 1;
00298             uint8_t *o1 = p + ( height - y ) * width * 3;
00299             uint8_t *o2 = p + ( height - y + 1 ) * width * 3 - 1;
00300             while ( o > i )
00301             {
00302                 r = *i ++;
00303                 g = *i ++;
00304                 b = *i ++;
00305                 *o -- = b;
00306                 *o -- = g;
00307                 *o -- = r;
00308                 *o1 ++ = r;
00309                 *o1 ++ = g;
00310                 *o1 ++ = b;
00311                 *o2 -- = b;
00312                 *o2 -- = g;
00313                 *o2 -- = r;
00314             }
00315         }
00316     }

void ImageFilterKaleidoscope::TopRight uint8_t *  pixels,
int  width,
int  height,
double  position
[inline]
 

Definition at line 318 of file image_filters.cc.

Referenced by FilterFrame().

00319     {
00320         uint8_t r, g, b;
00321         uint8_t *p = pixels;
00322         for ( int y = 0; y <= height / 2; y ++ )
00323         {
00324             uint8_t *i = p + ( y + 1 ) * width * 3 - 1;
00325             uint8_t *o = p + y * width * 3;
00326             uint8_t *o1 = p + ( height - y ) * width * 3;
00327             uint8_t *o2 = p + ( height - y + 1 ) * width * 3 - 1;
00328             while ( i > o )
00329             {
00330                 b = *i --;
00331                 g = *i --;
00332                 r = *i --;
00333                 *o ++ = r;
00334                 *o ++ = g;
00335                 *o ++ = b;
00336                 *o1 ++ = r;
00337                 *o1 ++ = g;
00338                 *o1 ++ = b;
00339                 *o2 -- = b;
00340                 *o2 -- = g;
00341                 *o2 -- = r;
00342             }
00343         }
00344     }


Member Data Documentation

int ImageFilterKaleidoscope::type [private]
 

Definition at line 270 of file image_filters.cc.

Referenced by FilterFrame().

GtkWidget* ImageFilterKaleidoscope::window [private]
 

Definition at line 269 of file image_filters.cc.

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


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