Example #1
0
static void
gimp_histogram_box_channel_notify (GimpHistogramView *view,
                                   GParamSpec        *pspec,
                                   GimpColorBar      *bar)
{
  gimp_color_bar_set_channel (bar, view->channel);
}
Example #2
0
static void
gimp_color_bar_set_property (GObject      *object,
                             guint         property_id,
                             const GValue *value,
                             GParamSpec   *pspec)
{
  GimpColorBar *bar = GIMP_COLOR_BAR (object);

  switch (property_id)
    {
    case PROP_ORIENTATION:
      bar->orientation = g_value_get_enum (value);
      break;
    case PROP_COLOR:
      gimp_color_bar_set_color (bar, g_value_get_boxed (value));
      break;
    case PROP_CHANNEL:
      gimp_color_bar_set_channel (bar, g_value_get_enum (value));
      break;

    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
      break;
    }
}
Example #3
0
static void
levels_update (GimpLevelsTool *tool,
               guint           update)
{
  GimpHistogramChannel channel;

  if (tool->color)
    {
      channel = tool->channel;
    }
  else
    {
      /* FIXME: hack */
      if (tool->channel == 1)
        channel = GIMP_HISTOGRAM_ALPHA;
      else
        channel = GIMP_HISTOGRAM_VALUE;
    }

  /*  Recalculate the transfer arrays  */
  levels_calculate_transfers (tool->levels);

  /* set up the lut */
  if (GIMP_IMAGE_MAP_TOOL (tool)->drawable)
    gimp_lut_setup (tool->lut,
                    (GimpLutFunc) levels_lut_func,
                    tool->levels,
                    gimp_drawable_bytes (GIMP_IMAGE_MAP_TOOL (tool)->drawable));

  if (update & LOW_INPUT)
    gtk_adjustment_set_value (tool->low_input,
                              tool->levels->low_input[tool->channel]);

  if (update & GAMMA)
    gtk_adjustment_set_value (tool->gamma,
                              tool->levels->gamma[tool->channel]);

  if (update & HIGH_INPUT)
    gtk_adjustment_set_value (tool->high_input,
                              tool->levels->high_input[tool->channel]);

  if (update & LOW_OUTPUT)
    gtk_adjustment_set_value (tool->low_output,
                              tool->levels->low_output[tool->channel]);

  if (update & HIGH_OUTPUT)
    gtk_adjustment_set_value (tool->high_output,
                              tool->levels->high_output[tool->channel]);

  if (update & INPUT_LEVELS)
    {
      switch (channel)
        {
        case GIMP_HISTOGRAM_VALUE:
        case GIMP_HISTOGRAM_ALPHA:
        case GIMP_HISTOGRAM_RGB:
          gimp_color_bar_set_buffers (GIMP_COLOR_BAR (tool->input_bar),
                                      tool->levels->input[tool->channel],
                                      tool->levels->input[tool->channel],
                                      tool->levels->input[tool->channel]);
          break;

        case GIMP_HISTOGRAM_RED:
        case GIMP_HISTOGRAM_GREEN:
        case GIMP_HISTOGRAM_BLUE:
          gimp_color_bar_set_buffers (GIMP_COLOR_BAR (tool->input_bar),
                                      tool->levels->input[GIMP_HISTOGRAM_RED],
                                      tool->levels->input[GIMP_HISTOGRAM_GREEN],
                                      tool->levels->input[GIMP_HISTOGRAM_BLUE]);
          break;
        }
    }

  if (update & OUTPUT_LEVELS)
    {
      gimp_color_bar_set_channel (GIMP_COLOR_BAR (tool->output_bar), channel);
    }

  if (update & INPUT_SLIDERS)
    {
      gtk_widget_queue_draw (tool->input_area);
    }

  if (update & OUTPUT_SLIDERS)
    {
      gtk_widget_queue_draw (tool->output_area);
    }
}