home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / gbmv2.zip / gbm.txt < prev    next >
Text File  |  1995-07-31  |  14KB  |  316 lines

  1. Generalised Bitmap Module
  2. =========================
  3.  
  4.  
  5. Supported File Formats
  6. ----------------------
  7.  
  8. Short name : Long name : File extensions
  9.     Comments
  10.  
  11. Bitmap : OS/2 1.1, 1.2, 2.0 / Windows 3.0 bitmap : .BMP .VGA .BGA .RLE .DIB .RL4 .RL8
  12.     Reads any of the above if uncompressed or run-length compressed.
  13.     Will not read CCITT G3 MH Fax compressed files.
  14.     Will not read 24 bit RLE files.
  15.     If input is an OS/2 bitmaparray file then which bitmap can be specified.
  16.         Input options: index=# (default: 0)
  17.     Can be made to write OS/2 1.1 or Windows 3.0 / OS/2 2.0 bitmaps
  18.         Output options: 1.1,win,2.0 (default: 2.0, note win=2.0)
  19.     The handling of 1bpp bitmaps is a little complicated.
  20.     When reading 1bpp bitmaps, the palette is ignored.
  21.     1's are considered foreground, and they are considered black.
  22.     0's are considered background, and they are considered white.
  23.     This agrees with WorkPlace Shell WPFolder background mode, and most PM
  24.     programs, but notably disagrees with Windows PBrush.
  25.     When writing 1bpp bitmaps, the actual 2 colours in the palette are
  26.     ignored, and a fixed palette is written. This is so that the resulting
  27.     bitmap will display black on white when displayed by WPFolder etc..
  28.     Foreground and background colours in palette can be inverted on input.
  29.         Input options: inv
  30.     Foreground and background colours in palette can be inverted on output.
  31.         Output options: inv
  32.     Foreground and background colours in bits can be inverted on input.
  33.         Input options: invb
  34.     Foreground and background colours in bits can be inverted on output.
  35.         Output options: invb
  36.  
  37. GIF : CompuServe Graphics Interchange Format : .GIF
  38.     Reads 1, bit data files.
  39.     Reads 2, 3 and 4 bit data files and presents them as 4 bit.
  40.     Reads 5, 6, 7 and 8 bit data files and presents them as 8 bit.
  41.     Writes 1, 4 and 8 bit data files.
  42.     Reads "GIF87a" and "GIF89a" style files.
  43.     Writes "GIF87a" style files.
  44.     Should correctly handle deferred clear-code in LZW data stream.
  45.     Will not generate output with deferred clear-code.
  46.     ie: should not break older GIF readers.
  47.     Can specify index of image within file on read.
  48.         Input option: index=# (default 0)
  49.     Can specify to return decoded data so far rather than error if corrupt.
  50.         Input option: errok
  51.     Can specify screen size to write in output screen descriptor.
  52.         Output options: xscreen=#,yscreen=# (defaults: image size).
  53.     Can specify background colour index to write in file BMHD header.
  54.         Output option: background=# (default: 0)
  55.     Can specify position information in output image descriptor.
  56.         Output options: xpos=#,ypos=# (defaults: 0,0).
  57.     Extensively test on GIF files from a wide variety of sources.
  58.     Compatibility tested with xloadimage and xv.
  59.  
  60. PCX : ZSoft PC Paintbrush Image format : .PCX
  61.     Reads and writes 1,4,8 and 24 bit colour files.
  62.     Subset of plane/bits-per-plane combinations supported.
  63.     Files are read and written using a run-length coding scheme.
  64.     Tested using Zsoft originated .PCX files.
  65.     Compressed runs of pixels are not supposed to straddle scan lines.
  66.     GBM never does this, but some other applications violate this rule.
  67.     By default, if GBM finds that a run of pixels is longer than the scan
  68.     line, it will use the leftover pixels on the next scan line.
  69.     Some images will not load properly, as they require the loading
  70.     program to discard those pixels in the run that extend beyond the end
  71.     of the scan line. This behaviour can be enabled in GBM.
  72.         Input option: trunc
  73.  
  74. TIFF : Microsoft/Aldus Tagged Image File Format support : .TIF
  75.     Reads and writes 1,4,8 and 24 bit colour files.
  76.     Can almost read all TIFF 6.0 Baseline compliant files.
  77.       Can read uncompressed and Packbits images.
  78.       CCITT Modified huffman compression is the missing peice.
  79.     Can read some files with extensions to Baseline.
  80.       Can read 1bpp greyscale and palettised files.
  81.       Can read Orientation==4 files.
  82.       Can read PlanarConfiguration==2 files for RGB image data.
  83.       Can read LZW compressed files too.
  84.       Can also read CMYK 4 colour seperation files.
  85.       No JPEG or Y-Cb-Cr support.
  86.     Writes files that comply with TIFF 6.0 Baseline.
  87.       Usually writes uncompressed files only.
  88.       Data is written out as a single large strip.
  89.     Can specify image within TIFF file with many images
  90.         Input option: index=# (default: 0)
  91.     Can write 1bpp as non-Baseline file preserving fg/bg cols
  92.         Output option: pal1bpp
  93.     Can ask for LZW compression.
  94.         Output option: lzw
  95.     Can specify informational tags to append on output.
  96.         Output options: artist=,software=,make=,model=,host=,documentname=,pagename=,imagedescription=
  97.  
  98. Targa : Truevision Targa/Vista bitmap : .TGA .VST .AFI
  99.     Reads any uncompressed type as 8 bit or 24 bit.
  100.     Reads both yup and ydown files.
  101.     Writes out as 8 bit or 16,24,32 bit.
  102.         Output options: 16,24,32 (default 24)
  103.     Can be made to write yup and ydown files.
  104.         Output options: ydown,yup (default: yup)
  105.  
  106. ILBM : Amiga IFF / ILBM Interleaved bitmap format : .IFF .LBM
  107.     Reads 1 bit palettised files.
  108.     Reads 2,3 and 4 bit palettised files, returning them as 4 bit.
  109.     Reads 5,6,7 and 8 bit palettised files, returning them as 8 bit.
  110.     Reads HAM6, HAM8, SHAM and Extra-Halfbrite images.
  111.     HAM6, HAM8 and SHAM returned as 24 bit data.
  112.     Writes 1,4 and 8 bit palettised colour files.
  113.     Writes 24 bit files by performing simple conversion to HAM6 first.
  114.     This loses quality but results are still better than 8 bit.
  115.     Understands the RLE compression scheme used.
  116.     Uses BMHD, CMAP, CAMG and BODY sections of file only.
  117.     Only writes BMHD, CMAP, CAMG and BODY sections in output files.
  118.     Can specify position information in file BHMD header.
  119.         Output options: xpos=#,ypos=# (defaults: 0,0).
  120.     Can specify transparent colour to write in file BMHD header.
  121.         Output option: transcol=# (default: 0)
  122.     Can specify aspect ratio to write in file BMHD header.
  123.         Output options: xaspect=#,yaspect=# (defaults: 1,1).
  124.     Can specify screen size to write in output BMHD header.
  125.         Output options: xscreen=#,yscreen=# (defaults: image size).
  126.     Note that when DeluxePaint etc. try to load an 8 bit IFF file, they
  127.     switch to a 32 colour (5 bit mode) and only read the 5 least
  128.     significant planes of the file - this generally looks yukky!
  129.     Tested using DeluxePaint sample bitmaps.
  130.  
  131. YUV12C : YUV12C M-Motion Frame Buffer : .VID
  132.     Reads files and presents data as 24 bit data.
  133.     Writes 24 bit data files by converting them into 12 bit YUV.
  134.     VID files MUST be a multiple of 4 pixels wide.
  135.     When writing a non-multiple of 4, the last 1, 2 or 3 pixels are lost.
  136.     Can specify image origin information in YUV12C header.
  137.         Output options: xpos=#,ypos=# (defaults: 0,0).
  138.     Tested using M-Control Program 2.0, Browser sample application.
  139.  
  140. Greymap : Portable Greyscale-map (binary P5 type) : .PGM
  141.     Credit for file format to Jef Poskancer.
  142.     No palette present in file format.
  143.     Reads 8 bit grey scale files.
  144.     Writes red, green, blue plane or greyscale equivelent of 8 bit image.
  145.         Output options: r,g,b,k (default: k)
  146.  
  147. Pixmap : Portable Pixel-map (binary P6 type) : .PPM
  148.     Credit for file format to Jef Poskancer.
  149.     Reads and writes 24 bit unpalettised RGB data files.
  150.  
  151. KIPS : IBM KIPS : .KPS
  152.     Reads 8 bit palettised files.
  153.     Will look for palette in .PAL file unless .KPL file specified.
  154.         Input options: pal,kpl (default: pal)
  155.     Writes 8 bit palettised files.
  156.     Will write palette in .PAL file unless .KPL file specified.
  157.         Output options: pal,kpl (default: pal)
  158.  
  159. IAX : IBM Image Access eXecutive : .IAX
  160.     Reads array as 8 bit greyscale.
  161.     File format does not hold image dimensions.
  162.     Hence code assumes width is 512 pixels unless overridden.
  163.         Input options: width=# (default: 512)
  164.     File format does not include palette.
  165.     Writes red, green, blue plane or greyscale equivelent of 8 bit image.
  166.         Output options: r,g,b,k (default: k)
  167.  
  168. XBitmap : X Windows bitmap : .XBM
  169.     Reads 1bpp X bitmaps, presenting 1's as black, 0's as white.
  170.     Writes 1bpp X bitmaps, darkest colours as 1's, brightest colour as 0's.
  171.     Tested upon some sample .XBM files.
  172.  
  173. Sprite : Archimedes Sprite format from RiscOS : .SPR .SPRITE
  174.     Technically sprite files have no extension, but GBM recognises .SPR.
  175.     Reads 1,4 and 8 bit sprites.
  176.     'First bit' value in header must be a multiple of 8 (v.likely).
  177.     Will only read image plane, will ignore any mask plane.
  178.     Will handle case when no palette present in file.
  179.     Will default to the default Wimp palette in this case.
  180.     If input contains more than one sprite then which can be specified.
  181.         Input options: index=# (default: 0)
  182.     Will output 1,4 and 8 bit files.
  183.     Will write a palette in the file.
  184.     Will only write an image plane, ie: no mask plane.
  185.     Will write a 16 entry palette for 8 bit data (not 64 entry).
  186.     Will map to wierd archmedes palette when writing 8 bit data.
  187.     Tested reading 4bpp sprites with no palette.
  188.     Tested reading 8bpp sprites with no palette and with 64 entry palette.
  189.     Sprites generated by GBM have been loaded on RiscOS.
  190.     Remember: Use SetType to change type of file from PC-file to Sprite,
  191.     by SetType option of filer menu or "*SetType <filename> Sprite".
  192.  
  193. PSEG : IBM Printer Page Segment : .PSE .PSEG .PSEG38PP .PSEG3820
  194.     This is a file format used by IBM document/printing systems.
  195.     It is used to represent a bi-level image to be used in a document.
  196.     Reads data and presents a 1bpp bitmap.
  197.     Image is presented 1's as black on 0's as white background.
  198.     PSEG files should be downloaded from a VM host in binary mode.
  199.     Some PSEG files have a corrupt record structure.
  200.     This doesn't cause a problem on VM but can confuse a non-VM reader.
  201.     GBM can be made to attempt to handle these files.
  202.         Input option: fixrec
  203.     Will output 1bpp file.
  204.     Can specify 2x scale factor.
  205.         Output option: double
  206.     Palette in 1bpp data is lost when written to file.
  207.     The resulting non-VM file has no record structure.
  208.     So when it is uploaded it must be fixed using FIXL3820 EXEC or similar.
  209.     Image width is rounded up to next multiple of 8 when written.
  210.  
  211.  
  212. Colour spaces
  213. -------------
  214.  
  215. If a light is physically twice as bright, the eye does not necessarily see it
  216. as twice as bright. Also, if a pixel is written onto a monitor screen with
  217. twice the value, the physical intensity of the pixel is not necessarily double.
  218.  
  219. How exactly should numbers inside a bitmap file relate to physical or
  220. perceived intensitys when displayed on the screen?
  221.  
  222. In OS/2 PM perceived intensitys are proportional to the values in the bitmap
  223. file. Pixels in such a bitmap are in the 'L* cyclometric' colour space.
  224.  
  225. Ray Tracers often write pixel values in the bitmap proportional to the physical
  226. intensity computed for that ray. Such data is in the 'intensity' colour space.
  227.  
  228. Finally, if a bitmap holds values computed in such a way as to compensate for
  229. the gamma of the monitor (ie: intensitys transformed to cancel out the gamma
  230. of the monitor), then the data is in a 'gamma corrected' colour space.
  231.  
  232. So, if you have some Ray Tracer output, and you wish to display on an 8514
  233. monitor WITHOUT using OS/2 PM, then to get a decent colour rendition, you must
  234. map the bitmap from the 'intensity' to a 'gamma corrected' colour space.
  235. To do this you must know the gamma of the 8514 monitor (which is about 2.1).
  236.  
  237. Also, if you have some Ray Tracer output, and you wish to display on OS/2 PM,
  238. then to get a decent rendition you must map the bitmap from the 'intensity' to
  239. the 'L* cyclometric' colour space.
  240.  
  241. GBMGAMMA is a colour mapping program capable of performing mappings between
  242. any 2 of the 3 colour spaces above.
  243.  
  244. Mapping of this sort should really be done on 24 bit data, before
  245. error-diffusion or halftoning takes place.
  246.  
  247.  
  248. Public domain declaration
  249. -------------------------
  250.  
  251. I wrote all this code in my own time on my own equiptment.
  252. I used public non-confidential information to do so.
  253. I hereby place all this code into the public domain.
  254. Feel free to do whatever you like with it.
  255. No copyright / no royalties / no guarantees / no problem.
  256. Caveat Emptor!
  257.  
  258.  
  259. Obtaining this code
  260. -------------------
  261.  
  262. Internet: ftp.cdrom.com:    /pub/os2/2_x/graphics/gbm.zip
  263.           ftp.cdrom.com:    /pub/os2/2_x/graphics/gbmsrc.zip
  264.           ftp-os2.nmsu.edu: /pub/os2/2_x/graphics/gbm.zip
  265.           ftp-os2.nmsu.edu: /pub/os2/2_x/graphics/gbmsrc.zip
  266. IBM-VNET: REQUEST GBM    FROM AKEY AT HVTVM5
  267.           REQUEST GBMSRC FROM AKEY AT HVTVM5
  268. An earlier release was included on the IBM OS/2 Developer Connection CD-ROM 2.
  269. Also, hopefully on the next Hobbes OS/2 Shareware CD-ROM.
  270.  
  271.  
  272. Change Log
  273. ----------
  274.  
  275. 11/5/92        Initial general release.
  276.  
  277. Various dates    Fixed assorted bugs in various parts of GBM.
  278.         Dropped support for 16 bit systems.
  279.         Changed all code to now be compiled multithreaded.
  280.         Changed GBM library to a DLL under OS/2, saved at least 500Kb.
  281.         /NOI now required when linking with GBM.LIB.
  282.         Added textual error messages.
  283.         Accelerated halftoning and error-diffusion.
  284.         Added GIF, X Bitmap and RiscOS Sprite support.
  285.         Extensively improved TIFF file support (now almost Baseline).
  286.         Extensively improved IFF support (HAM6, HAM8 etc.).
  287.         GBM structure enlarged => PLEASE RECOMPILE
  288.         Addition of bitmap transpose (and hence rotate) capability.
  289.         Added GBMV2, the flagship OS/2+PM program to show off GBM.
  290.  
  291. 28/9/93        Handling of 1bpp data has changed - now honors colours.
  292.         Windows / (OS/2 2.0 subset) not OS/2 1.1 bitmaps now default.
  293.         Improved error checking some file readers.
  294.         Addition of -s and -g options to GBMHDR.
  295.  
  296. 11/11/93    Added F3 to close GBMV and GBMV2.
  297.         Fixed keyboard scrolling in GBMV2.
  298.         Added general (single level) Undo capability to GBMV2.
  299.         Added GBMWPOBJ.CMD to set up Workplace Shell Objects.
  300.  
  301. 29/11/93    Sanitised documentation
  302.         Copy supplied to IBM OS/2 Developer Connection.
  303.  
  304. 2/6/94        Removed max number of strips limitation in TIFF reader.
  305.         Added TIFF LZW encode option (alpha-level code).
  306.         Added percentage on gbmhdr listing.
  307.  
  308. 1/4/94        Bugfix for speckley IFF file writing.
  309.         Bugfix for map to black and white.
  310.         Added support for PSEGs
  311.  
  312. {{{ Andy Key
  313.  
  314. Internet: ak@vnet.ibm.com    # Currently working at IBM until september 94
  315. IBM-VNET: AKEY AT HVTVM5    # so addresses valid at least until then.
  316.