Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving SCREEN 12 as ??

Status
Not open for further replies.

jcc3inc

Programmer
Dec 17, 2003
9
US
Gentlemen:

I will setup screen 12 as a template having 16 windows for a machine control panel. Because I want it to have a pleasing appearance, it will be made with special fonts and other niceties. To simplify the program, once the screen has been completed, could it be saved as a .??? file and then downloaded at the start of running the machine control program? During operation the normal screen 12, width 80, 30 and DOS font will be used to put data into the windows.

It appears that (1) BSAVE will not handle the data. Some others have used .PCX files for similar uses. Where can I find a program to load my screen template as a .PCX file?
Is there a better choice than .PCX?

Thank you,
Jack C.
 
There are plenty of picture loaders (and savers?) written in QB on the NET.
The alternatives to PCX (rather old format) is BMP and GIF. BMP being the simplest and GIF will compress things up so it takes less space. With that you can draw screens yousing your favourite paint program (add shades, 3d stuff etc ;))

And BSAVE should work as well - probably just you can not save it in one piece (64k limit?). Of cource paint programs wouldn't apply here.

So try to search this forum (for picture loader, I think), go and search
 
You could save it as a bitmap.

DECLARE SUB SAVE4BIT (FileName$, MinX, MinY, MaxX, MaxY)
TYPE BMPHeader
ValidID AS STRING * 2
SizeOfFile AS LONG
Reserved AS LONG
OffsetOfBitMap AS LONG
END TYPE
TYPE WindowsBMPInfoHeader
SizeOfHeader AS LONG
Widthz AS LONG
Heightz AS LONG
Planes AS INTEGER
BitsPerPixel AS INTEGER
CompressMethod AS LONG
ImageSizeInBytes AS LONG
HorizontalResol AS LONG
VerticalResol AS LONG
ColorsUsed AS LONG
ImportantColors AS LONG
END TYPE
SAVE4BIT "4bit.bmp", 0, 0, 639, 479

DEFINT A-Z
SUB SAVE4BIT (FileName$, MinX, MinY, MaxX, MaxY)
OPEN FileName$ FOR BINARY AS #255
IF LOF(255) <> 0 THEN
CLOSE
KILL FileName$
OPEN FileName$ FOR BINARY AS #255
END IF
ImageWidth = (MaxX - MinX) + 1: ImageHeight = (MaxY - MinY) + 1
DIM BMPHeader AS BMPHeader
DIM WindowsBMPInfoHeader AS WindowsBMPInfoHeader
WindowsBMPInfoHeader.SizeOfHeader = 40
WindowsBMPInfoHeader.Widthz = ImageWidth
WindowsBMPInfoHeader.Heightz = ImageHeight
WindowsBMPInfoHeader.Planes = 1
WindowsBMPInfoHeader.BitsPerPixel = 4
WindowsBMPInfoHeader.CompressMethod = 0
WindowsBMPInfoHeader.ColorsUsed = 16
WindowsBMPInfoHeader.ImportantColors = 16
PUT #255, 15, WindowsBMPInfoHeader
Empty$ = SPACE$(1)
SCREEN 12
FOR Colors = 0 TO 15
OUT &H3C6, &HFF
OUT &H3C7, Colors
Red$ = CHR$(INP(&H3C9) * 4): Green$ = CHR$(INP(&H3C9) * 4)
Blue$ = CHR$(INP(&H3C9) * 4): AllColorz$ = Blue$ + Green$ + Red$ + Empty$
PUT #255, , AllColorz$
NEXT Colors
Padding$ = SPACE$(0)
IF (4 - ((BMPInfoHeader.Widthz MOD 8) / 2)) <> 4 THEN
Padding$ = SPACE$((4 - ((BMPInfoHeader.Widthz MOD 8) / 2)))
END IF
FOR Loops = MaxY TO MinY STEP -1
FOR Lips = MinX TO MaxX STEP 2
Byte = POINT(Lips, Loops) * 16
IF Lips + 1 <= MaxX THEN
Byte = (Byte OR POINT(Lips + 1, Loops))
END IF
Bytez$ = Bytez$ + CHR$(Byte)
Byte = 0
NEXT Lips
LINE (MinX, Loops)-(MaxX, Loops), 0
PUT #255, , Bytez$
PUT #255, , Padding$
Bytez$ = &quot;&quot;
NEXT Loops
BMPHeader.ValidID = &quot;BM&quot;
BMPHeader.SizeOfFile = LOF(255)
BMPHeader.OffsetOfBitMap = 118
PUT #255, 1, BMPHeader
CLOSE
END SUB
 
Just saying that saving SCREEN 12 with BSAVE is different than with SCREEN 13. SCREEN 13 has one byte in each location for the color, but SCREEN 12 is different as that it saves each pixel and color in a totally different way since that each pixel is not a byte. When ever I BSAVE SCREEN 12 and then BLOAD it it all comes back, but in just black and white. Sounds like a good project :)
 
Hi...I'm just running around giving advice wherever I can. Hope nobody minds. :)

Since you're just saving and loading the image for use in your own program, why not just the POINT (x, y) function to save the entire screen to a file?

This should work

fileno = FREEFILE

open &quot;save.scr&quot; for binary as #fileno

for a = 1 to 640
for b = 1 to 480
get #fileno, , point(a,b)
next b
next a

close filen

and to load the screen back up,


fileno = FREEFILE

open &quot;save.scr&quot; for binary as #fileno

for a = 1 to 640
for b = 1 to 480
put #fileno, , x
pset(a,b),x
next b
next a

close filen


I know it's a bit sloppy, and wouldn't run the fastest, but it's a nice, simple, understandable way of saving and loading the screen until you find something a bit better. :)
 
Thats true, it is very simple, but if would also be four times bigger than a bitmap, and a bitmap you could edit in paintbrush if necessary.
 
Like I said, it's very simple. :p

(I use a similar technique myself because it's easier to optimize, and I know exactly what's going on. I don't really have the energy to learn a new graphics format just for the hell of it. :/
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top