home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_progs / prog_c / suplib.lzh / SUPLIB / DOC / BITMAP.DOC < prev    next >
Text File  |  1991-08-16  |  4KB  |  107 lines

  1.  
  2.                 BITMAP.DOC
  3.             (SUP32.LIB and DRES.LIBRARY)
  4.  
  5. MakeBitMap                               MakeBitMap
  6.  
  7.     BOOL MakeBitMap(bm, depth, width, height, memflags)
  8.     BM *bm;        D0     D1.B    D2.W   D3.W    A0
  9.     char  depth;
  10.     short width;
  11.     short height;
  12.     ulong memflags;    /*  used to allocate the planes */
  13.  
  14.     Warning:  If called from C you must pass all arguments as longs.
  15.  
  16.     This call fills in the uninitialized BitMap structure by first
  17.     calling InitBitMap() and then allocating <depth> planes of
  18.     <width>x<height> each (the width is increased to the nearest word
  19.     boundry, modulo 16 bits).
  20.  
  21.     The bitmap's planes are allocated using the memflags specified.
  22.     Normally one specifies:  MEMF_CHIP|MEMF_PUBLIC|MEMF_CLEAR.    You
  23.     must specify MEMF_CHIP if you wish to use graphics.library calls
  24.     on the bitmap or attach the bitmap to a rastport or use it in a
  25.     NewScreen or NewWindow structure.
  26.  
  27.     RESULTS:    0 on failure, 1 on success.  This call will failure if
  28.     insufficient memory exists to allocate all the planeptr's.  In the
  29.     case of failure, any planeptr's already allocated will be freed and
  30.     their corrosponding array entries set to NULL.
  31.  
  32.  
  33. FreeBitMap                               FreeBitMap
  34.  
  35.     (void) FreeBitMap(bm)
  36.     BM *bm;          D0
  37.  
  38.     This call frees the memory associated with the PlanePtr[]s of a bitmap.
  39.     The PlanePtr[]s are freed and their array entries set to NULL.  Any
  40.     PlanePtr[]s that were already NULL are ignored.  PlanePtr[] entries are
  41.     scanned up to the bm->Depth and not beyond.
  42.  
  43.  
  44.  
  45. MakeRastPortBitMap                       MakeRastPortBitMap
  46.  
  47.     BOOL MakeRastPortBitMap(rp, bm, depth, width, height, tmprassize, numai)
  48.                 D0    D1   D2     D3       D4         D5     A0
  49.  
  50.     RP *rp;        pointer to UnInitialized RastPort structure
  51.     BM *bm;        pointer to UnInitialized BitMap structure
  52.     long depth;     depth of bitmap
  53.     long width;     width in pixels (rounded to nearest word)
  54.     long height;    height in pixels
  55.     long tmprassize;    # bytes to allocate for rastport temporary raster
  56.     long numai;     number of vectors for area info.
  57.  
  58.     This call simply calls MakeBitMap() and if successful MakeRastPort().
  59.     If MakeRastPort() fails FreeBitMap() will be called before returning.
  60.     Thus, this is an all-or-nothing call.  Note that you provide the
  61.     RastPort and BitMap structures.
  62.  
  63.     The bitmap will be filled in according to specifications from CHIP_MEM.
  64.     The rastport will be filled in according to specifications and setup
  65.     with a temporary raster:
  66.  
  67.     tmprassize == -1    Allocate a TmpRas structure and temporary
  68.                 raster the size of one plane of the bitmap.
  69.               0     Do not allocate a TmpRas structure or raster
  70.               N     Allocate a TmpRas structure and temporary
  71.                 raster of size N bytes
  72.  
  73.     numai       == 0     Do not allocate an AreaInfo structure or vectors
  74.               N     Allocate an AreaInfo and buffer space for N
  75.                 vectors (5 bytes per vector).
  76.  
  77.     RESULTS:    0 on failure, 1 on success.  If successful the rastport
  78.         and bitmap will have been allocated and initialized with
  79.         the bitmap attached to the rastport.  Beyond the defaults
  80.         for InitRastPort(), the APen will be set to 1 and the
  81.         DrMd to JAM2.
  82.  
  83.         This is an all or nothing function.  On failure, anything
  84.         already allocated is freed and their pointers set to NULL.
  85.  
  86.  
  87. FreeRastPortBitMap                      FreeRastPortBitMap
  88.  
  89.     (void) FreeRastPortBitMap(rp)
  90.     RP *rp;              D0
  91.  
  92.     This call frees the memory associated with the rastport and its
  93.     bitmap (if any).  This call is a NOP if rp == NULL.
  94.  
  95.     If a TmpRas exists the memory associated with the raster and the TmpRas
  96.     structure is freed.  If an AreaInfo exists the memory associated with
  97.     the vector table and the AreaInfo structure is freed.  TmpRas and
  98.     AreaInfo are set to NULL. If a BitMap exists the memory associated with
  99.     the BitMap's PlanePtr[]s is freed. PlanePtr[] entries are set to NULL.
  100.  
  101.     The BitMap and RastPort structures themselves are not freed.
  102.  
  103.     This call is equivalent to calling FreeRastPort() and then FreeBitMap().
  104.  
  105.  
  106.  
  107.