home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / f / fractal112 / !PalGen / !Help < prev    next >
Text File  |  1994-12-12  |  9KB  |  195 lines

  1.                   Documentation for !PalGen
  2.                       By Ian Nichols
  3.  
  4.  
  5. Like many freeware programs, !PalGen was written partly as a programming
  6. exercise and partly to do something the way that the programmer wants it to
  7. be done rather than the way everyone else seems to do it.  In this case, the
  8. task in question is the generation and editing of 256 colour palettes,
  9. primarily for use with images created by !Fractal, but the palettes can also
  10. be used with any RISC OS 256-colour sprite.  Though it was developed on an
  11. ageing A310 with no more graphics enhancement than a VIDC enhancer, it is
  12. intended to be used on a machine with VIDC20, which allows the 256 colours to
  13. be selected from a 24-bit palette.  It has been tried on a RiscPC (someone
  14. else's - I'm still saving!) and seems to work as expected.
  15.  
  16. !PalGen can also save and load 256 colour palettes in the form used by the PC
  17. freeware program FractInt.
  18.  
  19. The way in which !PalGen works is somewhat different from other palette
  20. editors you may have seen.  Instead of setting colours individually or
  21. setting groups of colours by interpolating between two endpoints, !PalGen
  22. represents the whole palette as a set of 3 histograms; one for the red
  23. intensities, one for the green and one for the blue.  These histograms can be
  24. altered using the mouse or by means of 3 equations.
  25.  
  26. !PalGen has been written to be fully RISC OS compliant, and considering that
  27. it is only my second Wimp program I am quite pleased with its behaviour.  It
  28. supports both the file and RAM transfer protocols, although you do get some
  29. strange error messages when saving palettes into sprites in !Paint. I am told
  30. that this is almost certainly due to a bug in !Paint, but if there is someone
  31. out there who can find a bug in !PalGen which is causing this, please could
  32. they tell me!.
  33.  
  34.  
  35.  
  36. Using !PalGen
  37. -------------
  38.  
  39. Starting the application and opening the main window are all done in the
  40. usual RISC OS way.  I have not set up a run action for palette files (type
  41. &FED), so to load them you will have to drag their icons onto the !PalGen
  42. icon bar icon or the main window if it is open.  The default 256 colour
  43. palette is automatically loaded when the program starts (this is the same on a RiscPC as on the older machines).
  44.  
  45. Clicking on the icon bar icon, or dragging a palette file onto it will open
  46. the main window and the palette window. By default the main window will
  47. display the histogram for red intensities.  You can view and edit the green
  48. or blue intensities by clicking on the appropriate radio button. Please be
  49. patient, it is interpreted BASIC after all.  Each column of the histogram
  50. represents the intensity (0-255) of a logical colour (also 0-255).  As you
  51. move the mouse pointer over the histogram, the logical colour number and
  52. intensity corresponding to the mouse pointer position are displayed to the
  53. right of the radio buttons.
  54.  
  55. Clicking with...
  56.  
  57. Select:    Will set the intensity of the red, green or blue component of the
  58.     logical colour corresponding to the pointer position.
  59.  
  60. Adjust:    Will set the intensity of the red, green or blue component of the
  61.     logical colour correspoding to the pointer position and interpolate
  62.     all the colours between the current pointer position and the last
  63.         pointer position where a mouse click took place.
  64.  
  65. Note that if you hold down the mouse button, both of these actions will
  66. auto-repeat as fast as the program can keep up.  The palette display (if
  67. open) will update immediately.
  68.  
  69. Clicking with Menu whilst over the main window will open a menu with the
  70. following items:
  71.  
  72. Save        Opens a save box
  73.  
  74. Equations    Opens the 'Alter with equations' dialogue box.
  75.  
  76. Show Palette    Opens the palette display if it is closed.
  77.  
  78. The Save box is not quite the standard RISC OS item - it has two radio
  79. buttons to select the type of file you wish to save the palette as (see later
  80. for brief description of the two types.  The palette is saved in the usual
  81. RISC OS way, i.e. you drag the file icon to a filer window (or the
  82. appropriate window of whatever other application you want to save it into).
  83.  
  84. The 'Alter with equations' dialogue box contains 3 writable icons into which
  85. you can type equations to alter the red, green and blue components of the
  86. colours in the palette.  If you press RETURN or click on the 'Alter Palette'
  87. icon, the program will execute a FOR...NEXT loop for each logical colour
  88. (0-255), applying the expressions to the appropriate colour component.
  89.  
  90. There are 2 variables which you can use in the expressions you type: LCN% and
  91. CV%.  LCN% is simply the logical colour number.  CV% is used to store the
  92. current value of each colour component for each logical colour just before
  93. the expression is evaluated, i.e. leaving the expression as 'CV%' (the
  94. default) will not change that component of the palette.  CV%/2 will divide
  95. the intensities of a colour component by 2 for the whole palette.
  96. Intensities greater than 255 or less than 0 are checked for and clipped if
  97. necessary.
  98.  
  99.  
  100.  
  101. File Types Supported
  102. --------------------
  103.  
  104. Two file types are supported: the standard RISC OS 256 colour palette, as
  105. exported by !Paint and as used by !Fractal, and the 256 colour palette files
  106. used by the PC freeware program FractInt.
  107.  
  108.  
  109. The RISC OS palette files contain a sequence of 6 bytes for each colour as
  110. follows:
  111.  
  112.     19 <logical colour number> 16 <Red> <green> <blue>
  113.  
  114. This sequence corresponds to the BASIC command
  115.  
  116.            VDU  19,l,p,r,g,b
  117.  
  118. Which is used to set the physical colour of logical colour 'l'.  These files
  119. are identified by having the file type &FED and being 1536 bytes long.  When
  120. files of type &FED are loaded into !PalGen, the length of the file is checked
  121. and the first 3 bytes are tested (they will always be 19 0 16 if all is
  122. well).
  123.  
  124.  
  125. The files used by FractInt are plain ASCII text files and should be given the
  126. type &FFF (text) before you try to import them.  When you export this type of
  127. file, remember to give them the extension .MAP before you try to load them
  128. into FractInt.  They consist of red, green and blue values (separated by
  129. spaces) for each logical colour in order, starting with 0, one line for each
  130. logical colour. They may also contain embedded comments on any line, after
  131. the colour information.
  132.  
  133. Because they are constructed in this way, these files do not have a fixed
  134. length, which makes them slightly trickier to deal with.  If you have
  135. problems importing these, load them into your favourite text editor and
  136. examine them, bearing in mind the following points.
  137.  
  138. 1)    !PalGen checks that the first 3 bytes of the file give a valid
  139.     number in the range 0-255.  It does this by reading successive
  140.     bytes from the file until it finds a numeric character, then
  141.     assembles successive bytes into a string until it encounters a
  142.     non-numeric character.  If it has read more than four bytes
  143.     (i.e. 3 digits plus the next, non-numeric, character) then it
  144.     assumes that the file is not a valid palette file and reports
  145.     an error.
  146.  
  147. 2)    If the file contains any comments then they should be separated
  148.     from the colour information by at least one TAB character
  149.     (ASCII 9).  Note that any comments are ignored when !PalGen
  150.     imports these files and that !PalGen adds comments of its own
  151.     when exporting palettes in this format.
  152.  
  153.  
  154.  
  155.  
  156. Well, I hope someone out there finds this program useful.  If anyone is
  157. wondering why I have included some sort of  support for a PC program, the
  158. answer is this: I believe that if Acorn machines and RISC OS are to survive
  159. as a computing platform, it is important that we can exchange data with
  160. users of other platforms in both directions.  Especially when those 'users of
  161. other platforms' are also ourselves. Acorn users can import a variety of data
  162. types from other platforms (mostly the IBM PC clones), but this is almost an
  163. implicit admission that our platform is 'not good enough' - if it's any good,
  164. why can't we create our own masterpieces? Well we can, its just that we can't
  165. easily get them onto other types of computer....
  166.  
  167. I like to think that in some small way I am helping to spread the message of data portability by doing this.
  168.  
  169.  
  170. !PalGen is freeware.  You can give it to whoever you like as long as you
  171. include this file don't cha