home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
pascal
/
vicon19.zip
/
VICON.DOC
< prev
next >
Wrap
Text File
|
1992-01-18
|
20KB
|
751 lines
* * * * * * * *
* * * * * * * * *
***************** VICON *****************
* * * * * * * * * *
* * * <Version 1.9> * * *
* * * * * * * *
* * Programmed by * *
* * * * * *
*Khai-Wei CHOONG*
* * * *
* * *
* *
*
This essay was written on 20th June 1991.
Correspondence Address:
Permanent address: 11 Ray Street
Wilston
QLD 4051
Australia
Current address ( valid till end of 1991 ) :
3/242 Carmody Road
St Lucia
QLD 4067
Australia
================================================================
(1) Conception
After reading through an article in DR DOBB'S JOURNAL in
July 1989 which presented the techniques to create simple
icons, I could not resist the temptation of flashing out
a much more functional icon editor. Thence I was addicted
to these catchy little pictures even before Microsoft
Windows 3.0 immortalized them in the PC world.
================================================================
(2) Who needs icons?
Iconolaters cannot worship without them. Neither can
the modern men whose technological flair has resulted
in the endless need to compress a thousand words into
little pictures of instant appeal and meaning. Icons
have invaded our lives. They are on the streets, in
the courts, and now they are on our screens. Imagine
yourself pointing and clicking at them to switch TV
channels ten years from now! Or imagine using Microsoft
Windows without them.....
================================================================
(3) The neglected BGI programmers
Reverend Borland has provided more than 50 graphics
routines for Turbo Pascal, C and C++ users. As a result,
we have seen a flood of graphics applications previously
unachievable in text mode. However, I have yet to see
even a handful of icon-oriented programs. This is not
because of inability on the part of programmers, for an
icon is a relatively simple thing in the world of OOP
(object-oriented programming). It is the lack of facilities
to create icons that has stunted the growth and proliferation
of icons in graphics applications. Unlike many graphical
objects, an icon is a symbolic bit map image that cannot
be preprogrammed into an application and must be manually
created, pixel by pixel, in advance. Hence VICON to the
rescue.....
================================================================
(4) How good is it?
See for yourself.
VICON is similar to many drawing packages in various ways,
but strives for the much needed ease of use. For example,
in a few other drawing utilities, you are "locked" into the
rubber banding mode in order to draw an object, during which
you can only stretch the rubberband, click to anchor a pivot
or quit. You are not allowed to change colors, stroke
sizes or even select a menu. Another major problem is in
color selection: either the color palette is not immediately
available and has to be selected via a menu or the palette
is far away and the user has to constantly move the mouse
cursor across the screen to click on the desired color.
VICON addresses these problems to alleviate the tedious
editing, and provides additional features for special effects
and high productivity.
================================================================
(5) Bonus Add-Ons
Since the use of colors is so extensive and important I
have provided several tools to enhance and coordinate it.
These include Video Emulation, Palette Editor and Palette
Rotator. For those of you who like to grab your icon
on a piece of paper, you can print out your favourite ones
on a dot matrix printer, a LaserJet printer or a Hewlett-
Packard Color Plotter via any parallel or COM port. A
word of advice: if your mouse has been installed on
COM port 1 and you choose to print via this port, VICON
will oblige you, with the loss of use of your mouse
during the printing process. You can still respond to
VICON via the keyboard. The mouse will be faithfully
restored when the printing is finished.
================================================================
(6) What?! A file manager in an icon editor?
Yes, I know you are probably so used to your own file
manager that you won't even bother with it. Nevertheless,
if you do happen to need it, you will have to shell out,
quit VICON or use a TSR, won't you. Ah! speaking of TSRs,
they don't coexist well with graphics. If you have to use
a TSR in VICON, be certain to run Video Emulation to
restore the screen later. Anyway, a handy file manager
right at your finger tips is always great. Moreover,
this is one dressed in a stunning graphical user interface!
================================================================
(7) The future of VICON
This depends on whether I get enough incentive in the form
of constructive criticisms and user registrations. It will
be frustrating indeed not to receive any response or reward
after 18 months of intense effort. I would like people to
be honest and trustworthy, even to the author of an icon
editor. I have not built in enough intelligence in VICON
for this task. If only VICON could read the human mind!
================================================================
(8) Support for other graphics formats
This is not difficult provided I know the formats. However
I have a hard time obtaining the information. Meanwhile, I
have already worked out the Microsoft Windows Icon format
the hard way. Anyone who is interested in seeing VICON
support other graphics formats such as PCX, TIFF (etc.) may
send the complete information to me by mail. Once it is
successfully implemented, that version of VICON will be
sent to the person free. Any code examples included in
the information should preferably be written in PASCAL.
Unless it is well commented, I do not enjoy the task of reading
or translating C++, much less the cryptic old fashioned C.
I am also looking for BGI drivers that cater for 256 colors
at super VGA resolution(s). Please advise me if you know of any.
What about porting VICON to Microsoft Windows 3 ? This
will be another story..... Remember, I am anxious to
hear from you. And good luck in your future graphics
programming. May the GUI and VICON be with you !!!
================================================================
(9) Writing text to screen in graphics mode
From a programmer's point of view, the similarity between
an application in text mode and another in graphics mode
begins and ends in the way text is written to the screen.
Programming in graphics mode is largely a different ball
game. Gone are all the comforts of the 80 x 25 cells
supported by BIOS. As soon as you leave text mode, you
are responsible for the color and intensity of each of
the 640 x 480 pixels you inherit from a VGA screen.
The contemporary MS-DOS systems do not permit mapping
the ROM-based character set(s) directly into a graphics
display. Since text is more important than anything
else, Borland has supplied a few scalable fonts to
overcome that problem.
Writing text to a graphics screen is a laborious
programming task. When new text is written to the screen in
conventional text modes, the existing text is simply written
over, vanishing automatically as the new characters are assigned
to each row/column position. In graphics modes, however, text
output is drawn rather than written. The new text does not
replace; rather, it overlaps with the old, confusing the text
display. To erase the appropriate text before writing new text
to the screen, you would have to remove the block of graphics
background that otherwise would interfere with the text image.
The following prerequisites must be satisfied in order to
accomplish this task:
a) The text style, fonts and justification must be
identical as when the text was originally written.
b) The original drawing color must be in effect.
c) The screen coordinates where the original text was
written must be known. (This in turn may need to be
viewport-adjusted.)
d) The original text itself must be known.
e) The original color and fill style of the background
in which the text was written. (The background may
not even have a uniform color and fill style.)
So much for erasing text alone. You also need to
attend to the following when writing text to the screen:
a) Temporarily turn off the mouse cursor if it is
present, otherwise the refreshing of the cursor will
destroy some portions of the text.
b) Assuming that the text is being drawn horizontally,
you must make sure that the starting X-coordinate is
never less than zero, or nothing will be written to
the screen. This is one of the idiosyncrasies of the
Borland Graphics Interface (BGI).
Once you have mastered the basics, you can then pitch your
talent against creating a fully-fledged graphics editor.
You will need to overcome at least a few of these formidable
barriers:
a) Present the user with a blinking cursor so much taken for
granted in text mode. You will need to keep track
of the cursor's position, and its size according to
the font size and proportional width.
b) The screen can not be scrolled up or down and left
or right in the usual manner. While it is possible
to use GetImage() and PutImage() to move a major
portion of the screen image, the operation is slow
and the memory requirements can be excessive.
c) There is no way to read a character from the screen.
Neither is it easy to find the screen position of
any character, especially when a proportional font
is used.
Essentially, you have to invent most of the features found
in the CRT unit and many, many more to get reasonable results.
Tough! Tough! Tough!
================================================================
(10) The Graphical User Interface (GUI)
The subject of GUI could easily fill a thick book.
Here, I shall show you what you should pay attention to
as a programmer and what you should look for in a program
with a GUI from an end user's viewpoint.
1) An application will benefit the user if it is SAA
compliant. SAA stands for Systems Application
Architecture, which is a collection of selected
software interfaces, conventions and protocols
that collectively provides the framework for the
development and execution of consistent applications.
Programmers interested in developing their own GUI
will also reap much benefit if they follow the SAA
guide-lines set by IBM. Current examples of powerful
SAA compliant environments are Microsoft Windows and
the OS/2 Presentation Manager. The SAA Common User
Access (CUA) Advanced Interface Design Guide is
available from IBM representatives or branch offices.
2) If you are going to produce a graphics application
armed with a decent GUI, then learn object oriented
programming by all means. This programming methodology
promises to reduce the complexity of your task much
more than the ubiquitous structured programming.
3) The next phase is to make your application event-
driven. An event may be a mouse click, a mouse move
or a key pressed that an application responses to.
Instead of coding an event loop into every routine
or subroutine that interacts with a user, you code
one event manager to dispatch events to appropriate
routines. Hence the majority of your routines do
not bother themselves with the repetitive tasks
of reading user inputs or interacting with a scroll
bar and so on....
================================================================
(11) The limitations of Borland Graphics Interface (BGI)
BGI provides more than 50 primitives for various graphics
driver supports, line drawing, circle, ellipse, rectangle,
pie slice, sector, text and viewport. On the whole, BGI
is a rather complete and flexible graphics package for
most general applications. However, you need to do a great
deal of work to create a pipeline of graphics elements such
as buttons, scroll bars, menus and windows required by GUI.
BGI only provides the drawing primitives. The rest is all
up to you. There are also a few insurmountable obstacles
presented by BGI. Unless Borland further improves BGI,
the increasing availability and acceptance of Microsoft
Windows or even OS/2 might cast BGI to oblivion. Hey!
Borland, are you listening? Here is a list of features
absent, inadequately or incorrectly implemented in BGI,
together with some general problems:
a) Easier text handling and display are strongly
recommended.
b) Greater range of fonts, including bit-mapped,
stroked and Adobe-type fonts are desirable.
We would like fonts created from Bezier curves.
c) Rotatable text is required.
d) Multiple scrollable graphics windows or viewports
should be implemented.
e) Methods to extend the graphics image beyond the
display limits are desirable.
f) Provide an interactive program to facilitate the
creation of customized BGI drivers. Borland has
already produced a font editor to create CHR files.
An equivalent editor for the BGI files would be a
welcome addition.
g) VGA256.BGI is pretty useless with its 640 x 200
resolutions. Give us BGI drivers for SVGA, XVGA
etc., with resolutions up to 1024 x 768 and 256
colors.
h) Currently only a few graphics modes support multiple
video pages. I have one megabytes of video memory
to be tapped, yet only one page is supported in the
VGA high resolution mode.
i) FloodFill() and those palette manipulation routines
should work in all graphics modes, including IBM8514.
j) Fix the bug that prevents loading of any external
font whose source file is larger than 16K bytes.
k) PutImage() will not work if the whole image
does not fit inside the screen.
l) OutText() and OutTextXY() will not work if the
starting point does not lie inside the screen.
m) The BGI device driver routines are accessed via the
vector table. All but one vector in the table have
their equivalent routines in Turbo Pascal or C.
That unsupported vector is SYMBOL. We would like
to see it implemented by Borland.
n) Lastly, but not the least, increase the speed of
execution of all graphics routines.
I hope that Borland will release a version of TURBO VISION
written for BGI. Even though TURBO VISION is a masterpiece,
I am reluctant to use it for serious DOS applications simply
because text mode is too restrictive. Borland has been
accused of neglecting the once popular TURBO PASCAL GRAPHICS
TOOLBOX. Let's hope that BGI will not suffer the same fate.
To be fair, Borland has no obligation to offer follow-up
supports for any of their products. But then those of us who
have invested heavily on BGI and Turbo Vision etc. are truly
living dangerously at the mercy of Borland. I do like Turbo
Pascal for Windows. However, I also want freedom of choice.
Not everybody wants to develop graphics programs that run in
Microsoft Windows. BGI clearly fits the appetites of those
who want a solid DOS-based graphics foundation to work on.
================================================================
(12) Conclusions
(a) Icons are no longer just gimmicks and elaborations
used to fancily dress otherwise conventional programs.
Icons are pictures without words, conveying messages
without unnecessarily cluttering the screen with text.
Icons represent portholes into an application's
internals, encapsulating latent actions with easy
access by the user. Icons serve as screen symbols and
as buttons to summon or control applications or
subprocedures.
(b) Undoubtedly, graphics programming incurs man-months of
efforts and exacts tremendous demand and dedication
from the programmer. However, through the use of
object oriented and event driven programming, the
results can be very rewarding indeed.
(c) Current computer science courses in universities do
not stress the importance of software engineering
and user interface enough. The upshot is many poorly
designed applications with crummy user interface, low
level of usability and consistency. Moreover, since
our education stresses engineering, few of us have
formal and proper training in design. Most of us
spend hours after hours writing codes without giving
much thought to program organization, abstraction
and interaction. With the advent of object oriented
programming, which places more weight on design than
any previous programming approaches, the problems are
aggravated. As a result, much of the design work
occurs during the phase of implementation. Many
programmers are finding that, although they have a
working program, they are forced to redesign and
rewrite to truly reap the benefits of reusability,
extensibility and consistency.
================================================================
I invite you to judge and comment on all aspects of VICON.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Please read Register.DOC, ReadMe.DOC, BGIuser.DOC, Licence.DOC +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++