
/******************************************************************************
 *                                                                            *
 *  Redistribution and use in source and binary forms are permitted           *
 *  provided that source distributions retain this entire copyright           *
 *  notice and comment.                                                       *
 *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR            *
 *  IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED            *
 *  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.       *
 *  USE THIS SOFTWARE AT OWN RISK.                                            *
 *                                                                            *
 *  IN NO EVENT SHALL THE AUTHOR OF THIS SOFTWARE BE LIABLE FOR               *
 *  ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,   *
 *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,    *
 *  WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF *
 *  LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE    *
 *  OF THIS SOFTWARE.                                                         *
 *                                                                            *
 *                                                                            *
 ******************************************************************************/
     ===================== DRAX V1.4 ========================

     DRAX v1.4   -   multipurpose drawing editor.
     This is the fourth release.

     includes a modified version of GBM (Generalised Bitmap Module) 'libgbm.a'


REQUIREMENTS

    standard DOS 6.2. works fine.
    386 or later.
    Compiled with DJGPP V2.02. and Allegro 3.11. Compressed with DJP.
    A 32 bit DPMI server, such as cwsdpmi, QEMM, Windows DPMI or other
    is required. Source code is regular C.
    A compatible (with allegro) sound card is optional to use the MIDI player.

    cwsdpmi 4.0 is strongly recommended, since this software was developed
    with that server.

NEW

    Bigger cursor, baby. have phun! looks better in higher res.


DESCRIPTION

    Graphic editor program.DOS only.
    Uses screen resolutions from 360x480 (XMODE) to 1600x1200 (VESA).
    Edits 256 colors paletted images.

    Loads/Saves formats:
      TGA, BMP, LBM.             - from allegro
      KCF palette & CEL, PCX, GIF, PBM, PGM, PPM, XBM.   - from GBM

    The kisekae files *.KCF, *.CEL corresponds to
    Kisekae program KISS.EXE ver 2.24c and 2.37+ according to the specification.
    handles bpp 4 and 8 of CEL (old and new CEL types).
    handles bpp 12 and 24 of KCF. Should go fine with KISS/GS1 to KISS/GS4.

    Uses up to 3 mouse buttons.
    Positive zooming and using of tools in all zoom scales.
    No negative zoom.
    An alternative configuration file can be specified on the argument line.
    Default configuration file is 'drax.cfg'.
    use -?,/?,-h,/h on the command line for usage information.

    GBM is not my source code, but i got it from somewhere else.
    It is a import/export library that handle all the compression/decompression
    for using many graphic formats easily.
    I have changed some of the code to suit my needs.
    It is both a derivated and changed work.
    The version supplied has been shrunk to remove some formats used
    only on IBM machines. Many things have been changed in the GBM.
    It no longers flips the graphics upside down.
    Note that the TIF format still lacks some refurnishing.
    I have adapted the original GBM to be more DOS compatible.
    The sample applications have been removed.
    If you want the complete distribution then download it at from my homepage.

    Screen resolutions supported:
    360x480     XMODE
    640x480     VESA
    800x600     VESA
    1024x768    VESA
    1280x1024   VESA
    1600x1200   VESA

    you can use this program as a single graphic editor or you
    can use it for drawing several graphic blocks as a film strip.
    All the graphical blocks are saved as one single file.
    Each block is saved one below the other.
    The file drax.cfg defines several configuration parameters.

    This program is suitable for using as a tile or sprite editor.
    you can later on use the GRABBER utility which came with allegro to
    capture your sprites and use for example in a game or an application.


    Keyboard shortcuts:
    Pan image pressing space in main draw window.
    Select mouse button colors in palette window and press r to redraw
    with new user colors.


    Some windows autoscale themselves so the use of screen area is
    quite economic.

    Files needed:
    drax.exe    = main program.
    cwsdpmi.exe = The DPMI server used.
    drax1.pcx   = button icons, 30x30 pixels in size, bpp=1.
    drax2.pcx   = mouse patterns, 46x46 pixels in size (bpp must be 256 colors).
    drax3.pcx   = Fill patterns, 8x8 pixels in size, bpp=1.
    drax.cfg    = configuration file for drawing program.

    When the checkbox "ALL" is checkered, then any drawing operation
    will operate on ALL sprite blocks.

    When the checkbox "SRC" is checkered, then any drawing operation
    will operate on the source rectangle inside a sprite block.

    When the checkbox "DST" is checkered, then any drawing operation
    will operate on the destination rectangle inside a sprite block.
    Additionally, if the "ALL" checkbox is set then it means "operate on
    the destination rectangle for all sprite blocks".

    Black and White images loaded will use palette indexes 0 and 255.
    All binary operations use colors 0 and 255 as black and white.


    Some of the toolbar button functions are:
    { /* need some updates... */
      Draw functions:
        Putpixel, colorpicker, fill, rectangle, ellipse, circle, polyline.
      Clip functions:
       Define source clip rectangle,  define destination rectangle,
       copy       , copy with scaling,
       copy masked, copy masked with scaling,
       copy masked, copy masked with overlay,
       edit source rectangle,  edit destination rectangle.
       Split a graphic block into 8 bitplanes.
       Combine 8 bitplanes into a graphic block.
      Polyline clip functions:  -NONE YET, defined later, in the future-

    All methods used are:
       "Select brush"},
       "Select backgroundmap"},
       "putpixel"},
       "freedraw"},
       "color picker"},
       "solid fill"},
       "patterned fill, mous btns:1&3"},
       "draw line"},
       "draw rectangle"},
       "draw triangle"},
       "draw ellipse"},
       "draw circle"},
       "polyline"},
       "button colors 1&3 swap all occurences."},
       "copy button colors 1->3 all occurences."},
       "define source rectangle"},
       "define destination rectangle"},
       "copy src->dest"},
       "copy src->dest.transparent"},
       "copy src->dest.overlay"},
       "copy with scale"},
       "copy with scale.transparent"},
       "copy with scale.overlay"},
       "flip blocks src/dst"},
       "adapt size: [src] <- dst"},
       "adapt position: [src] <- dst"},
       "assign block: [src] <- dst"},
       "adapt size: src -> [dst] "},
       "adapt position: src -> [dst]"},
       "assign block: src -> [dst] "},
       "destroy src/dst"},
       "change src rect"},
       "change dst rect"},
       "get src bitmap into brush"},
       "Split into bitplanes"},
       "Join bitplanes"},
       "Error diffusion"},
       "Apply gammacorrection 1.8"},
       "Resize canvas, all"},
       "Rescale canvas, all"},
       "Load Palette from graphic"},
       "Load Palette from file"},
       "Save Palette to file"},
       "binop: NOT"},
       "binop: OR"},
       "binop: XOR"},
       "binop: AND"},
       "Split into rgb"},
       "Invert grey picture"},
       "add grey pictures"},
       "sub grey pictures"},
       "average grey pictures"},
    ...new since last version
       "add 8 to color index"},
       "Sort pal colors, light up."},
       "Remove pattern1,bk=mbt1,fg=mbt3"
       "Blur picture block"},
       "median picture block"},
       "Apply gamma 1.8 grey"},
       "4bit quantization"},
       "4bit IGS quantization"},  ( Improved Gray Scale )
       "2bit binaryzation"},
       "2bit bin., above"},
       "2bit bin., below"},
    }

    Other desktop button functions:
    {
     copy to
     paste from
     previous, next, first, last  <- block position.
     shift: up,down,left,right.   <- one pixel at a time
     Clear to background color
     flip x
     flip y
     rotate 90 degrees, works 50%
     rotate integer amount (0-360 degrees)
     Import/Export single graphic block as single graphic file.
     zoom+ (too much looks too big)
     zoom- (down to 0)
     cut sprite block (removes and shifts blocks)
     insert sprite block (adds empty block and shift to make position)
     save all (including mouse button colors)
    }

    The scroll bars are used to scroll through an image.
    Double clicking on the palette pops up a color changer dialog.

    There is NO special sprite standard involved.

    When using the fileselector, if you wish to save as BMP, give an
    extension of BMP and allegro will save using that graphic standard.
    Double click is required to select things inside the fileselector.

    well, that's it, have fun!


KNOWN BUGS / NON-FEATURES

    ...
    This program does not check the memory size before allocation,
    if while using the program you run out of memory, the program may hang.
    This may be the case if you are using a lots of big pictures with little
    memory. It may also happen if the cwsdpmi server is wrongly configured for
    the actual system.
    ...
    Switching the mouse cursor don't work, seems to be a allegro bugg...
    Future releases will use a graphic sprite instead (maybe).
    (FIXED!, works fine now and it's not a allegro bugg, it's my buggy code...)
    ...
    Currently, the upper toolbar button functions does not obey to the
    "all" flag and the "src" and "dst" flags.
    Will be fixed in future releases, since it requires extensive rewrite
    of some functions.
    (FIXED!, those functions that matters obeys to the flags.)
    ...
    Many options must be configured manually through the
    configuration file(s) drax.cfg, *.cfg using a text editor.
    ...
    All files saved are 256 colors only. Cannot save in other bitdepths.
    Will be fixed when the remaining graphic standards used in allegro
    will be moved all to GBM. (100% GBM).
    ...
    All file bit depths loaded are converted to 256 colors from other
    bitdepths, works fine with graphic standards defined in GBM
    but not in allegro. Will be fixed in future when it's 100% GBM.
    ...
    Only gammacorrection of 1.8 is provided although the code can handle
    any gamma value.
    (FIXED now)
    ...
    Only one type of error diffusion is provided, will handle more of them
    later on.
    (three already coded, not updated yet.)
    ...
    This program is 256 colors only. Will step up to 15/16/24 bpp when other
    parts of the program are ready, may take very long time i belive.
    ...
    No text drawing support. I haven't decided for Xwindows fonts yet.
    Current 8x8 font seems too ugly.
    (FIXED! Xwindows fonts works fine in code but not 100% implemented )
    ...
    There is no undo function, lost data is simply lost.
    ...
    split rgb didn't work for the last version (BUG).
    There was a bug in version 1.2 of the function split rgb. it is fixed now.
    ...
    v1.2:
    Sometimes when changing the copying area blocks near zero produced a
    break out to dos.
    It's Fixed now.
    ...

ALREADY ENHANCED SINCE version 1.0

   * ability to load/save GIF.

   * ability to load/save TIFF.

   * extra checkbox "FILL", when checked most drawing functions perform filled.

   * textual information when user moves mouse over buttons, displaying
     a small text describing what kind of button it is.
     (50%)

   * Background map is previous or next sprite block (selectable).

   * Enlarge/Shrink, resize all sprite block sizes.

   * loadable background map. It is a good feature if you plan to make a
     game with moveable figures, so you can edit and take a look at the
     background while editing the foreground graphic.

   * Patterned fill 8x8 pixels.

   * binary graphic filters, NOT, OR, XOR, AND.
     (NAND, NOR - not implemented).

ALREADY ENHANCED SINCE version 1.1

   ... don't remember, it's irrelevant anyway ...

ALREADY ENHANCED SINCE version 1.2

   * Xwindows font support. GRX fonts.
     50% ready.

   * MIDI player on background while editing. With multiple selection of
     files.

   * current 8x8 system font seems too big during mode-x,
     extra "thin" font provided.

   * play, to play frames each x milliseconds or so...
     50% ready.

   * Small single letters tag added to images.
     Some small bugs left to correct...

   * Bigger fonts on larger screens.
     50% ready.

ALREADY ENHANCED SINCE version 1.3

   * gamma selector window.

   * gamma selector dialog object.

   * Map Imported graphic to current palette.

   * Map all graphic to imported palette.

   * Fullscreen graphic viewer (standalone application).
     You can download this from the base.

   * animated gif89a viewer (standalone application, it's ready to dl ).

FUTURE ENHANCEMENTS PLANNED (in random order)

   * ...

   * tooltips for buttons...done!

   * saving options, different for each graphic standard.....difficult.

   * Fullscreen graphic viewer inside the editor......skipped

   * Creating of B/W Rasters. Size, Angle and DPI (dots per inch) selection.

   * RGB <-> CMYK transformation....skipped

   * RGB <-> HSV transformation....skipped

   * MPEG graphic format.....skipped.

   * XPM graphic format, single file.

   * PNG graphic format, single file.....skipped.

   * JPEG graphic format, using IJG's (Independent JPEG Group)  library.
     available at  ftp.uu.net as graphics/jpeg/jpegsrc.v6a.tar.gz (nope, not anymore...)
     .......skipped

   * FLI/B/H/C/T viewer  (standalone application, coded but not 100% clean).

   * Ability to load/save FLI/B/H/C/T.     ! cool ! but not yet

   * Ability to load/save animated GIF89a using the animated features.
     ! cool ! but not yet

   * CD player control window. Play while editing.......skipped

   * free sized patterned fill.

   * script language to write own functions easily.....skipped

   * other binary graphic filters, removal of selectable binary patterns.

   * 3x3 convolution.....skipped

   * luminance/blend effects.

   * loadable Map may be bigger or smaller than block.....skipped

   * More information onscreen and on events.

   * Negative zoom ( zoom backwards ), useful for big pictures.....skipped

   * Document with graphic standard formats used.

   * Extra documents explaining all the source code and the techniques used
     therein.

   * Vectored filters, Filters follows and bend according to vectors.

   * Vector graphic patterns for cut/insert.

   * Import/Export scaled vector graphic.

   * 1/4/15/16/24 bits depth........skipped, only 8.

   * draw text with font selection, international mapping
     and tricks ( shade, italics, reverse italics, outline, patterned fill ).
     Drawing angle, drawing direction, inverse drawing direction, autowrap.
     Maybe even selecting an existing scalable font technology (TTF?).
     Provision for Asian languages. JIS/NJIS/BIG5 etc.
     .....Skipped.

   * Dynamic loading of external button functions....using DXE...Done!
     That is, plug-ins, buttons with its own icons and functionality.
     Feature: Allows programmers to add own functions.
     .....using DXE...Done!  ... todo: Use windows DLL for a windows version.

   * Making the GBM system to dynamic loadable modules.....cool,
     allows programmers to add own graphic standards.

   * Switching from GBM's version of TIFF support to TIFFlib (full 6.0).
     Tifflib by  Sam Leffler (sam@engr.sgi.com)
     Available at  ftp://ftp.sgi.com/graphics/tiff....skipped


CONTACT

           ---
    email: ---
    http://www.geocities.com/SiliconValley/Garage/1780/index.html

DISCLAIMER

    Redistribution and use in source and binary forms are permitted
    provided that source distributions retain this entire copyright
    notice and comment.
    THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
    IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
    USE THIS SOFTWARE AT OWN RISK.

    IN NO EVENT SHALL THE AUTHOR OF THIS SOFTWARE BE LIABLE FOR
    ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
    OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
    WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
    LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
    OF THIS SOFTWARE.

    bla,bla,bla, nag,nag,nag....etc...


