REVIEW : Image321.DLL Reviewed by David Drake

Home

Dumping a file directly into a texteditor
Three items that caught my fancy recently...
Serial Communication with LB
David Drake reviews Image321.DLL
Translating Documentation
Implementing an editor with Scintilla.dll

Image321.dll is Picture-Perfect (Almost)

Alyce Watson has released a new 32-bit image manipulation DLL for any 32-bit programming language. [Ed: you can get the DLL and documentation from Alyce's Restaurant, URL - http://iquizme.0catch.com/lb/ - click on Tools for Liberty Basic 3.] The DLL incorporates functions for altering the color or appearance of images, scaling, rotation and mirroring, sprite tools, and more. It's small size (36K, I believe) makes it light on the downloads. Because Alyce wrote it with Liberty BASIC in mind, the DLL calls are simple enough for even the newer programmers among us.

Positive attributes:

Negative attributes:

Image321.DLL includes the following functions (taken directly from the image321.bas demo program, with a few editor [David Drake] comments):

* About - Opens an ABOUT box for the DLL
* BitmapWidth(hBmp)
* BitmapHeight(hBmp)
* DrawBitmap(hBmp,hWnd,x,y)
* DuoTone(hBmp,hWnd,nRed,nGreen,nBlue,x,y) - AND bitwise operator, with RGB specified, each 0-255
* Negative(hBmp, hWnd, x, y) - invert colors like photo negative
* ChangeAll (hBmp,hWnd,xSource,ySource,nRed,nGreen,nBlue,x,y) - change all pixels the same color as pixel at xSource,ySource
* ColorSwap(hBmp,hWnd,nRed,nGreen,nBlue,x,y) - 0=make this color red,1=make this color green, 1=make it blue so nRed=2 means make all red pixels blue, etc.
* FloodFillIt (hBmp,hWnd,xSource,ySource,nRed,nGreen,nBlue,x,y) - flood fill from xSource,ySource to be RGB specified
* GrayScale(hBmp,hWnd,x,y)
* Colorize(hBmp,hWnd,nRed,nGreen,nBlue,x,y) - Creates pic in strong tones of color specified; if nRed<>0 then use red in colorization, if nRed=0 then don't use red in colorization, etc.
* Hue(hBmp,hWnd,nRed,nGreen,nBlue,x,y) - Creates pic in all colors, but hue of color specified. If nRed<>0 then use red in colorization, if nRed=0 then don't use red in colorization, etc.
* Tint(hBmp,hWnd,nRed,nGreen,nBlue,x,y) - Creates pic in lighter tones of color specified. If nRed<>0 then use red in colorization, if nRed=0 then don't use red in colorization, etc.
* Brightness(hBmp,hWnd,nBright,x,y) - nBright=percent to brighten: 200 is twice as bright, 50 is half as bright.
* Contrast(hBmp,hWnd,x,y) - increases contrast between light and dark areas (not user-definable)
* Midtone(hBmp,hWnd,x,y) - decreases contrast between light and dark areas (not user-definable)
* Soften(hBmp,hWnd,x,y)
* Sharpen(hBmp,hWnd,x,y)
* Pixelate(hBmp,hWnd,x,y)
* Emboss(hBmp,hWnd,x,y)
* BlendPictures(hBmp,hBmp2,hWnd,x,y) - hBmp2 will be blended onto hBmp. If hBmp2 is smaller than hBmp, it will be tiled. This is a particularly cool effect (ed.)
* Blur(hBmp,hWnd,x,y)
* Rotate(hBmp,hWnd,angle,bgColor) - use angle between 0 and 360, bgColor=0 for black, bgColor=1 for white
* RotateWidth(hBmp,hWnd,angle) - width needed to display rotated bmp
* RotateHeight(hBmp,hWnd,angle) - height needed to display rotated bmp
* ChangeSize(hBmp,hWnd,x,y,nWidth,nHeight) - display in pixel size indicated
* FlipMirror(hBmp,hWnd,x,y,nMirror,nFlip) - nMirror=1 will mirror, nMirror=0 will not mirror, nFlip=1 will flip, nFlip=0 will not flip. Can be flipped and mirrored at same time
* Scale(hBmp, hWnd, x, y, nScale) - nScale is percentage: nScale=50 means half size, 200 means twice size
* PartialBitmap(hBmp,hWnd,x,y,nWidth,nHeight) - displays part of bmp at x,y, width nWidth, height nHeight
* AddMask(hBmp,hWnd) - adds mask above sprite... sprite must have black background
* DrawSprite(hBmp,hWnd,x,y) - draws a sprite at x,y (sprite must have black background, with proper mask above)
* GetRed(color) - gets red component of long color value
* GetGreen(color) - gets green component of long color value
* GetBlue(color) - gets blue component of long color value
* MakeRGB(nRed,nGreen,nBlue) - makes long colorref from red(0-255),green(0-255), blue(0-255)
* GetPixelColor(hWnd,x,y)

Possible applications for the Image321.dll:

* Image editor (in the works)
* Game sprite/image manipulation
* Cool graphical effects built-in
* Alter images to where they are useless to an outside person, but use the dll to restore the image's original properties to use in your program (a kind of copy protection or visual encryption)
* Image viewer that scales images to fit on screen or zoom tightly into areas on the image


[Ed: A couple weeks after David graciously sent me this review (which I confess I forced out of him - sorry David), he released Liberty BASIC Image321 Editor. I will let David tell you about it in his own words.]

Hello all.

Warning: Shameless promotion of free Liberty BASIC program to follow.

If you are interested, I've just made available an image editing program written in, of course, LB. Using Alyce Watson's perfectly primo Image321.DLL and Ken Nishita's Nviewlib.DLL, the Image321 Editor will load many image formats, save as bitmap or jpg, rotate, scale, resize, crop, tint, hue, emboss, sharpen, soften, colorize, grayscale... And more.

Download the source code and dll's here: http://www.foundrysearch.com (Scroll to the bottom and look under "What's New")

One known issue: Saving as a JPG image makes an odd little strip on the right edge of the picture. If anyone can fix this, I'd sure appreciate it.

- David Drake

Home

Dumping a file directly into a texteditor
Three items that caught my fancy recently...
Serial Communication with LB
David Drake reviews Image321.DLL
Translating Documentation
Implementing an editor with Scintilla.dll