Working with the RAW File Filter

The RAW File Filter can be used to load and save raw uncompressed data. The raw data can have

Loading a file with the RAW filter

Parameters for loading raw uncompressed data are set through the LoadInfo event in the Main Control.

Inside the LoadInfo event (or prior to the call of the LoadInfo event),set the LoadInfoBits property to FILE_RAW. Valid values must also be set for the following properties: LoadInfoWidth, LoadInfoHeight, LoadInfoBits, and LoadInfoOffset (byte location in the file where the raw data begins). If each line of RAW data is padded so that the number of bytes is a multiple of 4 (as is the case with raw Windows BMP data), include LOADINFO_PAD4 in the LoadInfoFlags property. Include an orientation flag in the LoadInfoFlags property to load the image with the proper orientation. For example, raw Windows BMP data is stored with a BOTTOM_LEFT orientation. If the orientation is unknown, include the TOP_LEFT flag. If the raw data is 8 bits per pixel or less, then the image is palettized and a palette must be generated. If this is the case, include the LOADINFO_PALETTE flag, and fill in the first (2 bits per pixel) entries of the UserPalette property.

If the color order is ORDER_RGB then include this flag. If the ORDER_RGB flag is not included, the data will be loaded as ORDER_BGR.

Saving a file with the RAW filter

To save raw uncompressed data, an image must already be loaded into a LEAD control. When saving raw uncompressed data, the raw data will correspond to the width, height, bits per pixel, and view perspective of the image when it was loaded. For example, if a Window BMP file that is 300x400 24-bit color is loaded and then saved as raw uncompressed data, the raw data is 24-bit, ORDER_BGR, with a view perspective BOTTOM_LEFT (the first bytes in the file correspond to the bottom-left of the image). The total size of the raw data file will be 300x400x3 = 360,000 bytes.

You can affect the way the raw data is saved by setting certain properties. The bits in each byte can be reversed by setting the SaveLSB property to TRUE. Each line of raw data can be padded so that the length is a multiple of four bytes by setting the SavePad4 property to TRUE. The raw data can be saved at any offset in the file by using the SaveOffset method.

When using the Save method or the SaveOffset method to save RAW data that is 8 bits per pixel or less, no palette information is saved. Consequently, after loading RAW data, it is necessary to supply a palette.(see Loading a file with the RAW filter above.)

For examples that demonstrate how to load and save raw uncompressed data, refer to:

RawLoad example for Visual Basic

RawLoad example for Visual C++ 4.0 and later

RawSave example for Visual Basic

RawSave example for Visual C++ 4.0 and later