本文整理汇总了C++中GEGL_PROPERTIES函数的典型用法代码示例。如果您正苦于以下问题:C++ GEGL_PROPERTIES函数的具体用法?C++ GEGL_PROPERTIES怎么用?C++ GEGL_PROPERTIES使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GEGL_PROPERTIES函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process
/* GeglOperationPointFilter gives us a linear buffer to operate on
* in our requested pixel format
*/
static gboolean
process (GeglOperation *op,
void *in_buf,
void *out_buf,
glong n_pixels,
const GeglRectangle *roi,
gint level)
{
GeglProperties *o = GEGL_PROPERTIES (op);
gfloat *in_pixel = in_buf;
gfloat *out_pixel = out_buf;
const gfloat *coeffs = o->user_data;
in_pixel = in_buf;
out_pixel = out_buf;
if (! coeffs)
{
coeffs = o->user_data = preprocess (o);
}
while (n_pixels--)
{
out_pixel[0] = in_pixel[0] * coeffs[0];
out_pixel[1] = in_pixel[1] * coeffs[1];
out_pixel[2] = in_pixel[2] * coeffs[2];
out_pixel[3] = in_pixel[3];
in_pixel += 4;
out_pixel += 4;
}
return TRUE;
}
示例2: process
static gboolean
process (GeglOperation *operation,
GeglBuffer *output,
const GeglRectangle *result,
gint level)
{
GeglProperties *o = GEGL_PROPERTIES (operation);
gint problem;
gint width, height;
Babl *format = NULL;
GError *err = NULL;
GFile *infile = NULL;
GInputStream *stream = gegl_gio_open_input_stream(o->uri, o->path, &infile, &err);
WARN_IF_ERROR(err);
problem = gegl_buffer_import_png (output, stream, 0, 0,
&width, &height, format, &err);
WARN_IF_ERROR(err);
g_input_stream_close(stream, NULL, NULL);
if (problem)
{
g_object_unref(infile);
g_object_unref(stream);
g_warning ("%s failed to open file %s for reading.",
G_OBJECT_TYPE_NAME (operation), o->path);
return FALSE;
}
if (infile) g_object_unref(infile);
g_object_unref(stream);
return TRUE;
}
示例3: process
static gboolean
process (GeglOperation *operation,
GeglBuffer *input,
GeglBuffer *output,
const GeglRectangle *result,
gint level)
{
GeglProperties *o = GEGL_PROPERTIES (operation);
GeglBuffer *temp_in;
GeglRectangle compute = gegl_operation_get_required_for_output (operation, "input", result);
if (result->width == 0 ||
result->height== 0 ||
o->radius < 1.0)
{
output = g_object_ref (input);
}
else
{
temp_in = gegl_buffer_create_sub_buffer (input, &compute);
snn_percentile (temp_in, output, o->radius, o->percentile, o->pairs);
g_object_unref (temp_in);
}
return TRUE;
}
示例4: process
static gboolean
process (GeglOperation *operation,
GeglBuffer *output,
const GeglRectangle *result,
gint level)
{
GeglProperties *o = GEGL_PROPERTIES (operation);
Priv *p = (Priv*) o->user_data;
if (p->config != NULL)
{
if (p->decoder != NULL)
{
if (decode_from_stream (p->stream, p->decoder) < 0)
{
g_warning ("failed decoding WebP image file");
cleanup (operation);
return FALSE;
}
g_input_stream_close (G_INPUT_STREAM (p->stream), NULL, NULL);
g_clear_object (&p->stream);
WebPIDelete (p->decoder);
p->decoder = NULL;
}
gegl_buffer_set (output, result, 0, p->format,
p->config->output.u.RGBA.rgba,
p->config->output.u.RGBA.stride);
}
return FALSE;
}
示例5: prepare
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);
}
示例6: process
/* For GeglOperationPointFilter subclasses, we operate on linear
* buffers with a pixel count.
*/
static gboolean
process (GeglOperation *op,
void *in_buf,
void *out_buf,
glong n_pixels,
const GeglRectangle *roi,
gint level)
{
/* Retrieve a pointer to GeglProperties structure which contains all the
* chanted properties
*/
GeglProperties *o = GEGL_PROPERTIES (op);
gfloat * GEGL_ALIGNED in_pixel;
gfloat * GEGL_ALIGNED out_pixel;
gfloat brightness, contrast;
glong i;
in_pixel = in_buf;
out_pixel = out_buf;
brightness = o->brightness;
contrast = o->contrast;
for (i=0; i<n_pixels; i++)
{
out_pixel[0] = (in_pixel[0] - 0.5f) * contrast + brightness + 0.5;
out_pixel[1] = (in_pixel[1] - 0.5f) * contrast + brightness + 0.5;
out_pixel[2] = (in_pixel[2] - 0.5f) * contrast + brightness + 0.5;
out_pixel[3] = in_pixel[3]; /* copy the alpha */
in_pixel += 4;
out_pixel += 4;
}
return TRUE;
}
示例7: get_required_for_output
static GeglRectangle
get_required_for_output (GeglOperation *operation,
const gchar *input_pad,
const GeglRectangle *roi)
{
GeglRectangle result = *roi;
if (! is_nop (operation))
{
GeglProperties *o = GEGL_PROPERTIES (operation);
GeglRectangle *in_rect = gegl_operation_source_get_bounding_box (operation, "input");
if (in_rect)
{
switch (o->mode)
{
case GEGL_SPHERIZE_MODE_RADIAL:
result = *in_rect;
break;
case GEGL_SPHERIZE_MODE_HORIZONTAL:
result.x = in_rect->x;
result.width = in_rect->width;
break;
case GEGL_SPHERIZE_MODE_VERTICAL:
result.y = in_rect->y;
result.height = in_rect->height;
break;
}
}
}
return result;
}
示例8: get_bounding_box
/* Compute the region for which this operation is defined.
*/
static GeglRectangle
get_bounding_box (GeglOperation *operation)
{
GeglRectangle result = {0,0,0,0};
GeglRectangle *in_rect = gegl_operation_source_get_bounding_box (operation, "input");
GeglProperties *o = GEGL_PROPERTIES (operation);
if (!in_rect){
return result;
}
if (o->clip) {
gegl_rectangle_copy(&result, in_rect);
}
else {
result.x = in_rect->x;
result.y = in_rect->y;
result.width = result.height = sqrt (in_rect->width * in_rect->width + in_rect->height * in_rect->height) * MAX ((o->o_x + 1), (o->o_y + 1)) * 2;
}
result.width = result.width * o->output_scale;
result.height = result.height * o->output_scale;
#ifdef TRACE
g_warning ("< get_bounding_box result = %dx%d+%d+%d", result.width, result.height, result.x, result.y);
#endif
return result;
}
示例9: process
/* Perform the specified operation.
*/
static gboolean
process (GeglOperation *operation,
GeglBuffer *input,
GeglBuffer *output,
const GeglRectangle *result,
gint level)
{
GeglProperties *o = GEGL_PROPERTIES (operation);
GeglRectangle boundary = gegl_operation_get_bounding_box (operation);
GeglRectangle eff_boundary = get_effective_area (operation);
const Babl *format = babl_format ("RaGaBaA float");
#ifdef DO_NOT_USE_BUFFER_SAMPLE
g_warning ("NOT USING BUFFER SAMPLE!");
#endif
apply_mirror (o->m_angle,
o->r_angle,
o->n_segs,
o->c_x * boundary.width,
o->c_y * boundary.height,
o->o_x * (eff_boundary.width - eff_boundary.x) + eff_boundary.x,
o->o_y * (eff_boundary.height - eff_boundary.y) + eff_boundary.y,
o->input_scale / 100,
o->clip,
o->warp,
format,
input,
&eff_boundary,
output,
&boundary,
result,
level);
return TRUE;
}
示例10: gegl_rgbe_load_get_bounding_box
static GeglRectangle
gegl_rgbe_load_get_bounding_box (GeglOperation *operation)
{
GeglProperties *o = GEGL_PROPERTIES (operation);
GeglRectangle result = {0,0,0,0};
rgbe_file *file;
guint width, height;
gegl_operation_set_format (operation,
"output",
babl_format (FORMAT));
file = rgbe_load_path (o->path);
if (!file)
goto cleanup;
if (!rgbe_get_size (file, &width, &height))
goto cleanup;
result.width = width;
result.height = height;
cleanup:
rgbe_file_free (file);
return result;
}
示例11: prepare
static void
prepare (GeglOperation *operation)
{
GeglProperties *o = GEGL_PROPERTIES (operation);
Priv *p= (Priv*)o->user_data;
if (p == NULL)
init (o);
p = (Priv*)o->user_data;
gegl_operation_set_format (operation, "output",
babl_format ("R'G'B'A u8"));
if (!p->fd)
{
p->force_format = 1;
p->dev_name = o->path;
p->io = IO_METHOD_MMAP;
p->w = o->width;
p->h = o->height;
open_device (p);
init_device (p);
start_capturing (p);
}
}
示例12: process
/* Perform the specified operation.
*/
static gboolean
process (GeglOperation *operation,
GeglBuffer *input,
GeglBuffer *output,
const GeglRectangle *result,
gint level)
{
GeglProperties *o = GEGL_PROPERTIES (operation);
GeglRectangle boundary = gegl_operation_get_bounding_box (operation);
const Babl *format = babl_format ("RaGaBaA float");
apply_whirl_pinch (o->whirl,
o->pinch,
o->radius,
boundary.width / 2.0,
boundary.height / 2.0,
format,
input,
&boundary,
output,
&boundary,
result,
level);
return TRUE;
}
示例13: prepare
static void
prepare (GeglOperation *operation)
{
GeglProperties *o = GEGL_PROPERTIES (operation);
const Babl *input_format = NULL;
const Babl *output_format = (o->linear ?
babl_format ("Y float") :
babl_format ("Y' float"));
switch (o->component)
{
case GEGL_COMPONENT_EXTRACT_ALPHA:
input_format = babl_format ("YA float");
break;
case GEGL_COMPONENT_EXTRACT_RGB_RED:
case GEGL_COMPONENT_EXTRACT_RGB_GREEN:
case GEGL_COMPONENT_EXTRACT_RGB_BLUE:
input_format = babl_format ("R'G'B' float");
break;
case GEGL_COMPONENT_EXTRACT_HUE:
case GEGL_COMPONENT_EXTRACT_HSV_SATURATION:
case GEGL_COMPONENT_EXTRACT_HSV_VALUE:
input_format = babl_format ("HSV float");
break;
case GEGL_COMPONENT_EXTRACT_HSL_LIGHTNESS:
case GEGL_COMPONENT_EXTRACT_HSL_SATURATION:
input_format = babl_format ("HSL float");
break;
case GEGL_COMPONENT_EXTRACT_CMYK_CYAN:
case GEGL_COMPONENT_EXTRACT_CMYK_MAGENTA:
case GEGL_COMPONENT_EXTRACT_CMYK_YELLOW:
case GEGL_COMPONENT_EXTRACT_CMYK_KEY:
input_format = babl_format ("CMYK float");
break;
case GEGL_COMPONENT_EXTRACT_YCBCR_Y:
case GEGL_COMPONENT_EXTRACT_YCBCR_CB:
case GEGL_COMPONENT_EXTRACT_YCBCR_CR:
input_format = babl_format ("Y'CbCr float");
break;
case GEGL_COMPONENT_EXTRACT_LAB_L:
case GEGL_COMPONENT_EXTRACT_LAB_A:
case GEGL_COMPONENT_EXTRACT_LAB_B:
input_format = babl_format ("CIE Lab float");
break;
case GEGL_COMPONENT_EXTRACT_LCH_C:
case GEGL_COMPONENT_EXTRACT_LCH_H:
input_format = babl_format ("CIE LCH(ab) float");
break;
}
gegl_operation_set_format (operation, "input", input_format);
gegl_operation_set_format (operation, "output", output_format);
}
示例14: process
static gboolean
process (GeglOperation *operation,
GeglBuffer *input,
const GeglRectangle *result,
gint level)
{
GeglProperties *o = GEGL_PROPERTIES (operation);
GOutputStream *stream;
GFile *file = NULL;
GError *error = NULL;
gboolean status = TRUE;
stream = gegl_gio_open_output_stream (NULL, o->path, &file, &error);
if (stream == NULL)
{
status = FALSE;
g_warning ("%s", error->message);
goto cleanup;
}
if (!export_webp (operation, input, result, stream))
{
status = FALSE;
g_warning ("could not export WebP file");
goto cleanup;
}
cleanup:
g_clear_object (&stream);
g_clear_object (&file);
return status;
}
示例15: process
static gboolean
process (GeglOperation *operation,
void *in_buf,
void *out_buf,
glong n_pixels,
const GeglRectangle *roi,
gint level)
{
GeglProperties *o = GEGL_PROPERTIES (operation);
const Babl *format = gegl_operation_get_format (operation, "input");
memcpy (out_buf, in_buf, n_pixels * babl_format_get_bytes_per_pixel (format));
if (o->cache != (void *) operation->node->cache)
{
if (o->cache)
{
g_object_unref (o->cache);
o->cache = NULL;
}
if (operation->node->cache)
o->cache = g_object_ref (operation->node->cache);
}
return TRUE;
}