Here is a simple OriginC function that will import a specified image file into a specified matrix window.
bool import_image(LPCSTR lpcszMatrix, LPCSTR lpcszFile)
{
Page pg(lpcszMatrix);
if( !pg || EXIST_MATRIX != pg.GetType() )
return false;
string strPage = lpcszMatrix;
if( !lpcszFile )
return false;
using Image = LabTalk.Image;
Image.FileName$ = lpcszFile;
int iErr = Image.Import.Matrix(strPage);
if( iErr )
{
printf("Import Error %d\n", iErr);
return false;
}
pg.LT_execute("matrix -ii"); // show matrix as image
return true;
}