コード例 #1
0
ファイル: motion-blur.c プロジェクト: peixuan/GEGL-OpenCL
static void
prepare_cl (GeglOperation *operation)
{
    GeglOperationAreaFilter* op_area = GEGL_OPERATION_AREA_FILTER (operation);
    GeglChantO* o = GEGL_CHANT_PROPERTIES (operation);

    gdouble theta = o->angle * G_PI / 180.0;
    gdouble offset_x = fabs(o->length * cos(theta));
    gdouble offset_y = fabs(o->length * sin(theta));

    op_area->left   =
        op_area->right  = (gint)ceil(0.5 * offset_x);
    op_area->top    =
        op_area->bottom = (gint)ceil(0.5 * offset_y);

    GeglNode * self;
    GeglPad *pad;
    Babl * format=babl_format ("RaGaBaA float");
    self=gegl_operation_get_source_node(operation,"input");
    while(self) {
        if(strcmp(gegl_node_get_operation(self),"gimp:tilemanager-source")==0) {
            format=gegl_operation_get_format(self->operation,"output");
            break;
        }
        self=gegl_operation_get_source_node(self->operation,"input");
    }
    gegl_operation_set_format (operation, "output", format);
}
コード例 #2
0
ファイル: affine.c プロジェクト: joyoseller/GEGL-OpenCL
static GeglNode *
gegl_affine_detect (GeglOperation *operation,
                    gint           x,
                    gint           y)
{
  OpAffine    *affine      = OP_AFFINE (operation);
  GeglNode    *source_node = gegl_operation_get_source_node (operation, "input");
  GeglMatrix3  inverse;
  gdouble      need_points [2];
  gint         i;

  if (gegl_affine_is_intermediate_node (affine) ||
      gegl_matrix3_is_identity (&inverse))
    {
      return gegl_operation_detect (source_node->operation, x, y);
    }

  need_points [0] = x;
  need_points [1] = y;

  gegl_affine_create_matrix (affine, &inverse);
  gegl_matrix3_invert (&inverse);

  for (i = 0; i < 2; i += 2)
    gegl_matrix3_transform_point (&inverse,
                             need_points + i, need_points + i + 1);

  return gegl_operation_detect (source_node->operation,
                                need_points[0], need_points[1]);
}
コード例 #3
0
static GeglNode *
detect (GeglOperation *operation,
        gint           x,
        gint           y)
{
  GeglNode *input_node = gegl_operation_get_source_node (operation, "input");
  GeglNode *aux_node   = gegl_operation_get_source_node (operation, "aux");

  if (input_node)
    input_node = gegl_node_detect (input_node, x, y);
  if (aux_node)
    aux_node = gegl_node_detect (aux_node, x, y);

  if (aux_node)
    return aux_node;
  if (input_node)
    return input_node;
  return NULL;
}
コード例 #4
0
static GeglNode *
detect (GeglOperation *operation,
        gint           x,
        gint           y)
{
  GeglNode *input_node;

  input_node = gegl_operation_get_source_node (operation, "input");

  if (input_node)
    return gegl_operation_detect (input_node->operation, x, y);
  return operation->node;
}
コード例 #5
0
ファイル: gegl-operation.c プロジェクト: AjayRamanathan/gegl
GeglRectangle *
gegl_operation_source_get_bounding_box (GeglOperation  *operation,
                                        const gchar   *input_pad_name)
{
  GeglNode *node = gegl_operation_get_source_node (operation, input_pad_name);

  if (node)
    {
      GeglRectangle *ret;
      g_mutex_lock (node->mutex);
      ret = &node->have_rect;
      g_mutex_unlock (node->mutex);
      return ret;
    }

  return NULL;
}
コード例 #6
0
ファイル: crop.c プロジェクト: Distrotech/gegl
static GeglNode *
gegl_crop_detect (GeglOperation *operation,
                  gint           x,
                  gint           y)
{
  GeglProperties *o = GEGL_PROPERTIES (operation);
  GeglNode   *input_node;

  input_node = gegl_operation_get_source_node (operation, "input");

  if (input_node)
    return gegl_node_detect (input_node,
                             x - floor (o->x),
                             y - floor (o->y));

  return operation->node;
}