Question
How can I create images in a HSDataBase without using the AcquisitionDevice in C++?
Answer
HSDatabase lDB = mApplicationControl.GetDatabase();
HSView lView = lDB.AddView ("New View");
const long ltype = HSImage::hsImageType::hsImage32bppRgb;
HSImage lImage = lView.AddImage("New Image",COleVariant(ltype));
lImage.SetWidth( 10 );
lImage.SetHeight( 10 );
// RawImagePointer may be changed after the allocation from SetWidth/SetHeight
// (hsImage32bppRgb represent a DWORD, hsImage8bppGreyScale is a BYTE)
DWORD* lPtr = (DWORD*)lImage.GetRawImagePointer();
for( int i=0; i<10; i++ )
{
for( int j=0; j<10; j++ )
{
// The two lines in here are both valid, the raw pointer, however, is faster
//lImage.SetPixel(i,j,0xffffff);
lPtr[j+i*(int)lImage.GetWidth()] = 0xffffff;
}
}
Comments
0 comments
Please sign in to leave a comment.