/* This file is an image processing operation for GEGL * * GEGL is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * GEGL is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with GEGL; if not, see . * * Copyright 2006 Øyvind Kolås */ #include "config.h" #include #ifdef GEGL_CHANT_PROPERTIES /* no properties */ #else #define GEGL_CHANT_TYPE_POINT_FILTER #define GEGL_CHANT_C_FILE "invert.c" #define GEGLV4 #include "gegl-chant.h" static gboolean process (GeglOperation *op, void *in_buf, void *out_buf, glong samples, const GeglRectangle *roi, gint level) { glong i; gfloat *in = in_buf; gfloat *out = out_buf; for (i=0; ikernel[0], 0, sizeof(cl_mem), (void*)&in_tex); cl_err |= gegl_clSetKernelArg(cl_data->kernel[0], 1, sizeof(cl_mem), (void*)&out_tex); if (cl_err != CL_SUCCESS) return cl_err; cl_err = gegl_clEnqueueNDRangeKernel(gegl_cl_get_command_queue (), cl_data->kernel[0], 1, NULL, &global_worksize, NULL, 0, NULL, NULL); if (cl_err != CL_SUCCESS) return cl_err; return cl_err; } static void gegl_chant_class_init (GeglChantClass *klass) { GeglOperationClass *operation_class; GeglOperationPointFilterClass *point_filter_class; operation_class = GEGL_OPERATION_CLASS (klass); point_filter_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass); point_filter_class->process = process; point_filter_class->cl_process = cl_process; operation_class->opencl_support = TRUE; gegl_operation_class_set_keys (operation_class, "name" , "gegl:invert", "categories" , "color", "description", _("Inverts the components (except alpha), the result is the " "corresponding \"negative\" image."), NULL); } #endif