1. drawbitmap ??
drawBitmap expects a bitmap handle as a parameter.
I have bitmap in my current directory called MYBITMAP.BMP
How do I use win32lib to get its handle?
Bernie
2. Re: drawbitmap ??
Bernie Ryan wrote:
> drawBitmap expects a bitmap handle as a parameter.
> I have bitmap in my current directory called
> MYBITMAP.BMP How do I use win32lib to get its handle?
Load the bitmap with:
handle = loadBitmapFromFile( "MyBitmap.bmp" )
Display it in MyWindow at {10,20) with:
drawBitmap( MyWindow, handle, 10, 20 )
-- David Cuny
3. Re: drawbitmap ??
On Mon, 26 Jul 1999 17:36:03 -0400, Bernie Ryan <bwryan at PCOM.NET> wrote:
>drawBitmap expects a bitmap handle as a parameter.
>
>I have bitmap in my current directory called MYBITMAP.BMP
>How do I use win32lib to get its handle?
>
>Bernie
Check EX16.EXW that comes with Win32Lib.
Specifically, to get the handle do this:
-- load the bitmap
hBitmap = loadBitmapFromFile("mybitmap.bmp")
-- Brian
4. Re: drawbitmap ??
On Mon, 26 Jul 1999 15:02:33 -0700, Cuny, David <David.Cuny at DSS.CA.GOV>
wrote:
>Load the bitmap with:
>
> handle = loadBitmapFromFile( "MyBitmap.bmp" )
>
>Display it in MyWindow at {10,20) with:
>
> drawBitmap( MyWindow, handle, 10, 20 )
>
>-- David Cuny
David
That is already done inside of drawBitmap function but comments in
drawBitmap says it expects a bitmap handle as a parameter. So why is
loadBitmapFromFile function inside of the drawBitmap function when you
are suppose to be passing a handle ?
Bernie
5. Re: drawbitmap ??
Bernie Ryan wrote:
> That is already done inside of drawBitmap function
> but comments in drawBitmap says it expects a bitmap
> handle as a parameter. So why is loadBitmapFromFile
> function inside of the drawBitmap function when you
> are suppose to be passing a handle ?
Just because there are undocumented features doesn't mean you should use
them. Sometimes I'm lazy, and forget to pull out debugging code. Did you
notice that the function doesn't *release* the bitmap when it's done?
Repeatedly calling the function with the file name would have the following
problems:
1. The file would be reloaded each time
2. The bitmap memory would not be released
These are Bad Things. Far more efficient to pass a handle.
-- David Cuny
6. Re: drawbitmap ??
On Mon, 26 Jul 1999 18:42:47 -0400, Bernie Ryan <bwryan at PCOM.NET> wrote:
>On Mon, 26 Jul 1999 15:02:33 -0700, Cuny, David <David.Cuny at DSS.CA.GOV>
>wrote:
>
>>Load the bitmap with:
>>
>> handle = loadBitmapFromFile( "MyBitmap.bmp" )
>>
>>Display it in MyWindow at {10,20) with:
>>
>> drawBitmap( MyWindow, handle, 10, 20 )
>>
>>-- David Cuny
>
>David
> That is already done inside of drawBitmap function but comments in
> drawBitmap says it expects a bitmap handle as a parameter. So why is
> loadBitmapFromFile function inside of the drawBitmap function when you
> are suppose to be passing a handle ?
>Bernie
Looks like drawBitmap is smart enough to accept a file name as an input...
On the subject of bitmaps... is there a routine for saving a Window's
contents as a bitmap so that it can later be redrawn on an onPaint event?
(Routines similar to DOS32's save_image / display_image)
7. Re: drawbitmap ??
Brian Broker wrote:
> On the subject of bitmaps... is there a routine
> for saving a Window's contents as a bitmap so that
> it can later be redrawn on an onPaint event?
This is often referred to as 'blitting' (block image transfer). The more
general routine is:
bitBlt()
Less parameters are required if you want to copy the entire source:
copyBlt()
Finally, transBlt (for "Transparent Blit") allows you to specify a color in
the source as transparent.
The easiest thing to do is to do _all_ your writing to the off-screen
bitmap, and blit the updated portion to the window, instead of drawing both
to the bitmap and the window.
-- David Cuny