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"
48 // ----------------------------------------------------------------------------
50 // ----------------------------------------------------------------------------
52 #if !USE_SHARED_LIBRARIES
53 IMPLEMENT_DYNAMIC_CLASS(wxBitmap
, wxGDIObject
)
54 IMPLEMENT_DYNAMIC_CLASS(wxMask
, wxObject
)
57 // ============================================================================
59 // ============================================================================
61 // ----------------------------------------------------------------------------
63 // ----------------------------------------------------------------------------
65 wxBitmapRefData::wxBitmapRefData()
73 m_selectedInto
= NULL
;
78 wxBitmapRefData::~wxBitmapRefData()
80 wxASSERT_MSG( !m_selectedInto
,
81 wxT("deleting bitmap still selected into wxMemoryDC") );
84 DeleteObject((HBITMAP
) m_hBitmap
);
90 // ----------------------------------------------------------------------------
92 // ----------------------------------------------------------------------------
94 wxList
wxBitmap::sm_handlers
;
98 if ( wxTheBitmapList
)
99 wxTheBitmapList
->AddBitmap(this);
102 wxBitmap::wxBitmap(const wxIcon
& icon
)
104 if ( wxTheBitmapList
)
105 wxTheBitmapList
->AddBitmap(this);
110 int width
= icon
.GetWidth(),
111 height
= icon
.GetHeight();
113 HDC hdc
= ::CreateCompatibleDC(NULL
); // screen DC
114 HBITMAP hbitmap
= ::CreateCompatibleBitmap(hdc
, width
, height
);
115 HBITMAP hbmpOld
= (HBITMAP
)::SelectObject(hdc
, hbitmap
);
117 HICON hicon
= (HICON
) icon
.GetHICON();
118 #if defined(__WIN32__) && !defined(__SC__) && !defined(__TWIN32__)
119 ::DrawIconEx(hdc
, 0, 0, hicon
, width
, height
, 0, 0, DI_NORMAL
);
121 ::DrawIcon(hdc
, 0, 0, hicon
);
124 ::SelectObject(hdc
, hbmpOld
);
127 m_refData
= new wxBitmapRefData
;
128 M_BITMAPDATA
->m_width
= width
;
129 M_BITMAPDATA
->m_height
= height
;
130 M_BITMAPDATA
->m_depth
= wxDisplayDepth();
131 M_BITMAPDATA
->m_numColors
= 0;
133 M_BITMAPDATA
->m_hBitmap
= (WXHBITMAP
)hbitmap
;
134 M_BITMAPDATA
->m_ok
= TRUE
;
137 wxBitmap::wxBitmap(const wxBitmap
& bitmap
)
141 if ( wxTheBitmapList
)
142 wxTheBitmapList
->AddBitmap(this);
145 wxBitmap::~wxBitmap()
148 wxTheBitmapList
->DeleteObject(this);
151 bool wxBitmap::FreeResource(bool WXUNUSED(force
))
156 wxASSERT_MSG( !M_BITMAPDATA
->m_selectedInto
,
157 wxT("freeing bitmap still selected into wxMemoryDC") );
159 if (M_BITMAPDATA
->m_hBitmap
)
161 DeleteObject((HBITMAP
) M_BITMAPDATA
->m_hBitmap
);
163 M_BITMAPDATA
->m_hBitmap
= 0 ;
166 if (M_BITMAPDATA->m_bitmapPalette)
167 delete M_BITMAPDATA->m_bitmapPalette;
169 M_BITMAPDATA->m_bitmapPalette = NULL ;
176 wxBitmap::wxBitmap(const char bits
[], int the_width
, int the_height
, int no_bits
)
178 m_refData
= new wxBitmapRefData
;
180 M_BITMAPDATA
->m_width
= the_width
;
181 M_BITMAPDATA
->m_height
= the_height
;
182 M_BITMAPDATA
->m_depth
= no_bits
;
183 M_BITMAPDATA
->m_numColors
= 0;
185 M_BITMAPDATA
->m_hBitmap
= (WXHBITMAP
) CreateBitmap(the_width
, the_height
, 1, no_bits
, bits
);
187 if (M_BITMAPDATA
->m_hBitmap
)
188 M_BITMAPDATA
->m_ok
= TRUE
;
190 M_BITMAPDATA
->m_ok
= FALSE
;
192 M_BITMAPDATA
->m_selectedInto
= NULL
;
194 if ( wxTheBitmapList
)
195 wxTheBitmapList
->AddBitmap(this);
198 // Create from XPM data
199 wxBitmap::wxBitmap(char **data
, wxControl
*WXUNUSED(anItem
))
201 (void) Create((void *)data
, wxBITMAP_TYPE_XPM_DATA
, 0, 0, 0);
204 wxBitmap::wxBitmap(int w
, int h
, int d
)
206 (void)Create(w
, h
, d
);
208 if ( wxTheBitmapList
)
209 wxTheBitmapList
->AddBitmap(this);
212 wxBitmap::wxBitmap(void *data
, long type
, int width
, int height
, int depth
)
214 (void) Create(data
, type
, width
, height
, depth
);
216 if ( wxTheBitmapList
)
217 wxTheBitmapList
->AddBitmap(this);
220 wxBitmap::wxBitmap(const wxString
& filename
, long type
)
222 LoadFile(filename
, (int)type
);
224 if ( wxTheBitmapList
)
225 wxTheBitmapList
->AddBitmap(this);
228 bool wxBitmap::Create(int w
, int h
, int d
)
232 m_refData
= new wxBitmapRefData
;
234 M_BITMAPDATA
->m_width
= w
;
235 M_BITMAPDATA
->m_height
= h
;
236 M_BITMAPDATA
->m_depth
= d
;
240 M_BITMAPDATA
->m_hBitmap
= (WXHBITMAP
) CreateBitmap(w
, h
, 1, d
, NULL
);
244 HDC dc
= GetDC((HWND
) NULL
);
245 M_BITMAPDATA
->m_hBitmap
= (WXHBITMAP
) CreateCompatibleBitmap(dc
, w
, h
);
246 ReleaseDC((HWND
) NULL
, dc
);
247 M_BITMAPDATA
->m_depth
= wxDisplayDepth();
249 if (M_BITMAPDATA
->m_hBitmap
)
250 M_BITMAPDATA
->m_ok
= TRUE
;
252 M_BITMAPDATA
->m_ok
= FALSE
;
253 return M_BITMAPDATA
->m_ok
;
256 bool wxBitmap::LoadFile(const wxString
& filename
, long type
)
260 m_refData
= new wxBitmapRefData
;
262 wxBitmapHandler
*handler
= FindHandler(type
);
264 if ( handler
== NULL
) {
265 wxLogWarning(wxT("no bitmap handler for type %d defined."), type
);
270 return handler
->LoadFile(this, filename
, type
, -1, -1);
273 bool wxBitmap::Create(void *data
, long type
, int width
, int height
, int depth
)
277 m_refData
= new wxBitmapRefData
;
279 wxBitmapHandler
*handler
= FindHandler(type
);
281 if ( handler
== NULL
) {
282 wxLogWarning(wxT("no bitmap handler for type %d defined."), type
);
287 return handler
->Create(this, data
, type
, width
, height
, depth
);
290 bool wxBitmap::SaveFile(const wxString
& filename
, int type
, const wxPalette
*palette
)
292 wxBitmapHandler
*handler
= FindHandler(type
);
294 if ( handler
== NULL
) {
295 wxLogWarning(wxT("no bitmap handler for type %d defined."), type
);
300 return handler
->SaveFile(this, filename
, type
, palette
);
303 void wxBitmap::SetWidth(int w
)
306 m_refData
= new wxBitmapRefData
;
308 M_BITMAPDATA
->m_width
= w
;
311 void wxBitmap::SetHeight(int h
)
314 m_refData
= new wxBitmapRefData
;
316 M_BITMAPDATA
->m_height
= h
;
319 void wxBitmap::SetDepth(int d
)
322 m_refData
= new wxBitmapRefData
;
324 M_BITMAPDATA
->m_depth
= d
;
327 void wxBitmap::SetQuality(int q
)
330 m_refData
= new wxBitmapRefData
;
332 M_BITMAPDATA
->m_quality
= q
;
335 void wxBitmap::SetOk(bool isOk
)
338 m_refData
= new wxBitmapRefData
;
340 M_BITMAPDATA
->m_ok
= isOk
;
343 void wxBitmap::SetPalette(const wxPalette
& palette
)
346 m_refData
= new wxBitmapRefData
;
348 M_BITMAPDATA
->m_bitmapPalette
= palette
;
351 void wxBitmap::SetMask(wxMask
*mask
)
354 m_refData
= new wxBitmapRefData
;
356 M_BITMAPDATA
->m_bitmapMask
= mask
;
359 void wxBitmap::SetHBITMAP(WXHBITMAP bmp
)
362 m_refData
= new wxBitmapRefData
;
364 M_BITMAPDATA
->m_hBitmap
= bmp
;
365 M_BITMAPDATA
->m_ok
= bmp
!= 0;
368 void wxBitmap::AddHandler(wxBitmapHandler
*handler
)
370 sm_handlers
.Append(handler
);
373 void wxBitmap::InsertHandler(wxBitmapHandler
*handler
)
375 sm_handlers
.Insert(handler
);
378 bool wxBitmap::RemoveHandler(const wxString
& name
)
380 wxBitmapHandler
*handler
= FindHandler(name
);
383 sm_handlers
.DeleteObject(handler
);
390 wxBitmapHandler
*wxBitmap::FindHandler(const wxString
& name
)
392 wxNode
*node
= sm_handlers
.First();
395 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->Data();
396 if ( (handler
->GetName().Cmp(name
) == 0) )
403 wxBitmapHandler
*wxBitmap::FindHandler(const wxString
& extension
, long bitmapType
)
405 wxNode
*node
= sm_handlers
.First();
408 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->Data();
409 if ( (handler
->GetExtension().Cmp(extension
) == 0) &&
410 (bitmapType
== -1 || (handler
->GetType() == bitmapType
)) )
417 wxBitmapHandler
*wxBitmap::FindHandler(long bitmapType
)
419 wxNode
*node
= sm_handlers
.First();
422 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->Data();
423 if (handler
->GetType() == bitmapType
)
430 // New Create/FreeDIB functions since ones in dibutils.cpp are confusing
431 static long createDIB(long xSize
, long ySize
, long bitsPerPixel
,
432 HPALETTE hPal
, LPBITMAPINFO
* lpDIBHeader
);
433 static long freeDIB(LPBITMAPINFO lpDIBHeader
);
435 // Creates a bitmap that matches the device context, from
436 // an arbitray bitmap. At present, the original bitmap must have an
437 // associated palette. TODO: use a default palette if no palette exists.
438 // Contributed by Frederic Villeneuve <frederic.villeneuve@natinst.com>
439 wxBitmap
wxBitmap::GetBitmapForDC(wxDC
& dc
) const
442 wxBitmap
tmpBitmap(this->GetWidth(), this->GetHeight(), dc
.GetDepth());
443 HPALETTE hPal
= (HPALETTE
) NULL
;
445 void *lpBits
= (void*) NULL
;
448 wxASSERT( this->GetPalette() && this->GetPalette()->Ok() && (this->GetPalette()->GetHPALETTE() != 0) );
450 tmpBitmap.SetPalette(this->GetPalette());
451 memDC.SelectObject(tmpBitmap);
452 memDC.SetPalette(this->GetPalette());
454 hPal = (HPALETTE) this->GetPalette()->GetHPALETTE();
456 if( this->GetPalette() && this->GetPalette()->Ok() && (this->GetPalette()->GetHPALETTE() != 0) )
458 tmpBitmap
.SetPalette(* this->GetPalette());
459 memDC
.SelectObject(tmpBitmap
);
460 memDC
.SetPalette(* this->GetPalette());
461 hPal
= (HPALETTE
) this->GetPalette()->GetHPALETTE();
465 hPal
= (HPALETTE
) ::GetStockObject(DEFAULT_PALETTE
);
467 palette
.SetHPALETTE( (WXHPALETTE
)hPal
);
468 tmpBitmap
.SetPalette( palette
);
469 memDC
.SelectObject(tmpBitmap
);
470 memDC
.SetPalette( palette
);
473 // set the height negative because in a DIB the order of the lines is reversed
474 createDIB(this->GetWidth(), -this->GetHeight(), this->GetDepth(), hPal
, &lpDib
);
476 lpBits
= malloc(lpDib
->bmiHeader
.biSizeImage
);
478 ::GetBitmapBits((HBITMAP
)GetHBITMAP(), lpDib
->bmiHeader
.biSizeImage
, lpBits
);
480 ::SetDIBitsToDevice((HDC
) memDC
.GetHDC(), 0, 0, this->GetWidth(), this->GetHeight(),
481 0, 0, 0, this->GetHeight(), lpBits
, lpDib
, DIB_RGB_COLORS
);
498 // Construct a mask from a bitmap and a colour indicating
499 // the transparent area
500 wxMask::wxMask(const wxBitmap
& bitmap
, const wxColour
& colour
)
503 Create(bitmap
, colour
);
506 // Construct a mask from a bitmap and a palette index indicating
507 // the transparent area
508 wxMask::wxMask(const wxBitmap
& bitmap
, int paletteIndex
)
511 Create(bitmap
, paletteIndex
);
514 // Construct a mask from a mono bitmap (copies the bitmap).
515 wxMask::wxMask(const wxBitmap
& bitmap
)
524 ::DeleteObject((HBITMAP
) m_maskBitmap
);
527 // Create a mask from a mono bitmap (copies the bitmap).
528 bool wxMask::Create(const wxBitmap
& bitmap
)
532 ::DeleteObject((HBITMAP
) m_maskBitmap
);
535 if (!bitmap
.Ok() || bitmap
.GetDepth() != 1)
539 m_maskBitmap
= (WXHBITMAP
) CreateBitmap(
544 HDC srcDC
= CreateCompatibleDC(0);
545 SelectObject(srcDC
, (HBITMAP
) bitmap
.GetHBITMAP());
546 HDC destDC
= CreateCompatibleDC(0);
547 SelectObject(destDC
, (HBITMAP
) m_maskBitmap
);
548 BitBlt(destDC
, 0, 0, bitmap
.GetWidth(), bitmap
.GetHeight(), srcDC
, 0, 0, SRCCOPY
);
549 SelectObject(srcDC
, 0);
551 SelectObject(destDC
, 0);
556 // Create a mask from a bitmap and a palette index indicating
557 // the transparent area
558 bool wxMask::Create(const wxBitmap
& bitmap
, int paletteIndex
)
562 ::DeleteObject((HBITMAP
) m_maskBitmap
);
565 if (bitmap
.Ok() && bitmap
.GetPalette()->Ok())
567 unsigned char red
, green
, blue
;
568 if (bitmap
.GetPalette()->GetRGB(paletteIndex
, &red
, &green
, &blue
))
570 wxColour
transparentColour(red
, green
, blue
);
571 return Create(bitmap
, transparentColour
);
577 // Create a mask from a bitmap and a colour indicating
578 // the transparent area
579 bool wxMask::Create(const wxBitmap
& bitmap
, const wxColour
& colour
)
583 ::DeleteObject((HBITMAP
) m_maskBitmap
);
591 // scan the bitmap for the transparent colour and set
592 // the corresponding pixels in the mask to BLACK and
594 COLORREF maskColour
= RGB(colour
.Red(), colour
.Green(), colour
.Blue());
595 m_maskBitmap
= (WXHBITMAP
) ::CreateBitmap(
600 HDC srcDC
= ::CreateCompatibleDC(0);
601 ::SelectObject(srcDC
, (HBITMAP
) bitmap
.GetHBITMAP());
602 HDC destDC
= ::CreateCompatibleDC(0);
603 ::SelectObject(destDC
, (HBITMAP
) m_maskBitmap
);
605 // this is not very efficient, but I can't think
606 // of a better way of doing it
607 for (int w
= 0; w
< bitmap
.GetWidth(); w
++)
609 for (int h
= 0; h
< bitmap
.GetHeight(); h
++)
611 COLORREF col
= GetPixel(srcDC
, w
, h
);
612 if (col
== maskColour
)
614 ::SetPixel(destDC
, w
, h
, RGB(0, 0, 0));
618 ::SetPixel(destDC
, w
, h
, RGB(255, 255, 255));
622 ::SelectObject(srcDC
, 0);
624 ::SelectObject(destDC
, 0);
633 IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler
, wxObject
)
635 bool wxBitmapHandler::Create(wxBitmap
*WXUNUSED(bitmap
), void *WXUNUSED(data
), long WXUNUSED(type
), int WXUNUSED(width
), int WXUNUSED(height
), int WXUNUSED(depth
))
640 bool wxBitmapHandler::LoadFile(wxBitmap
*WXUNUSED(bitmap
), const wxString
& WXUNUSED(name
), long WXUNUSED(type
),
641 int WXUNUSED(desiredWidth
), int WXUNUSED(desiredHeight
))
646 bool wxBitmapHandler::SaveFile(wxBitmap
*WXUNUSED(bitmap
), const wxString
& WXUNUSED(name
), int WXUNUSED(type
), const wxPalette
*WXUNUSED(palette
))
655 class WXDLLEXPORT wxBMPResourceHandler
: public wxBitmapHandler
657 DECLARE_DYNAMIC_CLASS(wxBMPResourceHandler
)
659 inline wxBMPResourceHandler()
661 m_name
= "Windows bitmap resource";
663 m_type
= wxBITMAP_TYPE_BMP_RESOURCE
;
666 virtual bool LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
667 int desiredWidth
, int desiredHeight
);
669 IMPLEMENT_DYNAMIC_CLASS(wxBMPResourceHandler
, wxBitmapHandler
)
671 bool wxBMPResourceHandler::LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long WXUNUSED(flags
),
672 int WXUNUSED(desiredWidth
), int WXUNUSED(desiredHeight
))
674 // TODO: load colourmap.
675 M_BITMAPHANDLERDATA
->m_hBitmap
= (WXHBITMAP
) ::LoadBitmap(wxGetInstance(), name
);
676 if (M_BITMAPHANDLERDATA
->m_hBitmap
)
678 M_BITMAPHANDLERDATA
->m_ok
= TRUE
;
680 GetObject((HBITMAP
) M_BITMAPHANDLERDATA
->m_hBitmap
, sizeof(BITMAP
), (LPSTR
) &bm
);
681 M_BITMAPHANDLERDATA
->m_width
= bm
.bmWidth
;
682 M_BITMAPHANDLERDATA
->m_height
= bm
.bmHeight
;
683 M_BITMAPHANDLERDATA
->m_depth
= bm
.bmBitsPixel
;
685 if ( bitmap
->IsKindOf(CLASSINFO(wxIcon
)) )
692 // it's probably not found
693 wxLogError(wxT("Can't load bitmap '%s' from resources! Check .rc file."), name
.c_str());
698 class WXDLLEXPORT wxBMPFileHandler
: public wxBitmapHandler
700 DECLARE_DYNAMIC_CLASS(wxBMPFileHandler
)
702 inline wxBMPFileHandler()
704 m_name
= "Windows bitmap file";
706 m_type
= wxBITMAP_TYPE_BMP
;
709 virtual bool LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
710 int desiredWidth
, int desiredHeight
);
711 virtual bool SaveFile(wxBitmap
*bitmap
, const wxString
& name
, int type
, const wxPalette
*palette
= NULL
);
713 IMPLEMENT_DYNAMIC_CLASS(wxBMPFileHandler
, wxBitmapHandler
)
715 bool wxBMPFileHandler::LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long WXUNUSED(flags
),
716 int WXUNUSED(desiredWidth
), int WXUNUSED(desiredHeight
))
718 #if wxUSE_IMAGE_LOADING_IN_MSW
719 wxPalette
*palette
= NULL
;
720 bool success
= FALSE
;
722 if (type & wxBITMAP_DISCARD_COLOURMAP)
723 success = wxLoadIntoBitmap(WXSTRINGCAST name, bitmap);
726 success
= (wxLoadIntoBitmap(WXSTRINGCAST name
, bitmap
, &palette
) != 0);
727 if (!success
&& palette
)
734 M_BITMAPHANDLERDATA
->m_bitmapPalette
= *palette
;
743 bool wxBMPFileHandler::SaveFile(wxBitmap
*bitmap
, const wxString
& name
, int WXUNUSED(type
), const wxPalette
*pal
)
745 #if wxUSE_IMAGE_LOADING_IN_MSW
746 wxPalette
*actualPalette
= (wxPalette
*)pal
;
747 if (!actualPalette
&& (!M_BITMAPHANDLERDATA
->m_bitmapPalette
.IsNull()))
748 actualPalette
= & (M_BITMAPHANDLERDATA
->m_bitmapPalette
);
749 return (wxSaveBitmap(WXSTRINGCAST name
, bitmap
, actualPalette
) != 0);
755 void wxBitmap::CleanUpHandlers()
757 wxNode
*node
= sm_handlers
.First();
760 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->Data();
761 wxNode
*next
= node
->Next();
768 void wxBitmap::InitStandardHandlers()
770 AddHandler(new wxBMPResourceHandler
);
771 AddHandler(new wxBMPFileHandler
);
773 // Not added by default: include xpmhand.h in your app
774 // and call these in your wxApp::OnInit.
775 // AddHandler(new wxXPMFileHandler);
776 // AddHandler(new wxXPMDataHandler);
778 AddHandler(new wxICOResourceHandler
);
779 AddHandler(new wxICOFileHandler
);
782 static long createDIB(long xSize
, long ySize
, long bitsPerPixel
,
783 HPALETTE hPal
, LPBITMAPINFO
* lpDIBHeader
)
785 unsigned long i
, headerSize
;
786 LPBITMAPINFO lpDIBheader
= NULL
;
787 LPPALETTEENTRY lpPe
= NULL
;
790 // Allocate space for a DIB header
791 headerSize
= (sizeof(BITMAPINFOHEADER
) + (256 * sizeof(PALETTEENTRY
)));
792 lpDIBheader
= (BITMAPINFO
*) malloc(headerSize
);
793 lpPe
= (PALETTEENTRY
*)((BYTE
*)lpDIBheader
+ sizeof(BITMAPINFOHEADER
));
795 GetPaletteEntries(hPal
, 0, 256, lpPe
);
798 memset(lpDIBheader
, 0x00, sizeof(BITMAPINFOHEADER
));
801 // Fill in the static parts of the DIB header
802 lpDIBheader
->bmiHeader
.biSize
= sizeof(BITMAPINFOHEADER
);
803 lpDIBheader
->bmiHeader
.biWidth
= xSize
;
804 lpDIBheader
->bmiHeader
.biHeight
= ySize
;
805 lpDIBheader
->bmiHeader
.biPlanes
= 1;
807 // this value must be 1, 4, 8 or 24 so PixelDepth can only be
808 lpDIBheader
->bmiHeader
.biBitCount
= (WORD
)(bitsPerPixel
);
809 lpDIBheader
->bmiHeader
.biCompression
= BI_RGB
;
810 lpDIBheader
->bmiHeader
.biSizeImage
= xSize
* abs(ySize
) * bitsPerPixel
>>
812 lpDIBheader
->bmiHeader
.biClrUsed
= 256;
815 // Initialize the DIB palette
816 for (i
= 0; i
< 256; i
++) {
817 lpDIBheader
->bmiColors
[i
].rgbReserved
= lpPe
[i
].peFlags
;
818 lpDIBheader
->bmiColors
[i
].rgbRed
= lpPe
[i
].peRed
;
819 lpDIBheader
->bmiColors
[i
].rgbGreen
= lpPe
[i
].peGreen
;
820 lpDIBheader
->bmiColors
[i
].rgbBlue
= lpPe
[i
].peBlue
;
823 *lpDIBHeader
= lpDIBheader
;
832 static long freeDIB(LPBITMAPINFO lpDIBHeader
)
835 if (lpDIBHeader
!= NULL
) {