Enlightenment CVS committal Author : titan Project : e17 Module : proto
Dir : e17/proto/ephoto/src Modified Files: ephoto_viewer.c Log Message: Ephoto's rotations are now functional and work! Yay :) =================================================================== RCS file: /cvs/e/e17/proto/ephoto/src/ephoto_viewer.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -3 -r1.13 -r1.14 --- ephoto_viewer.c 3 Oct 2006 01:50:29 -0000 1.13 +++ ephoto_viewer.c 5 Oct 2006 03:36:35 -0000 1.14 @@ -34,8 +34,7 @@ ewl_object_current_size_get(EWL_OBJECT(image_view), &ow, &oh); ewl_image_size_set(EWL_IMAGE(image_view), ow*2, oh*2); - ewl_widget_reparent(image_view); - + ewl_widget_configure(ibox); } @@ -46,8 +45,7 @@ ewl_object_current_size_get(EWL_OBJECT(image_view), &ow, &oh); ewl_image_size_set(EWL_IMAGE(image_view), ow/2, oh/2); - ewl_widget_reparent(image_view); - + ewl_widget_configure(ibox); } @@ -70,6 +68,76 @@ ewl_widget_configure(ibox); } +void rotate_left(Ewl_Widget *w, void *event, void *data) +{ + unsigned int *im_data, *im_data_new; + int index, ind, i, j, ni, nj, ew, eh, nw, nh; + + im_data = evas_object_image_data_get(EWL_IMAGE(image_view)->image, FALSE); + evas_object_image_size_get(EWL_IMAGE(image_view)->image, &ew, &eh); + index = 0; + + im_data_new = malloc(sizeof(unsigned int) * ew * eh); + + nw = eh; + nh = ew; + + for (i = 0; i < nh; i++) + { + for (j = 0; j < nw; j++) + { + ni = j; + nj = nh - i - 1; + + ind = ni * nh + nj; + + im_data_new[index] = im_data[ind]; + index++; + } + } + + evas_object_image_size_set(EWL_IMAGE(image_view)->image, nw, nh); + evas_object_image_data_set(EWL_IMAGE(image_view)->image, im_data_new); + evas_object_image_data_update_add(EWL_IMAGE(image_view)->image, 0, 0, nw, nh); + ewl_widget_configure(image_view); + ewl_widget_configure(ibox); +} + +void rotate_right(Ewl_Widget *w, void *event, void *data) +{ + unsigned int *im_data, *im_data_new; + int index, ind, i, j, ni, nj, ew, eh, nw, nh; + + im_data = evas_object_image_data_get(EWL_IMAGE(image_view)->image, FALSE); + evas_object_image_size_get(EWL_IMAGE(image_view)->image, &ew, &eh); + index = 0; + + im_data_new = malloc(sizeof(unsigned int) * ew * eh); + + nw = eh; + nh = ew; + + for (i = 0; i < nh; i++) + { + for (j = 0; j < nw; j++) + { + ni = nw - j - 1; + nj = i; + + ind = ni * nh + nj; + + im_data_new[index] = im_data[ind]; + index++; + } + } + + evas_object_image_size_set(EWL_IMAGE(image_view)->image, nw, nh); + evas_object_image_data_set(EWL_IMAGE(image_view)->image, im_data_new); + evas_object_image_data_update_add(EWL_IMAGE(image_view)->image, 0, 0, nw, nh); + ewl_widget_configure(image_view); + ewl_widget_configure(ibox); +} + void view_images(Ewl_Widget *w, void *event, void *data) { char *current_image; @@ -174,6 +242,7 @@ ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK); ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_CENTER); ewl_container_child_append(EWL_CONTAINER(hbox), button); + ewl_callback_append(button, EWL_CALLBACK_CLICKED, rotate_left, NULL); ewl_widget_show(button); button = ewl_button_new(); @@ -183,6 +252,7 @@ ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK); ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_CENTER); ewl_container_child_append(EWL_CONTAINER(hbox), button); + ewl_callback_append(button, EWL_CALLBACK_CLICKED, rotate_right, NULL); ewl_widget_show(button); ecore_dlist_goto_first(view_thumbs); ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs