LFile::TransformFile
#include "ltwrappr.h"
virtual L_INT LFile::TransformFile(pszFileDst, uTransform, pLoadOptions=NULL)
L_TCHAR * pszFileDst; |
/* name of the destination file */ |
L_UINT uTransform; |
/* the transformation to perform */ |
pLOADFILEOPTION pLoadOptions; |
/* pointer to optional extended load options */ |
Performs a lossless transformation for certain formats. The specified file is the destination file, while the internal file used by the class object is the source file. Currently, only JPEG, CMP and JPEG TIFF formats are supported.
Parameter |
Description |
|
pszFileDst |
Character string containing the name of the destination file. |
|
uTransform |
Binary flags that indicate the transform to be performed. Possible values are: |
|
|
Value |
Meaning |
|
FILE_TRANSFORM_FLIP |
[0x0001] Flip the image. |
|
FILE_TRANSFORM_REVERSE |
[0x0002] Reverse the image. |
|
FILE_TRANSFORM_ROTATE90 |
[0x0004] Rotate the image clockwise by 90 degrees. |
|
FILE_TRANSFORM_ROTATE180 |
[0x0008] Rotate the image clockwise by 180 degrees. |
|
FILE_TRANSFORM_ROTATE270 |
[0x000C] Rotate the image clockwise by 270 degrees. |
pLoadOptions |
Pointer to optional extended load options. Pass NULL to use the default load options. This is useful only for transforming JPEG TIFF files. The load options will specify the page to transform. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
Only one of the rotate flags can be specified.
This function calls the LFile:TransformFileCallBack, if the callback function has been enabled by calling the LBase::EnableCallBack. The callback function is provided for processing custom markers. (This is useful for rotating JPEG files only.) When transforming JPEG files, LFile::TransformFile will enumerate all the markers contained in the file and it will pass them to this callback. The user has the ability to control the transformation for all the markers. For additional information on JPEG markers, please consult the JPEG specification.
To customize this callback, derive a new class from LFile and override LFile::TransformFileCallBack, providing the needed functionality. (Create the object from the new class.)
The files transformed by this function will be read transformed by other applications capable of reading these file formats.
For JPEG files, the size of the image might be changed. This can happen when the image width or height is not a multiple of 8.
The transformation is lossless. It is better than loading the image, transforming it using LBitmapBase::Rotate, LBitmapBase::Flip or LBitmapBase::Reverse and resaving it. Repeated load and save process will cause image degradation, but calling this function will not cause any image degradation.
The rotation transformations are performed before the flip/reverse operations.
Required DLLs and Libraries
LTFIL For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
See Also
Functions: |
LFile::LoadFile, LBitmapBase::Rotate, LBitmapBase::Flip, LBitmapBase::Reverse, Class Members |
Topics: |
|
|
Example
L_VOID TestFunction(L_TCHAR * pszFileSrc, L_TCHAR * pszFileDst)
{
LFile File;
File.SetFileName(pszFileSrc);
File.TransformFile(pszFileDst, FILE_TRANSFORM_ROTATE90);
}