Languages

Menu
Sites
Language
How can i modified bitmap with memcpy using the buffer?

I was use this API on 2.2 version.
(Tizen::Graphics::Bitmap::Lock)
But it cannot be used on 2.3 version.
I could not find API to replace.

Is there an API that can be used to replace?

Responses

5 Replies
Marco Buettner

Tizen 2.3 use C instead C++ as programming language

pius lee

You can use image widget in elementary (EFL).

char path[256];
char* res = app_get_resource_path();
long fsize = 0;
FILE *f = NULL;
char* buf = NULL;

strcpy(path, res);
strcat(path, "baby.jpg");
f = fopen(path, "r");
fseek(f, 0, SEEK_END);
fsize = ftell(f);
fseek(f, 0, SEEK_SET);
buf = malloc(fsize);
fread(buf, fsize, 1, f);
fclose(f);

Evas_Object* img_baby = elm_image_add(box);
evas_object_size_hint_weight_set(img_baby, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(img_baby, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_image_memfile_set(img_baby, buf, fsize, "jpg", NULL);
elm_box_pack_end(box, img_baby);
evas_object_show(img_baby);

This code create elementary image widget from "baby.jpg" in application resource directory and add it to container widget(box).

You don't need to use memcpy, just use elm_image_memfile_set() function.

colin Rao

Hi, 

possible this tutorial can help you https://developer.tizen.org/documentation/tutorials/native-application/multimedia/image-util

also, tizen support the cairo lib.

Youngki Ahn

In Tizen 2.2.1

Tizen::Graphics::Bitmap bitmap;

bitmap.Construct(Dimension(100, 100), BITMAP_PIXEL_FORMAT_ARGB8888);

BufferInfo buffer_info;
bitmap.Lock(buffer_info);

In Tizen 2.3.0

cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 100, 100);

struct BufferInfo
{
        int width;
	int height;
	int pitch;
	int bitsPerPixel;
	cairo_format_t pixelFormat; // Tizen::Graphics::PixelFormat
	void* pPixels;
} buffer_info =
{
	cairo_image_surface_get_width(surface),
	cairo_image_surface_get_height(surface),
	cairo_image_surface_get_stride(surface),
	32, // CAIRO_FORMAT_ARGB32 has 32-bit
	CAIRO_FORMAT_ARGB32,
	(void*)cairo_image_surface_get_data(surface)
};

 

Palitsyna

Hello,

hope this documenteation about Image Widget will help you:

https://developer.tizen.org/documentation/guides/native-application/ui/ui-control/elementary-widgets/ui-widgets?langredirect=1#image

 

Regards,

Svetlana Palitsyna