Graphic Gadgets
Overview:
This
utility is designed to help you manipulate and save small, simple images for
games or applications. The best part is that you can embed the images directly
into any Just BASIC™ program you create!
Small, simple
images often compress to 1/2 to 1/50th the original bitmap size. A perfect
example of this is the file called "BG1.bmp" located in the Just
BASIC™ "SPRITES" folder. It has a file size of 25,318 bytes, while
the same image in .VRF format uses 2,306 bytes, for a better than 10 to 1
compression ratio!
You have
a clean canvas nearly the size of the entire Graphic Gadgets window. This is
intentional so that you can view and manipulate large bitmaps while viewing
them in their entirety. The only thing that fills the screen besides your
images are a few status messages to keep you informed as to what Graphic
Gadgets is doing during the different processes it performs.
Capabilities:
·
Load
a Windows™ bitmap (.bmp) to display on screen
·
Save
the current screen to a Windows™ bitmap on disk
·
Rotate
a bitmap from 0 to 360 degrees
·
Wrap
a bitmap around an arc or circle
·
Alpha
Blend two bitmap images
·
Flip
a bitmap horizontally (make a mirror image of the bitmap)
·
Flip
a bitmap vertically (flip a bitmap upside down)
·
Shear
a bitmap horizontally (tilt the upper corners of bitmap left or right)
·
Shear
a bitmap vertically (ramp the right hand corner of bitmap up or down)
·
Tile
a bitmap image to cover the entire screen
·
Convert
a Windows™ bitmap to a text file containing RLE compressed data statements
·
Convert
a Windows™ bitmap to RLE encoded data statements which are placed on the
Windows™ clipboard
·
Convert
a Windows™ bitmap to a ". VRF" image file (a RLE compressed form of
the bitmap)
·
Read
data statements from a text file containing an encoded image and save as a
Windows™ bitmap file
·
Read
data statements embedded in a program and display the encoded image on screen
·
Convert
an existing .VRF file to a text file of RLE encoded Data statements
·
Convert
an existing .VRF File to RLE encoded data statements which are placed on the
Windows™ clipboard
·
Convert
an existing .VRF file to a Windows™ bitmap file which is then stored on disk
·
Retrieve
a .VRF file stored on disk and display on screen for browsing existing .VRF
image files
·
Convert
an existing Windows™ bitmap to a "sprite mask" used by Just BASIC™
Limitations:
Graphic
Gadgets won't take the place of PhotoShop™ or the Gimp™ and other high end
image processing software, it just makes some image processing chores easier by
putting them all in one convenient software package for Just BASIC™. It’s also
nice to know that it’s coded in Just BASIC™ so you can modify to your heart’s
content.
The
graphic processing routines used in Graphic Gadgets are not
intended for use in “real time” (i.e. use while a program is running). They are intended as helper functions to
allow you to prepare the graphics for your application.
Graphic
Gadgets won't take the place of a good compression program. Some images are too
large or complex to benefit from the simple RLE encoding used. For these types
of images use PNG's, GIF's, or even JPG's if slight image degradation is not an
issue, then archive with your favorite compression program.
Images
having more than 256 colors will not work with any of the RLE
options in Graphic Gadgets. Images with more than 256 colors are usually too
complex and would take up more storage space than the bitmap they are encoding,
sometimes up to more than twice as much storage space!
You can
and should, only use 24-bit images, which are the default images created by
MS-Paint™. The limiting factor is that you can use only 256 colors out of the
16,777,216 colors available.
RGB – Red, Green, and Blue,
where each primary color is assigned a brightness/intensity level from 0 to 255
in order to represent millions of colors on the display screen. All three
values combined can express 16,777,216 different colors.
RLE - Run Length Encoding
is a simple algorithm to compress images. It does so by encoding the "run
length" of the same pixel color. If you have a black and white image
100x100 pixels where the top half of the picture is white and the other half
black, each scan line with white pixels will be encoded as “100, 16777215”
representing “100 pixels across using the same color” and “16777215” which is
the RGB value for white. In similar fashion the black scan lines will be
encoded as “100,0” representing “100 pixels across using the same color” and
“0” which is the RGB value for black.
VRF - Vector RLE File is the file format created by
this program. Because each pixel "run length" has two important
components, direction and magnitude, hence the Vector part of the file name. If
you add the color space of the "run length" then you have a 3-D
vector. The RLE part is of course the name of the simple compression algorithm
used to store these vectors on disk.
BASIC – Beginner’s All-Purpose Symbolic Instruction Code is the computer language used to write Graphic Gadgets. The name of the BASIC used to program Graphic Gadgets is called “Just BASIC™”.
Across the top of the Graphic
Gadget window is the menu bar with the following menu choices:
File Image
Options Special Effects Fast
Sprite Mask! Help
File
Load Bitmap - Allows you to
view bitmaps stored on disk on the display screen.
Save Bitmap - Captures
whatever is currently on the display screen and saves the image to a bitmap
file on disk.
Exit - Terminates the
program.
Image
Options
BMP to Data Text File – Converts a Windows™ bitmap to a text
file containing data statements encoding the bitmap using RLE compression.
Note: Small images are converted quickly; big and/or complex images are
converted slowly.
BMP
to Clipboard Data
- Converts a Windows™ bitmap to data statements. The “Run Length Encoded”
bitmap data statements are then copied to the Windows™ clipboard, ready to
paste in to your very own program code.
Note:
Small images are converted quickly; big and/or complex images are converted
slowly.
BMP to VRF File - Converts a Windows™ bitmap to a ". VRF"
image file (a RLE compressed form of the bitmap), then storing the .VRF image
file on disk.
Note:
Small images are converted quickly; big and/or complex images are converted
slowly.
Data
Text File to BMP -
Read the data statements containing the RLE encoded image, then saves the image
as a Windows™ bitmap file, which is stored on disk.
Note:
Small images are converted quickly; big and/or complex images are converted
slowly.
Show Data As Image – Reads the data statements embedded in a program and
display the encoded image on screen. This is just an example of how you can
embed and display images in your own programs.
Note:
Small images are displayed quickly; big and/or complex images are displayed
slowly.
VRF
File to Data Text File - Converts an existing .VRF image file to a text file of data
statements. The bitmap is “Run Length Encoded” to help reduce file size and is
saved to disk as a text file.
Note:
Small images are converted quickly; big and/or complex images are converted
slowly.
VRF
File to Clipboard Data - Converts an existing .VRF File to data statements. The “Run Length
Encoded” bitmap data statements are then copied to the Windows™ clipboard,
ready to paste in to your very own program code.
Note:
Small images are converted quickly; big and/or complex images are converted
slowly.
VRF
File to BMP File -
Converts an existing .VRF file to a Windows™ bitmap that is displayed on
screen. The image is then copied and saved to a bitmap file stored on disk.
Note:
Small images are converted quickly; big and/or complex images are converted
slowly.
Display
VRF File -
Retrieves a .VRF image file stored on disk and displays on screen. Main use is
for browsing existing .VRF image files.
Note:
Small images are displayed quickly; big and/or complex images are displayed
slowly.
Tile an
Image – Loads an
existing bitmap file and replicates the bitmap as many times as necessary to
cover the entire screen. For a quick example, select “Tile an Image” from the
menu, and navigate to the “BMP” folder and select “canBlu.bmp”. You can use any
bitmap for this purpose, although smaller bitmap tiles are the norm.
Image
Effects
The
angles of 0, 90, 180, and 270 degrees are the fastest to render in a typically
slow process.
You will
be prompted to select a bitmap to bend around an arc or circle.
Having selected a bitmap, you
will be prompted with a screen that allows you to use the mouse to enter the
following three items of information, the start angle in degrees, the amount
you are wrapping the bitmap around the arc or circle in degrees, and the radius
of the circle to wrap the bitmap. Start from left to right, and then click the
“OK” button when finished.
Note: You can also enter the
angle information by typing in any of the input boxes to enter custom angles.
Alpha Blend – This
effect require two images. Using the larger image as a base layer, overlay the
smaller image as a transparency over the base layer image. If you’ve ever seen
a picture with a watermark on the web, or a watermark in a MS-Word™ document,
then you’ve seen ‘Alpha Blend’ in action. This effect could also be used to
show two consecutive images in an animation sequence one on top of the other in
a paint program. It’s the same technique that professional animators have been
using for decades.
To use this effect, you will be
prompted for two image files. A small window will pop up to request the amount
of transparency of the second image. You can vary the amount from 0% -
completely transparent, to 100% - no transparency at all.
Lastly, using the mouse cursor,
position the outline of the second image over the base layer image to the
location desired. Left-click to apply the effect.
Fast
Sprite Mask!
Make Sprite Mask –
Converts a “normal” bitmap image to an image suitable for use with the Just
BASIC™ sprite system. This allows you to make images that display on screen
with transparent areas. You can convert just about any* size bitmap to a
masked sprite.
* The upper limit is approximately a 5500 pixel by 5500 pixel image that would probably take days or weeks of computer time to complete. The exact time has not been ascertained, but is more time than 99% of the general population will care to expend making a sprite mask.
Help
Help – This
help file
About – Who
wrote this program, version, and the release date.
canBlu.BMP
(derived from canRed.BMP)
canRed.BMP
sprBossPlane1.BMP
sprBossPlane2.BMP
sprBossPlane3.BMP (derived
from sprBossPlane1.BMP)
sprCoin.BMP
sprGrnRider.BMP
sprHeart.BMP
sprPlane1.BMP
sprPlane2.BMP
sprPlane3.BMP
sprPoof1.BMP
sprPoof2.BMP
sprPoof3.BMP
sprPotionBlu.BMP (derived
from sprPotionRed.BMP)
sprPotionGrn.BMP (derived
from sprPotionRed.BMP)
sprPotionRed.BMP
sprShip1.BMP
sprShip2.BMP
sprShip3.BMP1
sprTank1.BMP
sprTank2.BMP
sprTank3.BMP
sprWatermelon.BMP
sprTree.BMP
dice.BMP
gameBackground.BMP
sprCardSuitsLrg.BMP
sprCardSuitsSml.BMP
sprStar.BMP
yellowBar.BMP
sprBalloon.BMP
sprBug.BMP
sprCherries.BMP
sprGrayShip.BMP
sprJeep1.BMP
sprJeep2.BMP (derived
from sprJeep1.BMP)
sprJeep3.BMP
(derived from sprJeep1.BMP)