return pd->engine_data;
}
+EOLIAN static void *
+_evas_image_efl_gfx_buffer_buffer_get(Eo *eo_obj, Evas_Image_Data *o,
+ Eina_Bool to_write, unsigned int *length_out,
+ int *width, int *height, int *stride_out,
+ Efl_Gfx_Colorspace *cspace, Eina_Bool *alpha,
+ unsigned int *l, unsigned int *r, unsigned int *t, unsigned int *b)
+{
+ Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
+ int stride = 0, length = 0;
+ void *data;
+
+ // use the old api - same behaviour with more return info
+ data = evas_object_image_data_get(eo_obj, to_write);
+ if (!data) goto end;
+
+ // FIXME: length needs to be properly checked with the engine
+ // as we just ignore l,r,t,b here
+ ENFN->image_stride_get(ENDT, o->engine_data, &stride);
+ if (stride)
+ length = stride * o->cur->image.h;
+ else
+ {
+ length = _evas_common_rgba_image_surface_size(o->cur->image.w, o->cur->image.h, o->cur->cspace, NULL, NULL, NULL, NULL);
+ stride = _evas_common_rgba_image_surface_size(o->cur->image.w, 1, o->cur->cspace, NULL, NULL, NULL, NULL);
+ }
+
+end:
+ // TODO: support duplicated borders
+ if (l) *l = 0;
+ if (r) *r = 0;
+ if (t) *t = 0;
+ if (b) *b = 0;
+ if (alpha) *alpha = o->cur->has_alpha;
+ if (width) *width = o->cur->image.w;
+ if (height) *height = o->cur->image.h;
+ if (cspace) *cspace = (Efl_Gfx_Colorspace) o->cur->cspace;
+ if (length_out) *length_out = length;
+ if (stride_out) *stride_out = stride;
+ return data;
+}
+
+static Eina_Bool
+_evas_image_buffer_set_common(Eo *obj, Evas_Image_Data *o, void *pixels,
+ int width, int height, int stride,
+ Efl_Gfx_Colorspace cspace, Eina_Bool alpha,
+ unsigned int l, unsigned int r, unsigned int t, unsigned int b,
+ Eina_Bool copy)
+{
+ Evas_Colorspace cs = (Evas_Colorspace) cspace;
+ int stride_min;
+
+ if (l || r || t || b)
+ {
+ // TODO
+ ERR("Buffer borders are not supported yet!");
+ return EINA_FALSE;
+ }
+
+ stride_min = _evas_common_rgba_image_surface_size(width, 1, cs, NULL, NULL, NULL, NULL);
+ if (!stride) stride = stride_min;
+ if (stride < stride_min)
+ {
+ ERR("Image stride is too small: given %d needs %d", stride, stride_min);
+ return EINA_FALSE;
+ }
+ if (stride > stride_min) // FIXME/TODO
+ {
+ ERR("Image stride support is not implemented: given %d needs %d", stride, stride_min);
+ return EINA_FALSE;
+ }
+
+ if (cs != o->cur->cspace)
+ evas_object_image_colorspace_set(obj, cs);
+
+ if ((width != o->cur->image.w) || (height != o->cur->image.h))
+ evas_object_image_size_set(obj, width, height);
+
+ alpha = !!alpha;
+ if (alpha != o->cur->has_alpha)
+ evas_object_image_alpha_set(obj, alpha);
+
+ if (!pixels)
+ evas_object_image_data_set(obj, NULL);
+ else if (!copy)
+ evas_object_image_data_set(obj, pixels);
+ else
+ evas_object_image_data_copy_set(obj, pixels);
+
+ return o->engine_data ? EINA_TRUE : EINA_FALSE;
+}
+
+EOLIAN static Eina_Bool
+_evas_image_efl_gfx_buffer_buffer_set(Eo *obj, Evas_Image_Data *o, void *pixels,
+ int width, int height, int stride,
+ Efl_Gfx_Colorspace cspace, Eina_Bool alpha,
+ unsigned int l, unsigned int r, unsigned int t, unsigned int b)
+{
+ return _evas_image_buffer_set_common(obj, o, pixels, width, height, stride, cspace, alpha, l, r, t, b, EINA_FALSE);
+}
+
+EOLIAN static Eina_Bool
+_evas_image_efl_gfx_buffer_buffer_copy_set(Eo *obj, Evas_Image_Data *o, const void *pixels,
+ int width, int height, int stride,
+ Efl_Gfx_Colorspace cspace, Eina_Bool alpha,
+ unsigned int l, unsigned int r, unsigned int t, unsigned int b)
+{
+ return _evas_image_buffer_set_common(obj, o, (void *) pixels, width, height, stride, cspace, alpha, l, r, t, b, EINA_TRUE);
+}
+
/* Legacy deprecated functions */
EAPI void