m_pSelectedInto = NULL;
m_nNumColors = 0;
m_pBitmapMask = NULL;
- m_hBitmap = (WXHBITMAP) NULL;
+ m_hBitmap = (WXHBITMAP) NULL;
} // end of wxBitmapRefData::wxBitmapRefData
void wxBitmapRefData::Free()
wxLogLastError("GpiDeleteBitmap(hbitmap)");
}
}
-
- delete m_pBitmapMask;
- m_pBitmapMask = NULL;
+ if (m_pBitmapMask)
+ {
+ delete m_pBitmapMask;
+ m_pBitmapMask = NULL;
+ }
} // end of wxBitmapRefData::Free
// ----------------------------------------------------------------------------
void wxBitmap::Init()
{
m_bIsMono = FALSE;
+ //
+ // True for all bitmaps created from bits, wxImages, Xpms
+ //
} // end of wxBitmap::Init
bool wxBitmap::CopyFromIconOrCursor(
)
{
Init();
-
(void)Create( nW
,nH
,nD
} // end of wxBitmap::wxBitmap
wxBitmap::wxBitmap(
- const wxString& rFilename
+ int nId
, long lType
)
{
Init();
-
- LoadFile( rFilename
+ LoadFile( nId
,(int)lType
);
+ SetId(nId);
} // end of wxBitmap::wxBitmap
bool wxBitmap::Create(
// Xpms and bitmaps from other images can also be mono's, but only
// mono's need help changing their colors with MemDC changes
//
- if (nD == 1)
- m_bIsMono = TRUE;
if (nD > 0)
{
DEVOPENSTRUC vDop = {0L, "DISPLAY", NULL, 0L, 0L, 0L, 0L, 0L, 0L};
HDC hDC = ::DevOpenDC(vHabmain, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&vDop, NULLHANDLE);
HPS hPS = ::GpiCreatePS(vHabmain, hDC, &vSize, PU_PELS | GPIA_ASSOC);
+ if (nD == 1)
+ m_bIsMono = TRUE;
memset(&vHeader, '\0', 16);
vHeader.cbFix = 16;
vHeader.cx = nW;
}
SetHBITMAP((WXHBITMAP)hBmp);
-#if WXWIN_COMPATIBILITY_2
- GetBitmapData()->m_bOk = hBmp != 0;
-#endif // WXWIN_COMPATIBILITY_2
-
return Ok();
} // end of wxBitmap::Create
} // end of wxBitmap::CreateFromXpm
bool wxBitmap::LoadFile(
- const wxString& rFilename
+ int nId
, long lType
)
{
- HPS hPs = NULLHANDLE;
-
UnRef();
wxBitmapHandler* pHandler = wxDynamicCast( FindHandler(lType)
m_refData = new wxBitmapRefData;
return(pHandler->LoadFile( this
- ,rFilename
- ,hPs
+ ,nId
,lType
, -1
, -1
}
else
{
- wxImage vImage;
-
- if (!vImage.LoadFile(rFilename, lType) || !vImage.Ok() )
- return(FALSE);
-
- *this = wxBitmap(vImage);
-
- return(TRUE);
+ return(FALSE);
}
} // end of wxBitmap::LoadFile
if (!pHandler)
{
- wxLogDebug(wxT("Failed to create bitmap: no bitmap handler for "
- "type %d defined."), lType);
+ wxLogDebug(wxT("Failed to create bitmap: no bitmap handler for type %ld defined."), lType);
return(FALSE);
}
// ----------------------------------------------------------------------------
-// wxImage-wxBitmap convertion
+// wxImage-wxBitmap conversion
// ----------------------------------------------------------------------------
bool wxBitmap::CreateFromImage (
wxCHECK_MSG(rImage.Ok(), FALSE, wxT("invalid image"));
m_refData = new wxBitmapRefData();
-
int nSizeLimit = 1024 * 768 * 3;
int nWidth = rImage.GetWidth();
int nBmpHeight = rImage.GetHeight();
wxCHECK_MSG(rImage.Ok(), FALSE, wxT("invalid image"));
SetWidth(nWidth);
SetHeight(nBmpHeight);
+ if (nDepth == 1)
+ m_bIsMono = TRUE;
+ else
+ m_bIsMono = FALSE;
if (nDepth == -1)
nDepth = wxDisplayDepth();
SetDepth(nDepth);
vError = ::WinGetLastError(vHabmain);
sError = wxPMErrorToStr(vError);
}
- //
- // Debug stuff
- //
-
hPSScreen = ::GpiCreatePS( vHabmain
,hDCScreen
,&vSize
,PU_PELS | GPIA_ASSOC
);
- POINTL vPoint[4] = { 0, nOrigin,
- nWidth, nHeight,
- 0, 0, nWidth, nHeight
+ POINTL vPoint[4] = { {0, nOrigin},
+ {nWidth, nHeight},
+ {0, 0}, {nWidth, nHeight}
};
//
nHeight = nHRemain;
vHeader.cy = (DWORD)(nHeight);
+ vHeader.cbImage = nBytePerLine * nHeight;
}
ptbits = pucBits;
for (int j = 0; j < nHeight; j++)
,&vSize
,PU_PELS | GPIA_ASSOC
);
- POINTL vPoint2[4] = { 0, nOrigin,
- nWidth, nHeight,
- 0, 0, nWidth, nHeight
+ POINTL vPoint2[4] = { {0, nOrigin},
+ {nWidth, nHeight},
+ {0, 0}, {nWidth, nHeight}
};
::GpiBitBlt( hPSScreen
,hPS
BITMAPINFOHEADER2 vDIBh;
BITMAPINFO2 vDIBInfo;
HPS hPSMem;
- HPS hPS;
HBITMAP hBitmap;
HBITMAP hOldBitmap;
DEVOPENSTRUC vDop = {0L, "DISPLAY", NULL, 0L, 0L, 0L, 0L, 0L, 0L};
HDC hDCDst = ::DevOpenDC(vHabmain, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&vDop, NULLHANDLE);
HPS hPSSrc = ::GpiCreatePS(vHabmain, hDCSrc, &vSize, PU_PELS | GPIA_ASSOC);
HPS hPSDst = ::GpiCreatePS(vHabmain, hDCDst, &vSize, PU_PELS | GPIA_ASSOC);
- POINTL vPoint[4] = { 0, 0, rRect.width, rRect.height,
- rRect.x, rRect.y,
- rRect.x + rRect.width, rRect.y + rRect.height
+ POINTL vPoint[4] = { {0, 0}, {rRect.width, rRect.height},
+ {rRect.x, rRect.y},
+ {rRect.x + rRect.width, rRect.y + rRect.height}
};
::GpiSetBitmap(hPSSrc, (HBITMAP) GetHBITMAP());
vBmih.cx = rRect.width;
vBmih.cy = rRect.height;
vBmih.cPlanes = 1;
- vBmih.cBitCount = 1;
+ vBmih.cBitCount = 24;
HBITMAP hBmpMask = ::GpiCreateBitmap( hPSDst
,&vBmih
GetBitmapData()->m_nQuality = nQ;
} // end of wxBitmap::SetQuality
-#if WXWIN_COMPATIBILITY_2
-void wxBitmap::SetOk(
- bool bOk
-)
-{
- EnsureHasData();
-
- GetBitmapData()->m_bOk = bOk;
-} // end of wxBitmap::SetOk
-#endif // WXWIN_COMPATIBILITY_2
-
void wxBitmap::SetPalette(
const wxPalette& rPalette
)
HDC hDCDst = ::DevOpenDC(vHabmain, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&vDop, NULLHANDLE);
HPS hPSSrc = ::GpiCreatePS(vHabmain, hDCSrc, &vSize, PU_PELS | GPIA_ASSOC);
HPS hPSDst = ::GpiCreatePS(vHabmain, hDCDst, &vSize, PU_PELS | GPIA_ASSOC);
- POINTL vPoint[4] = { 0 ,0, rBitmap.GetWidth(), rBitmap.GetHeight(),
- 0, 0, rBitmap.GetWidth(), rBitmap.GetHeight()
+ POINTL vPoint[4] = { {0 ,0}, {rBitmap.GetWidth(), rBitmap.GetHeight()},
+ {0, 0}, {rBitmap.GetWidth(), rBitmap.GetHeight()}
};
if (m_hMaskBitmap)
vBmih.cx = rBitmap.GetWidth();
vBmih.cy = rBitmap.GetHeight();
vBmih.cPlanes = 1;
- vBmih.cBitCount = 1;
+ vBmih.cBitCount = 24;
m_hMaskBitmap = ::GpiCreateBitmap( hPSDst
,&vBmih
HDC hDCDst = ::DevOpenDC(vHabmain, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&vDop, NULLHANDLE);
HPS hPSSrc = ::GpiCreatePS(vHabmain, hDCSrc, &vSize, PU_PELS | GPIA_ASSOC);
HPS hPSDst = ::GpiCreatePS(vHabmain, hDCDst, &vSize, PU_PELS | GPIA_ASSOC);
- POINTL vPoint[4] = { 0 ,0, rBitmap.GetWidth(), rBitmap.GetHeight(),
- 0, 0, rBitmap.GetWidth(), rBitmap.GetHeight()
- };
if (m_hMaskBitmap)
{
bool wxBitmapHandler::Load(
wxGDIImage* pImage
-, const wxString& rName
-, HPS hPs
+, int nId
, long lFlags
, int nWidth
, int nHeight
);
return(pBitmap ? LoadFile( pBitmap
- ,rName
- ,hPs
+ ,nId
,lFlags
,nWidth
,nHeight
bool wxBitmapHandler::LoadFile(
wxBitmap* WXUNUSED(pBitmap)
-, const wxString& WXUNUSED(rName)
-, HPS WXUNUSED(hPs)
+, int WXUNUSED(nId)
, long WXUNUSED(lType)
, int WXUNUSED(nDesiredWidth)
, int WXUNUSED(nDesiredHeight)
HDC hDCDst = ::DevOpenDC(vHabmain, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&vDop, NULLHANDLE);
HPS hPSSrc = ::GpiCreatePS(vHabmain, hDCSrc, &vSize, PU_PELS | GPIA_ASSOC);
HPS hPSDst = ::GpiCreatePS(vHabmain, hDCDst, &vSize, PU_PELS | GPIA_ASSOC);
- POINTL vPoint[4] = { 0 ,0, nWidth, nHeight,
- 0, 0, nWidth, nHeight
+ POINTL vPoint[4] = { {0 ,0}, {nWidth, nHeight},
+ {0, 0}, {nWidth, nHeight}
};
- memset(&vBmih, '\0', sizeof(BITMAPINFOHEADER2));
- vBmih.cbFix = sizeof(BITMAPINFOHEADER2);
+ memset(&vBmih, '\0', 16);
+ vBmih.cbFix = 16;
vBmih.cx = nWidth;
vBmih.cy = nHeight;
vBmih.cPlanes = 1;
- vBmih.cBitCount = 1;
+ vBmih.cBitCount = 24;
hBmpInvMask = ::GpiCreateBitmap( hPSDst
,&vBmih