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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need a fast cache format 1

Status
Not open for further replies.

qbasicking

Programmer
Aug 19, 2001
628
US
Here's the specifics of what I need: A graphics format. One that can be altered one pixil at a time, and doesn't need to be loaded to do it...OPEN-EDIT-CLOSE
I need to cache the contents of a window.
I need it to be somewhat fast, maybe fast enough to run on a 486 or 386, but I need it to hold 630*430 pixils
It also needs to be somewhat compact, the formats that I've come up with were huge (1.x MB).

Bitmaps and JPEGS would be nice, but I can't figure out how to edit them one pixil at a time.

When i load them, I need to be able to load only parts of it at a time too, sometimes maybe only a few pixils.

Heres some formats I've tried, but were to bulky and big:
PUT #1, 1, pxl1
PUT #1, 2, pxl2
PUT #1, 3, pxl3
...

PUT #1, 1, pxl1 + pxl2 + pxl3...

Any ideas would be helpful, thanks in advace.
 
You want to grab a 16x16 block of the screen, which is 256 pixels. In [tt]SCREEN 12[/tt], there are 2 pixels to the byte, so these 256 pixels require 128 bytes to store. In addition, the [tt]GET[/tt] format requires 4 bytes for the header. So, you need 132 bytes in the array to perform this [tt]GET[/tt] operation. However, your array has only 31 elements of type [tt]SINGLE[/tt]. Each element is 4 bytes long, so the array has 124 bytes in it. Therefore, the array is not large enough to store the desired data.

In addition, there is another problem that will arise once the array is large enough to store the data. Remember that by default in QB, arrays start at index 0. [tt]GET[/tt] makes use of this and starts storing data at [tt]icon(0)[/tt] instead of [tt]icon(1)[/tt]. Since you are not saving [tt]icon(0)[/tt] to the file, the [tt]GET[/tt] header is not present, thus the format is incorrect, and [tt]PUT[/tt] will give you an error.
 
ooo, thank you, and the array is fine, it will GET and PUT it fine
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top