2.2.4.28.36 MatrixObject::SetDIB

Description

Set the Device Independent Bitmap that represents the current data. The MatrixObject will make a copy of the DIB passed in. If a DIB with the specified name already exists then the existing DIB will be replaced (deleted).

Syntax

BOOL SetDIB( HDIB hDIB, LPCSTR lpcszName = NULL, BOOL bCheckDim = FALSE )

Parameters

hDIB
[input] Handle to the Device Independent Bitmap.
lpcszName
[input] Name of the DIB. Can be NULL(by default) to use internal default name.
bCheckDim
[input]

Return

Return TRUE on successful exit and FALSE on failure.

Examples

EX1

#include <Control.h>
#include <ocImgLT.h>
#include <image_utils.h>
#include <..\originlab\ImageControl.h>
void MatrixObject_SetDIB_Ex1(ImageControlBase &ICB, pBITMAPHANDLE pLBmp)
{
    BITMAPHANDLE lbmpTemp;
    if(NULL == pLBmp)
    {
        pBITMAPHANDLE pLbmp = ICB.GetBitmapHandlePtr();
        if(pLbmp)
        {
            L_CopyBitmap(&lbmpTemp, pLbmp, sizeof(BITMAPHANDLE));
            pLBmp = &lbmpTemp;
        }
        else
        {
            error_report("failed to GetBitmapHandlePtr");
            return;
        }
    }
    HDIB h = L_ChangeToDIB(pLBmp);
    
    MatrixLayer    ml = Project.ActiveLayer();
    if(ml)
    {
        MatrixObject mo = ml.MatrixObjects(0);
        if(mo.SetDIB(L_ChangeToDIB(pLBmp)))
            printf("succeed to set");
        else
            printf("failed to set");
    }
}

Remark

See Also

MatrixObject::GetDIB

Header to Include

origin.h