L_SaveFileTile

#include "l_bitmap.h"

L_LTFIL_API L_INT L_SaveFileTile(pszFile, pBitmap, nCol, nRow, pfnCallback, pUserData, pSaveOptions)

L_TCHAR* pszFile;

/* file name */

pBITMAPHANDLE pBitmap;

/* pointer to the bitmap handle */

L_INT nCol;

/* left column of tile */

L_INT nRow;

/* top row of tile */

FILESAVECALLBACK pfnCallback;

/* optional callback function */

L_VOID* pUserData;

/* pointer to more parameters for the callback */

pSAVEFILEOPTION pSaveOptions;

/* pointer to optional extended save options */

Saves a bitmap to a specified rectangular location in an existing FlashPix file. It only works with uncompressed FlashPix files. If a compressed FlashPix file is passed in, an error will be returned.

Parameter

Description

pszFile

Character string containing the name of the image file to save.

pBitmap

Pointer to the bitmap handle for the loaded data.

nCol

Left column number of tile.

nRow

Top row number of tile.

pfnCallback

Optional callback function for additional processing.

 

If you do not provide a callback function, use NULL as the value of this parameter.

 

If you do provide a callback function, use the function pointer as the value of this parameter.

 

The callback function must adhere to the function prototype described in FILESAVECALLBACK Function.

pUserData

Void pointer that you can use to pass one or more additional parameters that the callback function needs.

 

To use this feature, assign a value to a variable or create a structure that contains as many fields as you need. Then, in this parameter, pass the address of the variable or structure, casting it to L_VOID  *. The callback function, which receives the address in its own pUserData parameter, can cast it to a pointer of the appropriate data type to access your variable or structure.

 

If the additional parameters are not needed, you can pass NULL in this parameter.

pSaveOptions

Pointer to optional extended save options. Pass NULL to use the default save options.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Note:

More options are available in the SAVEFILEOPTION structure.

This function only works with the FlashPix file format.

This function supports signed data images, but only DICOM and TIFF formats support signed data. This function will return an error code if you attempt to save a signed image to a format other than DICOM or TIFF.

If the bitmap has a region, the region stored in the bitmap will be saved, if the image is saved as one of the TIFF file formats.

Required DLLs and Libraries

LTFIL
File format DLLs

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Windows 2000 / XP/Vista, Windows CE.

See Also

Functions:

L_LoadFileTile,

 

L_DlgSave

Topics:

Raster Image Functions: Loading Files,

 

Loading and Saving Images

 

For a list of functions that utilize the LOADFILEOPTION or SAVEFILEOPTION structures, refer to Functions Utilizing the LOADFILEOPTION or SAVEFILEOPTION structures.

Example

 L_INT SaveFileTileExample(L_VOID)
{
   L_INT nRet;
   BITMAPHANDLE Bitmap;
   FILEINFO FileInfo;

   memset(&FileInfo, 0, sizeof(FILEINFO));
   FileInfo.uStructSize = sizeof(FileInfo);

   nRet = L_LoadBitmap (TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\IMAGE1.FPX"), &Bitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);
   if(nRet != SUCCESS)
      return nRet;
   nRet = L_FileInfo(TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\IMAGE1.FPX"), &FileInfo, sizeof(FILEINFO), 0, NULL);
   if(nRet != SUCCESS)
   {
      L_FreeBitmap(&Bitmap);
      return nRet;
   }

   // Save a bitmap in the center of the image
   nRet = L_SaveFileTile(TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\TEST.FPX"), &Bitmap, (FileInfo.Width - Bitmap.Width)/2, (FileInfo.Height - Bitmap.Height)/2, NULL, NULL, NULL);
   L_FreeBitmap(&Bitmap);

   return nRet;
}