参考地址:http://tsindahui.blog.sohu.com/151668003.html
1.
char lpcsType[MAX_STRING];
Hlong Pointer,Width, Height;
get_image_pointer1(Image, &Pointer, lpcsType, &Width, &Height);
//Halcon与VC++中的图像之间,存在着上下翻转
BYTE * lpByte;
BYTE * ImageG;
int bytewidth;
bytewidth = ((long) Width * 3 + 3 ) / 4 * 4 ;
ImageG = NULL ;
ImageG = new BYTE[ bytewidth * (long) Height ];
lpByte = (BYTE *) Pointer;
int i,j;
for( j = (long)Height-1; j>=0; j--)
{
}
BITMAPINFO * RotateBmpInfo;
BYTE * bitBuffer;
bitBuffer = NULL;
bitBuffer = new BYTE[sizeof(BITMAPINFO)];
RotateBmpInfo = (BITMAPINFO *)bitBuffer;
RotateBmpInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
RotateBmpInfo->bmiHeader.biHeight
RotateBmpInfo->bmiHeader.biWidth
RotateBmpInfo->bmiHeader.biPlanes
RotateBmpInfo->bmiHeader.biBitCount = 24;
RotateBmpInfo->bmiHeader.biCompression
RotateBmpInfo->bmiHeader.biSizeImage
RotateBmpInfo->bmiHeader.biXPelsPerMeter= 0;
RotateBmpInfo->bmiHeader.biYPelsPerMeter= 0;
RotateBmpInfo->bmiHeader.biClrUsed
RotateBmpInfo->bmiHeader.biClrImportant
CWnd * m_pWnd ;
m_pWnd = AfxGetApp()->GetMainWnd();
CDC *pDC = m_pWnd->GetDC();
::StretchDIBits(
m_pWnd->ReleaseDC(pDC);
delete [] ImageG ;
delete [] bitBuffer ;
2.
unsigned char *Pointer;
注:
a)
b)
c)
d)
3.
Hlong lWWindowID;
HTuple WindowHandle;
lWWindowID = (Hlong)m_hWnd; //要显示图片的控件的句柄 set_window_attr("border_width",0); //设置窗口属性 set_window_attr("background_color","light gray"); //设置窗口背景颜色 set_check("~father"); open_window(0,0,m_Width,m_Height,lWWindowID,"visible","",&WindowHandle); //创建窗口 set_check("father"); set_part(WindowHandle,0,0,m_Width-1,m_Height-1); //对窗口上显示图像和区域的一些设置 set_draw(WindowHandle,"margin"); set_colored(WindowHandle,12);
disp_obj(Image,WindowHandle); //显示图像Image(Hobject类型)
4.
//HTuple有一个元素
HTuple aa = 120; double dd = aa[0].D(); // dd=120.000 int ii = aa[0].I(); //ii=120 long ll = aa[0].L(); //ll=120 Hlong hh = aa[0].L();//hh=120 long num = aa.Num(); //num =1; aa = "120"; //HTuple为字符串时,如果赋值不是字符串,不能调用S()函数 const char *cc; cc = aa[0].S(); //cc[0]='1',cc[1]='2',cc[2]='0'
//当aa为多元素的数组时
aa[1] = 230; num = aa.Num(); //num =2; ii = aa[1].I(); //ii=230