- Copyright © 2004 - 2005 Tommy Carlier
- tommy.carlier@telenet.be
- http://users.telenet.be/tommycarlier
Win32Dib is a Euphoria-library that provides fast bitmap manipulation (24-bit graphics) to Win32Lib-applications.
Win32Dib is derived from my Shibby-library. I will no longer continue development of Shibby, so if you were using Shibby, I suggest you stop using it and start using Win32Dib, which is a lot faster and uses memory more efficiently. The names of constants, procedures and functions have changed to follow the naming convention used by Win32Lib. This makes sure that the code of your programs will look more consistent. Shibby used 32-bit graphics, which is silly because only 24 bits are really used. So Win32Dib now uses 24-bit graphics.
Thanks go to:
- Derek Parnell, for Win32Lib.
- Jiri Babor, for creating a texture mapping method that I used in the original drawDibTransformedPolygon.
- Renzo Beggia, for testing and suggestions.
- Robert Craig, for Euphoria and for helping to fix a bug.
- CoJaBo, Alon Bar-noy and OtterDad, for reporting bugs.
- the getDibFromClipboard-function still has bugs: sometimes it corrupts the clipboard when the application is closed.
Win32Dib version history
Win32Dib 0.5.3, 17-November-2005
- fixed a bug in drawDibToDib that caused a column of pixels to be cut off (thanks to Damien Black for reporting).
Win32Dib 0.5.2, 20-August-2005
- fixed a bug in scaleDib that caused a GDI- and memory-leak (thanks to OtterDad for reporting).
Win32Dib 0.5.1, 22-July-2004
- added a new routine: saveDibReduced, which saves the bitmap as an 8-bit BMP-file (uses websafe colors).
- Win32Dib now requires Win32Lib version 0.60.
- the finalizeDib-routine is now automatically called: you no longer need to call it yourself.
Win32Dib 0.5.0, 19-May-2004
- the library has been split up in several files. This way, you can choose to only use the routines you need.
- added a new routine: drawShadedPolygonToDib, which draws a shaded polygon on a bitmap.
- new demo program: shadepol.exw (draws shaded polygon to bitmap).
- the demos have been changed to only include the necessary libraries.
Win32Dib 0.4.3, 16-May-2004
- fixed a bug in saveDib (thanks to Alon Bar-noy).
- fixed some bugs in the demos (thanks to CoJaBo).
Win32Dib 0.4.2, 5-May-2004
- fixed a bug in drawDibTransformedPolygon and optimized it. If no clipping is necessary in both source and destination (automatically detected), the new version is about 50% faster than the old version.
- optimized some of the routines a little.
- the documentation is now in HTML. win32dib.htm now has a section about optimization: it tells you about the internal optimizations, and how you can use them to make your programs faster.
- new demo program: feedback.exw (moves 2 translucent bitmaps across the window)
Win32Dib 0.4.1, 11-April-2004
- removed routine drawTransDibToDib, and moved its functionality to drawDibToDib. Modified drawDibToDib: all the inner-loops have been replaced by machine-code, which makes the routine more than 10 times as fast.
- modified tileDibToDib: added transparency- and translucency-support.
- optimized the filter-routines: reduced the number of additions and multiplications per pixel for filters with a lot of zeros in the matrix.
- added 2 new routines: subtleBlurDib and subtleSharpenDib. These routines do the same as blurDib and sharpenDib, but are faster and more subtle (blurDib blurs more, sharpenDib sharpens more).
- modified demo programs tiledib.exw and polydib.exw: removed the Timer-mechanism and added a FPS-counter (frames per second).
Win32Dib 0.4.0, 10-April-2004
- new routine: applyDibBrightnessToDib (applies the brightness of a bitmap to another bitmap).
- added a translucency-argument to drawDibToDib and drawTransDibToDib (alpha = 0: totally transparent, alpha = 255: totally opaque).
- modified demo program: tiledib.exw now draws the image at the bottom right translucent.
Win32Dib 0.3.6, 7-April-2004
- new routine: saveDibGray (saves 8-bit grayscale bitmap).
- fixed a little bug in saveDib.
Win32Dib 0.3.5, 23-March-2004
- new routines: copyDibToClipboard and getDibFromClipboard (copy bitmaps from and to the clipboard) and drawDibTransformedPolygon (thanks to Jiri Babor).
- new demo program: polydib.exw (maps a bitmap to a polygon).
Win32Dib 0.3.4, 17-March-2004
- optimized the rotateDibFree-function for the special cases where angle is -270, -180, -90, 90, 180 or 270 degrees (now calls the much faster rotateDib-function for those cases).
- optimized some routines by reducing unnecessary clipping inside loops.
- fixed a nasty little bug in killDib, that crashed in Euphoria 2.3 but not in Euphoria 2.4 (thanks to Renzo Beggia for detecting and Robert Craig for helping to fix it).
Win32Dib 0.3.3, 12-March-2004
- new routines: rotateDibFree (free angle rotation of a bitmap), embossDib (embosses a bitmap), tileDibToDib (tiles a bitmap onto another bitmap) and drawTransDibToDib (draw a bitmap with a transparent color).
- added some example code to the documentation (win32dib.txt) and changed the structure of certain sections a bit.
- fixed a bug in clearDib and in copyDibToDib.
- made drawDibToDib about 3 times as fast: the old version just called bitBlt, the new version is entirely written in Euphoria, clips the coordinates and is still about 3 times as fast as the compiled bitBlt!
- made some other optimizations, like replacing all poke(dest, peek({src, 3})) with mem_copy(dest, src, 3), which is almost 3 times as fast.
- new demo programs: scaledib.exw (demonstrates the scaling of bitmaps) and tiledib.exw (demonstrates the tiling of bitmaps and transparent drawing).
Win32Dib 0.3.2, 11-March-2004
- fixed a nasty bug that occured when the width of the bitmap couldn’t be divided by 4.
Win32Dib 0.3.1, 10-March-2004
- new routines: scaleDib, scaleDibPct (scale a bitmap to a new size), and rotateDib (rotates a bitmap).
- fixed error in documentation (thanks to Renzo Beggia).
- fixed bug, caused by 32-bit alignment of bitmap scanlines, in some of the routines.
Win32Dib 0.3.0, 8-March-2004
- new routines: drawDibToDib (draws part of a bitmap on another bitmap), extractDib (extracts a bitmap from another bitmap or control) and copyDib (returns a copy of a bitmap).
- new demo program: manip.exw (demonstrates some of the manipulation routines from Win32Dib).
- optimized clearDib a bit.
- fixed little bug in filterDib3x3.
Win32Dib 0.2.3, 6-March-2004
- new routines: filterDib3x3 and filterDibGray3x3, which use a 3x3 matrix instead of 7x7. These routines are 3 to 4 times faster than filterDib and filterDibGray.
- detectDibEdges, sharpenDib and blurDib now use the 3x3 filter-routines, which makes them 3 to 4 times faster.
Win32Dib 0.2.2, 26-February-2004
- new routines: filterDib and filterDibGray, which filter the bitmap via a matrix (filterDibGray first makes the bitmap gray and is more than twice as fast as filterDib).
- new routines using filterDib and filterDibGray: detectDibEdges, sharpenDib, blurDib.
Win32Dib 0.2.1, 25-February-2004
- putDibPixel and getDibPixel have been optimized a little.
- makeDibGray has been optimized and now runs about 37% faster.
- colorizeDib has been optimized and now runs about 28% faster.
Win32Dib 0.2.0, 11-January-2004
- the bitmap-sequence now contains extra information: dib[DibBytesPerLine] = the amount of bytes per line, dib[DibBytesTotal] = the total amount of bytes
- some small optimizations have been done, using the extra information DibBytesPerLine and DibBytesTotal.
- the procedure makeDibGray has been modified: The previous version calculated gray as floor((red + green + blue)/3). When making a bitmap gray, the brightness of the colors should remain the same. The new version calculates gray as floor(red*0.299 + green*0.587 + blue*0.114) which produces a better gray bitmap.
- 2 new pixel-routines have been added: fastPutDibPixel is a much faster version of putDibPixel. fastGetDibPixel is a much faster version of getDibPixel. These 2 routines are faster than the original routine, because they don’t check if the coordinates are within the boundaries of the bitmap. Only use these faster routines if you’re sure that the coordinates of the pixel are valid coordinates (0 <= x < width, 0 <= y < height).
- Some new bitmap manipulation-procedures have been added: replaceDibColor: replaces 1 color in the bitmap with another. replaceDibColors: replaces multiple colors in the bitmap. adjustDibColors: adjusts the colors of the bitmap. colorizeDib: replace the colors of the bitmap with 1 color (brightness doesn’t change). adjustDibBrightness: adjusts the brightness of the bitmap. adjustDibContrast: adjusts the contrast of the bitmap. adjustDibBrightnessAndContrast: adjusts the brightness and the contrast of the bitmap.