View Full Version : Overlay draw circle

February 26, 2004, 20:15:51
How can I draw the overlay circle in solid color and line

Stefan Geissler
February 27, 2004, 12:12:04

With OverlayBitmap::getDC() you can retrieve the drawing DC of the OverlayBitmap object. With this, you can use the Windows GDI functions to draw circles.

smart_ptr<DShowLib::OverlayBitmap> ob;
ob = m_Grabber.getOverlay();
hDC = ob->getDC();

if( hDC != NULL)
// Now, perform some GDI functions with the hDC

HPEN hPen, hPenOld;
HBRUSH hBrush, hBrushOld;

hPen = CreatePen(PS_SOLID,1, color);
hBrush = CreateSolidBrush( color );

hPenOld = (HPEN)SelectObject(m_hDC, hPen);
hBrushOld = (HBRUSH)SelectObject( m_hDC, hBrush);

Ellipse( hDC, rect.left, rect.top, rect.right, rect.bottom );

SelectObject(m_hDC, hPenOld);
SelectObject(m_hDC, hBrushOld);

DeleteObject( hPen );
DeleteObject( hBrush);



color is a vaild RGB color, rect is an rectangle, which is used to draw the ellipse. The ellipse is filled (solid).

March 3, 2004, 17:40:48
How to work in Visual Basic & Not in solid ??

Stefan Geissler
March 4, 2004, 07:51:19
See the "I want to draw a non solid circle thread" in the ActiveX forum.

April 22, 2004, 19:52:34
After I draw the circle in the center , I cannot detect the pixel data which coverd by that circle any more !! What Can I do Now ??

April 22, 2004, 20:01:17

Stefan Geissler
April 23, 2004, 13:53:44
Hello Webmice,

If you draw in the overlay, it is copied completely on the frame. The original frame pixel data are overwritten.

April 23, 2004, 16:03:04
How can I get the same result ?????

Stefan Geissler
April 26, 2004, 07:38:46
What do you mean with "the same result"? If i understand you correctly, you want to draw some graphics on the live video without deleting the old contents of the live video. Is this correct?

If i am right, i attached to one of our threads a sample, that uses a CListener class that displays the live video image after you had time to process it. It uses an own displaying method on the display window DC. This DC can be used, to draw any other graphical elements, without overdrawing the original memory buffer.

Please let me know, what you want to do. Thank you.

April 26, 2004, 13:01:59
you are right !!!

Stefan Geissler
April 27, 2004, 11:50:54
You saw my entry in http://www.theimagingsourceforums.com/showthread.php?s=&threadid=315934

It shows how to solve your problem in C and in VB