PDA

View Full Version : drawLine not works properly



selvanathan
July 31, 2007, 10:08:02
Dear Sir,
I am using draw line function like following

in the HScroll event i use

void CTesting_Dlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
//Here i calculating Scroll bar value and store in

i_LeftScroll=SomeValue;
Fn_OverlayLines(); // This function is to display line

CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}


BOOL CCameraposition_Dlg::Fn_OverlayLines()
{
m_pGrabber->getOverlay()->setEnable(true);
m_pGrabber->getOverlay()->setDropOutColor(RGB(255,0,255));
m_pGrabber->getOverlay()->fill(m_pGrabber->getOverlay()->getDropOutColor());
m_pGrabber->getOverlay()->drawLine(RGB(255,255,0), i_LeftScroll,0, i_LeftScroll,Height); // Variable Height Having 768(Image Height)

return(true);
}

what i required is
according to the horizontal scroll bar value i need to move line from left to right or right to left



when i using the horizontal scroll bar it works (like 1.Jpg)
But, line is not displayed some time(like 2.Jpg),
how i display line with out break, 419

420

please view the attached Screen Shots.

for your reference i display scroll bar value in edit box.

Stefan Geissler
July 31, 2007, 11:52:33
Hello Selvanathan,

The only situation I know a line is not drawn is when the live video image has been resized to a smaller size, Also you should make sure that i_LeftScroll contains a valid value. The OnHScroll is called twice from the MFC frame work and in one of both calls the parameter nPos is 0.

selvanathan
August 1, 2007, 06:15:16
Dear Sir,
Thank u. Now i find that your first answer is correct. Because of changing the live image size to smaller, the line is not displayed. But i have no space to make that to original size because it is 1024 x 768 camera.

Is there any solution for that by keeping the smaller live image & draw lines with out break;

thanks in advance.

Stefan Geissler
August 1, 2007, 09:04:51
Hi Selvanathan,

The only solution is to draw the live video images and the lines on your own in a listener. You may have a look on the sample I attached to this post.

selvanathan
August 6, 2007, 09:56:20
Dear Sir,
Thank u for u r reply. Sorry, I am in leave so i am not able to reply u immediately

I am running u r file. But i got a following errors.

actually at first it asks "tisudshl.h" file, i include this & its supported header files. finally i got a following error

i atached a included header files for u r reference


--------------------Configuration: DrawWindow - Win32 Debug--------------------
Compiling...
DrawWindowDlg.cpp
E:\flickerfreedrawing\DrawWindowDlg.cpp(97) : error C2664: 'setSinkType' : cannot convert parameter 1 from 'class DShowLib::FrameGrabberSink' to 'const class smart_ptr<class DShowLib::GrabberSinkType,class refcount_ptr<class DShowLib::GrabberSinkTyp
e> > &'
Reason: cannot convert from 'class DShowLib::FrameGrabberSink' to 'const class smart_ptr<class DShowLib::GrabberSinkType,class refcount_ptr<class DShowLib::GrabberSinkType> >'
No constructor could take the source type, or constructor overload resolution was ambiguous
E:\flickerfreedrawing\DrawWindowDlg.cpp(168) : error C2664: 'setSinkType' : cannot convert parameter 1 from 'class DShowLib::FrameGrabberSink' to 'const class smart_ptr<class DShowLib::GrabberSinkType,class refcount_ptr<class DShowLib::GrabberSinkTy
pe> > &'
Reason: cannot convert from 'class DShowLib::FrameGrabberSink' to 'const class smart_ptr<class DShowLib::GrabberSinkType,class refcount_ptr<class DShowLib::GrabberSinkType> >'
No constructor could take the source type, or constructor overload resolution was ambiguous
Error executing cl.exe.

DrawWindow.exe - 2 error(s), 0 warning(s)

Stefan Geissler
August 6, 2007, 14:12:16
Hello Selvanathan,

The error occurs, because the sample has been written with IC Imaging Cotnrol 2.1. I will create a new one. At least, the most interesting part of the sample is the CListener class.

Sascha Schmidt
August 7, 2007, 11:09:37
Hello Selvanathan,

here is the the IC3.0 version of the "flickerfreedrawing" - sample.

It was only necessary to change

m_cGrabber.setSinkType( DShowLib::FrameGrabberSink(
DShowLib::FrameGrabberSink::tFrameGrabberMode::eGR AB, DShowLib::eRGB24 ) ); to

smart_ptr<FrameHandlerSink> pSink = FrameHandlerSink::create( eRGB24, 5 );
m_cGrabber.setSinkType( pSink ); in DrawWindowDlg.cpp

sdecorme
April 3, 2009, 14:16:22
Is there a sample in .net I've the same problem with horizontal lines that are not recording

Stefan Geissler
April 3, 2009, 14:30:15
I am very sorry, but this sample only is available for C++.

What do you mean with "not recording"? Are these lines not in a captured AVI file?