|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
BILLDOWS
Joined: 22 Jul 2005 Posts: 86 Location: Swansea, UK
|
Posted: Tue Aug 07, 2007 4:22 pm Post subject: Copying bitmap between drawing surfaces. |
|
|
I want to display a bitmap into an off-screen graphics region and then copy this onto the screen.
The value returned by get_dib_size shows that there are 8 bits/ pixel (matching the windows properties and the Adobe creator)
When written direct to the screen there is no problem. However when written off-screen and then copied to the screen everything is fine ONLY IF compiled with fullcheck. When compiled WITHOUT fullcheck it displays as a black rectangle.
A simple version of the program is attached below.
Any assistance would be much appreciated.
winapp
options (intl)
include <windows.ins>
character*9 file
c
c set up whole screen as graphics area
c
ixscrn = clearwin_info@('screen_width')
iyscrn = clearwin_info@('screen_depth')
iwiw = winio@('%ww%`gr&',ixscrn,iyscrn,1)
iwiw = winio@('%lw&',ictrl1)
iwiw = winio@('%mn[Exit]','EXIT')
call use_rgb_colours@(1,1)
c
c----------- get the bit map details -----------------------------------
c
file = 'boots.bmp'
call get_dib_size@(file,ixfile,iyfile,nbits,ierr)
c
c----------- set up off-screen region to accomodate the bitmap image --
c
call create_graphics_region@(2,ixfile,iyfile)
call use_rgb_colours@(2,1)
c
c------------ import image to region -----------------------------------
c
call select_graphics_object@(2)
ihfile = import_bmp@(file,ierr)
call dib_paint@(0L,0L,ihfile,0L,0L)
c
c------------ copy image to screen -------------------------------------
c
call select_graphics_object@(1L)
call copy_graphics_region@(1,10,10,ixfile,iyfile,
1 2, 0, 0,ixfile,iyfile,scrcopy)
call perform_graphics_update@
end |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2554 Location: Sydney
|
Posted: Wed Aug 08, 2007 1:15 am Post subject: |
|
|
Bill,
I checked my drawing to virtual windows and noted that I have used variables to store the handles for the screen and each graphics region. This may be a difference with what you have done ?
I create/draw all my screens, rather than use "dib", but I think once the image is a memory graphics image, there is no difference (?)
Also calls to "call perform_graphics_update@()" may help. My call to this is hidden in some of my other clean-up routines.
Below is a sample of some of my calls.
Regards John
!
CALL GET_CRT_SIZE (NXPIX, NYPIX)
DO II = 0,NUM_WOBBLE_SCREENS
!
! set up each virtual screen
handle(ii) = ii+10
i = create_graphics_region@ (handle(ii), nxpix+11, nypix+35)
i = select_graphics_object@ (handle(ii))
!
! draw to the virtual screen
call discel_pol (ddnode, cycfac, 0)
!
! return to screen
i = select_graphics_object@ (w_handle) ! select screen for report
END DO
!
! now cycle through each screen display
!
num = num_wobble_screens*(2*wobble_tot_screens+1) ! run for 60 seconds
DO k = 0, num
II = MOD (k,NUM_WOBBLE_SCREENS*2)
IF (II.GT.WOBBLE_NUM_SCREENS) II = NUM_WOBBLE_SCREENS*2-II
!
i = copy_graphics_region@ (w_handle, 6,6,nxpix,nypix, &
handle(ii), 6,6,nxpix,nypix, srccopy)
!
...
call sleep@ (wait)
call screen_report (string) ! This also finalises the screen
!
END DO |
|
Back to top |
|
|
BILLDOWS
Joined: 22 Jul 2005 Posts: 86 Location: Swansea, UK
|
Posted: Wed Aug 08, 2007 8:28 pm Post subject: |
|
|
Dear John,
Many thanks for you suggestions. I like yourself regularly create and copy around graphics I have created, but the problem here does seem to be the DIB. In all other respects the program posted is similar to that used for 'own images'.
Thanks again
Bill |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2554 Location: Sydney
|
Posted: Thu Aug 09, 2007 1:27 am Post subject: |
|
|
Bill,
you should use implicit_none !
I found 2 possible problems :
dib_paint@ should be a function, returning a sucess status
ii = dib_paint@(0L,0L,ihfile,0L,0L) ! is a function
(0L is same as 0 ?)
call copy_graphics_region@(1,10,10,ixfile,iyfile, &
2, 0, 0,ixfile,iyfile,scrcopy)
"scrcopy" should be "srccopy"
Also, I'm a convert to free format, so I assume your continuation format on the copy_graphics_region@ was ok
can ixfile and iyfile be > ixscrn-10 or iyscrn-10 ?
I hope this fixes the problem.
Regards John |
|
Back to top |
|
|
BILLDOWS
Joined: 22 Jul 2005 Posts: 86 Location: Swansea, UK
|
Posted: Fri Aug 10, 2007 6:51 am Post subject: |
|
|
Dear John,
MOST grateful for your continued attention to my code. I believe that all the points raised by you are in fact OK, but you did spot the real problem -SRCCOPY not SCRCOPY. I have used the command many times but on this occasion did not 're-use' old code and dyslexia took over.
(Screen copy !!! / source copy!!)
In fullcheck it obviously sets everything to zero and SCRCOPY then works!
Sincere thanks again
Bill |
|
Back to top |
|
|
|
|
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
|