1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
21 #pragma implementation "bitmap.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
37 #include "wx/palette.h"
38 #include "wx/dcmemory.h"
39 #include "wx/bitmap.h"
43 #include "wx/msw/private.h"
46 #include "wx/msw/dib.h"
49 // ----------------------------------------------------------------------------
51 // ----------------------------------------------------------------------------
53 #if !USE_SHARED_LIBRARIES
54 IMPLEMENT_DYNAMIC_CLASS(wxBitmap
, wxGDIObject
)
55 IMPLEMENT_DYNAMIC_CLASS(wxMask
, wxObject
)
58 // ============================================================================
60 // ============================================================================
62 // ----------------------------------------------------------------------------
64 // ----------------------------------------------------------------------------
66 wxBitmapRefData::wxBitmapRefData()
74 m_selectedInto
= NULL
;
79 wxBitmapRefData::~wxBitmapRefData()
81 wxASSERT_MSG( !m_selectedInto
,
82 wxT("deleting bitmap still selected into wxMemoryDC") );
85 DeleteObject((HBITMAP
) m_hBitmap
);
91 // ----------------------------------------------------------------------------
93 // ----------------------------------------------------------------------------
95 wxList
wxBitmap::sm_handlers
;
97 // this function should be called from all wxBitmap ctors
100 // m_refData = NULL; done in the base class ctor
102 if ( wxTheBitmapList
)
103 wxTheBitmapList
->AddBitmap(this);
106 bool wxBitmap::CopyFromIcon(const wxIcon
& icon
)
113 int width
= icon
.GetWidth(),
114 height
= icon
.GetHeight();
116 HICON hicon
= (HICON
) icon
.GetHICON();
118 // GetIconInfo() doesn't exist under Win16 and I don't know any other way
119 // to create a bitmap from icon there - but using this way we won't have
122 // copy the icon to the bitmap
123 HDC hdcScreen
= ::GetDC((HWND
)NULL
);
124 HDC hdc
= ::CreateCompatibleDC(hdcScreen
);
125 HBITMAP hbitmap
= ::CreateCompatibleBitmap(hdcScreen
, width
, height
);
126 HBITMAP hbmpOld
= (HBITMAP
)::SelectObject(hdc
, hbitmap
);
128 ::DrawIcon(hdc
, 0, 0, hicon
);
130 ::SelectObject(hdc
, hbmpOld
);
132 ::ReleaseDC((HWND
)NULL
, hdcScreen
);
135 if ( !GetIconInfo(hicon
, &iconInfo
) )
137 wxLogLastError("GetIconInfo");
142 HBITMAP hbitmap
= iconInfo
.hbmColor
;
144 wxMask
*mask
= new wxMask
;
145 mask
->SetMaskBitmap((WXHBITMAP
)iconInfo
.hbmMask
);
148 m_refData
= new wxBitmapRefData
;
150 M_BITMAPDATA
->m_width
= width
;
151 M_BITMAPDATA
->m_height
= height
;
152 M_BITMAPDATA
->m_depth
= wxDisplayDepth();
154 M_BITMAPDATA
->m_hBitmap
= (WXHBITMAP
)hbitmap
;
155 M_BITMAPDATA
->m_ok
= TRUE
;
164 wxBitmap::~wxBitmap()
167 wxTheBitmapList
->DeleteObject(this);
170 bool wxBitmap::FreeResource(bool WXUNUSED(force
))
175 wxASSERT_MSG( !M_BITMAPDATA
->m_selectedInto
,
176 wxT("freeing bitmap still selected into wxMemoryDC") );
178 if (M_BITMAPDATA
->m_hBitmap
)
180 DeleteObject((HBITMAP
) M_BITMAPDATA
->m_hBitmap
);
182 M_BITMAPDATA
->m_hBitmap
= 0 ;
185 if (M_BITMAPDATA->m_bitmapPalette)
186 delete M_BITMAPDATA->m_bitmapPalette;
188 M_BITMAPDATA->m_bitmapPalette = NULL ;
195 wxBitmap::wxBitmap(const char bits
[], int the_width
, int the_height
, int no_bits
)
199 m_refData
= new wxBitmapRefData
;
201 M_BITMAPDATA
->m_width
= the_width
;
202 M_BITMAPDATA
->m_height
= the_height
;
203 M_BITMAPDATA
->m_depth
= no_bits
;
204 M_BITMAPDATA
->m_numColors
= 0;
206 M_BITMAPDATA
->m_hBitmap
= (WXHBITMAP
) CreateBitmap(the_width
, the_height
, 1, no_bits
, bits
);
208 if (M_BITMAPDATA
->m_hBitmap
)
209 M_BITMAPDATA
->m_ok
= TRUE
;
211 M_BITMAPDATA
->m_ok
= FALSE
;
213 M_BITMAPDATA
->m_selectedInto
= NULL
;
216 // Create from XPM data
217 wxBitmap::wxBitmap(char **data
, wxControl
*WXUNUSED(anItem
))
221 (void)Create((void *)data
, wxBITMAP_TYPE_XPM_DATA
, 0, 0, 0);
224 wxBitmap::wxBitmap(int w
, int h
, int d
)
228 (void)Create(w
, h
, d
);
231 wxBitmap::wxBitmap(void *data
, long type
, int width
, int height
, int depth
)
235 (void) Create(data
, type
, width
, height
, depth
);
238 wxBitmap::wxBitmap(const wxString
& filename
, long type
)
242 LoadFile(filename
, (int)type
);
245 bool wxBitmap::Create(int w
, int h
, int d
)
249 m_refData
= new wxBitmapRefData
;
251 M_BITMAPDATA
->m_width
= w
;
252 M_BITMAPDATA
->m_height
= h
;
253 M_BITMAPDATA
->m_depth
= d
;
257 M_BITMAPDATA
->m_hBitmap
= (WXHBITMAP
) CreateBitmap(w
, h
, 1, d
, NULL
);
261 HDC dc
= GetDC((HWND
) NULL
);
262 M_BITMAPDATA
->m_hBitmap
= (WXHBITMAP
) CreateCompatibleBitmap(dc
, w
, h
);
263 ReleaseDC((HWND
) NULL
, dc
);
264 M_BITMAPDATA
->m_depth
= wxDisplayDepth();
266 if (M_BITMAPDATA
->m_hBitmap
)
267 M_BITMAPDATA
->m_ok
= TRUE
;
269 M_BITMAPDATA
->m_ok
= FALSE
;
270 return M_BITMAPDATA
->m_ok
;
273 bool wxBitmap::LoadFile(const wxString
& filename
, long type
)
277 m_refData
= new wxBitmapRefData
;
279 wxBitmapHandler
*handler
= FindHandler(type
);
281 if ( handler
== NULL
) {
283 if (!image
.LoadFile( filename
, type
)) return FALSE
;
286 *this = image
.ConvertToBitmap();
292 return handler
->LoadFile(this, filename
, type
, -1, -1);
295 bool wxBitmap::Create(void *data
, long type
, int width
, int height
, int depth
)
299 m_refData
= new wxBitmapRefData
;
301 wxBitmapHandler
*handler
= FindHandler(type
);
303 if ( handler
== NULL
) {
304 wxLogWarning(wxT("no bitmap handler for type %d defined."), type
);
309 return handler
->Create(this, data
, type
, width
, height
, depth
);
312 bool wxBitmap::SaveFile(const wxString
& filename
, int type
, const wxPalette
*palette
)
314 wxBitmapHandler
*handler
= FindHandler(type
);
316 if ( handler
== NULL
) { // try wxImage
317 wxImage
image( *this );
318 if (image
.Ok()) return image
.SaveFile( filename
, type
);
322 return handler
->SaveFile(this, filename
, type
, palette
);
325 void wxBitmap::SetWidth(int w
)
328 m_refData
= new wxBitmapRefData
;
330 M_BITMAPDATA
->m_width
= w
;
333 void wxBitmap::SetHeight(int h
)
336 m_refData
= new wxBitmapRefData
;
338 M_BITMAPDATA
->m_height
= h
;
341 void wxBitmap::SetDepth(int d
)
344 m_refData
= new wxBitmapRefData
;
346 M_BITMAPDATA
->m_depth
= d
;
349 void wxBitmap::SetQuality(int q
)
352 m_refData
= new wxBitmapRefData
;
354 M_BITMAPDATA
->m_quality
= q
;
357 void wxBitmap::SetOk(bool isOk
)
360 m_refData
= new wxBitmapRefData
;
362 M_BITMAPDATA
->m_ok
= isOk
;
365 void wxBitmap::SetPalette(const wxPalette
& palette
)
368 m_refData
= new wxBitmapRefData
;
370 M_BITMAPDATA
->m_bitmapPalette
= palette
;
373 void wxBitmap::SetMask(wxMask
*mask
)
376 m_refData
= new wxBitmapRefData
;
378 M_BITMAPDATA
->m_bitmapMask
= mask
;
381 void wxBitmap::SetHBITMAP(WXHBITMAP bmp
)
384 m_refData
= new wxBitmapRefData
;
386 M_BITMAPDATA
->m_hBitmap
= bmp
;
387 M_BITMAPDATA
->m_ok
= bmp
!= 0;
390 void wxBitmap::AddHandler(wxBitmapHandler
*handler
)
392 sm_handlers
.Append(handler
);
395 void wxBitmap::InsertHandler(wxBitmapHandler
*handler
)
397 sm_handlers
.Insert(handler
);
400 bool wxBitmap::RemoveHandler(const wxString
& name
)
402 wxBitmapHandler
*handler
= FindHandler(name
);
405 sm_handlers
.DeleteObject(handler
);
412 wxBitmapHandler
*wxBitmap::FindHandler(const wxString
& name
)
414 wxNode
*node
= sm_handlers
.First();
417 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->Data();
418 if ( (handler
->GetName().Cmp(name
) == 0) )
425 wxBitmapHandler
*wxBitmap::FindHandler(const wxString
& extension
, long bitmapType
)
427 wxNode
*node
= sm_handlers
.First();
430 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->Data();
431 if ( (handler
->GetExtension().Cmp(extension
) == 0) &&
432 (bitmapType
== -1 || (handler
->GetType() == bitmapType
)) )
439 wxBitmapHandler
*wxBitmap::FindHandler(long bitmapType
)
441 wxNode
*node
= sm_handlers
.First();
444 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->Data();
445 if (handler
->GetType() == bitmapType
)
452 // New Create/FreeDIB functions since ones in dibutils.cpp are confusing
453 static long createDIB(long xSize
, long ySize
, long bitsPerPixel
,
454 HPALETTE hPal
, LPBITMAPINFO
* lpDIBHeader
);
455 static long freeDIB(LPBITMAPINFO lpDIBHeader
);
457 // Creates a bitmap that matches the device context, from
458 // an arbitray bitmap. At present, the original bitmap must have an
459 // associated palette. TODO: use a default palette if no palette exists.
460 // Contributed by Frederic Villeneuve <frederic.villeneuve@natinst.com>
461 wxBitmap
wxBitmap::GetBitmapForDC(wxDC
& dc
) const
464 wxBitmap
tmpBitmap(this->GetWidth(), this->GetHeight(), dc
.GetDepth());
465 HPALETTE hPal
= (HPALETTE
) NULL
;
467 void *lpBits
= (void*) NULL
;
470 wxASSERT( this->GetPalette() && this->GetPalette()->Ok() && (this->GetPalette()->GetHPALETTE() != 0) );
472 tmpBitmap.SetPalette(this->GetPalette());
473 memDC.SelectObject(tmpBitmap);
474 memDC.SetPalette(this->GetPalette());
476 hPal = (HPALETTE) this->GetPalette()->GetHPALETTE();
478 if( this->GetPalette() && this->GetPalette()->Ok() && (this->GetPalette()->GetHPALETTE() != 0) )
480 tmpBitmap
.SetPalette(* this->GetPalette());
481 memDC
.SelectObject(tmpBitmap
);
482 memDC
.SetPalette(* this->GetPalette());
483 hPal
= (HPALETTE
) this->GetPalette()->GetHPALETTE();
487 hPal
= (HPALETTE
) ::GetStockObject(DEFAULT_PALETTE
);
489 palette
.SetHPALETTE( (WXHPALETTE
)hPal
);
490 tmpBitmap
.SetPalette( palette
);
491 memDC
.SelectObject(tmpBitmap
);
492 memDC
.SetPalette( palette
);
495 // set the height negative because in a DIB the order of the lines is reversed
496 createDIB(this->GetWidth(), -this->GetHeight(), this->GetDepth(), hPal
, &lpDib
);
498 lpBits
= malloc(lpDib
->bmiHeader
.biSizeImage
);
500 ::GetBitmapBits((HBITMAP
)GetHBITMAP(), lpDib
->bmiHeader
.biSizeImage
, lpBits
);
502 ::SetDIBitsToDevice((HDC
) memDC
.GetHDC(), 0, 0, this->GetWidth(), this->GetHeight(),
503 0, 0, 0, this->GetHeight(), lpBits
, lpDib
, DIB_RGB_COLORS
);
520 // Construct a mask from a bitmap and a colour indicating
521 // the transparent area
522 wxMask::wxMask(const wxBitmap
& bitmap
, const wxColour
& colour
)
525 Create(bitmap
, colour
);
528 // Construct a mask from a bitmap and a palette index indicating
529 // the transparent area
530 wxMask::wxMask(const wxBitmap
& bitmap
, int paletteIndex
)
533 Create(bitmap
, paletteIndex
);
536 // Construct a mask from a mono bitmap (copies the bitmap).
537 wxMask::wxMask(const wxBitmap
& bitmap
)
546 ::DeleteObject((HBITMAP
) m_maskBitmap
);
549 // Create a mask from a mono bitmap (copies the bitmap).
550 bool wxMask::Create(const wxBitmap
& bitmap
)
554 ::DeleteObject((HBITMAP
) m_maskBitmap
);
557 if (!bitmap
.Ok() || bitmap
.GetDepth() != 1)
561 m_maskBitmap
= (WXHBITMAP
) CreateBitmap(
566 HDC srcDC
= CreateCompatibleDC(0);
567 SelectObject(srcDC
, (HBITMAP
) bitmap
.GetHBITMAP());
568 HDC destDC
= CreateCompatibleDC(0);
569 SelectObject(destDC
, (HBITMAP
) m_maskBitmap
);
570 BitBlt(destDC
, 0, 0, bitmap
.GetWidth(), bitmap
.GetHeight(), srcDC
, 0, 0, SRCCOPY
);
571 SelectObject(srcDC
, 0);
573 SelectObject(destDC
, 0);
578 // Create a mask from a bitmap and a palette index indicating
579 // the transparent area
580 bool wxMask::Create(const wxBitmap
& bitmap
, int paletteIndex
)
584 ::DeleteObject((HBITMAP
) m_maskBitmap
);
587 if (bitmap
.Ok() && bitmap
.GetPalette()->Ok())
589 unsigned char red
, green
, blue
;
590 if (bitmap
.GetPalette()->GetRGB(paletteIndex
, &red
, &green
, &blue
))
592 wxColour
transparentColour(red
, green
, blue
);
593 return Create(bitmap
, transparentColour
);
599 // Create a mask from a bitmap and a colour indicating
600 // the transparent area
601 bool wxMask::Create(const wxBitmap
& bitmap
, const wxColour
& colour
)
605 ::DeleteObject((HBITMAP
) m_maskBitmap
);
613 // scan the bitmap for the transparent colour and set
614 // the corresponding pixels in the mask to BLACK and
616 COLORREF maskColour
= RGB(colour
.Red(), colour
.Green(), colour
.Blue());
617 m_maskBitmap
= (WXHBITMAP
) ::CreateBitmap(
622 HDC srcDC
= ::CreateCompatibleDC(0);
623 ::SelectObject(srcDC
, (HBITMAP
) bitmap
.GetHBITMAP());
624 HDC destDC
= ::CreateCompatibleDC(0);
625 ::SelectObject(destDC
, (HBITMAP
) m_maskBitmap
);
627 // this is not very efficient, but I can't think
628 // of a better way of doing it
629 for (int w
= 0; w
< bitmap
.GetWidth(); w
++)
631 for (int h
= 0; h
< bitmap
.GetHeight(); h
++)
633 COLORREF col
= GetPixel(srcDC
, w
, h
);
634 if (col
== maskColour
)
636 ::SetPixel(destDC
, w
, h
, RGB(0, 0, 0));
640 ::SetPixel(destDC
, w
, h
, RGB(255, 255, 255));
644 ::SelectObject(srcDC
, 0);
646 ::SelectObject(destDC
, 0);
655 IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler
, wxObject
)
657 bool wxBitmapHandler::Create(wxBitmap
*WXUNUSED(bitmap
), void *WXUNUSED(data
), long WXUNUSED(type
), int WXUNUSED(width
), int WXUNUSED(height
), int WXUNUSED(depth
))
662 bool wxBitmapHandler::LoadFile(wxBitmap
*WXUNUSED(bitmap
), const wxString
& WXUNUSED(name
), long WXUNUSED(type
),
663 int WXUNUSED(desiredWidth
), int WXUNUSED(desiredHeight
))
668 bool wxBitmapHandler::SaveFile(wxBitmap
*WXUNUSED(bitmap
), const wxString
& WXUNUSED(name
), int WXUNUSED(type
), const wxPalette
*WXUNUSED(palette
))
677 class WXDLLEXPORT wxBMPResourceHandler
: public wxBitmapHandler
679 DECLARE_DYNAMIC_CLASS(wxBMPResourceHandler
)
681 inline wxBMPResourceHandler()
683 m_name
= "Windows bitmap resource";
685 m_type
= wxBITMAP_TYPE_BMP_RESOURCE
;
688 virtual bool LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
689 int desiredWidth
, int desiredHeight
);
691 IMPLEMENT_DYNAMIC_CLASS(wxBMPResourceHandler
, wxBitmapHandler
)
693 bool wxBMPResourceHandler::LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long WXUNUSED(flags
),
694 int WXUNUSED(desiredWidth
), int WXUNUSED(desiredHeight
))
696 // TODO: load colourmap.
697 M_BITMAPHANDLERDATA
->m_hBitmap
= (WXHBITMAP
) ::LoadBitmap(wxGetInstance(), name
);
698 if (M_BITMAPHANDLERDATA
->m_hBitmap
)
700 M_BITMAPHANDLERDATA
->m_ok
= TRUE
;
702 GetObject((HBITMAP
) M_BITMAPHANDLERDATA
->m_hBitmap
, sizeof(BITMAP
), (LPSTR
) &bm
);
703 M_BITMAPHANDLERDATA
->m_width
= bm
.bmWidth
;
704 M_BITMAPHANDLERDATA
->m_height
= bm
.bmHeight
;
705 M_BITMAPHANDLERDATA
->m_depth
= bm
.bmBitsPixel
;
707 if ( bitmap
->IsKindOf(CLASSINFO(wxIcon
)) )
714 // it's probably not found
715 wxLogError(wxT("Can't load bitmap '%s' from resources! Check .rc file."), name
.c_str());
720 class WXDLLEXPORT wxBMPFileHandler
: public wxBitmapHandler
722 DECLARE_DYNAMIC_CLASS(wxBMPFileHandler
)
724 inline wxBMPFileHandler()
726 m_name
= "Windows bitmap file";
728 m_type
= wxBITMAP_TYPE_BMP
;
731 virtual bool LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
732 int desiredWidth
, int desiredHeight
);
733 virtual bool SaveFile(wxBitmap
*bitmap
, const wxString
& name
, int type
, const wxPalette
*palette
= NULL
);
735 IMPLEMENT_DYNAMIC_CLASS(wxBMPFileHandler
, wxBitmapHandler
)
737 bool wxBMPFileHandler::LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long WXUNUSED(flags
),
738 int WXUNUSED(desiredWidth
), int WXUNUSED(desiredHeight
))
740 #if wxUSE_IMAGE_LOADING_IN_MSW
741 wxPalette
*palette
= NULL
;
742 bool success
= FALSE
;
744 if (type & wxBITMAP_DISCARD_COLOURMAP)
745 success = wxLoadIntoBitmap(WXSTRINGCAST name, bitmap);
748 success
= (wxLoadIntoBitmap(WXSTRINGCAST name
, bitmap
, &palette
) != 0);
749 if (!success
&& palette
)
756 M_BITMAPHANDLERDATA
->m_bitmapPalette
= *palette
;
765 bool wxBMPFileHandler::SaveFile(wxBitmap
*bitmap
, const wxString
& name
, int WXUNUSED(type
), const wxPalette
*pal
)
767 #if wxUSE_IMAGE_LOADING_IN_MSW
768 wxPalette
*actualPalette
= (wxPalette
*)pal
;
769 if (!actualPalette
&& (!M_BITMAPHANDLERDATA
->m_bitmapPalette
.IsNull()))
770 actualPalette
= & (M_BITMAPHANDLERDATA
->m_bitmapPalette
);
771 return (wxSaveBitmap(WXSTRINGCAST name
, bitmap
, actualPalette
) != 0);
777 void wxBitmap::CleanUpHandlers()
779 wxNode
*node
= sm_handlers
.First();
782 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->Data();
783 wxNode
*next
= node
->Next();
790 void wxBitmap::InitStandardHandlers()
792 AddHandler(new wxBMPResourceHandler
);
793 AddHandler(new wxBMPFileHandler
);
795 // Not added by default: include xpmhand.h in your app
796 // and call these in your wxApp::OnInit.
797 // AddHandler(new wxXPMFileHandler);
798 // AddHandler(new wxXPMDataHandler);
800 AddHandler(new wxICOResourceHandler
);
801 AddHandler(new wxICOFileHandler
);
804 static long createDIB(long xSize
, long ySize
, long bitsPerPixel
,
805 HPALETTE hPal
, LPBITMAPINFO
* lpDIBHeader
)
807 unsigned long i
, headerSize
;
808 LPBITMAPINFO lpDIBheader
= NULL
;
809 LPPALETTEENTRY lpPe
= NULL
;
812 // Allocate space for a DIB header
813 headerSize
= (sizeof(BITMAPINFOHEADER
) + (256 * sizeof(PALETTEENTRY
)));
814 lpDIBheader
= (BITMAPINFO
*) malloc(headerSize
);
815 lpPe
= (PALETTEENTRY
*)((BYTE
*)lpDIBheader
+ sizeof(BITMAPINFOHEADER
));
817 GetPaletteEntries(hPal
, 0, 256, lpPe
);
820 memset(lpDIBheader
, 0x00, sizeof(BITMAPINFOHEADER
));
823 // Fill in the static parts of the DIB header
824 lpDIBheader
->bmiHeader
.biSize
= sizeof(BITMAPINFOHEADER
);
825 lpDIBheader
->bmiHeader
.biWidth
= xSize
;
826 lpDIBheader
->bmiHeader
.biHeight
= ySize
;
827 lpDIBheader
->bmiHeader
.biPlanes
= 1;
829 // this value must be 1, 4, 8 or 24 so PixelDepth can only be
830 lpDIBheader
->bmiHeader
.biBitCount
= (WORD
)(bitsPerPixel
);
831 lpDIBheader
->bmiHeader
.biCompression
= BI_RGB
;
832 lpDIBheader
->bmiHeader
.biSizeImage
= xSize
* abs(ySize
) * bitsPerPixel
>>
834 lpDIBheader
->bmiHeader
.biClrUsed
= 256;
837 // Initialize the DIB palette
838 for (i
= 0; i
< 256; i
++) {
839 lpDIBheader
->bmiColors
[i
].rgbReserved
= lpPe
[i
].peFlags
;
840 lpDIBheader
->bmiColors
[i
].rgbRed
= lpPe
[i
].peRed
;
841 lpDIBheader
->bmiColors
[i
].rgbGreen
= lpPe
[i
].peGreen
;
842 lpDIBheader
->bmiColors
[i
].rgbBlue
= lpPe
[i
].peBlue
;
845 *lpDIBHeader
= lpDIBheader
;
854 static long freeDIB(LPBITMAPINFO lpDIBHeader
)
857 if (lpDIBHeader
!= NULL
) {