Beispiel #1
0
void
gimp_applicator_set_output_format (GimpApplicator *applicator,
                                   const Babl     *format)
{
  g_return_if_fail (GIMP_IS_APPLICATOR (applicator));

  if (applicator->output_format != format)
    {
      if (format)
        {
          if (! applicator->output_format)
            {
              gegl_node_set (applicator->convert_format_node,
                             "operation", "gegl:convert-format",
                             "format",    format,
                             NULL);
            }
          else
            {
              gegl_node_set (applicator->convert_format_node,
                             "format", format,
                             NULL);
            }
        }
      else
        {
          gegl_node_set (applicator->convert_format_node,
                         "operation", "gegl:nop",
                         NULL);
        }

      applicator->output_format = format;
    }
}
Beispiel #2
0
void
gimp_applicator_apply (GimpApplicator       *applicator,
                       GeglBuffer           *src_buffer,
                       GeglBuffer           *apply_buffer,
                       gint                  apply_buffer_x,
                       gint                  apply_buffer_y,
                       gdouble               opacity,
                       GimpLayerModeEffects  paint_mode)
{
    gint width  = gegl_buffer_get_width  (apply_buffer);
    gint height = gegl_buffer_get_height (apply_buffer);

    if (applicator->src_buffer != src_buffer)
    {
        applicator->src_buffer = src_buffer;

        gegl_node_set (applicator->src_node,
                       "buffer", src_buffer,
                       NULL);
    }

    if (applicator->apply_buffer != apply_buffer)
    {
        applicator->apply_buffer = apply_buffer;

        gegl_node_set (applicator->apply_src_node,
                       "buffer", apply_buffer,
                       NULL);
    }


    gegl_node_set (applicator->apply_offset_node,
                   "x", (gdouble) apply_buffer_x,
                   "y", (gdouble) apply_buffer_y,
                   NULL);

    if ((applicator->opacity    != opacity) ||
            (applicator->paint_mode != paint_mode))
    {
        applicator->opacity    = opacity;
        applicator->paint_mode = paint_mode;

        gimp_gegl_mode_node_set (applicator->mode_node,
                                 paint_mode, opacity, FALSE);
    }

    gegl_processor_set_rectangle (applicator->processor,
                                  GEGL_RECTANGLE (apply_buffer_x,
                                          apply_buffer_y,
                                          width, height));

    while (gegl_processor_work (applicator->processor, NULL));
}
Beispiel #3
0
void
gimp_applicator_set_crop (GimpApplicator      *applicator,
                          const GeglRectangle *rect)
{
  g_return_if_fail (GIMP_IS_APPLICATOR (applicator));

  if (applicator->crop_enabled != (rect != NULL) ||
      (rect && ! gegl_rectangle_equal (&applicator->crop_rect, rect)))
    {
      if (rect)
        {
          if (! applicator->crop_enabled)
            {
              gegl_node_set (applicator->crop_node,
                             "operation", "gimp:compose-crop",
                             "x",         rect->x,
                             "y",         rect->y,
                             "width",     rect->width,
                             "height",    rect->height,
                             NULL);

              gegl_node_connect_to (applicator->input_node, "output",
                                    applicator->crop_node,  "aux");
            }
          else
            {
              gegl_node_set (applicator->crop_node,
                             "x",      rect->x,
                             "y",      rect->y,
                             "width",  rect->width,
                             "height", rect->height,
                             NULL);
            }

          applicator->crop_enabled = TRUE;
          applicator->crop_rect    = *rect;
        }
      else
        {
          gegl_node_disconnect (applicator->crop_node, "aux");
          gegl_node_set (applicator->crop_node,
                         "operation", "gegl:nop",
                         NULL);

          applicator->crop_enabled = FALSE;
        }
    }
}
Beispiel #4
0
static void
gimp_blend_tool_update_graph (GimpBlendTool *blend_tool)
{
  GimpTool *tool = GIMP_TOOL (blend_tool);
  gint      off_x, off_y;

  gimp_item_get_offset (GIMP_ITEM (tool->drawable), &off_x, &off_y);

#if 0
  if (gimp_blend_tool_is_shapeburst (blend_tool))
    {
      gfloat start, end;

      gegl_buffer_get (blend_tool->dist_buffer,
                       GEGL_RECTANGLE (blend_tool->start_x - off_x,
                                       blend_tool->start_y - off_y,
                                       1, 1),
                       1.0, babl_format("Y float"), &start,
                       GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE);

      gegl_buffer_get (blend_tool->dist_buffer,
                       GEGL_RECTANGLE (blend_tool->end_x - off_x,
                                       blend_tool->end_y - off_y,
                                       1, 1),
                       1.0, babl_format("Y float"), &end,
                       GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE);

      if (start != end)
        {
          gegl_node_set (blend_tool->subtract_node,
                         "value", (gdouble) start,
                         NULL);
          gegl_node_set (blend_tool->divide_node,
                         "value", (gdouble) (end - start),
                         NULL);
        }
    }
  else
#endif
    {
      gegl_node_set (blend_tool->render_node,
                     "start_x", blend_tool->start_x - off_x,
                     "start_y", blend_tool->start_y - off_y,
                     "end_x",   blend_tool->end_x - off_x,
                     "end_y",   blend_tool->end_y - off_y,
                     NULL);
    }
}
Beispiel #5
0
static GeglNode *
gimp_desaturate_tool_get_operation (GimpImageMapTool  *image_map_tool,
                                    GObject          **config)
{
  GimpDesaturateTool *desaturate_tool = GIMP_DESATURATE_TOOL (image_map_tool);
  GeglNode           *node;

  node = g_object_new (GEGL_TYPE_NODE,
                       "operation", "gimp-desaturate",
                       NULL);

  desaturate_tool->config = g_object_new (GIMP_TYPE_DESATURATE_CONFIG, NULL);

  *config = G_OBJECT (desaturate_tool->config);

  g_signal_connect_object (desaturate_tool->config, "notify",
                           G_CALLBACK (gimp_desaturate_tool_config_notify),
                           G_OBJECT (desaturate_tool), 0);

  gegl_node_set (node,
                 "config", desaturate_tool->config,
                 NULL);

  return node;
}
static GeglNode *
gimp_brightness_contrast_tool_get_operation (GimpImageMapTool  *im_tool,
                                             GObject          **config)
{
  GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (im_tool);
  GeglNode                   *node;

  node = g_object_new (GEGL_TYPE_NODE,
                       "operation", "gimp:brightness-contrast",
                       NULL);

  bc_tool->config = g_object_new (GIMP_TYPE_BRIGHTNESS_CONTRAST_CONFIG, NULL);

  *config = G_OBJECT (bc_tool->config);

  g_signal_connect_object (bc_tool->config, "notify",
                           G_CALLBACK (brightness_contrast_config_notify),
                           G_OBJECT (bc_tool), 0);

  gegl_node_set (node,
                 "config", bc_tool->config,
                 NULL);

  return node;
}
Beispiel #7
0
static void
prepare (GeglOperation *operation)
{
  GeglProperties *o = GEGL_PROPERTIES (operation);
  GeglNode *gegl, *input, *output;
  GError *error = NULL;

  gegl = operation->node;

  if (!o->user_data || !g_str_equal (o->user_data, o->string))
  {
    g_free (o->user_data);
    o->user_data = g_strdup (o->string);

  input  = gegl_node_get_input_proxy (gegl,  "input");
  output = gegl_node_get_output_proxy (gegl, "output");

  gegl_node_link_many (input, output, NULL);
  {
     gchar cwd[81920]; // XXX: should do better
     getcwd (cwd, sizeof(cwd));
  gegl_create_chain (o->string, input, output, 0.0,
                     gegl_node_get_bounding_box (input).height, cwd,
                     &error);
  }

  if (error)
  {
    gegl_node_set (gegl, "error", error->message, NULL);
    g_clear_error (&error);
  }
  else
    g_object_set (operation, "error", "", NULL);
  }
}
static GeglNode *
gimp_color_balance_tool_get_operation (GimpImageMapTool  *im_tool,
                                       GObject          **config)
{
  GimpColorBalanceTool *cb_tool = GIMP_COLOR_BALANCE_TOOL (im_tool);
  GeglNode             *node;

  node = g_object_new (GEGL_TYPE_NODE,
                       "operation", "gimp:color-balance",
                       NULL);

  cb_tool->config = g_object_new (GIMP_TYPE_COLOR_BALANCE_CONFIG, NULL);

  *config = G_OBJECT (cb_tool->config);

  g_signal_connect_object (cb_tool->config, "notify",
                           G_CALLBACK (color_balance_config_notify),
                           G_OBJECT (cb_tool), 0);

  gegl_node_set (node,
                 "config", cb_tool->config,
                 NULL);

  return node;
}
Beispiel #9
0
static GeglNode *
gimp_posterize_tool_get_operation (GimpImageMapTool  *image_map_tool,
                                   GObject          **config)
{
  GimpPosterizeTool *posterize_tool = GIMP_POSTERIZE_TOOL (image_map_tool);
  GeglNode          *node;

  node = g_object_new (GEGL_TYPE_NODE,
                       "operation", "gimp:posterize",
                       NULL);

  posterize_tool->config = g_object_new (GIMP_TYPE_POSTERIZE_CONFIG, NULL);

  *config = G_OBJECT (posterize_tool->config);

  g_signal_connect_object (posterize_tool->config, "notify",
                           G_CALLBACK (gimp_posterize_tool_config_notify),
                           G_OBJECT (posterize_tool), 0);

  gegl_node_set (node,
                 "config", posterize_tool->config,
                 NULL);

  return node;
}
void select_color (GtkButton *widget, gpointer user_data)
{
  GtkColorSelectionDialog* dialog = GTK_COLOR_SELECTION_DIALOG(gtk_color_selection_dialog_new("Select Color")); //todo put the old color selection in

  gint result = gtk_dialog_run(GTK_DIALOG(dialog));

  //

  if(result == GTK_RESPONSE_OK)
    {

      select_color_info* info = (select_color_info*)user_data;
      GtkColorSelection* colsel = GTK_COLOR_SELECTION(dialog->colorsel);

      GdkColor* sel_color = malloc(sizeof(GdkColor));
      gtk_color_selection_get_current_color(colsel, sel_color);

      GeglColor* color = gegl_color_new(NULL);
      gegl_color_set_rgba(color, (double)sel_color->red/65535.0,
			  (double)sel_color->green/65535.0,
			  (double)sel_color->blue/65535.0,
			  (double)gtk_color_selection_get_current_alpha(colsel)/65535.0);

      free(sel_color);

      gegl_node_set(info->node, info->property, color, NULL);

      refresh_images(info->layer);
    }
  gtk_widget_destroy(GTK_WIDGET(dialog));
}
static GeglNode *
gimp_hue_saturation_tool_get_operation (GimpImageMapTool  *im_tool,
                                        GObject          **config)
{
  GimpHueSaturationTool *hs_tool = GIMP_HUE_SATURATION_TOOL (im_tool);
  GeglNode              *node;

  node = g_object_new (GEGL_TYPE_NODE,
                       "operation", "gimp:hue-saturation",
                       NULL);

  hs_tool->config = g_object_new (GIMP_TYPE_HUE_SATURATION_CONFIG, NULL);

  *config = G_OBJECT (hs_tool->config);

  g_signal_connect_object (hs_tool->config, "notify",
                           G_CALLBACK (hue_saturation_config_notify),
                           G_OBJECT (hs_tool), 0);

  gegl_node_set (node,
                 "config", hs_tool->config,
                 NULL);

  return node;
}
void
gimp_gegl_mode_node_set_mode (GeglNode             *node,
                              GimpLayerModeEffects  mode,
                              gboolean              linear)
{
  const gchar *operation = "gimp:normal-mode";
  gdouble      opacity;

  g_return_if_fail (GEGL_IS_NODE (node));

  switch (mode)
    {
    case GIMP_NORMAL_MODE:        operation = "gimp:normal-mode"; break;
    case GIMP_DISSOLVE_MODE:      operation = "gimp:dissolve-mode"; break;
    case GIMP_BEHIND_MODE:        operation = "gimp:behind-mode"; break;
    case GIMP_MULTIPLY_MODE:      operation = "gimp:multiply-mode"; break;
    case GIMP_SCREEN_MODE:        operation = "gimp:screen-mode"; break;
    case GIMP_OVERLAY_MODE:       operation = "gimp:softlight-mode"; break;
    case GIMP_DIFFERENCE_MODE:    operation = "gimp:difference-mode"; break;
    case GIMP_ADDITION_MODE:      operation = "gimp:addition-mode"; break;
    case GIMP_SUBTRACT_MODE:      operation = "gimp:subtract-mode"; break;
    case GIMP_DARKEN_ONLY_MODE:   operation = "gimp:darken-only-mode"; break;
    case GIMP_LIGHTEN_ONLY_MODE:  operation = "gimp:lighten-only-mode"; break;
    case GIMP_HUE_MODE:           operation = "gimp:hue-mode"; break;
    case GIMP_SATURATION_MODE:    operation = "gimp:saturation-mode"; break;
    case GIMP_COLOR_MODE:         operation = "gimp:color-mode"; break;
    case GIMP_VALUE_MODE:         operation = "gimp:value-mode"; break;
    case GIMP_DIVIDE_MODE:        operation = "gimp:divide-mode"; break;
    case GIMP_DODGE_MODE:         operation = "gimp:dodge-mode"; break;
    case GIMP_BURN_MODE:          operation = "gimp:burn-mode"; break;
    case GIMP_HARDLIGHT_MODE:     operation = "gimp:hardlight-mode"; break;
    case GIMP_SOFTLIGHT_MODE:     operation = "gimp:softlight-mode"; break;
    case GIMP_GRAIN_EXTRACT_MODE: operation = "gimp:grain-extract-mode"; break;
    case GIMP_GRAIN_MERGE_MODE:   operation = "gimp:grain-merge-mode"; break;
    case GIMP_COLOR_ERASE_MODE:   operation = "gimp:color-erase-mode"; break;
    case GIMP_NEW_OVERLAY_MODE:   operation = "gimp:overlay-mode"; break;
    case GIMP_ERASE_MODE:         operation = "gimp:erase-mode"; break;
    case GIMP_REPLACE_MODE:       operation = "gimp:replace-mode"; break;
    case GIMP_ANTI_ERASE_MODE:    operation = "gimp:anti-erase-mode"; break;
    case GIMP_LCH_HUE_MODE:       operation = "gimp:lch-hue-mode"; break;
    case GIMP_LCH_CHROMA_MODE:    operation = "gimp:lch-chroma-mode"; break;
    case GIMP_LCH_COLOR_MODE:     operation = "gimp:lch-color-mode"; break;
    case GIMP_LCH_LIGHTNESS_MODE: operation = "gimp:lch-lightness-mode"; break;
    default:
      break;
    }

  gegl_node_get (node,
                 "opacity", &opacity,
                 NULL);

  /* setting the operation creates a new instance, so we have to set
   * all its properties
   */
  gegl_node_set (node,
                 "operation", operation,
                 "linear",    linear,
                 "opacity",   opacity,
                 NULL);
}
Beispiel #13
0
static void
gimp_blend_tool_create_graph (GimpBlendTool *blend_tool)
{
  GimpBlendOptions *options = GIMP_BLEND_TOOL_GET_OPTIONS (blend_tool);
  GimpContext      *context = GIMP_CONTEXT (options);
  GeglNode *graph, *output, *render;

  /* render_node is not supposed to be recreated */
  g_return_if_fail (blend_tool->graph == NULL);

  graph = gegl_node_new ();

  output = gegl_node_get_output_proxy (graph, "output");


  render = gegl_node_new_child (graph,
                                "operation", "gimp:blend",
                                NULL);

  gegl_node_link (render, output);

  blend_tool->graph       = graph;
  blend_tool->render_node = render;

  gegl_node_set (render,
                 "context", context,
                 NULL);
}
Beispiel #14
0
static GeglNode *
gimp_levels_tool_get_operation (GimpImageMapTool  *im_tool,
                                GObject          **config)
{
  GimpLevelsTool *tool = GIMP_LEVELS_TOOL (im_tool);
  GeglNode       *node;

  node = g_object_new (GEGL_TYPE_NODE,
                       "operation", "gimp:levels",
                       NULL);

  tool->config = g_object_new (GIMP_TYPE_LEVELS_CONFIG, NULL);

  *config = G_OBJECT (tool->config);

  g_signal_connect_object (tool->config, "notify",
                           G_CALLBACK (gimp_levels_tool_config_notify),
                           G_OBJECT (tool), 0);

  gegl_node_set (node,
                 "config", tool->config,
                 NULL);

  return node;
}
Beispiel #15
0
void
gimp_applicator_set_mask_buffer (GimpApplicator *applicator,
                                 GeglBuffer     *mask_buffer)
{
  g_return_if_fail (GIMP_IS_APPLICATOR (applicator));
  g_return_if_fail (mask_buffer == NULL || GEGL_IS_BUFFER (mask_buffer));

  if (applicator->mask_buffer == mask_buffer)
    return;

  gegl_node_set (applicator->mask_node,
                 "buffer", mask_buffer,
                 NULL);

  if (mask_buffer)
    {
      gegl_node_connect_to (applicator->mask_offset_node, "output",
                            applicator->mode_node,        "aux2");
    }
  else
    {
      gegl_node_disconnect (applicator->mode_node, "aux2");
    }

  applicator->mask_buffer = mask_buffer;
}
Beispiel #16
0
GeglBuffer *
gimp_applicator_dup_apply_buffer (GimpApplicator      *applicator,
                                  const GeglRectangle *rect)
{
  GeglBuffer *buffer;
  GeglBuffer *shifted;

  g_return_val_if_fail (GIMP_IS_APPLICATOR (applicator), NULL);
  g_return_val_if_fail (rect != NULL, NULL);

  buffer = gegl_buffer_new (GEGL_RECTANGLE (0, 0, rect->width, rect->height),
                            babl_format ("RGBA float"));

  shifted = g_object_new (GEGL_TYPE_BUFFER,
                          "source",  buffer,
                          "shift-x", -rect->x,
                          "shift-y", -rect->y,
                          NULL);

  gegl_node_set (applicator->dup_apply_buffer_node,
                 "buffer", shifted,
                 NULL);

  g_object_unref (shifted);

  return buffer;
}
Beispiel #17
0
static GeglNode *
gimp_threshold_tool_get_operation (GimpImageMapTool  *image_map_tool,
                                   GObject          **config)
{
  GimpThresholdTool *t_tool = GIMP_THRESHOLD_TOOL (image_map_tool);
  GeglNode          *node;

  node = g_object_new (GEGL_TYPE_NODE,
                       "operation", "gimp:threshold",
                       NULL);

  t_tool->config = g_object_new (GIMP_TYPE_THRESHOLD_CONFIG, NULL);

  *config = G_OBJECT (t_tool->config);

  g_signal_connect_object (t_tool->config, "notify",
                           G_CALLBACK (gimp_threshold_tool_config_notify),
                           G_OBJECT (t_tool), 0);

  gegl_node_set (node,
                 "config", t_tool->config,
                 NULL);

  return node;
}
Beispiel #18
0
void commit_params (struct dt_iop_module_t *self, dt_iop_params_t *p1, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
{
  dt_iop_gamma_params_t *p = (dt_iop_gamma_params_t *)p1;
#ifdef HAVE_GEGL
  // pull in new params to gegl
  gegl_node_set(piece->input, "linear_value", p->linear, "gamma_value", p->gamma, NULL);
  // gegl_node_set(piece->input, "value", p->gamma, NULL);
#else
  // build gamma table in pipeline piece from committed params:
  dt_iop_gamma_data_t *d = (dt_iop_gamma_data_t *)piece->data;
  float a, b, c, g;
  if(p->linear<1.0)
  {
    g = p->gamma*(1.0-p->linear)/(1.0-p->gamma*p->linear);
    a = 1.0/(1.0+p->linear*(g-1));
    b = p->linear*(g-1)*a;
    c = powf(a*p->linear+b, g)/p->linear;
  }
  else
  {
    a = b = g = 0.0;
    c = 1.0;
  }
  for(int k=0; k<0x10000; k++)
  {
    int32_t tmp;
    if (k<0x10000*p->linear) tmp = MIN(c*k, 0xFFFF);
    else tmp = MIN(powf(a*k/0x10000+b, g)*0x10000, 0xFFFF);
    d->table[k] = tmp>>8;
  }
#endif
}
Beispiel #19
0
/* gimp_seamless_clone_tool_render_node_update:
 * sc: the Seamless Clone tool whose render has to be updated.
 *
 * Returns: TRUE if any property changed.
 */
static gboolean
gimp_seamless_clone_tool_render_node_update (GimpSeamlessCloneTool *sc)
{
  static gint rendered__max_refine_scale = -1;
  static gint rendered_xoff              = G_MAXINT;
  static gint rendered_yoff              = G_MAXINT;

  GimpSeamlessCloneOptions *options = GIMP_SEAMLESS_CLONE_TOOL_GET_OPTIONS (sc);
  GimpDrawable *bg = GIMP_TOOL (sc)->drawable;
  gint          off_x, off_y;

  /* All properties stay the same. No need to update. */
  if (rendered__max_refine_scale == options->max_refine_scale &&
      rendered_xoff == sc->xoff                               &&
      rendered_yoff == sc->yoff)
    return FALSE;

  gimp_item_get_offset (GIMP_ITEM (bg), &off_x, &off_y);

  gegl_node_set (sc->sc_node,
                 "xoff", (gint) sc->xoff - off_x,
                 "yoff", (gint) sc->yoff - off_y,
                 "max-refine-scale", (gint) options->max_refine_scale,
                 NULL);

  rendered__max_refine_scale = options->max_refine_scale;
  rendered_xoff              = sc->xoff;
  rendered_yoff              = sc->yoff;

  return TRUE;
}
Beispiel #20
0
static void
gimp_blend_tool_precalc_shapeburst (GimpBlendTool *blend_tool)
{
  GimpTool *tool = GIMP_TOOL (blend_tool);
  gint      x, y, width, height;

  if (blend_tool->dist_buffer || ! tool->drawable)
    return;

  if (! gimp_item_mask_intersect (GIMP_ITEM (tool->drawable),
                                  &x, &y, &width, &height))
    return;

  blend_tool->dist_buffer =
    gimp_drawable_blend_shapeburst_distmap (tool->drawable, FALSE,
                                            GEGL_RECTANGLE (x, y, width, height),
                                            GIMP_PROGRESS (blend_tool));

  if (blend_tool->dist_node)
    gegl_node_set (blend_tool->dist_node,
                   "buffer", blend_tool->dist_buffer,
                   NULL);

  gimp_progress_end (GIMP_PROGRESS (blend_tool));
}
Beispiel #21
0
Datei: json.c Projekt: GNOME/gegl
static guint
install_properties(JsonOpClass *json_op_class)
{
    GObjectClass *object_class = G_OBJECT_CLASS (json_op_class);
    JsonObject *root = json_op_class->json_root;
    guint prop = 1;

    // Exported ports
    if (json_object_has_member(root, "inports")) {
        JsonObject *inports = json_object_get_object_member(root, "inports");
        GList *inport_names = json_object_get_members(inports);
        GList *l;
        for (l = inport_names; l != NULL; l = l->next) {
            const gchar *name = l->data;
            JsonObject *conn = json_object_get_object_member(inports, name);
            const gchar *proc = json_object_get_string_member(conn, "process");
            const gchar *port = json_object_get_string_member(conn, "port");
            JsonObject *processes = json_object_get_object_member(root, "processes");
            JsonObject *p = json_object_get_object_member(processes, proc);
            const gchar *component = json_object_get_string_member(p, "component");

            {
              GParamSpec *target_spec = NULL;
              gchar *opname = component2geglop(component);
              // HACK: should avoid instantiating node to determine prop
              GeglNode *n = gegl_node_new();
              g_assert(n);
              gegl_node_set(n, "operation", opname, NULL);
              target_spec = gegl_node_find_property(n, port);
              if (target_spec) {
                GParamSpec *spec = copy_param_spec(target_spec, name);
                PropertyTarget *t = property_target_new(g_strdup(proc), g_strdup(port));
                g_hash_table_insert(json_op_class->properties, GINT_TO_POINTER(prop), t);
                g_object_class_install_property (object_class, prop, spec);
                prop++;
              }
              g_object_unref(n);
              g_free(opname);
            }
        }

        g_list_free(inport_names);
    }

/*
    if (json_object_has_member(root, "outports")) {
        JsonObject *outports = json_object_get_object_member(root, "outports");
        GList *outport_names = json_object_get_members(outports);
        for (int i=0; i<g_list_length(outport_names); i++) {
            const gchar *name = g_list_nth_data(outport_names, i);
            JsonObject *conn = json_object_get_object_member(outports, name);
            const gchar *proc = json_object_get_string_member(conn, "process");
            const gchar *port = json_object_get_string_member(conn, "port");
            graph_add_port(self, GraphOutPort, name, proc, port);
        }
    }
*/
  return prop-1;
}
Beispiel #22
0
void
gimp_gegl_mode_node_set_opacity (GeglNode *node,
                                 gdouble   opacity)
{
  g_return_if_fail (GEGL_IS_NODE (node));

  gegl_node_set (node,
                 "opacity", opacity,
                 NULL);
}
Beispiel #23
0
GeglGtkView *
gegl_gtk_view_new_for_buffer(GeglBuffer *buffer)
{
    GeglNode *node = g_object_new (GEGL_TYPE_NODE, NULL);
    gegl_node_set (node,
                   "operation", "gegl:buffer-source",
                   "buffer", buffer,
                   NULL);
    return gegl_gtk_view_new_for_node(node);
}
static void
photos_operation_insta_hefe_setup (PhotosOperationInstaHefe *self)
{
  gegl_node_set (self->vignette,
                 "height", (gdouble) self->bbox.height,
                 "width", (gdouble) self->bbox.width,
                 "x", (gdouble) self->bbox.x,
                 "y", (gdouble) self->bbox.y,
                 NULL);
}
Beispiel #25
0
BufferPtr
BufferMaker::operator()(const std::string & path) throw()
{
    const NodePtr root = Gegl::Node::create();
    root->set("format", babl_format("RGB u8"));

    const NodePtr load = root->new_child("operation",
                                         "gegl:load");
    gegl_node_set(load->gobj(), "path", path.c_str(), NULL);

    const NodePtr buffer_sink = root->new_child("operation",
                                                "gegl:buffer-sink");
    GeglBuffer * buffer;
    gegl_node_set(buffer_sink->gobj(), "buffer", &buffer, NULL);

    load->link(buffer_sink);
    buffer_sink->process();

    return Glib::wrap(buffer, false);
}
static void
gimp_n_point_deformation_tool_set_options (GimpNPointDeformationTool    *npd_tool,
                                           GimpNPointDeformationOptions *npd_options)
{
  gegl_node_set (npd_tool->npd_node,
                 "square-size",       (gint) npd_options->square_size,
                 "rigidity",          (gint) npd_options->rigidity,
                 "asap-deformation",  npd_options->asap_deformation,
                 "mls-weights",       npd_options->mls_weights,
                 "mls-weights-alpha", npd_options->mls_weights_alpha,
                 NULL);
}
Beispiel #27
0
static void
gimp_cage_tool_render_node_update (GimpCageTool *ct)
{
  GimpCageOptions *options  = GIMP_CAGE_TOOL_GET_OPTIONS (ct);
  gboolean         option_fill, node_fill;
  GeglBuffer      *buffer;

  g_object_get (options,
                "fill-plain-color", &option_fill,
                NULL);

  gegl_node_get (ct->cage_node,
                 "fill-plain-color", &node_fill,
                 NULL);

  if (option_fill != node_fill)
    {
      gegl_node_set (ct->cage_node,
                     "fill_plain_color", option_fill,
                     NULL);
    }

  gegl_node_get (ct->coef_node,
                 "buffer", &buffer,
                 NULL);

  if (buffer != ct->coef)
    {
      gegl_node_set (ct->coef_node,
                     "buffer",  ct->coef,
                     NULL);
    }

  /* This just unref buffer, since gegl_node_get add a refcount on it */
  if (buffer)
    {
      g_object_unref (buffer);
    }
}
static gboolean
test_change_processor_rect_do_test (GeglProcessor       *processor,
                                    const GeglRectangle *rect,
                                    GeglNode            *sink)
{
  gint        i                         = 0;
  gboolean    result                    = TRUE;
  float       expected_result_buffer[4] = { 1.0, 1.0, 1.0, 1.0 };
  float       result_buffer[4]          = { 0, };
  GeglBuffer *buffer                    = NULL;

  gegl_node_set (sink,
                 "buffer", &buffer,
                 NULL);
  
  gegl_processor_set_rectangle (processor, rect);

  while (gegl_processor_work (processor, NULL));

  gegl_buffer_get (buffer,
                   rect,
                   1.0,
                   babl_format ("RGBA float"),
                   result_buffer,
                   GEGL_AUTO_ROWSTRIDE,
                   GEGL_ABYSS_NONE);

  /* Compare with a small epsilon to account for accumulated error */
  for(i = 0; i < G_N_ELEMENTS (expected_result_buffer); i++)
    result = result && FLOATS_EQUAL (expected_result_buffer[i], result_buffer[i]);

  gegl_node_set (sink,
                 "buffer", NULL,
                 NULL);

  g_object_unref (buffer);

  return result;
}
Beispiel #29
0
void
gimp_applicator_set_affect (GimpApplicator    *applicator,
                            GimpComponentMask  affect)
{
  if (applicator->affect != affect)
    {
      applicator->affect = affect;

      gegl_node_set (applicator->affect_node,
                     "mask", affect,
                     NULL);
    }
}
void text_property_changed(GtkEntry* entry, gpointer data)
{
  struct text_prop_data *dat  = (struct text_prop_data*)data;
  const gchar			*text = gtk_entry_get_text(entry);

  GeglNode*		 node	   = dat->node;
  const gchar*		 property  = dat->property;
  GType			 prop_type = dat->prop_type;
  GeglEditorLayer	*layer	   = dat->layer;

  g_print("%s -> %s\n", property, text);

  gint	i_value;
  gdouble	 d_value;
  gchar		*str_value;
  GValue	 value = { 0, };	//different than = 0?
  g_value_init(&value, prop_type);
  g_print("%s\n", G_VALUE_TYPE_NAME(&value));

  switch(prop_type)
    {
    case G_TYPE_INT:
      i_value = (gint)strtod(text, NULL);
      gegl_node_set(node, property, i_value, NULL);
      break;
    case G_TYPE_DOUBLE:
      d_value = strtod(text, NULL);
      gegl_node_set(node, property, d_value, NULL);
      break;
    case G_TYPE_STRING:
      gegl_node_set(node, property, text, NULL);
      break;
    default:
      g_print("Unknown property type: %s (%s)\n", property, g_type_name(prop_type));
    }

  refresh_images(layer);
}