1. Tommy Carlier's win32dib library problem
- Posted by DB James <larches at comcast.net> Jun 12, 2007
- 625 views
Hi, I have been experimenting with the key function in this library: newDib() and am having no luck. According to the documentation the handle to the new bitmap file is the first item in a returned sequence. [Begin docs quote] Creating and deleting a bitmap A Win32Dib-bitmap is a sequence of length 7: * dib[DibHandle] is the bitmap handle (integer) you can use in Win32Lib-routines. * dib[DibMemory] is the address (atom) of the memory block of the bitmap. * dib[DibWidth] is the width of the bitmap in pixels. * dib[DibHeight] is the height of the bitmap in pixels. * dib[DibBytesPerLine] is the amount of bytes per line of the bitmap. * dib[DibBytesTotal] is the total amount of bytes of the bitmap. * dib[DibPadding] is the amount of bytes of padding after each scanline. [End docs quote] However, the first item is actually a huge number -- an atom. It causes a type-check failure. As far as I know, I have the latest version of the library. Tommy..? Or anyone get this to work? --Quark
2. Re: Tommy Carlier's win32dib library problem
- Posted by Greg Haberek <ghaberek at ssoe.com> Jun 12, 2007
- 623 views
DB James wrote: > > Hi, > > I have been experimenting with the key function in this library: newDib() and > am having no luck. According to the documentation the handle to the new > bitmap file is the first item in a returned sequence. > > [Begin docs quote] > Creating and deleting a bitmap > > A Win32Dib-bitmap is a sequence of length 7: > > * dib[DibHandle] is the bitmap handle (integer) you can use in > Win32Lib-routines. > * dib[DibMemory] is the address (atom) of the memory block of the bitmap. > * dib[DibWidth] is the width of the bitmap in pixels. > * dib[DibHeight] is the height of the bitmap in pixels. > * dib[DibBytesPerLine] is the amount of bytes per line of the bitmap. > * dib[DibBytesTotal] is the total amount of bytes of the bitmap. > * dib[DibPadding] is the amount of bytes of padding after each scanline. > > [End docs quote] > > However, the first item is actually a huge number -- an atom. It causes > a type-check failure. As far as I know, I have the latest version of the > library. > > Tommy..? Or anyone get this to work? > > --Quark You are confusing the terms "handle" and "id". A "handle" is a memory address; a pointer to the object in memory. A Win32Lib "id" is a sequential identification number starting from 1. You can use this large-atom "handle" with Win32Lib bitmap routines like bitBlt(). ~Greg
3. Re: Tommy Carlier's win32dib library problem
- Posted by DB James <larches at comcast.net> Jun 13, 2007
- 620 views
Greg Haberek wrote: > > DB James wrote: > > > > Hi, > > > > I have been experimenting with the key function in this library: newDib() > > and > > am having no luck. According to the documentation the handle to the new > > bitmap file is the first item in a returned sequence. > > > > [Begin docs quote] > > Creating and deleting a bitmap > > > > A Win32Dib-bitmap is a sequence of length 7: > > > > * dib[DibHandle] is the bitmap handle (integer) you can use in > > Win32Lib-routines. > > * dib[DibMemory] is the address (atom) of the memory block of the > > bitmap. > > * dib[DibWidth] is the width of the bitmap in pixels. > > * dib[DibHeight] is the height of the bitmap in pixels. > > * dib[DibBytesPerLine] is the amount of bytes per line of the bitmap. > > * dib[DibBytesTotal] is the total amount of bytes of the bitmap. > > * dib[DibPadding] is the amount of bytes of padding after each scanline. > > > > [End docs quote] > > > > However, the first item is actually a huge number -- an atom. It causes > > a type-check failure. As far as I know, I have the latest version of the > > library. > > > > Tommy..? Or anyone get this to work? > > > > --Quark > > You are confusing the terms "handle" and "id". A "handle" is a memory address; > a pointer to the object in memory. A Win32Lib "id" is a sequential > identification > number starting from 1. You can use this large-atom "handle" with Win32Lib > bitmap > routines like bitBlt(). > > ~Greg Hi Greg, Yes, I get it now, and am using the library, even writing a couple of drawing routines for it. I was led astray by the docs quote "dib[DibHandle] is the bitmap handle (integer) you can use in Win32Lib-routines." It's not a Eu integer in fact, and alas, I've seen a number of ambiguous uses of such terms as handle, not to mention pixmap, bitmap, DIB, etc. The main goal here is to be able to create a bitmap in memory, be able to draw to it easily, and save it to a file (can't read to a bitmap from screen because the program may be minimized at the time of save). No doubt it will be easy in some future incarnation of win32lib. Thanks for the reply, --Quark