Brian,
as in my own previos tests, finally I get an error message: 'Invalid handle passed to EXPORT_BMP@'.
I compiled your code (without attempt to resize) and put it into a modern form:
winapp
program resize
use mswin
IMPLICIT NONE
!INCLUDE <windows.ins> ! wie winapp und mswin
character*60 :: bmpfile
integer*4 :: hDib,res,hres,vres,nb_colours,ier,hres2,vres2,hres1,vres1,ixpos,iypos
INTEGER i
real :: scale,bscale
INTEGER*4 :: r_handle ,rr_handle,g_handle
Integer :: x1,y1,offsetx,offsety,xmax,ymax
bmpfile='trm_hex.bmp'
r_handle=888
rr_handle=999
g_handle=123
!Brian:
i=winio@('%`gr[white,metafile_resize]&',426L,600L,g_handle)
print *,'%gr: g_handle,i=',g_handle,i
call get_graphical_resolution@(xmax,ymax)
print *,'xmax,ymax=',xmax,ymax
scale=1.
!file='logo.bmp'
bmpfile='trm_hex.bmp'
call get_dib_size@(bmpfile,hres,vres,nb_colours,ier)
print *,'hres,vres,nb_colours,ier=',hres,vres,nb_colours,ier
i= create_graphics_region@(r_handle,hres,vres)
print *,'create_ : i=',i
call use_rgb_colours@(r_handle,1)
i= select_graphics_object@(r_handle)
print *,'select: i=',i
hdib= import_bmp@(bmpfile,ier)
if (ier==0) print *,'import_bmp : hdib,ier=',hdib,ier, ' sucess'
call dib_paint@(0,0,hDib,0,0)
i= create_graphics_region@(rr_handle,5*hres,5*vres)
print *,'create_ : i=',i
call use_rgb_colours@(rr_handle,1)
i= select_graphics_object@(rr_handle)
print *,'select_ : rr_handle,i=',rr_handle,i
! bscale is defined by size of graphics region ie screen or plotter
bscale=1.
hres1=bscale*hres
vres1=bscale*vres
i= copy_graphics_region@(rr_handle,0,0,hres1,vres1,r_handle,0,0,hres,vres,SRCCOPY)
if (i==1) print *,'copy_ : i=',i, ' success'
offsetx=0
offsety=0
x1=((offsetx)*scale+.5)
y1=((offsety)*scale+.5)
i= select_graphics_object@(g_handle)
print *,'select_ : i=',i
i= copy_graphics_region@(g_handle,x1,y1,hres1,vres1,rr_handle,0,0,hres1,vres1,SRCCOPY)
if (i==1) print *,'copy_ : g_handle,i=',g_handle,i,' success'
if (i/=1) print *,'copy_ : g_handle,i=',g_handle,i,' no success'
i= select_graphics_object@(g_handle)
call export_bmp@(g_handle,'resized.bmp',ier)
print *,'ier'
STOP
The testprints look good, except the first returning i=-1. Why?
&',426L,600L,g_handle)
print *,'%gr: g_handle,i=',g_handle,i
call get_graphical_resolution@(xmax,ymax)
print *,'xmax,ymax=',xmax,ymax
scale=1.
!file='logo.bmp'
bmpfile='trm_hex.bmp'
call get_dib_size@(bmpfile,hres,vres,nb_colours,ier)
print *,'hres,vres,nb_colours,ier=',hres,vres,nb_colours,ier
i= create_graphics_region@(r_handle,hres,vres)
print *,'create_ : i=',i
call use_rgb_colours@(r_handle,1)
i= select_graphics_object@(r_handle)
print *,'select: i=',i
hdib= import_bmp@(bmpfile,ier)
if (ier==0) print *,'import_bmp : hdib,ier=',hdib,ier, ' sucess'
call dib_paint@(0,0,hDib,0,0)
i= create_graphics_region@(rr_handle,5*hres,5*vres)
print *,'create_ : i=',i
call use_rgb_colours@(rr_handle,1)
i= select_graphics_object@(rr_handle)
print *,'select_ : rr_handle,i=',rr_handle,i
! bscale is defined by size of graphics region ie screen or plotter
bscale=1.
hres1=bscale*hres
vres1=bscale*vres
i= copy_graphics_region@(rr_handle,0,0,hres1,vres1,r_handle,0,0,hres,vres,SRCCOPY)
if (i==1) print *,'copy_ : i=',i, ' success'
offsetx=0
offsety=0
x1=((offsetx)*scale+.5)
y1=((offsety)*scale+.5)
i= select_graphics_object@(g_handle)
print *,'select_ : i=',i
i= copy_graphics_region@(g_handle,x1,y1,hres1,vres1,rr_handle,0,0,hres1,vres1,SRCCOPY)
if (i==1) print *,'copy_ : g_handle,i=',g_handle,i,' success'
if (i/=1) print *,'copy_ : g_handle,i=',g_handle,i,' no success'
i= select_graphics_object@(g_handle)
call export_bmp@(g_handle,'resized.bmp',ier)
print *,'ier'
STOP
The testprints look good, except the first returning i=-1. Why?
[quote:ff8b7ac1f6]%gr: g_handle,i= 123 -1
xmax,ymax= 426 600
hres,vres,nb_colours,ier= 200 125 24 0
create_ : i= 1
select: i= 1
import_bmp : hdib,ier= 3446440 0 sucess
create_ : i= 1
select_ : rr_handle,i= 999 1
copy_ : i= 1 success
select_ : i= 1
copy_ : g_handle,i= 123 1 success
As said, the program aborts with 'Invalid handle passed to EXPORT_BMP@'. An empty file 'resized.bmp' is created. What could be wrong?