![]() To test this domo, you should compile the png32_helper project first, and then compile mfc_demo. See CMfc_demoDlg::OnInitDialog for an example. The new version has a new interface, Png32_LoadFromMem, with which you can easily load a 32 bit PNG image form memory. ![]() Mov ,dh // save result to *pBitsDestīitBlt(hdc,xDest,yDest,nWidth,nHeight,hmemdc, 0, 0,SRCCOPY) Imul eax, 4 // 4 bytes make up one pixel add esi,eax HbmpDest = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS,īitBlt(hmemdc, 0, 0,nWidth,nHeight,hdc,xDest,yDest,SRCCOPY) Do alpla blend int nLineTailDest=WIDTHBYTES(24*nWidth)-3*nWidth īmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER) PPngInfo->ppbyRow+pPngInfo->nHeight-1-(pPngInfo->nHeight-ySour-nHeight) If(ySour+nHeight>( int)pPngInfo->nHeight) nHeight=pPngInfo->nHeight-ySour If(xSour+nWidth>( int)pPngInfo->nWidth) nWidth=pPngInfo->nWidth-xSour display a 32 bit deep png image void Png32_Show(HDC hdc, int xDest, int yDest, int nWidth, int nHeight, In order to simplify the code, I only support 32 pixel depth PNG images. In order to use this code, you should import the lib first, and then you can display a PNG32 image in just three steps. ![]() The download includes a demo and the static library's source code. I have wrapped the code to a static library. Thanks for your attention! Using the code I am not very good at ASM, so if there are any shortcomings or bugs in my code, please let me know. In order to fasten the speed of display, the code's core part is optimized by using ASM. ![]() The basic idea is to simulate AlplaBlend's behavior, see the following code. But, it does not deal with transparent PNGs. Searching with the keyword "PNG" in CodeProject, I found a demo named PNGView. Some days ago, I needed a component to display a transparent PNG image in my code. If you are searching for a component to display a PNG32 image, this code may give you some tips. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |