CDC::GetPixel() returns a -1 as if the pixel is not in clip region 
Author Message
 CDC::GetPixel() returns a -1 as if the pixel is not in clip region

CDC::GetPixel() and SetPixel return a -1 as if the pixel is not in clip
region instead of the COLORREF color in a CView drived class OnDraw
function.  CDC::GetClipBox returns an empty rectangle.
CWnd::InvalidateRect is called in the function that sends the WM_PAINT
message  which causes the OnDraw function to be called.  Whether the
rectangle given to InvalidateRect is NULL which should invalidate the
whole window or the window client rectangle is used the GetClipBox
rectangle is still empty. According to the documentation BeginPaint
should create a device context that creates the appropiate clipping
region. CView::OnPaint uses CPaintDC which calls BeginPaint. The
background is not erased since this is only a partial redraw.  I would
like to be able to determine the color of a given pixel without
redrawing the whole window.

Thanks,
Ron Marhall



Tue, 22 Aug 2000 03:00:00 GMT  
 CDC::GetPixel() returns a -1 as if the pixel is not in clip region

Try this:
CClientDC dc( this );
COLORREF color = dc.GetPixel( point );

Claire Sylvestre

Quote:

>CDC::GetPixel() and SetPixel return a -1 as if the pixel is not in clip
>region instead of the COLORREF color in a CView drived class OnDraw
>function.  CDC::GetClipBox returns an empty rectangle.
>CWnd::InvalidateRect is called in the function that sends the WM_PAINT
>message  which causes the OnDraw function to be called.  Whether the
>rectangle given to InvalidateRect is NULL which should invalidate the
>whole window or the window client rectangle is used the GetClipBox
>rectangle is still empty. According to the documentation BeginPaint
>should create a device context that creates the appropiate clipping
>region. CView::OnPaint uses CPaintDC which calls BeginPaint. The
>background is not erased since this is only a partial redraw.  I would
>like to be able to determine the color of a given pixel without
>redrawing the whole window.



Wed, 23 Aug 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Reading pixels outside clipping region

2. I want to use the function GetPixel or anything else to get each pixel and

3. CDC::GetPixel

4. problem with cdc::getpixel

5. graphics / clip regions

6. Clip regions for windowless controls

7. HOW CAN GET CLIPPING REGION?

8. turn off/reset clipping region

9. Clipping Regions

10. Donut-Shaped Clipping Region

11. Region and clipping Functions fail in an Embedded Item

12. Repeated use of clipping regions results in strange, system-wide screwed up DC

 

 
Powered by phpBB® Forum Software