Logo Search packages:      
Sourcecode: ygraph version File versions  Download package

GdkGC* line_set_gc ( Plot plot,
PlotLine plot_data,
gint  frame_nbr,
gint  nframes 
)

Set the line colour for SHOW_ALL display mode.

Set the colour of a line depending on it's frame_nbr. Lines corresponding to a single data set are assigned a 'start colour' (the colour of the first frame) and an 'end colour' (the colour of the last frame) and the frames have a colour on the line in RGB-space between the two.

Parameters:
plot The Plot for which the colour is being set.
plot_data The particular data set which is being coloured.
frame_nbr The frame to be coloured.
nframes The total number of frames in the data set.
Returns:
A graphics context specifying an appropriate line colour.

Definition at line 70 of file color.c.

References color_set_rgb(), _Plot::colormap, _PlotLine::end_color, _Plot::plot_area, and _PlotLine::start_color.

Referenced by plot_window_draw_all().

{
  GdkGC* gc;
  GdkColor* start_color;
  GdkColor* end_color;
  GdkColor* color;
  gdouble s;
  gulong red;
  gulong green;
  gulong blue;

  gc = gdk_gc_new(plot->plot_area->window);

  start_color = plot_data->start_color;
  end_color = plot_data->end_color;

  s = (gdouble) frame_nbr / nframes;

  red = start_color->red + s*(end_color->red - start_color->red);
  green = start_color->green + s*(end_color->green - start_color->green);
  blue = start_color->blue + s*(end_color->blue - start_color->blue);

  color = color_set_rgb(plot->colormap, red, green, blue);

  gdk_gc_set_foreground(gc, color);
  g_free(color);

  return gc;
}


Generated by  Doxygen 1.6.0   Back to index