L_Jp2AppendFramesMemory
#include "l_bitmap.h"
L_LTJP2_API L_INT EXT_FUNCTION L_Jp2AppendFramesMemory(hJp2, pBuffer, uBufferSize, lpOutBuffer, puOutBufferSize, pComposite, nBitsPerPixel, nQFactor, pSaveOptions, pSaveCallBack, pUserData)
L_HJP2 hJp2; |
/* JPEG 2000 engine handle */ |
L_UINT8 * pBuffer; |
/* pointer to a JPEG 2000 file in memory */ |
L_SIZE_T uBufferSize; |
/* size of the JPEG 2000 file*/ |
L_UINT8 ** lpOutBuffer; |
/* pointer to a pointer */ |
L_SIZE_T * puOutBufferSize; |
/* pointer to a variable to be updated */ |
pL_JP2_JPXCOMPOSITE pComposite; |
/* frame information */ |
L_INT nBitsPerPixel; |
/* resulting frames pixel depth*/ |
L_INT nQFactor; |
/* quality factor */ |
pSAVEFILEOPTION pSaveOptions; |
/* pointer to optional extended save options */ |
FILESAVECALLBACK pSaveCallBack; |
/* optional callback function */ |
L_VOID * pUserData; |
/* pointer to more parameter for the ecallback */ |
Appends new frames to the specified JPEG 2000 file in memory.
Parameter |
Description |
hJp2 |
JPEG 2000 engine handle that was created by the L_Jp2Create function. |
pBuffer |
Pointer to a JPEG 2000 file in memory. |
uBufferSize |
Size of the JPEG 2000 file in bytes. |
lpOutBuffer |
Pointer to a pointer to be updated with an array of bytes that contains a JPEG 2000 file with new appended frames. You must free this buffer by calling the Windows GlobalFree () function. |
puOutBufferSize |
Address of a variable to be updated with the size of the output memory buffer in bytes. |
pComposite |
Pointer to a composite structure that contains new frames information (color channels, opacity channels, pre-multiplied opacity channels, and compression type). |
nBitsPerPixel |
Resulting frames pixel depth. The available valid bits per pixel are 8, 12, 16, 24, 32, 48, and 64. If this value is zero, each bitmap will be saved by its own bits per pixel but it shall be one of the above values. |
nQFactor |
Quality factor. This value determines the degree of loss in the compression process. Possible values are from 0 to 255. Zero (0) represents lossless compression. Values between 1 and 255 are interpreted as a compression ratio. |
pSaveOptions |
Pointer to optional extended save options. Pass NULL to use the default save options. |
pSaveCallBack |
Optional callback function for additional processing.
The callback function must adhere to the syntax described in the FILESAVECALLBACK function. |
pUserData |
Void pointer you can use to pass one or more additional parameters. 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 additional parameters are not needed, you can pass NULL in this parameter. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
L_Jp2AppendFrames appends new frames to already existing JPEG 2000 file in memory. The new frames codestreams are determined by pComposite. pComposite determines the channels of this layer. If the channels bitmap is not allocated, the channel does not exist. The color bitmap must be allocated in all frames. If any color bitmap is not allocated, the function will return ERROR_NO_BITMAP. All of the engines boxes will be reset.
Required DLLs and Libraries
LTJP2 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.
See Also
Example
This example appends an image to already existing JPEG 2000 file.
L_LTJP2TEX_API L_INT Jp2AppendFramesMemoryExample(pBITMAPHANDLE pBitmap, L_UINT8* pFileBuffer, L_SIZE_T uFileSize, L_UINT8** lpOutBuffer, L_SIZE_T * puOutSize) { L_HJP2 hEngine; L_INT nRet; L_JP2_JPXBITMAPS pBitmaps[1] = {0}; L_JP2_JPXCOMPOSITE Composite; pBitmaps[0].uStructSize = sizeof(L_JP2_JPXBITMAPS); pBitmaps[0].ColorBitmap = *pBitmap; pBitmaps[0].eColorFormat = LEADJP2_J2K; Composite.uStructSize = sizeof(L_JP2_JPXCOMPOSITE); Composite.pBitmaps = pBitmaps; Composite.uNumOfBitmaps = 1; /*Create JPEG 2000 engine handle*/ hEngine = L_Jp2Create(); /*Append frames to a JPX file*/ nRet = L_Jp2AppendFramesMemory(hEngine, pFileBuffer, uFileSize,lpOutBuffer, puOutSize, &Composite,24,5,NULL,NULL,NULL); if(nRet != SUCCESS) return nRet; /*Destroy engine handle*/ L_Jp2Destroy(hEngine); return SUCCESS; }