MCPcopy Create free account
hub / github.com/DennisLiu1993/Fastest_Image_Pattern_Matching / DrawToHDC

Method DrawToHDC

MatchTool/CvvImage.cpp:222–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220 }
221}
222void CvvImage::DrawToHDC( HDC hDCDst, RECT* pDstRect )
223{
224 if( pDstRect && m_img && m_img->depth == IPL_DEPTH_8U && m_img->imageData )
225 {
226 uchar buffer[sizeof(BITMAPINFOHEADER) + 1024];
227 BITMAPINFO* bmi = (BITMAPINFO*)buffer;
228 int bmp_w = m_img->width, bmp_h = m_img->height;
229 CvRect roi = cvGetImageROI( m_img );
230 CvRect dst = RectToCvRect( *pDstRect );
231 if( roi.width == dst.width && roi.height == dst.height )
232 {
233 Show( hDCDst, dst.x, dst.y, dst.width, dst.height, roi.x, roi.y );
234 return;
235 }
236 if( roi.width > dst.width )
237 {
238 SetStretchBltMode(
239 hDCDst, // handle to device context
240 HALFTONE );
241 }
242 else
243 {
244 SetStretchBltMode(
245 hDCDst, // handle to device context
246 COLORONCOLOR );
247 }
248 FillBitmapInfo( bmi, bmp_w, bmp_h, Bpp(), m_img->origin );
249 ::StretchDIBits(
250 hDCDst,
251 dst.x, dst.y, dst.width, dst.height,
252 roi.x, roi.y, roi.width, roi.height,
253 m_img->imageData, bmi, DIB_RGB_COLORS, SRCCOPY );
254 }
255}
256void CvvImage::Fill( int color )
257{
258 cvSet( m_img, cvScalar(color&255,(color>>8)&255,(color>>16)&255,(color>>24)&255) );

Callers

nothing calls this directly

Calls 2

RectToCvRectFunction · 0.85
FillBitmapInfoFunction · 0.85

Tested by

no test coverage detected