The last time I saw the problem of memory on the memory of memory, I thought this now.
I don't need to discuss it, I have been solved by the CPU. At the time, I considered a way.
This problem is thought of when the problem is rotated.
The solution to the bitmap is applied to sharing with you:
Void crotatebitmapview :: onfileopen () {// Load bitmap CFiledialog DLG (True, "BMP", "*. BMP"); if (DLG.Domodal ()! = idok) return; cfile file; file.open dlg.GetFileName (), CFile :: modeRead); file.Read (& m_bfHeader, sizeof (BITMAPFILEHEADER)); int nSize = m_bfHeader.bfOffBits - sizeof (BITMAPFILEHEADER); m_pBMPInfo = (LPBITMAPINFOHEADER) new char [nSize]; file.Read (m_pBMPInfo, nSize); DWORD dwBitlen = m_bfHeader.bfSize - m_bfHeader.bfOffBits; m_lpBMPSrcBits = (LPBYTE) new char [dwBitlen]; file.Read (m_lpBMPSrcBits, dwBitlen); file.Close (); Invalidate (true);}
(! M_lpBMPSrcBits) // Rotate 90 degrees to the rightvoid CRotateBitmapView :: OnTodoRight () {if return; int i, j; int newWidth = 0; switch (m_pBMPInfo-> biBitCount) {case 1: return; case 4: m_BitsSize = (((M_PBmpinfo-> Biheight 1) / 2 3) / 4 * 4) * m_pbmpinfo-> biwidth; m_lpbmpdstbits = (lpbyte) new char [m_bitssize]; MEMSET (M_LPBMPDSTBITS, 0, M_BITSSIZE); BYTE TEMPBYTE; / / memset (& tempbyte, 0,1); tempbyte = 0; m_lpBMPDstBitsCopy = m_lpBMPDstBits; for (i = 0; i
Tempbyte << 4; IF ((J 1)% 2 == 0) Tempbyte = Tempbyte >> 4; * m_lpbmpdstbits = (* m_lpbmpdstbits) | TempByte; M_LPBMPSRCBITSCOPY = ((m_pbmpinfo-> biwidth 1) / 2 3) / 4 * 4;} else {tempbyte = * (m_lpbmpsrcbitscopy-1); tempByte = Tempbyte << 4; tempbyte = tempbyte >> 4; if ((j 1)% 2 == 1) Tempbyte = Tempbyte < <4; * m_lpbmpdstbits = (* m_lpbmpdstbits) | TempByte; M_LpBmpsrcBitscopy = (M_PBmpinfo-> BiWidth 1) / 2 3) / 4 * 4;}}} (((J 1)% 2 == 0) m_lpBMPDstBits ;}} break; case 8: m_BitsSize = ((m_pBMPInfo-> biHeight 3) / 4 * 4) * m_pBMPInfo-> biWidth; m_lpBMPDstBits = (LPBYTE) new char [m_BitsSize]; memset (m_lpBMPDstBits, 0, m_BitsSize) ; M_lpbmpdstbitscopy = m_lpbmpdstbits; for (i = 1; i <= m_pBmpinfo-> biwidth; i ) {// from the row last pixel forward m_lpbmpsrcbitscopy = m_lpbmpsrcbits m_pbmpinfo-> biwidth - i; for (j = 0; J
m_pBMPInfo-> biWidth * 3 - i * 3; for (j = 0; j
if (m_lpBMPSrcBits! = NULL) {StretchDIBits (pDC-> GetSafeHdc (), 50,50, m_pBMPInfo-> biWidth, m_pBMPInfo-> biHeight, 0, 0, m_pBMPInfo-> biWidth, m_pBMPInfo-> biHeight, m_lpBMPSrcBits, (LPBITMAPINFO) M_PBmpinfo, Dib_RGB_COLORS, SRCCOPY);}}
My last word is: http://www.9cbs.net/develop/read_article.asp? Id = 24769
If you have any opinions, you can also discuss with me.
My mailbox is: sunqing_nt@hotmail.com (is also my MSN)