¿¬½ÀÀå(´Ù¹ö¸®°í °©´Ï´Ù...)-³²±æ ±ÛÀÌ ÀÖÀ¸¸é ¹Î°¡ÃÌ¿¡ ³²°ÜÁֽðí, ȸ¿ø °¡ÀÔÀ» ¹ÞÁö ¾Ê½À´Ï´Ù.

2003/06/29 (23:37) from 61.110.211.104' of 61.110.211.104' Article Number : 104
Delete Modify _Àü Access : 3056 , Lines : 39
DIB ¸Ê ·Îµå(HBITMAP ÀÌ¿ë)
HBITMAP LoadBMP(LPSTR szFileName)
{
 return (HBITMAP)LoadImage(NULL,szFileName,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
}

void DisplayBMP(HBITMAP hbmp)
{
BITMAP bm;
BYTE* bmBits;
int offset, offset2;

GetObject(hbmp, sizeof(BITMAP), &bm);

bmBits = new BYTE[bm.bmHeight * bm.bmWidthBytes];
GetBitmapBits(hbmp, bm.bmHeight * bm.bmWidthBytes, (BYTE*)bmBits);

char str[256];
wsprintf(str, "w : %d", bm.bmBits);
TextOut(memoryDC, 700, 10, str, strlen(str));

for(int y = 0; y < bm.bmHeight; ++y)
{
 for(int x = 0; x <  bm.bmWidth; ++x)
   {
     offset = x * 4 + y * bm.bmWidthBytes;
     offset2 = x * 3 + y * 3 * 800;

     pRaster[offset2] = bmBits[offset];
     pRaster[offset2+1] = bmBits[offset+1];
     pRaster[offset2+2] = bmBits[offset+2];
   }
}

delete bmBits;
}

HBITMAP bmp;
bmp = LoadBMP("a.bmp");
DisplayBMP(bmp);

Backward Forward Post Reply List