IanLambley
Joined: 17 Dec 2006 Posts: 490 Location: Sunderland
|
Posted: Mon Jul 21, 2008 10:28 am Post subject: |
|
|
I don't know if this helps, but I was having difficulty placing an image on the printer. The solution was to put it to a separate intermediate graphics region and then copy that region to the printer. In your case, you could copy a section of this graphics region.
Code: |
program print_test
include <windows.ins>,nolist
integer*4 iwidth,iheight,dx,dy
external idraw_image
call GET_DIB_SIZE@( 'cball7.jpg', iWIDTH, iHEIGHT, NBBP, iERCODE )
print *,'iWIDTH, iHEIGHT, NBBP, iERCODE'
print *,iWIDTH, iHEIGHT, NBBP, iERCODE
iwid=500
ihgt=300
i=winio@('%ca[image in window]%ww&')
i=winio@('%rj%im[{cball7.jpg}]%ff&')
i=winio@('%`gr[white,RGB_COLOURS]&', iwid, ihgt, ihandle)
i=winio@('%sc',idraw_image)
call set_clearwin_string@('printer_document','Print image')
ihandle2 = 2
i=CREATE_GRAPHICS_REGION@( iHANDLE2, iWIDTH, iHEIGHT )
i=USE_RGB_COLOURS@( iHANDLE2, .true.)
ihandle3 = 3
jwidth = iwidth*4
jHEIGHT = iHEIGHT*4
i=CREATE_GRAPHICS_REGION@( iHANDLE3, jwidth, jHEIGHT )
i=USE_RGB_COLOURS@( iHANDLE3, .true.)
i=SELECT_GRAPHICS_OBJECT@( iHANDLE2 )
i=IMPORT_IMAGE@('{cball7.jpg}', 0, 0 )
ihandl = 1
itest = open_printer@(ihandl)
if(itest .ne. 0)then
call use_rgb_colours@(1,1)
i=SELECT_GRAPHICS_OBJECT@( ihandl )
call get_graphical_resolution@( ix, iy )
dx = ix/8
dy = iy/8
i = COPY_GRAPHICS_REGION@(ihandl , DX, DY, iWIDTH, iHEIGHT, &
iHANDLE2, 0,0, iWIDTH, iHEIGHT, SRCCOPY)
i = COPY_GRAPHICS_REGION@(ihandle3, 0,0, jwidth, jHEIGHT, &
iHANDLE2, 0,0, iWIDTH, iHEIGHT, SRCCOPY)
dx = ix/4
dy = iy/4
i = COPY_GRAPHICS_REGION@(ihandl , DX,DY, jwidth, jHEIGHT, &
iHANDLE3, 0, 0, jWIDTH, jHEIGHT, SRCCOPY)
!c now close the printer, sending the output to the printer
itest = close_printer@(ihandl)
endif
i=DELETE_GRAPHICS_REGION@( iHANDLE2 )
i=DELETE_GRAPHICS_REGION@( iHANDLE3 )
end
integer*4 function idraw_image()
include <windows.ins>,nolist
idraw_image= 1
i=IMPORT_IMAGE@('{cball7.jpg}', 100,50 )
end
|
|
|