home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / pascal / vicon19.zip / VICON.DOC < prev    next >
Text File  |  1992-01-18  |  20KB  |  751 lines

  1.  
  2.  
  3.                *   *   *   *   *   *   *   *
  4.              *   *   *   *   *   *   *   *   *
  5.          ***************** VICON *****************
  6.            *   *   *   *   *   *   *   *   *   *
  7.              *   *   * <Version 1.9> *   *   *
  8.                *   *   *   *   *   *   *   *
  9.                  *   * Programmed by *   *
  10.                    *   *   *   *   *   *
  11.                      *Khai-Wei CHOONG*
  12.                        *   *   *   *
  13.                          *   *   *
  14.                            *   *
  15.                              *
  16.  
  17.  
  18.  
  19.  
  20.  
  21. This essay was written on 20th June 1991.
  22.  
  23.  
  24.  
  25. Correspondence Address:
  26.  
  27.  
  28.       Permanent address:   11 Ray Street
  29.                            Wilston
  30.                            QLD  4051
  31.                            Australia
  32.  
  33.  
  34.       Current address ( valid till end of 1991 ) :
  35.                            3/242 Carmody Road
  36.                            St Lucia
  37.                            QLD  4067
  38.                            Australia
  39.  
  40.  
  41. ================================================================
  42.  
  43.  
  44. (1) Conception
  45.  
  46.  
  47.  
  48.     After reading through an article in DR DOBB'S JOURNAL in
  49.  
  50.     July 1989 which presented the techniques to create simple
  51.  
  52.     icons, I could not resist the temptation of flashing out
  53.  
  54.     a much more functional icon editor. Thence I was addicted
  55.  
  56.     to these catchy little pictures even before Microsoft
  57.  
  58.     Windows 3.0 immortalized them in the PC world.
  59.  
  60.  
  61. ================================================================
  62.  
  63.  
  64. (2) Who needs icons?
  65.  
  66.  
  67.  
  68.     Iconolaters cannot worship without them.  Neither can
  69.  
  70.     the modern men whose technological flair has resulted
  71.  
  72.     in the endless need to compress a thousand words into
  73.  
  74.     little pictures of instant appeal and meaning.  Icons
  75.  
  76.     have invaded our lives.  They are on the streets, in
  77.  
  78.     the courts, and now they are on our screens.  Imagine
  79.  
  80.     yourself pointing and clicking at them to switch TV
  81.  
  82.     channels ten years from now!  Or imagine using Microsoft
  83.  
  84.     Windows without them.....
  85.  
  86.  
  87. ================================================================
  88.  
  89.  
  90. (3) The neglected BGI programmers
  91.  
  92.  
  93.  
  94.     Reverend Borland has provided more than 50 graphics
  95.  
  96.     routines for Turbo Pascal, C and C++ users.  As a result,
  97.     
  98.     we have seen a flood of graphics applications previously
  99.  
  100.     unachievable in text mode.  However, I have yet to see
  101.  
  102.     even a handful of icon-oriented programs.  This is not
  103.  
  104.     because of inability on the part of programmers, for an
  105.  
  106.     icon is a relatively simple thing in the world of OOP
  107.  
  108.     (object-oriented programming).  It is the lack of facilities
  109.  
  110.     to create icons that has stunted the growth and proliferation
  111.  
  112.     of icons in graphics applications.  Unlike many graphical
  113.  
  114.     objects, an icon is a symbolic bit map image that cannot
  115.  
  116.     be preprogrammed into an application and must be manually
  117.  
  118.     created, pixel by pixel, in advance.  Hence VICON to the
  119.  
  120.     rescue.....
  121.  
  122.  
  123. ================================================================
  124.  
  125.  
  126. (4) How good is it?
  127.  
  128.  
  129.  
  130.     See for yourself.
  131.  
  132.     VICON is similar to many drawing packages in various ways,
  133.  
  134.     but strives for the much needed ease of use.  For example,
  135.  
  136.     in a few other drawing utilities, you are "locked" into the
  137.  
  138.     rubber banding mode in order to draw an object, during which
  139.  
  140.     you can only stretch the rubberband, click to anchor a pivot
  141.  
  142.     or quit.  You are not allowed to change colors, stroke
  143.  
  144.     sizes or even select a menu.  Another major problem is in
  145.  
  146.     color selection: either the color palette is not immediately
  147.  
  148.     available and has to be selected via a menu or the palette
  149.  
  150.     is far away and the user has to constantly move the mouse
  151.  
  152.     cursor across the screen to click on the desired color.
  153.  
  154.     VICON addresses these problems to alleviate the tedious
  155.  
  156.     editing, and provides additional features for special effects
  157.  
  158.     and high productivity.
  159.  
  160.  
  161. ================================================================
  162.  
  163.  
  164. (5) Bonus Add-Ons
  165.  
  166.  
  167.  
  168.     Since the use of colors is so extensive and important I
  169.  
  170.     have provided several tools to enhance and coordinate it.
  171.  
  172.     These include Video Emulation, Palette Editor and Palette
  173.  
  174.     Rotator.  For those of you who like to grab your icon
  175.  
  176.     on a piece of paper, you can print out your favourite ones
  177.  
  178.     on a dot matrix printer, a LaserJet printer or a Hewlett-
  179.  
  180.     Packard Color Plotter via any parallel or COM port.  A
  181.  
  182.     word of advice:  if your mouse has been installed on
  183.  
  184.     COM port 1 and you choose to print via this port, VICON
  185.  
  186.     will oblige you, with the loss of use of your mouse
  187.  
  188.     during the printing process.  You can still respond to
  189.  
  190.     VICON via the keyboard.  The mouse will be faithfully
  191.  
  192.     restored when the printing is finished.
  193.  
  194.  
  195. ================================================================
  196.  
  197.  
  198. (6) What?!  A file manager in an icon editor?
  199.  
  200.  
  201.  
  202.     Yes, I know you are probably so used to your own file
  203.  
  204.     manager that you won't even bother with it.  Nevertheless,
  205.  
  206.     if you do happen to need it, you will have to shell out,
  207.  
  208.     quit VICON or use a TSR, won't you.  Ah! speaking of TSRs,
  209.  
  210.     they don't coexist well with graphics.  If you have to use
  211.  
  212.     a TSR in VICON, be certain to run Video Emulation to
  213.  
  214.     restore the screen later.  Anyway, a handy file manager
  215.  
  216.     right at your finger tips is always great.  Moreover,
  217.  
  218.     this is one dressed in a stunning graphical user interface!
  219.  
  220.  
  221. ================================================================
  222.  
  223.  
  224. (7) The future of VICON
  225.  
  226.  
  227.  
  228.     This depends on whether I get enough incentive in the form
  229.  
  230.     of constructive criticisms and user registrations.  It will
  231.  
  232.     be frustrating indeed not to receive any response or reward
  233.  
  234.     after 18 months of intense effort.  I would like people to
  235.  
  236.     be honest and trustworthy, even to the author of an icon
  237.  
  238.     editor.  I have not built in enough intelligence in VICON
  239.  
  240.     for this task.  If only VICON could read the human mind!
  241.  
  242.  
  243. ================================================================
  244.  
  245.  
  246. (8) Support for other graphics formats
  247.  
  248.  
  249.  
  250.     This is not difficult provided I know the formats.  However
  251.  
  252.     I have a hard time obtaining the information.  Meanwhile, I
  253.  
  254.     have already worked out the Microsoft Windows Icon format
  255.  
  256.     the hard way.  Anyone who is interested in seeing VICON
  257.  
  258.     support other graphics formats such as PCX, TIFF (etc.) may
  259.  
  260.     send the complete information to me by mail.  Once it is
  261.  
  262.     successfully implemented, that version of VICON will be
  263.  
  264.     sent to the person free.  Any code examples included in
  265.  
  266.     the information should preferably be written in PASCAL.
  267.  
  268.     Unless it is well commented, I do not enjoy the task of reading
  269.  
  270.     or translating C++, much less the cryptic old fashioned C.
  271.  
  272.     I am also looking for BGI drivers that cater for 256 colors
  273.  
  274.     at super VGA resolution(s).  Please advise me if you know of any.
  275.  
  276.  
  277.  
  278.  
  279.     What about porting VICON to Microsoft Windows 3 ?  This
  280.  
  281.     will be another story.....   Remember, I am anxious to
  282.  
  283.     hear from you.  And good luck in your future graphics
  284.  
  285.     programming.  May the GUI and VICON be with you !!!
  286.  
  287.  
  288. ================================================================
  289.  
  290.  
  291. (9) Writing text to screen in graphics mode
  292.  
  293.  
  294.  
  295.     From a programmer's point of view, the similarity between
  296.  
  297.     an application in text mode and another in graphics mode
  298.  
  299.     begins and ends in the way text is written to the screen.
  300.  
  301.     Programming in graphics mode is largely a different ball
  302.  
  303.     game.  Gone are all the comforts of the 80 x 25 cells
  304.  
  305.     supported by BIOS.  As soon as you leave text mode, you
  306.  
  307.     are responsible for the color and intensity of each of
  308.  
  309.     the 640 x 480 pixels you inherit from a VGA screen.
  310.  
  311.     The contemporary MS-DOS systems do not permit mapping
  312.  
  313.     the ROM-based character set(s) directly into a graphics
  314.  
  315.     display.  Since text is more important than anything
  316.  
  317.     else, Borland has supplied a few scalable fonts to
  318.  
  319.     overcome that problem.
  320.  
  321.  
  322.  
  323.                Writing text to a graphics screen is a laborious
  324.  
  325.     programming task.  When new text is written to the screen in
  326.  
  327.     conventional text modes, the existing text is simply written
  328.  
  329.     over, vanishing automatically as the new characters are assigned
  330.  
  331.     to each row/column position.  In graphics modes, however, text
  332.  
  333.     output is drawn rather than written.  The new text does not
  334.  
  335.     replace; rather, it overlaps with the old, confusing the text
  336.  
  337.     display.  To erase the appropriate text before writing new text
  338.  
  339.     to the screen, you would have to remove the block of graphics
  340.  
  341.     background that otherwise would interfere with the text image.
  342.  
  343.     The following prerequisites must be satisfied in order to
  344.  
  345.     accomplish this task:
  346.  
  347.          a) The text style, fonts and justification must be
  348.  
  349.             identical as when the text was originally written.
  350.  
  351.          b) The original drawing color must be in effect.
  352.  
  353.          c) The screen coordinates where the original text was
  354.  
  355.             written must be known. (This in turn may need to be
  356.  
  357.             viewport-adjusted.)
  358.  
  359.          d) The original text itself must be known.
  360.  
  361.          e) The original color and fill style of the background
  362.  
  363.             in which the text was written. (The background may
  364.  
  365.             not even have a uniform color and fill style.)
  366.  
  367.  
  368.  
  369.     So much for erasing text alone.  You also need to
  370.  
  371.     attend to the following when writing text to the screen:
  372.  
  373.          a) Temporarily turn off the mouse cursor if it is
  374.  
  375.             present, otherwise the refreshing of the cursor will
  376.  
  377.             destroy some portions of the text.
  378.  
  379.          b) Assuming that the text is being drawn horizontally,
  380.  
  381.             you must make sure that the starting X-coordinate is
  382.  
  383.             never less than zero, or nothing will be written to
  384.  
  385.             the screen.  This is one of the idiosyncrasies of the
  386.  
  387.             Borland Graphics Interface (BGI).
  388.  
  389.  
  390.  
  391.     Once you have mastered the basics, you can then pitch your
  392.  
  393.     talent against creating a fully-fledged graphics editor.
  394.  
  395.     You will need to overcome at least a few of these formidable
  396.  
  397.     barriers:
  398.  
  399.          a) Present the user with a blinking cursor so much taken for
  400.  
  401.             granted in text mode.  You will need to keep track
  402.  
  403.             of the cursor's position, and its size according to
  404.  
  405.             the font size and proportional width.
  406.  
  407.          b) The screen can not be scrolled up or down and left
  408.  
  409.             or right in the usual manner.  While it is possible
  410.  
  411.             to use GetImage() and PutImage() to move a major
  412.  
  413.             portion of the screen image, the operation is slow
  414.  
  415.             and the memory requirements can be excessive.
  416.  
  417.          c) There is no way to read a character from the screen.
  418.  
  419.             Neither is it easy to find the screen position of
  420.  
  421.             any character, especially when a proportional font
  422.  
  423.             is used.
  424.  
  425.  
  426.  
  427.  
  428.     Essentially, you have to invent most of the features found
  429.  
  430.     in the CRT unit and many, many more to get reasonable results.
  431.  
  432.     Tough! Tough! Tough!
  433.  
  434.  
  435. ================================================================
  436.  
  437.  
  438. (10) The Graphical User Interface (GUI)
  439.  
  440.  
  441.  
  442.      The subject of GUI could easily fill a thick book.
  443.  
  444.      Here, I shall show you what you should pay attention to
  445.  
  446.      as a programmer and what you should look for in a program
  447.  
  448.      with a GUI from an end user's viewpoint.
  449.  
  450.  
  451.  
  452.        1) An application will benefit the user if it is SAA
  453.  
  454.           compliant.  SAA stands for Systems Application
  455.  
  456.           Architecture, which is a collection of selected
  457.  
  458.           software interfaces, conventions and protocols
  459.  
  460.           that collectively provides the framework for the
  461.  
  462.           development and execution of consistent applications.
  463.  
  464.           Programmers interested in developing their own GUI
  465.  
  466.           will also reap much benefit if they follow the SAA
  467.  
  468.           guide-lines set by IBM.  Current examples of powerful
  469.  
  470.           SAA compliant environments are Microsoft Windows and
  471.  
  472.           the OS/2 Presentation Manager.  The SAA Common User
  473.  
  474.           Access (CUA) Advanced Interface Design Guide is
  475.  
  476.           available from IBM representatives or branch offices.
  477.  
  478.  
  479.  
  480.        2) If you are going to produce a graphics application
  481.  
  482.           armed with a decent GUI, then learn object oriented
  483.  
  484.           programming by all means.  This programming methodology
  485.  
  486.           promises to reduce the complexity of your task much
  487.  
  488.           more than the ubiquitous structured programming.
  489.  
  490.  
  491.  
  492.        3) The next phase is to make your application event-
  493.  
  494.           driven.  An event may be a mouse click, a mouse move
  495.  
  496.           or a key pressed that an application responses to.
  497.  
  498.           Instead of coding an event loop into every routine
  499.  
  500.           or subroutine that interacts with a user, you code
  501.  
  502.           one event manager to dispatch events to appropriate
  503.  
  504.           routines.  Hence the majority of your routines do
  505.  
  506.           not bother themselves with the repetitive tasks
  507.  
  508.           of reading user inputs or interacting with a scroll
  509.  
  510.           bar and so on....
  511.  
  512.  
  513. ================================================================
  514.  
  515.  
  516. (11) The limitations of Borland Graphics Interface (BGI)
  517.  
  518.  
  519.  
  520.      BGI provides more than 50 primitives for various graphics
  521.  
  522.      driver supports, line drawing, circle, ellipse, rectangle,
  523.  
  524.      pie slice, sector, text and viewport.  On the whole, BGI
  525.  
  526.      is a rather complete and flexible graphics package for
  527.  
  528.      most general applications.  However, you need to do a great
  529.  
  530.      deal of work to create a pipeline of graphics elements such
  531.  
  532.      as buttons, scroll bars, menus and windows required by GUI.
  533.  
  534.      BGI only provides the drawing primitives.  The rest is all
  535.  
  536.      up to you.  There are also a few insurmountable obstacles
  537.  
  538.      presented by BGI.  Unless Borland further improves BGI,
  539.  
  540.      the increasing availability and acceptance of Microsoft
  541.  
  542.      Windows or even OS/2 might cast BGI to oblivion.  Hey!
  543.  
  544.      Borland, are you listening?  Here is a list of features
  545.  
  546.      absent, inadequately or incorrectly implemented in BGI,
  547.  
  548.      together with some general problems:
  549.  
  550.  
  551.  
  552.          a) Easier text handling and display are strongly
  553.  
  554.             recommended.
  555.  
  556.          b) Greater range of fonts, including bit-mapped,
  557.  
  558.             stroked and Adobe-type fonts are desirable.
  559.  
  560.             We would like fonts created from Bezier curves.
  561.  
  562.          c) Rotatable text is required.
  563.  
  564.          d) Multiple scrollable graphics windows or viewports
  565.  
  566.             should be implemented.
  567.  
  568.          e) Methods to extend the graphics image beyond the
  569.  
  570.             display limits are desirable.
  571.  
  572.          f) Provide an interactive program to facilitate the
  573.  
  574.             creation of customized BGI drivers.  Borland has
  575.  
  576.             already produced a font editor to create CHR files.
  577.  
  578.             An equivalent editor for the BGI files would be a
  579.  
  580.             welcome addition.
  581.  
  582.          g) VGA256.BGI is pretty useless with its 640 x 200
  583.  
  584.             resolutions.  Give us BGI drivers for SVGA, XVGA
  585.  
  586.             etc., with resolutions up to 1024 x 768 and 256
  587.  
  588.             colors.
  589.  
  590.          h) Currently only a few graphics modes support multiple
  591.  
  592.             video pages.  I have one megabytes of video memory
  593.  
  594.             to be tapped, yet only one page is supported in the
  595.  
  596.             VGA high resolution mode.
  597.  
  598.          i) FloodFill() and those palette manipulation routines
  599.  
  600.             should work in all graphics modes, including IBM8514.
  601.  
  602.          j) Fix the bug that prevents loading of any external
  603.  
  604.             font whose source file is larger than 16K bytes.
  605.  
  606.          k) PutImage() will not work if the whole image
  607.  
  608.             does not fit inside the screen.
  609.  
  610.          l) OutText() and OutTextXY() will not work if the
  611.  
  612.             starting point does not lie inside the screen.
  613.  
  614.          m) The BGI device driver routines are accessed via the
  615.  
  616.             vector table.  All but one vector in the table have
  617.  
  618.             their equivalent routines in Turbo Pascal or C.
  619.  
  620.             That unsupported vector is SYMBOL.  We would like
  621.  
  622.             to see it implemented by Borland.
  623.  
  624.          n) Lastly, but not the least, increase the speed of
  625.  
  626.             execution of all graphics routines.
  627.  
  628.  
  629.  
  630.  
  631.  
  632.      I hope that Borland will release a version of TURBO VISION
  633.  
  634.      written for BGI.  Even though TURBO VISION is a masterpiece,
  635.  
  636.      I am reluctant to use it for serious DOS applications simply
  637.  
  638.      because text mode is too restrictive.  Borland has been
  639.  
  640.      accused of neglecting the once popular TURBO PASCAL GRAPHICS
  641.  
  642.      TOOLBOX.  Let's hope that BGI will not suffer the same fate.
  643.  
  644.      To be fair, Borland has no obligation to offer follow-up
  645.  
  646.      supports for any of their products.  But then those of us who
  647.  
  648.      have invested heavily on BGI and Turbo Vision etc. are truly
  649.  
  650.      living dangerously at the mercy of Borland.  I do like Turbo
  651.  
  652.      Pascal for Windows.  However, I also want freedom of choice.
  653.  
  654.      Not everybody wants to develop graphics programs that run in
  655.  
  656.      Microsoft Windows.  BGI clearly fits the appetites of those
  657.  
  658.      who want a solid DOS-based graphics foundation to work on.
  659.  
  660.  
  661. ================================================================
  662.  
  663.  
  664. (12) Conclusions
  665.  
  666.  
  667.         (a) Icons are no longer just gimmicks and elaborations
  668.  
  669.             used to fancily dress otherwise conventional programs.
  670.  
  671.             Icons are pictures without words, conveying messages
  672.  
  673.             without unnecessarily cluttering the screen with text.
  674.  
  675.             Icons represent portholes into an application's
  676.  
  677.             internals, encapsulating latent actions with easy
  678.  
  679.             access by the user.  Icons serve as screen symbols and
  680.  
  681.             as buttons to summon or control applications or
  682.  
  683.             subprocedures.
  684.  
  685.  
  686.  
  687.         (b) Undoubtedly, graphics programming incurs man-months of
  688.  
  689.             efforts and exacts tremendous demand and dedication
  690.  
  691.             from the programmer.  However, through the use of
  692.  
  693.             object oriented and event driven programming, the
  694.  
  695.             results can be very rewarding indeed.
  696.  
  697.  
  698.  
  699.         (c) Current computer science courses in universities do
  700.  
  701.             not stress the importance of software engineering
  702.  
  703.             and user interface enough.  The upshot is many poorly
  704.  
  705.             designed applications with crummy user interface, low
  706.  
  707.             level of usability and consistency.  Moreover, since
  708.  
  709.             our education stresses engineering, few of us have
  710.  
  711.             formal and proper training in design.  Most of us
  712.  
  713.             spend hours after hours writing codes without giving
  714.  
  715.             much thought to program organization, abstraction
  716.  
  717.             and interaction.  With the advent of object oriented
  718.  
  719.             programming, which places more weight on design than
  720.  
  721.             any previous programming approaches, the problems are
  722.  
  723.             aggravated.  As a result, much of the design work
  724.  
  725.             occurs during the phase of implementation.  Many
  726.  
  727.             programmers are finding that, although they have a
  728.  
  729.             working program, they are forced to redesign and
  730.  
  731.             rewrite to truly reap the benefits of reusability,
  732.  
  733.             extensibility and consistency.
  734.  
  735.  
  736. ================================================================
  737.  
  738.  
  739.  
  740.  
  741.  
  742. I invite you to judge and comment on all aspects of VICON.
  743.  
  744.  
  745.  
  746.  
  747.  
  748. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  749. + Please read Register.DOC, ReadMe.DOC, BGIuser.DOC, Licence.DOC +
  750. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  751.