Paul,
I have tried to combine user_surface and select_graphics_object@ and have not been successful. I have checked the relationship betweet the pointer to the graphics memory and the use of virtual windows and can confirm that the pointer is not updated when a virtual screen is selected.
I obtain the pointer to the graphics memory using %gr with:
i = winio@ ('%ca@&', caption)
i = winio@ ('%ww[no_border]&')
i = winio@ ('%sc&', plot_setup_func) ! call saplot setup function
i = winio@ ('%pv&')
!
i = winio@ ('%`^gr[grey, user_resize, rgb_colours, full_mouse_input, user_surface]&', &
1024, 768, & ! screen dimension when not maximised
ptr_RGB_Address, & ! screen address for rgb surface ( not sure of the order ? )
w_handle, & ! ` window handle defined in crtstart
mouse_back_func) ! ^ call back function for mouse and resize
!
i = winio@ ('%mg&', WM_MOUSEWHEEL, OnMouseWheel) ! mousewheel response
!
call Plot_Menus
!
i = winio@ ('%hw', hwnd) ! return the handle of the current window.
I then select the virtual screen with:
call get_graphical_resolution@ ( w_width, w_depth )
write (98,9000) 'Returned graphics window size', w_width, w_depth
write (98,9001) 'pointer for RGB direct addressing ', ptr_RGB_Address
!
NXPIX = MIN (HDFLAG,MXZBUF) ! limit for zbuffer
X_MAX_WIN = nxpix - 1
Y_MAX_WIN = X_MAX_WIN * ASPECT_WIN
NYPIX = Y_MAX_WIN + 1
!
i = create_graphics_region@ (hd_handle, nxpix, nypix)
i = select_graphics_object@ (hd_handle)
!
call draw_filled_rectangle@ (0,0, nxpix-1,nypix-1, rgb@ (50,50,50))
!
write (98,9003) 'Revised graphics size ', nxpix, nypix
write (98,9004) 'pointer for RGB direct addressing ', ptr_RGB_Address
This reports:
<Real _SCREEN> :Returned graphics window size X=1234 Y= 847
<Real _SCREEN> :pointer for RGB direct addressing 1152778240
<VIRTUAL_SCREEN> :Revised graphics size X=2048 Y=1358
<VIRTUAL_SCREEN> :pointer for RGB direct addressing 1152778240
I then try to check the graphics object using 'ptr_RGB_Address'
call GET_GRAPHICAL_RESOLUTION@ ( WIDTH, HEIGHT )
!
iw = clearwin_info@ ('GRAPHICS_WIDTH')
id = clearwin_info@ ('GRAPHICS_DEPTH')
jw = ((3*iw+3)/4)*4
!
do ver = 0,height-1
do hor = 0,width-1
!
! get colour from direct addressing
jj = ptr_RGB_Address + hor*3 + ver*jw
rgb_i(1) = core1(jj) ; if (rgb_i(1) < 0) rgb_i(1) = rgb_i(1)+256 ! blue
rgb_i(2) = core1(jj+1) ; if (rgb_i(2) < 0) rgb_i(2) = rgb_i(2)+256 ! green
rgb_i(3) = core1(jj+2) ; if (rgb_i(3) < 0) rgb_i(3) = rgb_i(3)+256 ! red
rgb_all = rgb_i(3) + 256*(rgb_i(2) + 256*rgb_i(1))
!
call GET_RGB_VALUE@ ( HOR, VER, VALUE )
if (rgb_all /= value) then
write ( *,*) hor,ver, rgb_i, rgb_all, value, ' Change RGB'
write (98,*) hor,ver, rgb_i, rgb_all, value, ' Change RGB'
n_e = n_e + 1
else
n_s = n_s + 1
end if
This indicates that the user_surface address is not pointing to the selected graphics object. What I need is a routine of the form:
get_select_graphics_object_address@ (Byte_Address, WIDTH, HEIGHT, NBBP, ERCODE )
Where NBBP would indicate the memory storage format, hopefully indicating RGB or BGR format. My understanding of selecting 'user_surface' is that it enforces a BGR storage format.
Is there a possibility of this (or similar) approach providing direct addressing for virtual screens ?
I can confirm that ptr_RGB_Address is being updated when RESIZE is selected.
John