static void prepare (GeglOperation *operation) { GeglOperationAreaFilter *area = GEGL_OPERATION_AREA_FILTER (operation); GeglProperties *o = GEGL_PROPERTIES (operation); const Babl *in_format = gegl_operation_get_source_format (operation, "input"); const Babl *format = babl_format ("RGB float"); area->left = area->right = area->top = area->bottom = o->radius; o->user_data = g_renew (gint, o->user_data, o->radius + 1); init_neighborhood_outline (o->neighborhood, o->radius, o->user_data); if (in_format) { if (babl_format_has_alpha (in_format)) format = babl_format ("RGBA float"); } gegl_operation_set_format (operation, "input", format); gegl_operation_set_format (operation, "output", format); }
static void prepare (GeglOperation *operation) { const Babl *src_format = gegl_operation_get_source_format (operation, "input"); const char *format = "RGB float"; if (src_format) { const Babl *model = babl_format_get_model (src_format); if (model == babl_model ("RGB")) format = "RGB float"; else if (model == babl_model ("RGBA")) format = "RGBA float"; else if (model == babl_model ("R'G'B'")) format = "R'G'B' float"; else if (model == babl_model ("R'G'B'A")) format = "R'G'B'A float"; else if (babl_format_has_alpha (src_format)) format = "RGBA float"; } gegl_operation_set_format (operation, "input", babl_format (format)); gegl_operation_set_format (operation, "output", babl_format (format)); }
static void prepare (GeglOperation *operation) { GeglProperties *o = GEGL_PROPERTIES (operation); GeglOperationAreaFilter *op_area = GEGL_OPERATION_AREA_FILTER (operation); const Babl *format; if (o->direction == GEGL_ORIENTATION_HORIZONTAL) { op_area->left = o->shift; op_area->right = o->shift; op_area->top = 0; op_area->bottom = 0; } else if (o->direction == GEGL_ORIENTATION_VERTICAL) { op_area->top = o->shift; op_area->bottom = o->shift; op_area->left = 0; op_area->right = 0; } format = gegl_operation_get_source_format (operation, "input"); gegl_operation_set_format (operation, "input", format); gegl_operation_set_format (operation, "output", format); }
static void gegl_nop_prepare (GeglOperation *self) { const Babl *fmt = gegl_operation_get_source_format (self, "input"); gegl_operation_set_format (self, "output", fmt); }
static void gegl_gblur_1d_prepare (GeglOperation *operation) { const Babl *src_format = gegl_operation_get_source_format (operation, "input"); const char *format = "RaGaBaA float"; /* * FIXME: when the abyss policy is _NONE, the behavior at the edge * depends on input format (with or without an alpha component) */ if (src_format) { const Babl *model = babl_format_get_model (src_format); if (model == babl_model ("RGB") || model == babl_model ("R'G'B'")) format = "RGB float"; else if (model == babl_model ("Y") || model == babl_model ("Y'")) format = "Y float"; else if (model == babl_model ("YA") || model == babl_model ("Y'A") || model == babl_model ("YaA") || model == babl_model ("Y'aA")) format = "YaA float"; } gegl_operation_set_format (operation, "output", babl_format (format)); }
static void prepare (GeglOperation *operation) { GeglProperties *o = GEGL_PROPERTIES (operation); const Babl *src_format = gegl_operation_get_source_format (operation, "input"); const Babl *input_format = babl_format ("RGB double"); gint n_components = 3; const Babl *output_format; if (src_format) { const Babl *model = babl_format_get_model (src_format); if (model == babl_model ("RGB") || model == babl_model ("R'G'B'") || model == babl_model ("RGBA") || model == babl_model ("R'G'B'A")) { input_format = babl_format ("RGB double"); n_components = 3; } else if (model == babl_model ("Y") || model == babl_model ("Y'") || model == babl_model ("YA") || model == babl_model ("Y'A")) { input_format = babl_format ("Y double"); n_components = 1; } } if (o->squared) n_components *= 2; output_format = babl_format_n (babl_type ("double"), n_components); gegl_operation_set_format (operation, "input", input_format); gegl_operation_set_format (operation, "output", output_format); }
/** * Prepare function of gegl filter. * @param operation given Gegl operation */ static void prepare (GeglOperation *operation) { const Babl *format = gegl_operation_get_source_format (operation, "input"); gegl_operation_set_format (operation, "input", format); gegl_operation_set_format (operation, "output", format); }
static void prepare (GeglOperation *self) { const Babl *fmt = gegl_operation_get_source_format (self, "input"); GeglProperties *o = GEGL_PROPERTIES (self); if (fmt) { const Babl *model = babl_format_get_model (fmt); if (model == babl_model ("R'aG'aB'aA") || model == babl_model ("Y'aA")) { o->user_data = NULL; fmt = babl_format ("R'aG'aB'aA float"); } else if (model == babl_model ("RaGaBaA") || model == babl_model ("YaA")) { o->user_data = NULL; fmt = babl_format ("RaGaBaA float"); } else if (model == babl_model ("R'G'B'A") || model == babl_model ("R'G'B'") || model == babl_model ("Y'") || model == babl_model ("Y'A")) { o->user_data = (void*)0xabc; fmt = babl_format ("R'G'B'A float"); } else { o->user_data = (void*)0xabc; fmt = babl_format ("RGBA float"); } } else { o->user_data = (void*)0xabc; fmt = babl_format ("RGBA float"); } gegl_operation_set_format (self, "input", fmt); gegl_operation_set_format (self, "output", fmt); gegl_operation_set_format (self, "aux", babl_format ("Y float")); return; }
static void prepare (GeglOperation *operation) { GeglOperationAreaFilter *area = GEGL_OPERATION_AREA_FILTER (operation); //GeglChantO *o = GEGL_CHANT_PROPERTIES (operation); const Babl *source_format = gegl_operation_get_source_format (operation, "input"); area->left = area->right = area->top = area->bottom = SOBEL_RADIUS; gegl_operation_set_format (operation, "input", babl_format ("RGBA float")); if (source_format && !babl_format_has_alpha (source_format)) gegl_operation_set_format (operation, "output", babl_format ("RGB float")); else gegl_operation_set_format (operation, "output", babl_format ("RGBA float")); }
static void prepare (GeglOperation *operation) { GeglProperties *o = GEGL_PROPERTIES (operation); const Babl *format; const Babl *input_format; const Babl *input_model; const Babl *lch_model; input_format = gegl_operation_get_source_format (operation, "input"); if (input_format == NULL) return; input_model = babl_format_get_model (input_format); if (babl_format_has_alpha (input_format)) { lch_model = babl_model ("CIE LCH(ab) alpha"); if (input_model == lch_model) { format = babl_format ("CIE LCH(ab) alpha float"); o->user_data = process_lch_alpha; } else { format = babl_format ("CIE Lab alpha float"); o->user_data = process_lab_alpha; } } else { lch_model = babl_model ("CIE LCH(ab)"); if (input_model == lch_model) { format = babl_format ("CIE LCH(ab) float"); o->user_data = process_lch; } else { format = babl_format ("CIE Lab float"); o->user_data = process_lab; } } gegl_operation_set_format (operation, "input", format); gegl_operation_set_format (operation, "output", format); }
static void prepare (GeglOperation *operation) { const Babl *input_format = gegl_operation_get_source_format (operation, "input"); const Babl *format; GeglOperationAreaFilter *op_area = GEGL_OPERATION_AREA_FILTER (operation); if (input_format == NULL || babl_format_has_alpha (input_format)) format = babl_format ("R'G'B'A float"); else format = babl_format ("R'G'B' float"); gegl_operation_set_format (operation, "input", format); gegl_operation_set_format (operation, "output", format); op_area->left = op_area->right = op_area->top = op_area->bottom = 1; }
static void prepare (GeglOperation *operation) { const Babl *input_format = gegl_operation_get_source_format (operation, "input"); GeglProperties *o = GEGL_PROPERTIES (operation); CmParamsType *mix; const Babl *format; if (o->user_data == NULL) o->user_data = g_slice_new0 (CmParamsType); mix = (CmParamsType*) o->user_data; mix->preserve_luminosity = o->preserve_luminosity; mix->red.red_gain = o->rr_gain; mix->red.green_gain = o->rg_gain; mix->red.blue_gain = o->rb_gain; mix->green.red_gain = o->gr_gain; mix->green.green_gain = o->gg_gain; mix->green.blue_gain = o->gb_gain; mix->blue.red_gain = o->br_gain; mix->blue.green_gain = o->bg_gain; mix->blue.blue_gain = o->bb_gain; if (input_format == NULL || babl_format_has_alpha (input_format)) { mix->has_alpha = TRUE; format = babl_format ("R'G'B'A float"); } else { mix->has_alpha = FALSE; format = babl_format ("R'G'B' float"); } gegl_operation_set_format (operation, "input", format); gegl_operation_set_format (operation, "output", format); }
static void prepare (GeglOperation *operation) { GeglOperationAreaFilter *area = GEGL_OPERATION_AREA_FILTER (operation); const Babl *input_f = gegl_operation_get_source_format (operation, "input"); const Babl *format = babl_format ("R'G'B' float"); area->left = area->right = area->top = area->bottom = 1; if (input_f) { if (babl_format_has_alpha (input_f)) format = babl_format ("R'G'B'A float"); } gegl_operation_set_format (operation, "input", format); gegl_operation_set_format (operation, "output", format); }
static void prepare (GeglOperation *operation) { GeglOperationAreaFilter *area = GEGL_OPERATION_AREA_FILTER (operation); GeglProperties *o = GEGL_PROPERTIES (operation); const Babl *in_format = gegl_operation_get_source_format (operation, "input"); const Babl *format = babl_format ("RGB float");; area->left = area->right = area->top = area->bottom = o->radius; if (in_format) { if (babl_format_has_alpha (in_format)) format = babl_format ("RGBA float"); } gegl_operation_set_format (operation, "input", format); gegl_operation_set_format (operation, "output", format); }
static void prepare (GeglOperation *self) { const Babl *fmt = gegl_operation_get_source_format (self, "input"); GeglChantO *o = GEGL_CHANT_PROPERTIES (self); if (fmt) { const Babl *model = babl_format_get_model (fmt); if (model == babl_model ("RaGaBaA") || model == babl_model ("R'aG'aB'aA") || model == babl_model ("YaA") || model == babl_model ("Y'aA")) { o->chant_data = NULL; gegl_operation_set_format (self, "input", babl_format ("RaGaBaA float")); gegl_operation_set_format (self, "output", babl_format ("RaGaBaA float")); gegl_operation_set_format (self, "aux", babl_format ("Y float")); return; } } /* ugly way of communicating that we want the RGBA version */ /* because of that, we can't use the common opencl api for point ops */ o->chant_data = (void*)0xabc; gegl_operation_set_format (self, "input", babl_format ("RGBA float")); gegl_operation_set_format (self, "output", babl_format ("RGBA float")); gegl_operation_set_format (self, "aux", babl_format ("Y float")); return; }
static void gimp_operation_mask_components_prepare (GeglOperation *operation) { const Babl *format = gegl_operation_get_source_format (operation, "input"); if (format) { const Babl *model = babl_format_get_model (format); if (model == babl_model ("R'G'B'A")) format = babl_format ("R'G'B'A float"); else format = babl_format ("RGBA float"); } else { format = babl_format ("RGBA float"); } gegl_operation_set_format (operation, "input", format); gegl_operation_set_format (operation, "aux", format); gegl_operation_set_format (operation, "output", format); }
static gboolean process (GeglOperation *operation, GeglBuffer *input, GeglBuffer *output, const GeglRectangle *result, gint level) { GeglProperties *o = GEGL_PROPERTIES (operation); const Babl *src_format = gegl_operation_get_source_format (operation, "input"); const Babl *dst_format = gegl_operation_get_format (operation, "output"); gint src_components = babl_format_get_n_components (src_format); gint dst_components = babl_format_get_n_components (dst_format); gint width, height; gint row_size; gint y; gdouble *top_row = NULL; gdouble *dst_row = NULL; gdouble *src_row = NULL; gdouble *p_top = NULL; gdouble *p_dst = NULL; width = gegl_buffer_get_width (input); height = gegl_buffer_get_height (input); row_size = width + 1; top_row = g_new0 (gdouble, row_size * dst_components); dst_row = g_new0 (gdouble, row_size * dst_components); src_row = g_new (gdouble, row_size * src_components); p_top = top_row; p_dst = dst_row; for (y = 0; y < height; y++) { GeglRectangle row_rect = {-1, y, width + 1, 1}; gegl_buffer_get (input, &row_rect, 1.0, src_format, src_row, GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE); compute_row_integral (src_row + src_components, p_top + dst_components, p_dst + dst_components, width, src_components, o->squared); gegl_buffer_set (output, &row_rect, 0, dst_format, p_dst, GEGL_AUTO_ROWSTRIDE); p_top = p_dst; if (p_dst == top_row) p_dst = dst_row; else p_dst = top_row; } g_free (top_row); g_free (dst_row); g_free (src_row); return TRUE; }