Aga, I think the routine you quote is based on 16 bits pixels only: I just read that fast, but Pixel16& seems to be a combination of the three components, coded into a 2 bytes parameter. Correct me if I'm wrong, this may help me to optimise the TC-Lib...
To SCM : when I realised I would never make hi-res graphics with good'ol Screen 12, I developed a lot of progs based on 24 bits bitmaps. The technique is slow, but really reliable, since it is fully independant from the graphic card of the machine. Most of the graphics on The Mandelbrot Dazibao were made that way, and that allowed also making videos by merging still images, generated through a batch.
Then I discovered the SVGA modes, and developed the TC-Lib, 100% true-colours dedicated. The lib is slow from a technical point of view but, as you said above, when its takes hours to perform a heavy fractal computation, it is more important to get reliable results than to have a faast display.
I have the same problem as you when quitting the SVGA modes activated from QB. The last lib I made was finally a "virtual screen" graphic library, which allows using a 24 bits bitmap file with Pset and a Point routines. This way, you can run your prog in the background of Windows, and check the result from time to time with an external viewer. I personally use Thumbnails Plus from Cerious Software, this is the best images manager I know (it can, amongst other features, view an non complete bmp file!).
Note: with the virtual screen technique, you can prog when at work :lol: :wink:
See the three routine below, they allow working with an anysize bitmap file as a virtual true-colour screen. They are fully compatible with the TC-Lib programs, so you can switch from TCLib.bas to TCBmp.bas without changing a line in the main prog...
Code:
SUB SetVGA
SELECT CASE SizeScreen
CASE 1: ScrWidth = 400: ScrHeight = 300
CASE 2: ScrWidth = 640: ScrHeight = 480
CASE 3: ScrWidth = 800: ScrHeight = 600
CASE 4: ScrWidth = 1024: ScrHeight = 768
CASE 5: ScrWidth = 2048: ScrHeight = 1524
CASE ELSE
CLS
PRINT "Define a mode number (1-4) before calling SetVGA"
DO WHILE INKEY$ = "": LOOP
SYSTEM
END SELECT
' Bitmap structure parameters
CLS
IF Name$ = "" THEN Name$ = "TCLib"
PRINT "Creating blank bitmap "; Name$
Bw& = ScrWidth
Bh& = ScrHeight
Os& = 54
IF (3 * Bw& MOD (4)) <> 0 THEN PadBytes% = 4 - ((3 * Bw&) MOD (4))
Fs& = (3 * Bw& + PadBytes%) * Bh& + Os&
Ps& = (3 * Bw& + PadBytes%) * Bh&
Pic$ = SaveDir$ + Name$ + ".bmp"
OPEN Pic$ FOR BINARY AS #2
' Bitmap header
Buffer$ = "BM"
Buffer$ = Buffer$ + MKL$(Fs&) 'File Size
Buffer$ = Buffer$ + CHR$(0) + CHR$(0) 'Reserved 1
Buffer$ = Buffer$ + CHR$(0) + CHR$(0) 'Reserved 2
Buffer$ = Buffer$ + MKL$(Os&) 'Offset
Buffer$ = Buffer$ + MKL$(40) 'File Info size
Buffer$ = Buffer$ + MKL$(Bw&) 'Pic Width
Buffer$ = Buffer$ + MKL$(Bh&) 'Pic Height
Buffer$ = Buffer$ + CHR$(1) + CHR$(0) 'Number of planes
Buffer$ = Buffer$ + CHR$(24) + CHR$(0) 'Number of bits per pixel
Buffer$ = Buffer$ + MKL$(0) 'No compression
Buffer$ = Buffer$ + MKL$(Ps&) 'Image Size
Buffer$ = Buffer$ + MKL$(0) 'X Size (pixel/meter)
Buffer$ = Buffer$ + MKL$(0) 'Y Size (pixel/meter)
Buffer$ = Buffer$ + MKL$(0) 'Colors used
Buffer$ = Buffer$ + MKL$(0) 'Important colors
PUT #2, 1, Buffer$
' Blank Pixels (three bytes per pixel)
FOR Ny = 1 TO Bh&
Buffer$ = CHR$(0) + CHR$(0) + CHR$(0)
FOR Nx = 1 TO Bw&
PUT #2, , Buffer$
NEXT Nx
Buffer$ = ""
FOR i = 1 TO PadBytes%
Buffer$ = Buffer$ + CHR$(0)
NEXT i
PUT #2, , Buffer$
NEXT Ny
CLS
PRINT "Bitmap "; Name$; " created"; Bw&; "x"; Bh&; ". Picture in progress"
END SUB
Code:
SUB Point24 (x%, y%)
' Returns the current RGB combination of the selected pixel
IF x% < 1 OR x% > ScrWidth OR y% < 1 OR y% > ScrHeight THEN EXIT SUB
Bw& = ScrWidth
Bh& = ScrHeight
IF (3 * Bw& MOD (4)) <> 0 THEN PadBytes% = 4 - ((3 * Bw&) MOD (4))
LineLength& = 3 * Bw& + PadBytes%
Os& = 54
Offset& = (Os& + 1) + (ScrHeight - y%) * LineLength& + (x% - 1) * 3
Col$ = " "
GET #2, Offset&, Col$
Blue% = ASC(LEFT$(Col$, 1))
Green% = ASC(MID$(Col$, 2, 1))
Red% = ASC(RIGHT$(Col$, 1))
END SUB
SUB Pset24 (x%, y%)
' Plots a pixel using the current RGB combination
IF x% < 1 OR x% > ScrWidth OR y% < 1 OR y% > ScrHeight THEN EXIT SUB
Col$ = CHR$(Blue%) + CHR$(Green%) + CHR$(Red%)
Bw& = ScrWidth
Bh& = ScrHeight
IF (3 * Bw& MOD (4)) <> 0 THEN PadBytes% = 4 - ((3 * Bw&) MOD (4))
LineLength& = 3 * Bw& + PadBytes%
Os& = 54
Offset& = (Os& + 1) + (ScrHeight - y%) * LineLength& + (x% - 1) * 3
PUT #2, Offset&, Col$
END SUB