#include "l_bitmap.h"
L_LTJP2_API L_INT EXT_FUNCTION L_Jp2ReadFrames(hJp2, pszFile, pComposite, pFrames, uNumOfFrames, nBitsPerPixel, nOrder, pLoadOptions, pFileInfo, pReadCallBack, pUserData)
L_HJP2 hJp2; |
JPEG 2000 engine handle |
L_TCHAR * pszFile; |
JPEG 2000 file name |
pL_JP2_JPXCOMPOSITE pComposite; |
pointer to a L_JP2_JPXCOMPOSITE structure |
L_UINT32 * pFrames; |
frames indices |
L_UINT32 uNumOfFrames; |
number of frames |
L_INT nBitsPerPixel; |
resulting bitmaps pixel depth |
L_INT nOrder; |
desired color order |
pLOADFILEOPTION pLoadOptions; |
pointer to optional extended load options |
pFILEINFO pFileInfo; |
pointer to a structure |
FILEREADCALLBACK pReadCallBack; |
optional callback function |
L_VOID * pUserData; |
pointer to more parameters for the callback |
Loads the specified frames bitmaps (Color, Opacity and Pre-multiplied opacity) stored in the specified JPEG 2000 file.
Parameter | Description | |
hJp2 | JPEG 2000 engine handle that was created by the L_Jp2Create function. | |
pszFile | Character string that contains the name of the JPEG 2000 file. | |
pComposite | Pointer to the L_JP2_JPXCOMPOSITE structure that references L_JP2_JPXBITMAPS bitmaps to be filled with image data. | |
pFrames | Frames indices. An array of unsigned integers specifies the indices of the frames to be loaded from the file. | |
uNumOfFrames | Number of frames to be loaded. This value specifies the size of pFrames. | |
nBitsPerPixel | Resulting bitmap pixel depth. If zero [0], the bitmap will have the original files pixel depth (do not convert). | |
nOrder | The desired color order. Possible values are: | |
Value | Meaning | |
ORDER_RGB | [0] Read-green-blue order. | |
ORDER_BGR | [1] Blue green-red order. | |
ORDER_GRAY | [2] 12 or 16-bit grayscale image. 12 and 16-bit grayscale images are supported in Document and Medical imaging products only. | |
0 | The data is 8 bits per pixel or less. | |
ORDER_RGBORGRAY | [3] Load the image as red, green, blue, OR as a 12 or 16-bit grayscale image. 12 and 16-bit grayscale images are supported in Document/Medical imaging products only. | |
ORDER_BGRORGRAY | [4] Load the image as blue, green, red, OR as a 12 or 16-bit grayscale image. 12 and 16-bit grayscale images are supported in Document/Medical imaging products only. | |
ORDER_ROMM | [5] ROMM order. ROMM only supports 24 and 48-bit images. | |
ORDER_BGRORGRAYORROMM | [6] Load the image as blue, green, red, OR as a 12 or 16-bit grayscale image OR as ROMM. 12 and 16-bit grayscale images are supported in Document/Medical imaging products only. | |
pLoadOptions | Pointer to optional extended load options. Pass NULL to use the default load options. | |
pFileInfo | Pointer to a FILEINFO structure. If nothing is known about the file pass NULL. | |
pReadCallBack |
Optional callback function for additional processing.
If you do not provide a callback function, pass NULL. 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 the FILEREADCALLBACK function. |
|
pUserData | Void pointer that you can use to pass one or more additional parameters used by the callback function. |
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
L_Jp2ReadFrames loads the specified frames bitmaps (Color, Opacity and Pre-multiplied opacity) stored in the specified JPEG 2000 file. You must free this structure by calling the L_Jp2FreeComposite function. Also you must free structure bitmaps by calling the L_FreeBitmap function. All of the engines boxes will be reset.
Required DLLs and Libraries
For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Win32, x64.
This example reads specific frame in JPEG 2000 file format
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT Jp2ReadFramesExample(pBITMAPHANDLE pBitmap)
{
L_HJP2 hEngine;
L_INT nRet;
L_JP2_JPXCOMPOSITE Composite = {0};
L_UINT32 puFrames[1] = {0};
Composite.uStructSize = sizeof(L_JP2_JPXCOMPOSITE);
/*Create JPEG 2000 engine handle*/
hEngine = L_Jp2Create();
/*Read a frame*/
puFrames[0] = 0;
nRet = L_Jp2ReadFrames(hEngine,MAKE_IMAGE_PATH(TEXT("image1.jpx")),&Composite,puFrames,1,24,ORDER_BGR,NULL,NULL,NULL, NULL);
if(nRet != SUCCESS)
return nRet;
*pBitmap = Composite.pBitmaps[0].ColorBitmap;
/*Free comoposite structure*/
L_Jp2FreeComposite(hEngine, &Composite);
/*Destroy engine handle*/
L_Jp2Destroy(hEngine);
return SUCCESS;
}
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET