Enlightenment CVS committal Author : titan Project : e17 Module : apps/ephoto
Dir : e17/apps/ephoto/src/bin Modified Files: ephoto_edit_view.c ephoto_imaging.c Log Message: Sepia speedups and fixes. Sepia is tons better now. =================================================================== RCS file: /cvs/e/e17/apps/ephoto/src/bin/ephoto_edit_view.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -3 -r1.23 -r1.24 --- ephoto_edit_view.c 23 May 2007 22:02:56 -0000 1.23 +++ ephoto_edit_view.c 25 May 2007 20:55:53 -0000 1.24 @@ -16,6 +16,8 @@ static void image_sharpen(Ewl_Widget *w, void *event, void *data); static void image_grayscale(Ewl_Widget *w, void *event, void *data); static void image_sepia(Ewl_Widget *w, void *event, void *data); +//static void close_channel(Ewl_Widget *w, void *event, void *data); +//static void channel_mixer(Ewl_Widget *w, void *event, void *data); /*Add the edit view*/ Ewl_Widget *add_edit_view(Ewl_Widget *c) @@ -89,37 +91,37 @@ Ewl_Widget *button; button = add_button(c, "Zoom In", PACKAGE_DATA_DIR "/images/search.png", zoom_in, NULL); - ewl_button_image_size_set(EWL_BUTTON(button), 30, 30); + ewl_button_image_size_set(EWL_BUTTON(button), 20, 20); ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_LEFT); ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_HFILL); button = add_button(c, "Zoom Out", PACKAGE_DATA_DIR "/images/search.png", zoom_out, NULL); - ewl_button_image_size_set(EWL_BUTTON(button), 30, 30); + ewl_button_image_size_set(EWL_BUTTON(button), 20, 20); ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_LEFT); ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_HFILL); //button = add_button(c, "Zoom 1:1", PACKAGE_DATA_DIR "/images/search.png", zoom_full, NULL); - ewl_button_image_size_set(EWL_BUTTON(button), 30, 30); + ewl_button_image_size_set(EWL_BUTTON(button), 20, 20); ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_LEFT); ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_HFILL); button = add_button(c, "Rotate Left", PACKAGE_DATA_DIR "/images/undo.png", rotate_image_left, NULL); - ewl_button_image_size_set(EWL_BUTTON(button), 30, 30); + ewl_button_image_size_set(EWL_BUTTON(button), 20, 20); ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_LEFT); ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_HFILL); button = add_button(c, "Rotate Right", PACKAGE_DATA_DIR "/images/redo.png", rotate_image_right, NULL); - ewl_button_image_size_set(EWL_BUTTON(button), 30, 30); + ewl_button_image_size_set(EWL_BUTTON(button), 20, 20); ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_LEFT); ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_HFILL); button = add_button(c, "Flip Horizontally", PACKAGE_DATA_DIR "/images/go-next.png", flip_image_horizontal, NULL); - ewl_button_image_size_set(EWL_BUTTON(button), 30, 30); + ewl_button_image_size_set(EWL_BUTTON(button), 20, 20); ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_LEFT); ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_HFILL); button = add_button(c, "Flip Vertically", PACKAGE_DATA_DIR "/images/go-down.png", flip_image_vertical, NULL); - ewl_button_image_size_set(EWL_BUTTON(button), 30, 30); + ewl_button_image_size_set(EWL_BUTTON(button), 20, 20); ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_LEFT); ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_HFILL); @@ -132,25 +134,29 @@ Ewl_Widget *button; button = add_button(c, "Blur Image", NULL, image_blur, NULL); - ewl_button_image_size_set(EWL_BUTTON(button), 30, 30); + ewl_button_image_size_set(EWL_BUTTON(button), 20, 20); ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_LEFT); ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_HFILL); button = add_button(c, "Sharpen Image", NULL, image_sharpen, NULL); - ewl_button_image_size_set(EWL_BUTTON(button), 30, 30); + ewl_button_image_size_set(EWL_BUTTON(button), 20, 20); ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_LEFT); ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_HFILL); button = add_button(c, "Black and White", NULL, image_grayscale, NULL); - ewl_button_image_size_set(EWL_BUTTON(button), 30, 30); + ewl_button_image_size_set(EWL_BUTTON(button), 20, 20); ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_LEFT); ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_HFILL); button = add_button(c, "Sepia", NULL, image_sepia, NULL); - ewl_button_image_size_set(EWL_BUTTON(button), 30, 30); + ewl_button_image_size_set(EWL_BUTTON(button), 20, 20); ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_LEFT); ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_HFILL); +/* button = add_button(c, "Channel Editor", NULL, channel_mixer, NULL); + ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_LEFT); + ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_HFILL);*/ + return; } @@ -234,7 +240,7 @@ image->oh = nh; ewl_object_preferred_inner_size_set(EWL_OBJECT(em->eimage), nw, nh); ewl_widget_configure(em->eimage->parent); - + return; } @@ -352,4 +358,58 @@ return; } + +/*Close the Channel Mixer*/ +/*static void close_channel(Ewl_Widget *w, void *event, void *data) +{ + Ewl_Widget *win; + + win = data; + + ewl_widget_destroy(win); +}*/ + +/*Add a Channel Mixer*/ +/*static void channel_mixer(Ewl_Widget *w, void *event, void *data) +{ + Ewl_Widget *window, *vbox, *ol, *image, *hist; + + window = add_window("Channel Editor", 200, 400, NULL, NULL); + ewl_callback_append(window, EWL_CALLBACK_DELETE_WINDOW, close_channel, window); + + vbox = add_box(window, EWL_ORIENTATION_VERTICAL, 5); + + ol = ewl_overlay_new(); + ewl_object_alignment_set(EWL_OBJECT(ol), EWL_FLAG_ALIGN_CENTER); + ewl_object_fill_policy_set(EWL_OBJECT(ol), EWL_FLAG_FILL_SHRINK); + ewl_container_child_append(EWL_CONTAINER(vbox), ol); + ewl_widget_show(ol); + + image = add_image(ol, ewl_image_file_path_get(EWL_IMAGE(em->eimage)), + 0, NULL, NULL); + ewl_image_size_set(EWL_IMAGE(image), 175, 175); + ewl_object_alignment_set(EWL_OBJECT(image), EWL_FLAG_ALIGN_CENTER); + + hist = ewl_histogram_new(); + ewl_histogram_channel_set(EWL_HISTOGRAM(hist), EWL_HISTOGRAM_CHANNEL_R); + ewl_histogram_image_set(EWL_HISTOGRAM(hist), EWL_IMAGE(image)); + ewl_object_fill_policy_set(EWL_OBJECT(hist), EWL_FLAG_FILL_ALL); + ewl_container_child_append(EWL_CONTAINER(ol), hist); + ewl_widget_show(hist); + + hist = ewl_histogram_new(); + ewl_histogram_channel_set(EWL_HISTOGRAM(hist), EWL_HISTOGRAM_CHANNEL_G); + ewl_histogram_image_set(EWL_HISTOGRAM(hist), EWL_IMAGE(image)); + ewl_object_fill_policy_set(EWL_OBJECT(hist), EWL_FLAG_FILL_ALL); + ewl_container_child_append(EWL_CONTAINER(ol), hist); + ewl_widget_show(hist); + + hist = ewl_histogram_new(); + ewl_histogram_channel_set(EWL_HISTOGRAM(hist), EWL_HISTOGRAM_CHANNEL_B); + ewl_histogram_image_set(EWL_HISTOGRAM(hist), EWL_IMAGE(image)); + ewl_object_fill_policy_set(EWL_OBJECT(hist), EWL_FLAG_FILL_ALL); + ewl_container_child_append(EWL_CONTAINER(ol), hist); + ewl_widget_show(hist); + +}*/ =================================================================== RCS file: /cvs/e/e17/apps/ephoto/src/bin/ephoto_imaging.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -3 -r1.15 -r1.16 --- ephoto_imaging.c 24 May 2007 22:43:03 -0000 1.15 +++ ephoto_imaging.c 25 May 2007 20:55:53 -0000 1.16 @@ -370,10 +370,9 @@ unsigned int *sepia_image(Ewl_Widget *image) { unsigned int *im_data, *im_data_new; - int i, r, g, b, a, ew, eh; - float h, s, v; + int i, r, rr, g, gg, b, bb, a, ew, eh; - im_data = evas_object_image_data_get(EWL_IMAGE(image)->image, FALSE); + im_data = evas_object_image_data_get(EWL_IMAGE(image)->image, FALSE); evas_object_image_size_get(EWL_IMAGE(image)->image, &ew, &eh); im_data_new = malloc(sizeof(unsigned int) * ew * eh); @@ -384,11 +383,18 @@ g = (int)((im_data[i] >> 8) & 0xff); r = (int)((im_data[i] >> 16) & 0xff); a = (int)((im_data[i] >> 24) & 0xff); + + rr = (int)(((r + g + b)/3)+40); + if (rr < 0) rr = 0; + if (rr > 255) rr = 255; + gg = (int)(((r + g + b)/3)+2); + if (gg < 0) gg = 0; + if (gg > 255) gg = 255; + bb = (int)(((r + g + b)/3)+2); + if (bb < 0) bb = 0; + if (bb > 255) bb = 255; - evas_color_rgb_to_hsv(r, g, b, &h, &s, &v); - evas_color_hsv_to_rgb(35, s, v, &r, &g, &b); - - im_data_new[i] = (a << 24) | (r << 16) | (g << 8) | b; + im_data_new[i] = (a << 24) | (rr << 16) | (gg << 8) | bb; } return im_data_new; } ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs