keronprints.blogg.se

Stretchblt copyimage
Stretchblt copyimage













  1. #STRETCHBLT COPYIMAGE CODE#
  2. #STRETCHBLT COPYIMAGE WINDOWS#

#STRETCHBLT COPYIMAGE CODE#

I uploaded a small program with source code to demonstrate the issue : StretchBlt(dc.GetSafeHdc(),rect.left,rect.top,rect.Width(),rect.Height(),hMemDC,0,0,sz.cx,sz.cy,SRCCOPY) SetStretchBltMode(dc.GetSafeHdc(),m_smoothing=0?COLORONCOLOR:HALFTONE) HBITMAP hOldBitmap = (HBITMAP)SelectObject(hMemDC, m_hBitmap) The code to draw the image is straigthforward: So basically, StrectchBlt HALFTONE smoothing will work depending on the content of my image ! The funny thing is that, if i lighten or darken the image a little bit, then StretchBlt works again. The images i use to reproduce the bug are small 108x150 RGB 32 bits images where pixels are all gray, but different shades of gray of course. Basically, each pixel becomes a big block of pixels with the same color. The smoothing looks as if i had used COLORONCOLOR, even though when comparing the results, the image on screen is different than the one i get with COLORONCOLOR. What happens is that on some images, when I use StretchBlt with the HALFTONE stretching mode, the image is correctly stretched but the smoothing is wrong. I also tried with ATI and NVIDIA cards, same problem. I use VC++ 2005 and can reproduce the bug under XP and Vista so far.

#STRETCHBLT COPYIMAGE WINDOWS#

My question is how can this be written to where it doesn't eat up the Windows Resources and runs quickly?ĭirectShow Filter Graph Spy: Extremely helpful for finding deep details for DirectShow Graphs.Hi there, I have a very strange behaviour for the GDI function StrechBlt. Such as something like 300 MB of Windows Page File in something like 7 to 10 minutes for around 1000 images! OUCH! especially when it is called 100's of times. This code works pretty well except that it eats up Windows Page File resources very very quickly. M_SMALL_THUMBNAIL.SetBitmap(hbm3) // Move Resized Bitmap to our Form Move our held hbm3 bitmap into our thumbnail area. StretchBlt(memdc3, 0, 0, cx1, cy1, memdc4, 0, 0, bm1.bmWidth, bm1.bmHeight, SRCCOPY) ::SetStretchBltMode(memdc3, COLORONCOLOR) HGDIOBJ hOld2 = SelectObject(memdc3, hbm3) HBITMAP hbm3 = CreateCompatibleBitmap(dc1, cx1, cy1) HWND DesktopWindow1 = ::GetDesktopWindow() Resize from 640 by 480 pixels to 120 by 90 pixels M_LARGE_THUMBNAIL.SetBitmap(hbm2) // Move Resized Bitmap to our Form now we have a resized Bitmap in hbm2 at 320 by 240 pixels StretchBlt(memdc, 0, 0, cx, cy, memdc2, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY)

stretchblt copyimage

::SetStretchBltMode(memdc, COLORONCOLOR) HGDIOBJ hOld = SelectObject(memdc, hbm2)

stretchblt copyimage

HBITMAP hbm2 = CreateCompatibleBitmap(dc, cx, cy) HWND DesktopWindow = ::GetDesktopWindow()

stretchblt copyimage stretchblt copyimage

Resize from 640 by 480 pixels to 320 by 240 pixels HBITMAP hbm = (HBITMAP) m_PICTUREBOX.GetBitmap() m_PICTUREBOX points to a Picture Box on my form that is 640 by 480 pixels The sample code below is where we have the issue with StretchBlt: therefore I need help to understand why the code below has problems and how best to fix them. I can write in MFC C++ but it is not my best programming language. We have a Visual Studio 2005 MFC C++ Test Project that we are attempting to use hundreds of times.Īssume that m_PICTUREBOX points to a PictureBox on the form and that this same PictureBox is updated before each iteration of a loop.















Stretchblt copyimage