Image Loading



I am retrieving jpg's from file and displaying them on any one of four
monitors on the computer.  I run the program 4 times (one time for each
monitor, modified to output its results to the appropriate monitor). 
The problem is it is very processor intesive, running about 100% for all
4 programs running at the same time.  I had initially read from disk to
load each image into the window, to update say a radar loop.  I want to
load the images to memory and just cycle through them but am running
into problems with what path to take to do this.  What functions, or
method should I use to do this so its as efficient as possible?  Here is
the part of the function that does the loading of image and update to
window.

/*-----------------------------------------------------------------------------------------*/  
//cb_timeout Function 

static gint cb_timeout(gpointer screen)
{
  struct window_data *display = (struct window_data *) screen;
  
  //For Development progress/error detection
  //g_print("In Timeout %d\n", display->counter);

  if (display->counter != 11)
    display->counter++;
  
  else if (display->counter == 11)
    display->counter = 0;
  
  //Destroy current Image Widget and Re-assign it
  gtk_widget_destroy(display->image);
  display->image =
gtk_image_new_from_file(display->image_name[display->counter]->str);

  //Re-Pack Box with Image and Refresh the image in the window
  gtk_box_pack_start(GTK_BOX(display->box), display->image, FALSE,
FALSE, 0);
  gtk_widget_realize(display->image);
  gtk_widget_show(display->image);
  gtk_window_move(GTK_WINDOW(display->window), 0, 0);
  gtk_window_fullscreen(GTK_WINDOW(display->window));
 
  return TRUE;
}
/*-----------------------------------------------------------------------------------------*/  

Thanks,
Matt





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]