2.1.12.3 apply_pal_to_LT_bmp


Description

apply palette to Image

Syntax

int apply_pal_to_LT_bmp( pBITMAPHANDLE pLBmp, string strPalFile )

Parameters

pLBmp
[modify] the image handler need to apply palette.
strPalFile
[input] palette file path

Return

SUCCESS or a LeadTools error number less than zero.

Examples

Prior to compilation, load matdata_utils.c to the workspace by executing the following LabTalk command:

Run.LoadOC("Originlab\matdata_utils.c", 16);

To retain matdata_utils.c in the workspace for successive sessions, drag and drop the file from the Temporary folder to the System folder.

EX1

#include <..\originlab\matdata_utils.h>
#include <image_utils.h>
//this example assumes that there is already an image in the active matrixsheet 
void apply_pal_to_LT_bmp_ex1()
{
    MatrixObject        mobj;
    if (!mobj.Attach("MBook1"))
    {
        out_str("Attachment failed!");
    }
    Image img(mobj);
    if(!img.IsValid())
        return;
    BITMAPHANDLE* pLBmp = img.GetLBmp();
    string strPalFile = GetAppPath(true) + "Samples\Image Processing and Analysis\cell.jpg";
    int nRet = apply_pal_to_LT_bmp(pLBmp, strPalFile);
    if (nRet)
    {
        out_str("Apply palette to Image Success");
    }
    else
    {
        out_str("Apply palette to Image failed");
    }
}

Remark

See Also

apply_pal_to_image

Header to Included

matdata_utils.h

Reference