More bitmap and imaging updates
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15276 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -600,7 +600,7 @@ bool wxBitmap::CreateFromImage (
|
|||||||
HDC hDC = ::DevOpenDC(vHabmain, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&vDop, NULLHANDLE);
|
HDC hDC = ::DevOpenDC(vHabmain, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&vDop, NULLHANDLE);
|
||||||
HPS hPS = ::GpiCreatePS(vHabmain, hDC, &vSize, PU_PELS | GPIA_ASSOC);
|
HPS hPS = ::GpiCreatePS(vHabmain, hDC, &vSize, PU_PELS | GPIA_ASSOC);
|
||||||
LONG lScans;
|
LONG lScans;
|
||||||
HDC hDCScreen = ::WinOpenWindowDC(HWND_DESKTOP);
|
HDC hDCScreen = ::DevOpenDC(vHabmain, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&vDop, NULLHANDLE);
|
||||||
HPS hPSScreen;
|
HPS hPSScreen;
|
||||||
HBITMAP hBmp;
|
HBITMAP hBmp;
|
||||||
HBITMAP hBmpOld;
|
HBITMAP hBmpOld;
|
||||||
@@ -661,6 +661,7 @@ bool wxBitmap::CreateFromImage (
|
|||||||
// Have to do something similar to WIN32's StretchDIBits, use GpiBitBlt
|
// Have to do something similar to WIN32's StretchDIBits, use GpiBitBlt
|
||||||
// in combination with setting the bits into the selected bitmap
|
// in combination with setting the bits into the selected bitmap
|
||||||
//
|
//
|
||||||
|
vInfo.cBitCount = 16;
|
||||||
if ((lScans = ::GpiSetBitmapBits( hPS
|
if ((lScans = ::GpiSetBitmapBits( hPS
|
||||||
,0 // Start at the bottom
|
,0 // Start at the bottom
|
||||||
,(LONG)nHeight // One line per scan
|
,(LONG)nHeight // One line per scan
|
||||||
@@ -671,6 +672,25 @@ bool wxBitmap::CreateFromImage (
|
|||||||
ERRORID vError;
|
ERRORID vError;
|
||||||
wxString sError;
|
wxString sError;
|
||||||
|
|
||||||
|
vError = ::WinGetLastError(vHabmain);
|
||||||
|
sError = wxPMErrorToStr(vError);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// for debugging----
|
||||||
|
//
|
||||||
|
LONG alFormats[24];
|
||||||
|
::GpiQueryDeviceBitmapFormats(hPS, 24, alFormats);
|
||||||
|
if ((lScans = ::GpiQueryBitmapBits( hPS
|
||||||
|
,0L
|
||||||
|
,(LONG)nHeight
|
||||||
|
,(PBYTE)pucBits
|
||||||
|
,&vInfo
|
||||||
|
)) == GPI_ALTERROR)
|
||||||
|
{
|
||||||
|
ERRORID vError;
|
||||||
|
wxString sError;
|
||||||
|
|
||||||
vError = ::WinGetLastError(vHabmain);
|
vError = ::WinGetLastError(vHabmain);
|
||||||
sError = wxPMErrorToStr(vError);
|
sError = wxPMErrorToStr(vError);
|
||||||
}
|
}
|
||||||
@@ -708,11 +728,11 @@ bool wxBitmap::CreateFromImage (
|
|||||||
//
|
//
|
||||||
if (rImage.HasMask())
|
if (rImage.HasMask())
|
||||||
{
|
{
|
||||||
vHeader.cbFix = sizeof(BITMAPINFOHEADER2);
|
vHeader.cbFix = 16;
|
||||||
vHeader.cx = nWidth;
|
vHeader.cx = nWidth;
|
||||||
vHeader.cy = nHeight;
|
vHeader.cy = nHeight;
|
||||||
vHeader.cPlanes = 1;
|
vHeader.cPlanes = 1;
|
||||||
vHeader.cBitCount = 1;
|
vHeader.cBitCount = 24;
|
||||||
hBmp = ::GpiCreateBitmap( hPS
|
hBmp = ::GpiCreateBitmap( hPS
|
||||||
,&vHeader
|
,&vHeader
|
||||||
,0L
|
,0L
|
||||||
@@ -725,7 +745,6 @@ bool wxBitmap::CreateFromImage (
|
|||||||
else
|
else
|
||||||
nHeight = nSizeLimit / nBytePerLine;
|
nHeight = nSizeLimit / nBytePerLine;
|
||||||
vHeader.cy = (DWORD)(nHeight);
|
vHeader.cy = (DWORD)(nHeight);
|
||||||
vHeader.cbImage = nBytePerLine * nHeight;
|
|
||||||
nOrigin = 0;
|
nOrigin = 0;
|
||||||
|
|
||||||
unsigned char cRed = rImage.GetMaskRed();
|
unsigned char cRed = rImage.GetMaskRed();
|
||||||
@@ -745,7 +764,6 @@ bool wxBitmap::CreateFromImage (
|
|||||||
//
|
//
|
||||||
nHeight = nHRemain;
|
nHeight = nHRemain;
|
||||||
vHeader.cy = (DWORD)(nHeight);
|
vHeader.cy = (DWORD)(nHeight);
|
||||||
vHeader.cbImage = nBytePerLine * nHeight;
|
|
||||||
}
|
}
|
||||||
ptbits = pucBits;
|
ptbits = pucBits;
|
||||||
for (int j = 0; j < nHeight; j++)
|
for (int j = 0; j < nHeight; j++)
|
||||||
@@ -801,7 +819,7 @@ bool wxBitmap::CreateFromImage (
|
|||||||
|
|
||||||
pMask->SetMaskBitmap((WXHBITMAP)hBmp);
|
pMask->SetMaskBitmap((WXHBITMAP)hBmp);
|
||||||
SetMask(pMask);
|
SetMask(pMask);
|
||||||
hBmpOld = ::GpiSetBitmap(hPS, hBmp);
|
hBmpOld = ::GpiSetBitmap(hPS, hBmpOld);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -982,7 +1000,7 @@ wxImage wxBitmap::ConvertToImage() const
|
|||||||
HPS hMemPS = ::GpiCreatePS( vHabmain
|
HPS hMemPS = ::GpiCreatePS( vHabmain
|
||||||
,hMemDC
|
,hMemDC
|
||||||
,&vSizlPage
|
,&vSizlPage
|
||||||
,PU_PELS | GPIA_ASSOC | GPIT_MICRO
|
,PU_PELS | GPIA_ASSOC
|
||||||
);
|
);
|
||||||
::GpiSetColor(hMemPS, OS2RGB(0, 0, 0));
|
::GpiSetColor(hMemPS, OS2RGB(0, 0, 0));
|
||||||
::GpiSetBackColor(hMemPS, OS2RGB(255, 255, 255) );
|
::GpiSetBackColor(hMemPS, OS2RGB(255, 255, 255) );
|
||||||
|
@@ -204,7 +204,7 @@ void wxMemoryDC::DoDrawRectangle(
|
|||||||
{
|
{
|
||||||
unsigned char* pucData = NULL;
|
unsigned char* pucData = NULL;
|
||||||
unsigned char* pucBits;
|
unsigned char* pucBits;
|
||||||
int nBytesPerLine = vWidth * 3;
|
int nBytesPerLine = m_vSelectedBitmap.GetWidth() * 3;
|
||||||
LONG lScans = 0L;
|
LONG lScans = 0L;
|
||||||
POINTL vPoint;
|
POINTL vPoint;
|
||||||
LONG lColor;
|
LONG lColor;
|
||||||
@@ -231,14 +231,13 @@ void wxMemoryDC::DoDrawRectangle(
|
|||||||
pucBits = pucData;
|
pucBits = pucData;
|
||||||
for (int i = 0; i < m_vSelectedBitmap.GetHeight(); i++)
|
for (int i = 0; i < m_vSelectedBitmap.GetHeight(); i++)
|
||||||
{
|
{
|
||||||
for (int j = vX; j < m_vSelectedBitmap.GetWidth(); j++)
|
for (int j = 0; j < m_vSelectedBitmap.GetWidth(); j++)
|
||||||
{
|
{
|
||||||
if (i >= vY && j >= vX && i < vHeight && j < vWidth)
|
if (i >= vY && j >= vX && i < vHeight && j < vWidth)
|
||||||
{
|
{
|
||||||
vPoint.x = j; vPoint.y = i;
|
|
||||||
if (i == vY || j == vX ||
|
if (i == vY || j == vX ||
|
||||||
i == m_vSelectedBitmap.GetWidth() -1 ||
|
i == m_vSelectedBitmap.GetWidth() -1 ||
|
||||||
j == m_vSelectedBitmap.GetHeight()
|
j == m_vSelectedBitmap.GetHeight() - 1
|
||||||
)
|
)
|
||||||
lColor = m_pen.GetColour().GetPixel();
|
lColor = m_pen.GetColour().GetPixel();
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user