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

ImageCreateColourRange Class Reference

Create a number of images that move from one colour to the next. More...

Inheritance diagram for ImageCreateColourRange:

Inheritance graph
[legend]
Collaboration diagram for ImageCreateColourRange:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ImageCreateColourRange ()
char * GetDescription () const
void CreateFrame (uint8_t *pixels, int width, int height, double position, double frame_delta)
void AttachWidgets (GtkBin *bin)
void DetachWidgets (GtkBin *bin)
void InterpretWidgets (GtkBin *bin)

Protected Attributes

GdkColor end
GtkWidget * start_picker
GtkWidget * end_picker

Detailed Description

Create a number of images that move from one colour to the next.

Definition at line 220 of file image_create.cc.


Constructor & Destructor Documentation

ImageCreateColourRange::ImageCreateColourRange  )  [inline]
 

Definition at line 228 of file image_create.cc.

References end.

00229     {
00230         end.red = end.green = end.blue = 0;
00231     }


Member Function Documentation

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

Reimplemented from ImageCreateColour.

Reimplemented in ImageCreateFromFile.

Definition at line 252 of file image_create.cc.

References ImageCreateColour::AddFrameCollector(), end, end_picker, Repaint(), ImageCreateColour::start, and start_picker.

00253     {
00254         GtkWidget * table = gtk_table_new( 2, 4, FALSE );
00255         gtk_table_set_row_spacings( GTK_TABLE( table ), 6 );
00256         gtk_table_set_col_spacings( GTK_TABLE( table ), 6 );
00257 
00258         GtkWidget *start_label = gtk_label_new( _( "From:" ) );
00259         gtk_widget_show( start_label );
00260 
00261         start_picker = gtk_color_button_new();
00262         gtk_color_button_set_color( GTK_COLOR_BUTTON( start_picker ), &start );
00263         gtk_widget_show( start_picker );
00264         g_signal_connect( G_OBJECT( start_picker ), "color-set", G_CALLBACK( Repaint ), 0 );
00265 
00266         GtkWidget *end_label = gtk_label_new( _( "To:" ) );
00267         gtk_widget_show( end_label );
00268 
00269         end_picker = gtk_color_button_new();
00270         gtk_color_button_set_color( GTK_COLOR_BUTTON( end_picker ), &end );
00271         gtk_widget_show( end_picker );
00272         g_signal_connect( G_OBJECT( end_picker ), "color-set", G_CALLBACK( Repaint ), 0 );
00273 
00274         AddFrameCollector( table, 0 );
00275 
00276         gtk_table_attach( GTK_TABLE( table ), start_label, 0, 1, 1, 2, ( GtkAttachOptions ) ( GTK_FILL ), ( GtkAttachOptions ) ( 0 ), 0, 0 );
00277         gtk_table_attach( GTK_TABLE( table ), start_picker, 1, 2, 1, 2, ( GtkAttachOptions ) ( 0 ), ( GtkAttachOptions ) ( 0 ), 0, 0 );
00278         gtk_table_attach( GTK_TABLE( table ), end_label, 2, 3, 1, 2, ( GtkAttachOptions ) ( GTK_FILL ), ( GtkAttachOptions ) ( 0 ), 0, 0 );
00279         gtk_table_attach( GTK_TABLE( table ), end_picker, 3, 4, 1, 2, ( GtkAttachOptions ) ( 0 ), ( GtkAttachOptions ) ( 0 ), 0, 0 );
00280 
00281         gtk_widget_show( table );
00282         gtk_container_add( GTK_CONTAINER( bin ), table );
00283     }

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

Reimplemented from ImageCreateColour.

Reimplemented in ImageCreateFromFile.

Definition at line 238 of file image_create.cc.

References end, and ImageCreateColour::start.

00239     {
00240         uint8_t r = start.red + guint16( ( end.red - start.red ) * position ) >> 8 ;
00241         uint8_t g = start.green + guint16( ( end.green - start.green ) * position ) >> 8;
00242         uint8_t b = start.blue + guint16( ( end.blue - start.blue ) * position ) >> 8;
00243         uint8_t *p = pixels;
00244         while ( p < ( pixels + width * height * 3 ) )
00245         {
00246             *p ++ = r;
00247             *p ++ = g;
00248             *p ++ = b;
00249         }
00250     }

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

Reimplemented from ImageCreateColour.

Reimplemented in ImageCreateFromFile.

Definition at line 285 of file image_create.cc.

References end, end_picker, ImageCreateColour::InterpretFrameCollector(), ImageCreateColour::start, and start_picker.

00286     {
00287         if ( bin->child != NULL )
00288         {
00289             InterpretFrameCollector( );
00290             gtk_color_button_get_color( GTK_COLOR_BUTTON( start_picker ), &start );
00291             gtk_color_button_get_color( GTK_COLOR_BUTTON( end_picker ), &end );
00292             gtk_container_remove( GTK_CONTAINER( bin ), bin->child );
00293         }
00294     }

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

Reimplemented from ImageCreateColour.

Reimplemented in ImageCreateFromFile.

Definition at line 233 of file image_create.cc.

00234     {
00235         return _( "Colour Range" );
00236     }

void ImageCreateColourRange::InterpretWidgets GtkBin *  bin  )  [inline, virtual]
 

Reimplemented from ImageCreateColour.

Reimplemented in ImageCreateFromFile.

Definition at line 296 of file image_create.cc.

References end, end_picker, ImageCreateColour::InterpretFrameCollector(), ImageCreateColour::start, and start_picker.

00297     {
00298         if ( bin->child != NULL )
00299         {
00300             InterpretFrameCollector( );
00301             gtk_color_button_get_color( GTK_COLOR_BUTTON( start_picker ), &start );
00302             gtk_color_button_get_color( GTK_COLOR_BUTTON( end_picker ), &end );
00303         }
00304     }


Member Data Documentation

GdkColor ImageCreateColourRange::end [protected]
 

Definition at line 223 of file image_create.cc.

Referenced by AttachWidgets(), CreateFrame(), DetachWidgets(), ImageCreateColourRange(), and InterpretWidgets().

GtkWidget* ImageCreateColourRange::end_picker [protected]
 

Definition at line 225 of file image_create.cc.

Referenced by AttachWidgets(), DetachWidgets(), and InterpretWidgets().

GtkWidget* ImageCreateColourRange::start_picker [protected]
 

Definition at line 224 of file image_create.cc.

Referenced by AttachWidgets(), DetachWidgets(), and InterpretWidgets().


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