comparison dwtest.c @ 1243:c191a562c14a

Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2. Added new strech option to the test program to test this functionality. OS/2 version is untested and I am not sure I got the math right... GTK and Mac versions to come soon.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Wed, 19 Oct 2011 08:14:05 +0000
parents 8e37ebb3fab7
children 2d2b945ee0bf
comparison
equal deleted inserted replaced
1242:8e37ebb3fab7 1243:c191a562c14a
91 status1, 91 status1,
92 status2, 92 status2,
93 rendcombo, 93 rendcombo,
94 imagexspin, 94 imagexspin,
95 imageyspin, 95 imageyspin,
96 imagestretchcheck,
96 container_status, 97 container_status,
97 tree_status, 98 tree_status,
98 stext, 99 stext,
99 tree, 100 tree,
100 container, 101 container,
123 int menu_enabled = 1; 124 int menu_enabled = 1;
124 125
125 HPIXMAP text1pm,text2pm,image; 126 HPIXMAP text1pm,text2pm,image;
126 HICN fileicon,foldericon; 127 HICN fileicon,foldericon;
127 int mle_point=-1; 128 int mle_point=-1;
128 int image_x = 20, image_y = 20; 129 int image_x = 20, image_y = 20, image_stretch = 0;
129 130
130 int font_width = 8; 131 int font_width = 8;
131 int font_height=12; 132 int font_height=12;
132 int rows=10,width1=6,cols=80; 133 int rows=10,width1=6,cols=80;
133 char *current_file = NULL; 134 char *current_file = NULL;
352 HPIXMAP pixmap = direct ? NULL : hpm; 353 HPIXMAP pixmap = direct ? NULL : hpm;
353 HWND window = direct ? textbox2 : 0; 354 HWND window = direct ? textbox2 : 0;
354 355
355 image_x = (int)dw_spinbutton_get_pos(imagexspin); 356 image_x = (int)dw_spinbutton_get_pos(imagexspin);
356 image_y = (int)dw_spinbutton_get_pos(imageyspin); 357 image_y = (int)dw_spinbutton_get_pos(imageyspin);
358 image_stretch = dw_checkbox_get(imagestretchcheck);
357 359
358 dw_color_foreground_set(DW_CLR_WHITE); 360 dw_color_foreground_set(DW_CLR_WHITE);
359 dw_draw_rect(window, pixmap, TRUE, 0, 0, width, height); 361 dw_draw_rect(window, pixmap, TRUE, 0, 0, width, height);
360 dw_color_foreground_set(DW_CLR_DARKPINK); 362 dw_color_foreground_set(DW_CLR_DARKPINK);
361 dw_draw_rect(window, pixmap, TRUE, 10, 10, width - 20, height - 20); 363 dw_draw_rect(window, pixmap, TRUE, 10, 10, width - 20, height - 20);
362 dw_color_foreground_set(DW_CLR_GREEN); 364 dw_color_foreground_set(DW_CLR_GREEN);
363 dw_color_background_set(DW_CLR_DARKRED); 365 dw_color_background_set(DW_CLR_DARKRED);
364 dw_draw_text(window, pixmap, 10, 10, "This should be aligned with the edges."); 366 dw_draw_text(window, pixmap, 10, 10, "This should be aligned with the edges.");
365 if(image) 367 if(image)
366 { 368 {
367 dw_pixmap_bitblt(window, pixmap, image_x, image_y, (int)DW_PIXMAP_WIDTH(image), (int)DW_PIXMAP_HEIGHT(image), 0, image, 0, 0); 369 if(image_stretch)
370 dw_pixmap_stretch_bitblt(window, pixmap, 10, 10, width - 20, height - 20, 0, image, 0, 0, (int)DW_PIXMAP_WIDTH(image), (int)DW_PIXMAP_HEIGHT(image));
371 else
372 dw_pixmap_bitblt(window, pixmap, image_x, image_y, (int)DW_PIXMAP_WIDTH(image), (int)DW_PIXMAP_HEIGHT(image), 0, image, 0, 0);
368 } 373 }
369 374
370 /* If we aren't drawing direct do a bitblt */ 375 /* If we aren't drawing direct do a bitblt */
371 if(!direct && !hpma) 376 if(!direct && !hpma)
372 { 377 {
946 dw_box_pack_start( hbox, imageyspin, 25, 25, TRUE, FALSE, 0); 951 dw_box_pack_start( hbox, imageyspin, 25, 25, TRUE, FALSE, 0);
947 dw_spinbutton_set_limits(imagexspin, 2000, 0); 952 dw_spinbutton_set_limits(imagexspin, 2000, 0);
948 dw_spinbutton_set_limits(imageyspin, 2000, 0); 953 dw_spinbutton_set_limits(imageyspin, 2000, 0);
949 dw_spinbutton_set_pos(imagexspin, 20); 954 dw_spinbutton_set_pos(imagexspin, 20);
950 dw_spinbutton_set_pos(imageyspin, 20); 955 dw_spinbutton_set_pos(imageyspin, 20);
956 imagestretchcheck = dw_checkbox_new("Stretch", 1021);
957 dw_box_pack_start( hbox, imagestretchcheck, 25, 25, TRUE, FALSE, 0);
951 958
952 button1 = dw_button_new( "Refresh", 1223L ); 959 button1 = dw_button_new( "Refresh", 1223L );
953 dw_box_pack_start( hbox, button1, 100, 25, FALSE, FALSE, 0); 960 dw_box_pack_start( hbox, button1, 100, 25, FALSE, FALSE, 0);
954 button2 = dw_button_new( "Print", 1224L ); 961 button2 = dw_button_new( "Print", 1224L );
955 dw_box_pack_start( hbox, button2, 100, 25, FALSE, FALSE, 0); 962 dw_box_pack_start( hbox, button2, 100, 25, FALSE, FALSE, 0);
1004 dw_signal_connect(textbox2, DW_SIGNAL_CONFIGURE, DW_SIGNAL_FUNC(configure_event), text2pm); 1011 dw_signal_connect(textbox2, DW_SIGNAL_CONFIGURE, DW_SIGNAL_FUNC(configure_event), text2pm);
1005 dw_signal_connect(textbox2, DW_SIGNAL_MOTION_NOTIFY, DW_SIGNAL_FUNC(motion_notify_event), (void *)1); 1012 dw_signal_connect(textbox2, DW_SIGNAL_MOTION_NOTIFY, DW_SIGNAL_FUNC(motion_notify_event), (void *)1);
1006 dw_signal_connect(textbox2, DW_SIGNAL_BUTTON_PRESS, DW_SIGNAL_FUNC(motion_notify_event), (void *)0); 1013 dw_signal_connect(textbox2, DW_SIGNAL_BUTTON_PRESS, DW_SIGNAL_FUNC(motion_notify_event), (void *)0);
1007 dw_signal_connect(hscrollbar, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(scrollbar_valuechanged_callback), (void *)status1); 1014 dw_signal_connect(hscrollbar, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(scrollbar_valuechanged_callback), (void *)status1);
1008 dw_signal_connect(vscrollbar, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(scrollbar_valuechanged_callback), (void *)status1); 1015 dw_signal_connect(vscrollbar, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(scrollbar_valuechanged_callback), (void *)status1);
1016 dw_signal_connect(imagestretchcheck, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(refresh_callback), NULL);
1009 dw_signal_connect(button1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(refresh_callback), NULL); 1017 dw_signal_connect(button1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(refresh_callback), NULL);
1010 dw_signal_connect(button2, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(print_callback), NULL); 1018 dw_signal_connect(button2, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(print_callback), NULL);
1011 dw_signal_connect(rendcombo, DW_SIGNAL_LIST_SELECT, DW_SIGNAL_FUNC(render_select_event_callback), NULL ); 1019 dw_signal_connect(rendcombo, DW_SIGNAL_LIST_SELECT, DW_SIGNAL_FUNC(render_select_event_callback), NULL );
1012 dw_signal_connect(mainwindow, DW_SIGNAL_KEY_PRESS, DW_SIGNAL_FUNC(keypress_callback), NULL); 1020 dw_signal_connect(mainwindow, DW_SIGNAL_KEY_PRESS, DW_SIGNAL_FUNC(keypress_callback), NULL);
1013 1021