c++ - Caching a bitmap -


I am writing a Win32 application using C ++.

I WM_PAINT message in this application:

  issue WM_PAINT: hdc = startpay (hwnd, and ps); GDPlus Startup (& amp; gdiplus Token & GDIPlus Startup, 0); Dram (Ph. HDC, HWND); Endpents (hwnd, and ps); break;  

And I'm doing something like this in the DrawM function:

  Zero mark sign (HDC HDC, HWND hwd) {if (IsDrawn) {/ / (Some calculation) Graphics G (HDC); Bitmap img (max_x, max_i, and g); Int zoom_factor = 50; (Int i = 0; i & lt; segments.size (); i ++) {// (for some maths) (int j = 0; j & lt; segments.at (i) .point_count; j + +) // (second dose of mathematics) Drones (and pens, segment points, segments. Et (i) .point_count); [] Delete Segment Point; } Yes. save (); IsDrawn = true; } And {// here is the problem}  

}

In the code above, what I wanted to do was render the image once, and after When the window is resized, transmits, or anything that requires re-purpose, it will not assign a bitmap to the scratch, instead it should use a cache instead. The problem is that the bitmap copy (does not allow copy creator reject it). Another problem is that, when I'm trying to save the image in a file or stream, I get the "invalid parameter" error (i.e. return code is 2):

  CLSID pngClsid; GetEncoderClsid (L "image / PNG", & amp; pngClsid); Img.Save (_T ("m.png"), and Gdiplus :: ImageFormatPNG, NULL);  

-> Clone () Also it seems that it is not working, because when I define an indicator on a bitmap, clone bitmap on it and "Other In the statement I use it:

  Graphics G (HDC); G.DrawImage (bmpClone, 50, 50);  

Nothing has been provided.

Any ideas about how to cache bitmap?

clone () should work, but without seeing your code ( What makes it difficult to understand what is happening is, as an alternative, another (more nervousness) approach to GetHBITMAP () original bitmap Call on, handle GDI bitmap and then create new bitmap with the manufacturer in the future recruits.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -