The first stage in converting from FTN77 & DBOS era graphics to FTN95 is to accept that you are going to need to create a Windows application. This can be as primitive or as full-featured as you like. You can do it using .NET or the older ClearWin approach. I use ClearWin.
There used to be a demo program named PLOT.FOR distributed with FTN77+clearwin. This became PLOT.F90 and seems to have disappeared from the demos distributed with FTN95.
Basically, you open a window with Clearwin. In this window, you create a graphics region. It used to be done with the %dw code (the example is in PLOT.FOR), but the newer %gr is better (PLOT.F90 uses this). You need to tell windows that you want RGB graphics mode. The, you use the standard library graphics routines provided in FTN95 to draw into the graphics area. You will find direct replacements for every library subroutine in the old graphics library - some of them are even the same name.
When it comes to printing your colour graphic, the simplest way is to get a screen dump and print that. The next simplest way is to open a windows printer and redraw the graphic. The graphics areas on the screen and printer obviously have different sizes, so that you need to interrogate any new 'device' for its size before you begin drawing. You switch between devices such as a graphics area on the screen or a printer by means of an integer number called a 'handle' - every windows object, be it a menu item, 'button', graphics area etc has its own unique handle.
Here's my version of PLOT with printing built in ...
OPTIONS (INTL)
WINAPP
PROGRAM PLOT
IMPLICIT NONE
INCLUDE <WINDOWS.INS> ! you can USE CLRWIN instead
! Remember to declare your call-back functions EXTERNAL
INTEGER4, EXTERNAL :: ABOUT_FUNCTION,PLOT_FUNCTION,CLEAR_FUNCTION
INTEGER4, EXTERNAL :: PRNT_FUNCTION
INTEGER A, ICTRL, iXRES, iYRES, ictrl
COMMON / SCREEN / iXRES, iYRES, ictrl
iXRES=GetSystemMetrics(SM_CXSCREEN)*0.7
iYRES=GetSystemMetrics(SM_CYSCREEN)*0.7
A=WINIO@('%ca[Simple drawing program]&')
A=WINIO@('%mn[&File[E&xit]]&','EXIT')
A=WINIO@('%mn[&Help[&About ClearWin+ PLOT]]&',ABOUT_FUNCTION)
A=WINIO@('%ob%gr[rgb_colours]%cb%lw&',iXRES,iYRES,ictrl)
A=WINIO@('%rj%10bt[Clear]&',CLEAR_FUNCTION)
A=WINIO@('%2nl%rj%10`bt[&Plot]&',PLOT_FUNCTION)
A=WINIO@('%2nl%rj%10bt[Print]&',PRNT_FUNCTION)
A=WINIO@('%2nl%rj%10bt[E&xit]&','EXIT')
A=WINIO@('%ww[maximise]')
END
INTEGER FUNCTION CLEAR_FUNCTION()
USE CLRWIN ! Salford Clearwin + GUI
IMPLICIT NONE
CALL CLEAR_SCREEN@()
CLEAR_FUNCTION=1
END
INTEGER FUNCTION ABOUT_FUNCTION()
USE CLRWIN
IMPLICIT NONE
INTEGER A
A=WINIO@('%ca[About ClearWin+ PLOT demo program]&')
A=WINIO@('%cnPlot Demo&')
A=WINIO@('%2nl%cn%`7bt[OK]')
ABOUT_FUNCTION=1
END
INTEGER*4 FUNCTION PLOT_FUNCTION()
USE CLRWIN
IMPLICIT NONE
INTEGER A, ICTRL, iXRES, iYRES, ictrl, IX0,IX1, IY0,IY1
COMMON / SCREEN / iXRES, iYRES, ictrl
CHARACTER*20 TITLES(3)
DATA TITLES/'First title ', 'Second title ',
1 'Third title ' /
call DRAW_TEXT@(TITLES(1),iXRES/10,iYRES/10,RGB@(255,0,0))
call DRAW_TEXT@(TITLES(2),2*iXRES/10,2*iYRES/10,RGB@(0,255,0))
call DRAW_TEXT@(TITLES(3),3*iXRES/10,3*iYRES/10,RGB@(0,0,255))
IX0 = iXRES/10; IX1 = iXRES*9/10
IY0 = 5*iYRES/10; IY1 = iYRES*6/10
CALL DRAW_LINE@(IX0,IY0,IX1,IY1,RGB@(0,0,0))
PLOT_FUNCTION=1
END
INTEGER*4 FUNCTION PRNT_FUNCTION()
C implicit integers used in this routine
INCLUDE <WINDOWS.INS>
CHARACTER20 TITLES(3)
DATA TITLES/'First title ', 'Second title ',
1 'Third title ' /
IA = OPEN_PRINTER@ (jHDC)
CALL SET_CLEARWIN_STRING@(PRINTER_DOCUMENT, 'PLOT graphic')
CALL GET_CURRENT_DC@ (jHDC)
CALL USE_RGB_COLOURS@(0,1)
C CALL USE_RGB_COLOURS@(0,.true.)
C See info on Get Device Caps on MSDN
iXRES = GetDeviceCaps(jHDC, HORZRES)
iYRES = GetDeviceCaps(jHDC, VERTRES)
CALL SELECT_FONT@('Arial')
CALL SIZE_IN_POINTS@(14,7)
call DRAW_TEXT@(TITLES(1),iXRES/10,iYRES/10,RGB@(255,0,0))
call DRAW_TEXT@(TITLES(2),2iXRES/10,2iYRES/10,RGB@(0,255,0))
call DRAW_TEXT@(TITLES(3),3iXRES/10,3iYRES/10,RGB@(0,0,255))
IX0 = iXRES/10; IX1 = iXRES9/10
IY0 = 5iYRES/10; IY1 = iYRES6/10
CALL DRAW_LINE@(IX0,IY0,IX1,IY1,RGB@(0,0,0))
CALL CLOSE_PRINTER@(JHDC)
! see other options if you want to print more than one page
PRNT_FUNCTION=1
END
You have to set font size, otherwise printed fonts are too small. SET_CLEARWIN_STRING@ gives a proper heading in the print queue. Note that in PRNT_FUNCTION, iXRES and iYRES aren't put into the common block! I have deliberately mixed USE CLRWIN and INCLUDE <CLEARWIN.INS> so that you can see both styles. Beware of where I have used C as a comment, and where I have used a continuation marker in column 6 - these don't come over well in this forum.
Eddie Bromhead