I am trying to save an image from a %gr window to a jpg file, but I find two problems. Briefly, the program works as follows:
First imports a bmp image into the clearwin window with:
call clear_screen@ call perform_graphics_update@ call set_rgb_colours_default@(1) call get_dib_size@(file,hres,vres,nb_colours,ier) if(ier/= 0) STOP 'Problem' call create_graphics_region@(2,hres,vres) call use_rgb_colours@(2,1) call select_graphics_object@(2) ihfile = import_bmp@(file,ierr) call dib_paint@(0l,0l,ihfile,0l,0l) call copy_graphics_region@(1,0,0,800,600,2,0,0,hres,vres,srccopy) call perform_graphics_update@
Then performs the determination of the image contour creating a new graphics region (3) where it draws points in red for contour and in white for backgraound and copies this image to the screen:
call create_graphics_region@(3,hres,vres) call select_graphics_object@(3) call draw_point@(i,j,red) call draw_point@(i,j,white) call clear_screen@ call copy_graphics_region@(1,0,0,800,600,3,0,0,hres,vres,srccopy) call delete_graphics_region@(3) call perform_graphics_update@
The %gr window now shows the graphics of region 3, but...when I set
ipc=export_image@('output2.jpg')
the red contour created in graphics region 3 and shown in the screen is not saved (just a white renctangle). If I do not call the clear_screen@, the original bmp image is saved as jpg ALTHOUGH it is no more shown in the window! Only the contour image appears in %dw!. And what is more intriguing, once the jpg image is saved, the program closes automatically! (it works like an Exit). Is anything wrong with my code or am I misunderstanding the use of export_image function?
Agustin