a32Dib

Definition: a32Dib identifier
-- or --
integer i = a32Dib(object x)
Description: This serves to define the a32Dib type. You can also call it like an ordinary function to determine if an object is an a32Dib.
Comments: An arwen32dib bitmap is a sequence of length 7:
  • dib[DibHandle] is the bitmap handle (integer) you can use in arwen and Windows API 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 bytes required per line of the bitmap.
  • dib[DibBytesTotal] is the total size in bytes of the bitmap.
  • dib[DibPadding] is the number of bytes of padding after each scanline.
Variables declared with the user defined type a32Dib can be used to store the above.

When invoked as a function, returns 1 if x is an a32Dib otherwise returns 0.

Some routines, such as newDib, can fail and return 0, hence there is another user defined type, a32Dib0, which allows 0 or the above. Provided you have appropriate error handling in place (ie a test for 0) you can instead store the result of newDib (etc) in an a32Dib0 variable, rather than terminate the application with a run-time typecheck error. If you do not have said test, a typecheck is slightly preferrable to an attempt to subscript an atom, so a32Dib is the better choice. You can of course store arwen32dib bitmaps in a variable declared as an object or a sequence, or indeed in an element of a sequence, if for some reason you do not want to perform any potentially helpful safety checks.

Any performance overhead from type checking is likely to be neglible compared to the number of pixels being processed.
Example:
a32Dib dib
dib = newDib(300, 200)             -- create a bitmap
See Also: a32Colour