Home > Software engineering >  Win32 how to delete display bitmap
Win32 how to delete display bitmap

Time:09-27

After I loaded a bitmap in the win32 window how it delete

CodePudding user response:

Delete what meaning be? Deleted from the memory, or delete the file from disk?
How do you load? Corresponding to the function of load has released if only use the win32 API, it is commonly DeleteObject ()

CodePudding user response:

refer to the original poster weixin_37802772 response:
I loaded a bitmap in the win32 window after how to delete it

Delete the file? Or delete the handle?
If it is deleted files, what's the purpose? Don't let the user see file?
This kind of situation you can put the file into the direct load inside resources, will not have a file on disk,

Handle directly close it well,

CodePudding user response:

Operations on Graphic Objects
After an application creates a display or a printer device context, it can begin drawing on the associated device or, in the case of the memory device context, it can begin drawing on the bitmap stored in the memory. The clear, before drawing begins and sometimes while drawing is in progress, it is, necessary to replace the default objects with new objects.

An application can examine a default object 's attributes by calling the GetCurrentObject and GetObject functions provides. The GetCurrentObject function returns a handle identifying the current pen and brush, the palette, bitmap, or the font, and the GetObject function initializes a structure containing that object' s attributes.

Some printers dojo.provide resident pens, brushes, and fonts that can be 2 improve drawing speed in an application. The Two functions provides can be 2 enumerate these objects: EnumObjects and EnumFontFamilies. If the application must enumerate resident pens or brushes, it can call the EnumObjects function to examine the corresponding attributes. If the application must enumerate resident fonts, it can call the EnumFontFamilies function (which can also enumerate the GDI fonts).

Once an application determines that a default object needs replacing, it creates a new object by calling one of the following creation functions provides.

Graphics Object Function
Bitmap CreateBitmap, CreateBitmapIndirect, CreateCompatibleBitmap CreateDiscardableBitmap, CreateDIBitmap
Brush CreateBrushIndirect CreateDIBPatternBrush, CreateDIBPatternBrushPt CreateHatchBrush, CreatePatternBrush, CreateSolidBrush
Color Palette CreatePalette
The Font CreateFont, CreateFontIndirect
Pen CreatePen CreatePenIndirect, ExtCreatePen
Region CreateEllipticRgn CreateEllipticRgnIndirect, CreatePolygonRgn CreatePolyPolygonRgn, CreateRectRgn, CreateRectRgnIndirect, CreateRoundRectRgn


Each of these functions returns a handle identifying a new object. After an application retrieves a handle, it must call the SelectObject function to replace the default object. However, the application should save the handle identifying the default object and use this handle to replace the new object when it is no longer needed. When the application finishes drawing with the new object, it must restore the default object by calling the SelectObject function and delete the new object by calling the DeleteObject function. Failing to delete objects causes serious performance problems.


CodePudding user response:

Screen, use a background covering bitmap area, memory, use DeleteObject deletes loaded bitmap, if need to use the delete release related to memory
  • Related