|
-
April 2nd, 1999, 03:23 PM
#1
Drawing a Bitmap in Code?
How do I create a Bitmap in code?. I would like to dynamically create a bitmap to pass to CBrush::CreatePatternBrush .
-
April 2nd, 1999, 06:03 PM
#2
Re: Drawing a Bitmap in Code?
Hi, take a look to
HBITMAP CreateBitmapIndirect(
CONST BITMAP *lpbm // pointer to the bitmap data
);
and the structure BITMAP
typedef struct tagBITMAP { /* bm */
int bmType;
int bmWidth;
int bmHeight;
int bmWidthBytes;
BYTE bmPlanes;
BYTE bmBitsPixel;
LPVOID bmBits;
} BITMAP;
The actual bitmap is store in the array bmBits.
Good luck
Fabian
-
August 9th, 1999, 08:55 AM
#3
Re: Drawing a Bitmap in Code?
This is a sample code for creating bitmap using GDI function FillRect
Likewise you can use any GDI functions
hdc = GetDC (hwnd) ;
hdcMem = CreateCompatibleDC (hdc) ;
hBitmap = CreateCompatibleBitmap (hdc, 48,48) ;
ReleaseDC (hwnd, hdc) ;
rect.bottom = 48;
rect.left = 0;
rect.right = 48;
rect.top = 0;
SelectObject (hdcMem, hBitmap) ;
if ( !(FillRect(hdcMem,&rect,NEW_BRUSH)) )
MessageBox(hwnd,"Error","Test",MB_OK);
DeleteDC (hdcMem) ;
Please rate
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|