×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Saving SCREEN 12 as ??

Saving SCREEN 12 as ??

Saving SCREEN 12 as ??

(OP)
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.

RE: Saving SCREEN 12 as ??

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
http://www.allbasiccode.com/

RE: Saving SCREEN 12 as ??

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$ = ""
NEXT Loops
BMPHeader.ValidID = "BM"
BMPHeader.SizeOfFile = LOF(255)
BMPHeader.OffsetOfBitMap = 118
PUT #255, 1, BMPHeader
CLOSE
END SUB

RE: Saving SCREEN 12 as ??

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   

RE: Saving SCREEN 12 as ??

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 "save.scr" 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 "save.scr" 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. :)

RE: Saving SCREEN 12 as ??

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.

RE: Saving SCREEN 12 as ??

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. :/

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close