Enlightenment CVS committal Author : titan Project : e17 Module : proto
Dir : e17/proto/ephoto/src/bin Modified Files: ephoto.h ephoto_gui.c ephoto_imaging.c Log Message: More cleanup/work with imaging. =================================================================== RCS file: /cvs/e/e17/proto/ephoto/src/bin/ephoto.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- ephoto.h 11 Jan 2007 23:14:28 -0000 1.6 +++ ephoto.h 12 Jan 2007 01:24:34 -0000 1.7 @@ -21,6 +21,8 @@ Ecore_List *get_images(char *directory); /* Ephoto Imaging */ +unsigned int *flip_horizontal(Ewl_Widget *image); +unsigned int *flip_vertical(Ewl_Widget *image); unsigned int *rotate_left(Ewl_Widget *image); unsigned int *rotate_right(Ewl_Widget *image); void update_image(Ewl_Widget *image, int w, int h, unsigned int *data); =================================================================== RCS file: /cvs/e/e17/proto/ephoto/src/bin/ephoto_gui.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -3 -r1.20 -r1.21 --- ephoto_gui.c 11 Jan 2007 23:25:47 -0000 1.20 +++ ephoto_gui.c 12 Jan 2007 01:24:34 -0000 1.21 @@ -19,10 +19,13 @@ /*Ephoto MVC Callbacks*/ static Ewl_Widget *directory_view_new(void); static void directory_view_assign(Ewl_Widget *w, void *data); +static Ewl_Widget *directory_header_fetch(void *data, int column); static void *directory_data_fetch(void *data, unsigned int row, unsigned int column); static int directory_data_count(void *data); /*Ephoto Image Manipulation*/ +static void flip_image_horizontal(Ewl_Widget *w, void *event, void *data); +static void flip_image_vertical(Ewl_Widget *w, void *event, void *data); static void rotate_image_left(Ewl_Widget *w, void *event, void *data); static void rotate_image_right(Ewl_Widget *w, void *event, void *data); @@ -198,7 +201,6 @@ ewl_model_count_set(model, directory_data_count); tree = ewl_tree2_new(); - ewl_tree2_headers_visible_set(EWL_TREE2(tree), FALSE); ewl_mvc_selection_mode_set(EWL_MVC(tree), EWL_SELECTION_MODE_SINGLE); ewl_object_fill_policy_set(EWL_OBJECT(tree), EWL_FLAG_FILL_ALL); ewl_container_child_append(EWL_CONTAINER(c), tree); @@ -207,7 +209,8 @@ view = ewl_view_new(); ewl_view_constructor_set(view, directory_view_new); ewl_view_assign_set(view, directory_view_assign); - + ewl_view_header_fetch_set(view, directory_header_fetch); + ewl_tree2_column_append(EWL_TREE2(tree), model, view); return tree; @@ -249,6 +252,18 @@ ewl_callback_append(w, EWL_CALLBACK_CLICKED, populate_files, NULL); } +/* The header for the tree */ +static Ewl_Widget *directory_header_fetch(void *data, int column) +{ + Ewl_Widget *label; + + label = ewl_label_new(); + ewl_label_text_set(EWL_LABEL(label), "Browser"); + ewl_widget_show(label); + + return label; +} + /* The directories that will be displayed*/ static void *directory_data_fetch(void *data, unsigned int row, unsigned int column) { @@ -294,7 +309,7 @@ static void populate_files(Ewl_Widget *w, void *event, void *data) { char *cdir, *imagef; - Ewl_Widget *image, *thumb; + Ewl_Widget *thumb; if (w) { @@ -327,12 +342,9 @@ while (!ecore_list_is_empty(images)) { imagef = ecore_list_remove_first(images); - - image = ewl_image_new(); - ewl_image_file_set(EWL_IMAGE(image), imagef, NULL); - thumb = ewl_image_thumbnail_get(EWL_IMAGE(image)); - ewl_image_file_set(EWL_IMAGE(thumb), PACKAGE_DATA_DIR "/images/album.png", NULL); + thumb = ewl_image_thumbnail_new(); + ewl_image_thumbnail_request(EWL_IMAGE_THUMBNAIL(thumb), imagef); ewl_image_proportional_set(EWL_IMAGE(thumb), TRUE); ewl_image_constrain_set(EWL_IMAGE(thumb), 100); ewl_container_child_append(EWL_CONTAINER(fbox), thumb); @@ -340,6 +352,33 @@ ewl_widget_show(thumb); } ewl_widget_configure(fbox); + ewl_widget_configure(fbox->parent); +} + +/*Flip the image 180 degrees horizontally*/ +static void flip_image_horizontal(Ewl_Widget *w, void *event, void *data) +{ + unsigned int *image_data; + int nw, nh; + + evas_object_image_size_get(EWL_IMAGE(vimage)->image, &nw, &nh); + image_data = flip_horizontal(vimage); + update_image(vimage, nw, nh, image_data); + ewl_widget_configure(vimage); + ewl_widget_configure(vimage->parent); +} + +/*Flip the image 180 degrees vertically*/ +static void flip_image_vertical(Ewl_Widget *w, void *event, void *data) +{ + unsigned int *image_data; + int nw, nh; + + evas_object_image_size_get(EWL_IMAGE(vimage)->image, &nw, &nh); + image_data = flip_vertical(vimage); + update_image(vimage, nw, nh, image_data); + ewl_widget_configure(vimage); + ewl_widget_configure(vimage->parent); } /*Rotate the image 90 degrees to the left*/ @@ -355,6 +394,7 @@ ewl_widget_configure(vimage->parent); } +/*Rotate the image 90 degrees to the right*/ static void rotate_image_right(Ewl_Widget *w, void *event, void *data) { unsigned int *image_data; @@ -449,6 +489,8 @@ ewl_object_fill_policy_set(EWL_OBJECT(ihbox), EWL_FLAG_FILL_SHRINK); ewl_widget_show(ihbox); + add_button(ihbox, "Flip Horizontal", NULL, flip_image_horizontal); + add_button(ihbox, "Flip Vertical", NULL, flip_image_vertical); add_button(ihbox, "Rotate Left", NULL, rotate_image_left); add_button(ihbox, "Rotate Right", NULL, rotate_image_right); add_button(ihbox, "Return to Catalog", NULL, view_catalog); =================================================================== RCS file: /cvs/e/e17/proto/ephoto/src/bin/ephoto_imaging.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- ephoto_imaging.c 11 Jan 2007 23:25:47 -0000 1.2 +++ ephoto_imaging.c 12 Jan 2007 01:24:34 -0000 1.3 @@ -1,18 +1,61 @@ #include "ephoto.h" -void update_image(Ewl_Widget *image, int w, int h, unsigned int *data) +unsigned int *flip_horizontal(Ewl_Widget *image) { - if (w && h && !data) + unsigned int *im_data, *im_data_new; + int index, ind, i, j, ni, nj, ew, eh; + + im_data = evas_object_image_data_get(EWL_IMAGE(image)->image, FALSE); + evas_object_image_size_get(EWL_IMAGE(image)->image, &ew, &eh); + + index = 0; + + im_data_new = malloc(sizeof(unsigned int) * ew * eh); + + for (i = 0; i < eh; i ++) { - ewl_image_size_set(EWL_IMAGE(image), w, h); - ewl_widget_configure(image); + for (j = 0; j < ew; j++) + { + ni = i; + nj = ew - j - 1; + + ind = ni * ew + nj; + + im_data_new[index] = im_data[ind]; + + index++; + } } - if (w && h && data) + return im_data_new; +} + +unsigned int *flip_vertical(Ewl_Widget *image) +{ + unsigned int *im_data, *im_data_new; + int index, ind, i, j, ni, nj, ew, eh; + + im_data = evas_object_image_data_get(EWL_IMAGE(image)->image, FALSE); + evas_object_image_size_get(EWL_IMAGE(image)->image, &ew, &eh); + + index = 0; + + im_data_new = malloc(sizeof(unsigned int) * ew * eh); + + for (i = 0; i < eh; i++) { - evas_object_image_size_set(EWL_IMAGE(image)->image, w, h); - evas_object_image_data_set(EWL_IMAGE(image)->image, data); - evas_object_image_data_update_add(EWL_IMAGE(image)->image, 0, 0, w, h); + for (j = 0; j < ew; j++) + { + ni = eh - i - 1; + nj = j; + + ind = ni * ew + nj; + + im_data_new[index] = im_data[ind]; + + index++; + } } + return im_data_new; } unsigned int *rotate_left(Ewl_Widget *image) @@ -44,7 +87,6 @@ index++; } } - return im_data_new; } @@ -77,7 +119,20 @@ index++; } } - return im_data_new; } +void update_image(Ewl_Widget *image, int w, int h, unsigned int *data) +{ + if (w && h && !data) + { + ewl_image_size_set(EWL_IMAGE(image), w, h); + ewl_widget_configure(image); + } + if (w && h && data) + { + evas_object_image_size_set(EWL_IMAGE(image)->image, w, h); + evas_object_image_data_set(EWL_IMAGE(image)->image, data); + evas_object_image_data_update_add(EWL_IMAGE(image)->image, 0, 0, w, h); + } +} ------------------------------------------------------------------------- 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