Compresses the input raw data using the ABIC encoder.
#include "ltwrappr.h"
static L_INT LBase::EncodeABIC(pInputData, nAlign, nWidth, nHeight, ppOutputData, pnLength, bBiLevel)
Pointer to a buffer that contains the uncompressed raw data.
Number of bytes used to align the uncompressed raw data pointed to by pInputData.
Width of the uncompressed raw data image, in pixels.
Height of the uncompressed raw data image, in pixels.
Pointer to a pointer to an output data buffer to be updated with the resulting compressed ABIC data.
Pointer to a variable to be updated with the length of the resulting compressed data pointed to by ppOutputData.
Flag that indicates whether to encode the uncompressed input data pointed to by pInputData as bi-level or grayscale. Possible values are:
Value | Meaning |
---|---|
TRUE | Encodes the input buffer as 1-bit Bi-level. |
FALSE | Encodes the input buffer as 4-bit Grayscale. |
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
This function compresses the input raw data to 1-bit bi-level or 4-bit grayscale ABIC data.
The output buffer pointed by ppOutputData is allocated automatically by the function. The user is responsible to free this ppOutputData buffer by calling GlobalFreePtr() function.
Win32, x64.
L_INT LBase__EncodeABICExample( LBitmapBase& Bitmap )
{
L_UCHAR *pData;
L_UCHAR *pOutData;
L_SSIZE_T nOutLength;
L_INT nRet;
L_HANDLE pFile = NULL; /* File handle */
LMemoryFile Memfile;
LBuffer Buffer;
DWORD wWrittenBytes;
nRet = 0;
if( Bitmap.IsAllocated() )
{
nOutLength = 0;
pOutData = NULL;
Memfile.SetBitmap(&Bitmap);
nRet = Memfile.Save( &Buffer, FILE_RAW, Bitmap.GetBitsPerPixel(), 0, NULL );
if( SUCCESS == nRet )
{
pData = (L_UCHAR *)GlobalLock( Buffer.GetHandle() );
nRet = LBase::EncodeABIC( pData, 4, Bitmap.GetWidth(), Bitmap.GetHeight(), &pOutData, &nOutLength, FALSE );
if( SUCCESS == nRet )
{
pFile = CreateFile(MAKE_IMAGE_PATH(TEXT("output.ica")), GENERIC_ALL, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
if( pFile )
{
if( !WriteFile(pFile, pOutData,(DWORD)(sizeof( L_UCHAR ) * nOutLength), &wWrittenBytes, NULL))
{
nRet = -1; /* failed to write data */
}
CloseHandle(pFile );
}
else
{
nRet = -1; /* failed to open file */
}
GlobalFreePtr( pOutData );
nRet = SUCCESS;
}
else
{
nRet = -1; /* failed to encode data */
}
GlobalUnlock( Buffer.GetHandle() );
GlobalFree( Buffer.GetHandle() );
}
}
else
{
MessageBox( AfxGetApp()->m_pMainWnd->GetSafeHwnd(), TEXT("Do decode first please!"), TEXT("Information!"), MB_OK | MB_ICONINFORMATION);
nRet = 0;
}
return nRet;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document