forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem Displaying JPG File
Goto page Previous  1, 2
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
IanLambley



Joined: 17 Dec 2006
Posts: 490
Location: Sunderland

PostPosted: Mon Jul 21, 2008 10:28 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group