1 /////////////////////////////////////////////////////////////////////////////
4 // Author: David Webster
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "bitmap.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
25 #include "wx/palette.h"
26 #include "wx/dcmemory.h"
27 #include "wx/bitmap.h"
31 #include "wx/os2/private.h"
34 //#include "wx/msw/dib.h"
37 // ----------------------------------------------------------------------------
39 // ----------------------------------------------------------------------------
41 IMPLEMENT_DYNAMIC_CLASS(wxBitmap
, wxGDIObject
)
42 IMPLEMENT_DYNAMIC_CLASS(wxMask
, wxObject
)
44 IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler
, wxObject
)
46 // ============================================================================
48 // ============================================================================
50 // ----------------------------------------------------------------------------
52 // ----------------------------------------------------------------------------
54 wxBitmapRefData::wxBitmapRefData()
57 m_pSelectedInto
= NULL
;
60 m_hBitmap
= (WXHBITMAP
) NULL
;
61 } // end of wxBitmapRefData::wxBitmapRefData
63 void wxBitmapRefData::Free()
65 wxASSERT_MSG( !m_pSelectedInto
,
66 wxT("deleting bitmap still selected into wxMemoryDC") );
70 if ( !::GpiDeleteBitmap((HBITMAP
)m_hBitmap
) )
72 wxLogLastError("GpiDeleteBitmap(hbitmap)");
78 } // end of wxBitmapRefData::Free
80 // ----------------------------------------------------------------------------
82 // ----------------------------------------------------------------------------
84 // this function should be called from all wxBitmap ctors
87 // m_refData = NULL; done in the base class ctor
90 wxTheBitmapList
->AddBitmap(this);
91 } // end of wxBitmap::Init
93 bool wxBitmap::CopyFromIconOrCursor(
94 const wxGDIImage
& rIcon
97 HPOINTER hIcon
= (HPOINTER
)rIcon
.GetHandle();
98 POINTERINFO SIconInfo
;
100 if (!::WinQueryPointerInfo(hIcon
, &SIconInfo
))
102 wxLogLastError(wxT("WinQueryPointerInfo"));
105 wxBitmapRefData
* pRefData
= new wxBitmapRefData
;
107 m_refData
= pRefData
;
109 int nWidth
= rIcon
.GetWidth();
110 int nHeight
= rIcon
.GetHeight();
112 pRefData
->m_nWidth
= nWidth
;
113 pRefData
->m_nHeight
= nHeight
;
114 pRefData
->m_nDepth
= wxDisplayDepth();
116 pRefData
->m_hBitmap
= (WXHBITMAP
)SIconInfo
.hbmColor
;
119 // No mask in the Info struct in OS/2
122 } // end of wxBitmap::CopyFromIconOrCursor
124 bool wxBitmap::CopyFromCursor(
125 const wxCursor
& rCursor
132 return(CopyFromIconOrCursor(rCursor
));
133 } // end of wxBitmap::CopyFromCursor
135 bool wxBitmap::CopyFromIcon(
144 return CopyFromIconOrCursor(rIcon
);
145 } // end of wxBitmap::CopyFromIcon
147 wxBitmap::~wxBitmap()
150 wxTheBitmapList
->DeleteObject(this);
151 } // end of wxBitmap::~wxBitmap
162 wxBitmapRefData
* pRefData
= new wxBitmapRefData
;
163 BITMAPINFOHEADER2 vHeader
;
167 DEVOPENSTRUC vDop
= { NULL
, "DISPLAY", NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
};
168 SIZEL vSize
= {0, 0};
170 wxASSERT(vHabmain
!= NULL
);
172 hDc
= ::DevOpenDC(vHabmain
, OD_MEMORY
, (PSZ
)"*", 1L, (PDEVOPENDATA
)&vDop
, 0L);
174 vHeader
.cbFix
= sizeof(vHeader
);
175 vHeader
.cx
= (USHORT
)nTheWidth
;
176 vHeader
.cy
= (USHORT
)nTheHeight
;
177 vHeader
.cPlanes
= 1L;
178 vHeader
.cBitCount
= nNoBits
;
179 vHeader
.ulCompression
= BCA_UNCOMP
;
180 vHeader
.cxResolution
= 0;
181 vHeader
.cyResolution
= 0;
182 vHeader
.cclrUsed
= 0;
183 vHeader
.cclrImportant
= 0;
184 vHeader
.usUnits
= BRU_METRIC
;
185 vHeader
.usRecording
= BRA_BOTTOMUP
;
186 vHeader
.usRendering
= BRH_NOTHALFTONED
;
189 vHeader
.ulColorEncoding
= 0;
190 vHeader
.ulIdentifier
= 0;
192 hPs
= ::GpiCreatePS(vHabmain
, hDc
, &vSize
, GPIA_ASSOC
| PU_PELS
);
195 wxLogLastError("GpiCreatePS Failure");
198 m_refData
= pRefData
;
200 pRefData
->m_nWidth
= nTheWidth
;
201 pRefData
->m_nHeight
= nTheHeight
;
202 pRefData
->m_nDepth
= nNoBits
;
203 pRefData
->m_nNumColors
= 0;
204 pRefData
->m_pSelectedInto
= NULL
;
206 HBITMAP hBmp
= ::GpiCreateBitmap(hPs
, &vHeader
, 0L, NULL
, &vInfo
);
209 wxLogLastError("CreateBitmap");
211 SetHBITMAP((WXHBITMAP
)hBmp
);
212 } // end of wxBitmap::wxBitmap
215 // Create from XPM data
223 (void)Create( (void *)ppData
224 ,wxBITMAP_TYPE_XPM_DATA
229 } // end of wxBitmap::wxBitmap
237 (void)Create( (void *)ppData
238 ,wxBITMAP_TYPE_XPM_DATA
243 } // end of wxBitmap::wxBitmap
257 } // end of wxBitmap::wxBitmap
275 } // end of wxBitmap::wxBitmap
278 const wxString
& rFilename
287 } // end of wxBitmap::wxBitmap
289 bool wxBitmap::Create(
296 BITMAPINFOHEADER2 vHeader
;
298 wxASSERT(vHabmain
!= NULL
);
300 m_refData
= new wxBitmapRefData
;
301 GetBitmapData()->m_nWidth
= nW
;
302 GetBitmapData()->m_nHeight
= nH
;
303 GetBitmapData()->m_nDepth
= nD
;
307 DEVOPENSTRUC vDop
= {0L, "DISPLAY", NULL
, 0L, 0L, 0L, 0L, 0L, 0L};
308 SIZEL vSize
= {0, 0};
309 HDC hDC
= ::DevOpenDC(vHabmain
, OD_MEMORY
, "*", 5L, (PDEVOPENDATA
)&vDop
, NULLHANDLE
);
310 HPS hPS
= ::GpiCreatePS(vHabmain
, hDC
, &vSize
, PU_PELS
| GPIA_ASSOC
);
312 memset(&vHeader
, '\0', sizeof(BITMAPINFOHEADER2
));
313 vHeader
.cbFix
= sizeof(BITMAPINFOHEADER2
);
317 vHeader
.cBitCount
= nD
;
319 hBmp
= ::GpiCreateBitmap( hPS
334 hPSScreen
= ::WinGetScreenPS(HWND_DESKTOP
);
335 hDCScreen
= ::GpiQueryDevice(hPSScreen
);
336 ::DevQueryCaps(hDCScreen
, CAPS_COLOR_BITCOUNT
, 1L, &lBitCount
);
338 memset(&vHeader
, '\0', sizeof(BITMAPINFOHEADER2
));
339 vHeader
.cbFix
= sizeof(BITMAPINFOHEADER2
);
343 vHeader
.cBitCount
= lBitCount
;
345 hBmp
= ::GpiCreateBitmap( hPSScreen
352 GetBitmapData()->m_nDepth
= wxDisplayDepth();
353 ::WinReleasePS(hPSScreen
);
355 SetHBITMAP((WXHBITMAP
)hBmp
);
357 #if WXWIN_COMPATIBILITY_2
358 GetBitmapData()->m_bOk
= hBmp
!= 0;
359 #endif // WXWIN_COMPATIBILITY_2
362 } // end of wxBitmap::Create
364 bool wxBitmap::LoadFile(
365 const wxString
& rFilename
369 HPS hPs
= NULLHANDLE
;
373 wxBitmapHandler
* pHandler
= wxDynamicCast( FindHandler(lType
)
379 m_refData
= new wxBitmapRefData
;
381 return(pHandler
->LoadFile( this
393 if (!vImage
.LoadFile(rFilename
, lType
) || !vImage
.Ok() )
396 *this = vImage
.ConvertToBitmap();
400 } // end of wxBitmap::LoadFile
402 bool wxBitmap::Create(
412 wxBitmapHandler
* pHandler
= wxDynamicCast( FindHandler(lType
)
418 wxLogDebug(wxT("Failed to create bitmap: no bitmap handler for "
419 "type %d defined."), lType
);
424 m_refData
= new wxBitmapRefData
;
426 return(pHandler
->Create( this
433 } // end of wxBitmap::Create
435 bool wxBitmap::SaveFile(
436 const wxString
& rFilename
438 , const wxPalette
* pPalette
441 wxBitmapHandler
* pHandler
= wxDynamicCast( FindHandler(lType
)
447 return pHandler
->SaveFile( this
455 // FIXME what about palette? shouldn't we use it?
456 wxImage
vImage(*this);
461 return(vImage
.SaveFile( rFilename
465 } // end of wxBitmap::SaveFile
467 // ----------------------------------------------------------------------------
468 // sub bitmap extraction
469 // ----------------------------------------------------------------------------
471 wxBitmap
wxBitmap::GetSubBitmap(
476 (rRect
.x
>= 0) && (rRect
.y
>= 0) &&
477 (rRect
.x
+ rRect
.width
<= GetWidth()) &&
478 (rRect
.y
+ rRect
.height
<= GetHeight()),
479 wxNullBitmap
, wxT("Invalid bitmap or bitmap region") );
481 wxBitmap
vRet( rRect
.width
485 wxASSERT_MSG( vRet
.Ok(), wxT("GetSubBitmap error") );
491 SIZEL vSize
= {0, 0};
492 DEVOPENSTRUC vDop
= {0L, "DISPLAY", NULL
, 0L, 0L, 0L, 0L, 0L, 0L};
493 HDC hDCSrc
= ::DevOpenDC(vHabmain
, OD_MEMORY
, "*", 5L, (PDEVOPENDATA
)&vDop
, NULLHANDLE
);
494 HDC hDCDst
= ::DevOpenDC(vHabmain
, OD_MEMORY
, "*", 5L, (PDEVOPENDATA
)&vDop
, NULLHANDLE
);
495 HPS hPSSrc
= ::GpiCreatePS(vHabmain
, hDCSrc
, &vSize
, PU_PELS
| GPIA_ASSOC
);
496 HPS hPSDst
= ::GpiCreatePS(vHabmain
, hDCDst
, &vSize
, PU_PELS
| GPIA_ASSOC
);
497 POINTL vPoint
[4] = { rRect
.x
, rRect
.y
,
498 rRect
.x
+ rRect
.width
, rRect
.y
+ rRect
.height
,
499 0, 0, GetWidth(), GetHeight()
502 ::GpiSetBitmap(hPSSrc
, (HBITMAP
) GetHBITMAP());
503 ::GpiSetBitmap(hPSDst
, (HBITMAP
) vRet
.GetHBITMAP());
513 // Copy mask if there is one
517 BITMAPINFOHEADER2 vBmih
;
519 memset(&vBmih
, '\0', sizeof(BITMAPINFOHEADER2
));
520 vBmih
.cbFix
= sizeof(BITMAPINFOHEADER2
);
521 vBmih
.cx
= rRect
.width
;
522 vBmih
.cy
= rRect
.height
;
526 HBITMAP hBmpMask
= ::GpiCreateBitmap( hPSDst
533 ::GpiSetBitmap(hPSSrc
, (HBITMAP
) GetHBITMAP());
534 ::GpiSetBitmap(hPSDst
, (HBITMAP
) vRet
.GetHBITMAP());
536 ::GpiSetBitmap(hPSSrc
, (HBITMAP
) GetMask()->GetMaskBitmap());
537 ::GpiSetBitmap(hPSDst
, (HBITMAP
) hBmpMask
);
546 wxMask
* pMask
= new wxMask((WXHBITMAP
)hBmpMask
);
550 ::GpiSetBitmap(hPSSrc
, NULL
);
551 ::GpiSetBitmap(hPSDst
, NULL
);
552 ::GpiDestroyPS(hPSSrc
);
553 ::GpiDestroyPS(hPSDst
);
554 ::DevCloseDC(hDCSrc
);
555 ::DevCloseDC(hDCDst
);
557 } // end of wxBitmap::GetSubBitmap
559 // ----------------------------------------------------------------------------
560 // wxBitmap accessors
561 // ----------------------------------------------------------------------------
563 void wxBitmap::SetQuality(
569 GetBitmapData()->m_nQuality
= nQ
;
570 } // end of wxBitmap::SetQuality
572 #if WXWIN_COMPATIBILITY_2
573 void wxBitmap::SetOk(
579 GetBitmapData()->m_bOk
= bOk
;
580 } // end of wxBitmap::SetOk
581 #endif // WXWIN_COMPATIBILITY_2
583 void wxBitmap::SetPalette(
584 const wxPalette
& rPalette
589 GetBitmapData()->m_vBitmapPalette
= rPalette
;
590 } // end of wxBitmap::SetPalette
592 void wxBitmap::SetMask(
598 GetBitmapData()->m_pBitmapMask
= pMask
;
599 } // end of wxBitmap::SetMask
602 // Will try something for OS/2 but not really sure how close
603 // to the msw intent this is.
605 wxBitmap
wxBitmap::GetBitmapForDC(
610 wxBitmap
vTmpBitmap( this->GetWidth()
614 WXHBITMAP vOldBitmap
;
620 hMemoryPS
= ::GpiCreatePS(vHabmain
, (HDC
)vMemDC
.GetHDC(), &vSize
, PU_PELS
| GPIT_MICRO
| GPIA_ASSOC
);
621 hPs
= ::GpiCreatePS(vHabmain
, (HDC
)rDc
.GetHDC(), &vSize
, PU_PELS
| GPIT_MICRO
| GPIA_ASSOC
);
623 // TODO: Set the points
625 vOldBitmap
= (WXHBITMAP
)::GpiSetBitmap(hPs
, (HBITMAP
)vTmpBitmap
.GetHBITMAP());
626 ::GpiBitBlt(hPs
, hMemoryPS
, 4L, vPoint
, ROP_SRCCOPY
, BBO_IGNORE
);
629 } // end of wxBitmap::GetBitmapForDC
631 // ----------------------------------------------------------------------------
633 // ----------------------------------------------------------------------------
638 } // end of wxMask::wxMask
640 // Construct a mask from a bitmap and a colour indicating
641 // the transparent area
643 const wxBitmap
& rBitmap
644 , const wxColour
& rColour
651 } // end of wxMask::wxMask
653 // Construct a mask from a bitmap and a palette index indicating
654 // the transparent area
656 const wxBitmap
& rBitmap
664 } // end of wxMask::wxMask
666 // Construct a mask from a mono bitmap (copies the bitmap).
668 const wxBitmap
& rBitmap
673 } // end of wxMask::wxMask
678 ::GpiDeleteBitmap((HBITMAP
)m_hMaskBitmap
);
679 } // end of wxMask::~wxMask
681 // Create a mask from a mono bitmap (copies the bitmap).
683 const wxBitmap
& rBitmap
686 BITMAPINFOHEADER2 vBmih
;
687 SIZEL vSize
= {0, 0};
688 DEVOPENSTRUC vDop
= {0L, "DISPLAY", NULL
, 0L, 0L, 0L, 0L, 0L, 0L};
689 HDC hDCSrc
= ::DevOpenDC(vHabmain
, OD_MEMORY
, "*", 5L, (PDEVOPENDATA
)&vDop
, NULLHANDLE
);
690 HDC hDCDst
= ::DevOpenDC(vHabmain
, OD_MEMORY
, "*", 5L, (PDEVOPENDATA
)&vDop
, NULLHANDLE
);
691 HPS hPSSrc
= ::GpiCreatePS(vHabmain
, hDCSrc
, &vSize
, PU_PELS
| GPIA_ASSOC
);
692 HPS hPSDst
= ::GpiCreatePS(vHabmain
, hDCDst
, &vSize
, PU_PELS
| GPIA_ASSOC
);
693 POINTL vPoint
[4] = { 0 ,0, rBitmap
.GetWidth(), rBitmap
.GetHeight(),
694 0, 0, rBitmap
.GetWidth(), rBitmap
.GetHeight()
699 ::GpiDeleteBitmap((HBITMAP
) m_hMaskBitmap
);
702 if (!rBitmap
.Ok() || rBitmap
.GetDepth() != 1)
707 memset(&vBmih
, '\0', sizeof(BITMAPINFOHEADER2
));
708 vBmih
.cbFix
= sizeof(BITMAPINFOHEADER2
);
709 vBmih
.cx
= rBitmap
.GetWidth();
710 vBmih
.cy
= rBitmap
.GetHeight();
714 m_hMaskBitmap
= ::GpiCreateBitmap( hPSDst
721 ::GpiSetBitmap(hPSSrc
, (HBITMAP
) rBitmap
.GetHBITMAP());
722 ::GpiSetBitmap(hPSDst
, (HBITMAP
) m_hMaskBitmap
);
731 ::GpiDestroyPS(hPSSrc
);
732 ::GpiDestroyPS(hPSDst
);
733 ::DevCloseDC(hDCSrc
);
734 ::DevCloseDC(hDCDst
);
736 } // end of wxMask::Create
738 // Create a mask from a bitmap and a palette index indicating
739 // the transparent area
741 const wxBitmap
& rBitmap
747 ::GpiDeleteBitmap((HBITMAP
) m_hMaskBitmap
);
750 if (rBitmap
.Ok() && rBitmap
.GetPalette()->Ok())
753 unsigned char cGreen
;
756 if (rBitmap
.GetPalette()->GetRGB( nPaletteIndex
762 wxColour
vTransparentColour( cRed
767 return (Create( rBitmap
773 } // end of wxMask::Create
775 // Create a mask from a bitmap and a colour indicating
776 // the transparent area
778 const wxBitmap
& rBitmap
779 , const wxColour
& rColour
783 COLORREF vMaskColour
= OS2RGB( rColour
.Red()
787 BITMAPINFOHEADER2 vBmih
;
788 SIZEL vSize
= {0, 0};
789 DEVOPENSTRUC vDop
= { NULL
, "DISPLAY", NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
};
790 HDC hDCSrc
= ::DevOpenDC(vHabmain
, OD_MEMORY
, "*", 5L, (PDEVOPENDATA
)&vDop
, NULLHANDLE
);
791 HDC hDCDst
= ::DevOpenDC(vHabmain
, OD_MEMORY
, "*", 5L, (PDEVOPENDATA
)&vDop
, NULLHANDLE
);
792 HPS hPSSrc
= ::GpiCreatePS(vHabmain
, hDCSrc
, &vSize
, PU_PELS
| GPIA_ASSOC
);
793 HPS hPSDst
= ::GpiCreatePS(vHabmain
, hDCDst
, &vSize
, PU_PELS
| GPIA_ASSOC
);
794 POINTL vPoint
[4] = { 0 ,0, rBitmap
.GetWidth(), rBitmap
.GetHeight(),
795 0, 0, rBitmap
.GetWidth(), rBitmap
.GetHeight()
800 ::GpiDeleteBitmap((HBITMAP
) m_hMaskBitmap
);
809 // Scan the bitmap for the transparent colour and set
810 // the corresponding pixels in the mask to BLACK and
814 memset(&vBmih
, '\0', sizeof(BITMAPINFOHEADER2
));
815 vBmih
.cbFix
= sizeof(BITMAPINFOHEADER2
);
816 vBmih
.cx
= rBitmap
.GetWidth();
817 vBmih
.cy
= rBitmap
.GetHeight();
821 m_hMaskBitmap
= ::GpiCreateBitmap( hPSDst
828 ::GpiSetBitmap(hPSSrc
, (HBITMAP
) rBitmap
.GetHBITMAP());
829 ::GpiSetBitmap(hPSDst
, (HBITMAP
) m_hMaskBitmap
);
832 // This is not very efficient, but I can't think
833 // of a better way of doing it
835 for (int w
= 0; w
< rBitmap
.GetWidth(); w
++)
837 for (int h
= 0; h
< rBitmap
.GetHeight(); h
++)
840 COLORREF vCol
= (COLORREF
)::GpiQueryPel(hPSSrc
, &vPt
);
841 if (vCol
== (COLORREF
)CLR_NOINDEX
)
844 // Doesn't make sense to continue
850 if (vCol
== vMaskColour
)
852 ::GpiSetColor(hPSDst
, OS2RGB(0, 0, 0));
853 ::GpiSetPel(hPSDst
, &vPt
);
857 ::GpiSetColor(hPSDst
, OS2RGB(255, 255, 255));
858 ::GpiSetPel(hPSDst
, &vPt
);
862 ::GpiSetBitmap(hPSSrc
, NULL
);
863 ::GpiSetBitmap(hPSDst
, NULL
);
864 ::GpiDestroyPS(hPSSrc
);
865 ::GpiDestroyPS(hPSDst
);
866 ::DevCloseDC(hDCSrc
);
867 ::DevCloseDC(hDCDst
);
869 } // end of wxMask::Create
871 // ----------------------------------------------------------------------------
873 // ----------------------------------------------------------------------------
875 bool wxBitmapHandler::Create(
884 wxBitmap
* pBitmap
= wxDynamicCast( pImage
888 return(pBitmap
? Create( pBitmap
896 bool wxBitmapHandler::Load(
898 , const wxString
& rName
905 wxBitmap
* pBitmap
= wxDynamicCast( pImage
909 return(pBitmap
? LoadFile( pBitmap
918 bool wxBitmapHandler::Save(
920 , const wxString
& rName
924 wxBitmap
* pBitmap
= wxDynamicCast( pImage
928 return(pBitmap
? SaveFile( pBitmap
934 bool wxBitmapHandler::Create(
935 wxBitmap
* WXUNUSED(pBitmap
)
936 , void* WXUNUSED(pData
)
937 , long WXUNUSED(lType
)
938 , int WXUNUSED(nWidth
)
939 , int WXUNUSED(nHeight
)
940 , int WXUNUSED(nDepth
)
946 bool wxBitmapHandler::LoadFile(
947 wxBitmap
* WXUNUSED(pBitmap
)
948 , const wxString
& WXUNUSED(rName
)
950 , long WXUNUSED(lType
)
951 , int WXUNUSED(nDesiredWidth
)
952 , int WXUNUSED(nDesiredHeight
)
958 bool wxBitmapHandler::SaveFile(
959 wxBitmap
* WXUNUSED(pBitmap
)
960 , const wxString
& WXUNUSED(rName
)
961 , int WXUNUSED(nType
)
962 , const wxPalette
* WXUNUSED(pPalette
)
968 // ----------------------------------------------------------------------------
970 // ----------------------------------------------------------------------------
971 HBITMAP
wxInvertMask(
977 HBITMAP hBmpInvMask
= 0;
979 wxCHECK_MSG( hBmpMask
, 0, _T("invalid bitmap in wxInvertMask") );
982 // Get width/height from the bitmap if not given
984 if (!nWidth
|| !nHeight
)
986 BITMAPINFOHEADER2 vBmhdr
;
988 ::GpiQueryBitmapInfoHeader( hBmpMask
991 nWidth
= (int)vBmhdr
.cx
;
992 nHeight
= (int)vBmhdr
.cy
;
995 BITMAPINFOHEADER2 vBmih
;
996 SIZEL vSize
= {0, 0};
997 DEVOPENSTRUC vDop
= {0L, "DISPLAY", NULL
, 0L, 0L, 0L, 0L, 0L, 0L};
998 HDC hDCSrc
= ::DevOpenDC(vHabmain
, OD_MEMORY
, "*", 5L, (PDEVOPENDATA
)&vDop
, NULLHANDLE
);
999 HDC hDCDst
= ::DevOpenDC(vHabmain
, OD_MEMORY
, "*", 5L, (PDEVOPENDATA
)&vDop
, NULLHANDLE
);
1000 HPS hPSSrc
= ::GpiCreatePS(vHabmain
, hDCSrc
, &vSize
, PU_PELS
| GPIA_ASSOC
);
1001 HPS hPSDst
= ::GpiCreatePS(vHabmain
, hDCDst
, &vSize
, PU_PELS
| GPIA_ASSOC
);
1002 POINTL vPoint
[4] = { 0 ,0, nWidth
, nHeight
,
1003 0, 0, nWidth
, nHeight
1006 memset(&vBmih
, '\0', sizeof(BITMAPINFOHEADER2
));
1007 vBmih
.cbFix
= sizeof(BITMAPINFOHEADER2
);
1011 vBmih
.cBitCount
= 1;
1013 hBmpInvMask
= ::GpiCreateBitmap( hPSDst
1020 ::GpiSetBitmap(hPSSrc
, (HBITMAP
) hBmpMask
);
1021 ::GpiSetBitmap(hPSDst
, (HBITMAP
) hBmpInvMask
);
1031 ::GpiDestroyPS(hPSSrc
);
1032 ::GpiDestroyPS(hPSDst
);
1033 ::DevCloseDC(hDCSrc
);
1034 ::DevCloseDC(hDCDst
);
1037 } // end of WxWinGdi_InvertMask