home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / snip9707.zip / VIOIMAGE.C < prev    next >
C/C++ Source or Header  |  1997-07-05  |  1KB  |  75 lines

  1. /* +++Date last modified: 05-Jul-1997 */
  2.  
  3. /*
  4.  *  VIOIMAGE.C; VidMgr routines for saving and restoring text images.
  5.  *              Release 1.2.
  6.  *
  7.  *  This module written in May 1996 by Andrew Clarke and released to the
  8.  *  public domain.
  9.  */
  10.  
  11. #include <stdlib.h>
  12. #include "vidmgr.h"
  13. #include "vioimage.h"
  14.  
  15. void vioImageDefaults(VIOIMAGE * v)
  16. {
  17.     v->width = 0;
  18.     v->height = 0;
  19.     v->image = NULL;
  20. }
  21.  
  22. int vioImageInit(VIOIMAGE * v, char width, char height)
  23. {
  24.     v->image = malloc(width * height * 2);
  25.     if (v->image)
  26.     {
  27.         v->width = width;
  28.         v->height = height;
  29.         return 1;
  30.     }
  31.     else
  32.     {
  33.         return 0;
  34.     }
  35. }
  36.  
  37. int vioImageTerm(VIOIMAGE * v)
  38. {
  39.     if (v->image)
  40.     {
  41.         free(v->image);
  42.         return 1;
  43.     }
  44.     else
  45.     {
  46.         return 0;
  47.     }
  48. }
  49.  
  50. int vioImageSave(VIOIMAGE * v, char x, char y)
  51. {
  52.     if (v->image)
  53.     {
  54.         vm_gettext(x, y, v->width, v->height, v->image);
  55.         return 1;
  56.     }
  57.     else
  58.     {
  59.         return 0;
  60.     }
  61. }
  62.  
  63. int vioImageRestore(VIOIMAGE * v, char x, char y)
  64. {
  65.     if (v->image)
  66.     {
  67.         vm_puttext(x, y, v->width, v->height, v->image);
  68.         return 1;
  69.     }
  70.     else
  71.     {
  72.         return 0;
  73.     }
  74. }
  75.