So, I'm trying to follow default Cairo tutorial: https://developer.tizen.org/development/tutorials/native-application/graphics/cairo?langredirect=1, but I have black screen only.
This is my code:
void cairo_drawing(appdata_s *data) { appdata_s *ad = data; int d = 360; cairo_set_source_rgba(ad->cairo, 1, 1, 1, 1); cairo_paint(ad->cairo); cairo_translate(ad->cairo, 0.1 * d, 0.1 * d); cairo_set_line_width(ad->cairo, 2); cairo_set_source_rgba(ad->cairo, 0.0, 0.0, 1.0, 1.0); cairo_move_to(ad->cairo, 0.2 * d , 0.2 * d); cairo_line_to(ad->cairo, 0.4 * d, 0.3 * d); cairo_rel_line_to(ad->cairo, 0.2 * d, -0.1 * d); cairo_arc(ad->cairo, 0.4 * d, 0.4 * d, 0.2* d * sqrt(2), -0.25 * M_PI, 0.25 * M_PI); cairo_rel_curve_to(ad->cairo, -0.2* d, -0.1 * d, -0.2* d, 0.1 * d, -0.4 * d, 0); cairo_close_path(ad->cairo); cairo_fill(ad->cairo); cairo_rectangle(ad->cairo, 0, 0, 0.8 * d, 0.8 * d); cairo_stroke(ad->cairo); cairo_surface_flush(ad->surface); unsigned char * imageData = cairo_image_surface_get_data(cairo_get_target(ad->cairo)); evas_object_image_data_set(ad->img, imageData); evas_object_image_data_update_add(ad->img, 0, 0, 360, 360); } static void create_gui(appdata_s *ad) { ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE); if (elm_win_wm_rotation_supported_get(ad->win)) { int rots[4] = { 0, 90, 180, 270 }; elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4); } evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL); evas_object_show(ad->win); ad->img = evas_object_image_filled_add(evas_object_evas_get(ad->win)); evas_object_show(ad->img); evas_object_geometry_get(ad->win, NULL, NULL, ad->width, ad->height); ad->surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 360, 360); ad->cairo = cairo_create(ad->surface); dlog_print(DLOG_ERROR, LOG_TAG, cairo_status_to_string(cairo_status(ad->cairo))); } static bool app_create(void *data) { appdata_s *ad = (appdata_s *)data; create_gui(ad); cairo_drawing(ad); return true; }
So, please, can anyone help me?