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

ImageTransitionDifferences Class Reference

Inheritance diagram for ImageTransitionDifferences:

Inheritance graph
[legend]
Collaboration diagram for ImageTransitionDifferences:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ImageTransitionDifferences ()
virtual ~ImageTransitionDifferences ()
char * GetDescription () const
void GetFrame (uint8_t *io, uint8_t *mesh, int width, int height, double position, double frame_delta, bool reverse)
void AttachWidgets (GtkBin *bin)
void DetachWidgets (GtkBin *bin)

Private Attributes

GtkWidget * window
int type
int sensitivity
GdkColor color

Constructor & Destructor Documentation

ImageTransitionDifferences::ImageTransitionDifferences  )  [inline]
 

Definition at line 265 of file image_transitions.cc.

References lookup_widget(), magick_glade, Repaint(), and window.

00266     {
00267         window = glade_xml_get_widget( magick_glade, "image_transition_differences" );
00268         GtkWidget* widget = lookup_widget( window, "optionmenu_action" );
00269         g_signal_connect( G_OBJECT( widget ), "changed", G_CALLBACK( Repaint ), 0 );
00270         widget = lookup_widget( window, "colorpicker" );
00271         g_signal_connect( G_OBJECT( widget ), "color-set", G_CALLBACK( Repaint ), 0 );
00272         widget = lookup_widget( window, "hscale_sensitivity" );
00273         g_signal_connect( G_OBJECT( widget ), "value-changed", G_CALLBACK( Repaint ), 0 );
00274     }

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

Definition at line 276 of file image_transitions.cc.

References window.

00277     {
00278         gtk_widget_destroy( window );
00279     }


Member Function Documentation

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

Reimplemented from GDKImageTransition.

Definition at line 333 of file image_transitions.cc.

References window.

00334     {
00335         gtk_widget_reparent( ( GTK_BIN( window ) ) ->child, GTK_WIDGET( bin ) );
00336     }

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

Reimplemented from GDKImageTransition.

Definition at line 338 of file image_transitions.cc.

References window.

00339     {
00340         gtk_widget_reparent( ( GTK_BIN( bin ) ) ->child, GTK_WIDGET( window ) );
00341     }

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

Implements ImageTransition.

Definition at line 281 of file image_transitions.cc.

00282     {
00283         return _( "Differences" );
00284     }

void ImageTransitionDifferences::GetFrame uint8_t *  io,
uint8_t *  mesh,
int  width,
int  height,
double  position,
double  frame_delta,
bool  reverse
[inline, virtual]
 

Implements ImageTransition.

Definition at line 286 of file image_transitions.cc.

References color, DIFFERS_BY, lookup_widget(), sensitivity, type, and window.

00287     {
00288         GtkMenu *menu = GTK_MENU( gtk_option_menu_get_menu( GTK_OPTION_MENU( lookup_widget( window, "optionmenu_action" ) ) ) );
00289         GtkWidget *active_item = gtk_menu_get_active( menu );
00290         type = g_list_index ( GTK_MENU_SHELL ( menu ) ->children, active_item );
00291 
00292         GtkColorButton *colorButton = GTK_COLOR_BUTTON( lookup_widget( window, "colorpicker" ) );
00293         gtk_color_button_get_color( colorButton, &color );
00294 
00295         GtkRange *range = GTK_RANGE( lookup_widget( window, "hscale_sensitivity" ) );
00296         GtkAdjustment *adjust = gtk_range_get_adjustment( range );
00297         sensitivity = ( int ) adjust->value;
00298         
00299         // Differences only
00300         uint8_t * k = mesh;
00301         uint8_t *p = io;
00302         uint8_t r, g, b;
00303         uint8_t kr, kg, kb;
00304         for ( int y = 0; y < height; y ++ )
00305         {
00306             for ( int x = 0; x < width; x ++ )
00307             {
00308                 r = *p;
00309                 g = *( p + 1 );
00310                 b = *( p + 2 );
00311                 kr = *k ++;
00312                 kg = *k ++;
00313                 kb = *k ++;
00314 
00315                 bool differs = DIFFERS_BY( kr, r, sensitivity ) && DIFFERS_BY( kg, g, sensitivity ) && DIFFERS_BY( kb, b, sensitivity );
00316 
00317                 if ( ( !differs && type == 0 ) || ( differs && type == 1 ) )
00318                 {
00319                     *p ++ = color.red >> 8;
00320                     *p ++ = color.green >> 8;
00321                     *p ++ = color.blue >> 8;
00322                 }
00323                 else
00324                 {
00325                     *p ++ = r;
00326                     *p ++ = g;
00327                     *p ++ = b;
00328                 }
00329             }
00330         }
00331     }


Member Data Documentation

GdkColor ImageTransitionDifferences::color [private]
 

Definition at line 262 of file image_transitions.cc.

Referenced by GetFrame().

int ImageTransitionDifferences::sensitivity [private]
 

Definition at line 261 of file image_transitions.cc.

Referenced by GetFrame().

int ImageTransitionDifferences::type [private]
 

Definition at line 260 of file image_transitions.cc.

Referenced by GetFrame().

GtkWidget* ImageTransitionDifferences::window [private]
 

Definition at line 259 of file image_transitions.cc.

Referenced by AttachWidgets(), DetachWidgets(), GetFrame(), ImageTransitionDifferences(), and ~ImageTransitionDifferences().


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