Download ORNUCOPIA
Transcript
Figure 2-Monochrome Hex Data Generation
unsigned char color, count, buffer, mask;
=
=
count
7;
/* corresponds to location of point within data byte */
buffer
0;
/* this will hold a points */
for (each point in the image)
{
find color (color equals 0 or 1) /* Mandelbrot code provides this
mask
color « count;
/* shift color to the correct position
buffer 1= mask;
/* place it in the buffer
if (count
0)
/* is the a-bit buffer full
=
==
*/
*/
*/
*/
{
if (buffer < OxlO)
/* pad hex byte with leading 0 if necessary */
fprintf (fp, "0");
fprintf (fp, "%x", buffer);
/* print the byte in hex format */
count
7;
/* reset these in preparation for next a points */
buffer
0;
=
=
else
count--;
/* buffer ain't full,
so get another point */
•••
amount of data, since image will read as
much as it's told, regardless of how
much data you actually place in the file.
Here, the right amount means too
much. We want to print 1500 dots per
line. With eight dots per byte of data, 187
1/2 bytes would do the trick. But image
doesn't understand nybbles and would
get out of synch by four dots every line.
50 the first line of Figure 1 assigns 188 to
strsize and image throws out the extra
nybble at the end of each line.
The main section of the program locates the image at the center of the page,
scales it to 5"x 5", and calls fractal. In real
life, all 282,000 bytes of data would fol-
QEditTM
ADVANCED
The fast, easy to
THE41· - '"
use, fully featured text
'tIJ,~
editor at an affordable price.
EDITOR
If you are looking for the
right combination of price
and value in a text editor,
then give QEdit a try. At
ONL y $54. 95 and a
money-back guaranteeyou just can't go wrong.
QEdit is fast, easy to use, and simple
to install. At the same time you get
all of these features and more.
iii Completely configurable, including keyboard and colors
• Edit as many files simultaneously
as will fit in memory
• Open up to eight windows
• 99 scratch buffers for cut-and-
paste or template operations
• Exit to DOS (or a DOS shell)
from within QEdit
• "Pop-Down" menu system and
customizable Help Screen
• Column Blocks
• Easy to use macro capability
including keyboard recording
• Wordwrap and paragraph
reformat capabilities
• Recover deleted text
• Automatic indentation for C
programming
• Import files and export blocks
• Locate matching braces and
parentheses
• Execute command line compilers
from within QEdit
low fractal. But I didn't think it necessary
or prudent to print each and every one;
just use your imagination.
Images defined by a manageable
amount of data can use a direct data procedure like{<OF12A377>}
"<" and ">" tell the interpreter that it's
dealing with hex values. I used this
method at first and it worked fine until I
got into larger images. It turns out that a
hexadecimal string cannot exceed 64K.
This wasn't obvious to me, so I went
whining to Adobe's developer's hotline
and had the answer in seconds. Good
outfit.
Generating The Hex Data
I won't bore you with the specifics of
the Mandelbrot code again; it's been
covered in Micro C before (issues #39 and
#42). Log onto our BB5 or get the issue
disk for a look at the complete program.
Figure 2, a mixture of pseudo-code
and C, shows the steps necessary to fill a
byte with 8 points of the image, and print
the byte to a file. fprintfO conveniently
•• This small, blazing-fast editor
lets program instructions, memos,
letters, and assorted text databases flow easily between brain
and computer. ~ ~
•• The editor's speed, windows,
and other features make it among
the best text editors I've ever
used. ~ ~
George F. Goley IV,
David M. Kalman,
Editor-in-Chief, Data Based
Advisor (September, 1988)
Contributing Editor, Data Based
Advisor (September, 1988)
• QEdit supports 101 key keyboards, EGA 43-line mode, and
VGA 50-line mode
• Great for use with laptopsQEdit edits files entirely in memory,
saving drain on laptop batteries
• Compact-Even with all these
features, QEdit requires less than
sOk of disk space
Full 30 day
money-back guarantee
System Requirements _ _ _ __
QEdit requires on IBM PS/2, PC/AT, PC/XT,
PC, PC/Jr, or compatible. Minimum system
requirements are 64 KB of memory, PC-DOS
2.0 or MS-DOS 2.0 or greater, 50 KB of disk
space. QEdit runs GREAT on floppy based
systems and laptops.
"I
To order direct call , ;
404·428·64161
fIii!Pl·. •Cards)'.l
.. . ~ II!!iiiiiIIl
'
.
eR''''''.
~
"
""Rm
;
.
.
:",~
; Add $3.00 for shipping~$10.qO.J
for overseaS .shipping. UPS 2nd J
~. DAY AIR available.withhi
j
. the U.S. for ONLY $5.00 'I
, COD's ~ccepted-please~dq $3.00' i
rGeorgia residents odd~o/~~~!:~.t?~J
SEMWARE™
730 Elk Cove Ct. • Kennesaw,GA 30144
QEdit and SemWare are trademarks of
Applied Systems Technologies, Inc.
© 1989 Applied Systems Technologies, Inc.
Reader Service Number 127
MICRO CORNUCOPIA, #49, Sept-Oct 1989
19