DQBsaveImage
FUNCTION

Prototype

DECLARE FUNCTION DQBsaveImage (Layer AS INTEGER, x1 AS INTEGER, y1 AS INTEGER,
                               x2 AS INTEGER, y2 AS INTEGER, FileName AS
                               STRING, Pal AS STRING, Format AS INTEGER)

Parameters

Layer - Layer where is the image to save

x1 - x coordinate of upper-left area of layer to save

y1 - y coordinate of upper-left area of layer to save

x2 - x coordinate of lower-right area of layer to save

y2 - y coordinate of lower-right area of layer to save

FileName - New image file name with full extension

Pal - String holding the palette to save

Format - Image file format

Returns

An INTEGER value holding the saving results: > 0 Operation successful > 1 Cannot create file or disk error > 2 Unable to write data or disk full

Description

Call this function to save an area of a layer to a file. Images can be saved in three different formats: BSAVE compatible, BMP or PCX. When saving in the BSAVE format, you can load the image by simply calling the QB command BLOAD, and the palette will be appended to the end of the file. In addition, BSAVEd images are large files, but they're the fastest to load. When using the BMP format, the resulting file will be even larger, but you'll have a image saved into a standard file format, editable by most of the commercial image-editing programs. PCX is the smallest available file format, and contains the palette, but it's also the slowest to load. The palette to save with the file must have been previously stored into a string as explained into appendix A, by calling DQBgetPal or even DQBloadLayer. This is done to allow saving hidden layers with a palette different from the current one.

Notes:

When you're saving in the BSAVE format an image that's 320x200 pixels, it'll be saved just like the QB command

DEF SEG = <layerseg>: BSAVE <imagefile>, 0, 64000

So you'll be able to load it on the screen without requiring an intermediate buffer. On the other hand, if you use the BSAVE format to save an image that's smaller than 320x200, it'll be like if you used

GET (x1, y1)-(x2, y2), <array> DEF SEG = VARSEG(<array>): BSAVE <imagefile>, VARPTR(<array>), <length>

In both cases, the palette will be appended to the file; but don't worry, because BLOAD will be still able to load your images - though without loading the appended palette.