creating bitmap
-
I want to create the rgb24 or rgb32 bitmap having some text(example "sometext") on it . the lenght of the bitmap should be the font size and width be the length of the text("sometext").
Rajesh
-
-
Use CreateBitmap API.
-
Use CreateBitmap API.
-
can you sugggest me the last three parameter for creating 24bit rgb and write some text over it
Rajesh
Try out the below code piece...
CDC* pDC = GetDC();
CDC memDC;
memDC.CreateCompatibleDC(pDC);CBitmap bitmap;
bitmap.CreateCompatibleBitmap(pDC, 100, 100);CBitmap* pOldBitmap = memDC.SelectObject((CBitmap*)&bitmap);
//
// Write the Text using memDC
//pDC->BitBlt(0, 0, 100, 100, &memDC, 0, 0, SRCCOPY);
memDC.SelectObject((CBitmap*)pOldBitmap);
ReleaseDC(pDC);
Regards, Rane
-
Try out the below code piece...
CDC* pDC = GetDC();
CDC memDC;
memDC.CreateCompatibleDC(pDC);CBitmap bitmap;
bitmap.CreateCompatibleBitmap(pDC, 100, 100);CBitmap* pOldBitmap = memDC.SelectObject((CBitmap*)&bitmap);
//
// Write the Text using memDC
//pDC->BitBlt(0, 0, 100, 100, &memDC, 0, 0, SRCCOPY);
memDC.SelectObject((CBitmap*)pOldBitmap);
ReleaseDC(pDC);
Regards, Rane
-
-
Rane's code makes a bitmap the same format as the display. If you want to guarantee 24bpp or 32bpp you can use CreateDIBSection() instead of CreateCompatibleBitmap(). Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
I want to create the rgb24 or rgb32 bitmap having some text(example "sometext") on it . the lenght of the bitmap should be the font size and width be the length of the text("sometext").
Rajesh