home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / gnu / gchsrc31 / include / screen.h < prev    next >
C/C++ Source or Header  |  1992-04-27  |  3KB  |  112 lines

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. //  This file is part of the Atari Machine Specific Library,
  4. //  and is Copyright 1992 by Warwick W. Allison.
  5. //
  6. //  You are free to copy and modify these sources, provided you acknoledge
  7. //  the origin by retaining this notice, and adhere to the conditions
  8. //  described in the file COPYING.
  9. //
  10. //////////////////////////////////////////////////////////////////////////////
  11.  
  12. #ifndef _Screen_h
  13. #define _Screen_h
  14. //
  15. //  Support for direct Atari screens.
  16. //
  17. //  Screens are memory areas (possibly extending above and below the
  18. //  visible area) with palettes.  Palettes are fairly independent, but
  19. //  are included here, because most picture file formats include the
  20. //  palette in the file.
  21. //
  22. //  One good thing.  Palette is spelt correctly!
  23. //
  24. //  The LoadDegas and SaveDegas routines support TT resolutions as
  25. //  logical extensions (all still have 16 colours, except TTLow which
  26. //  has 256 colours).  LoadCrackArt and SaveCrackArt routines also
  27. //  support TT resolutions logically.
  28. //
  29. //  Note that CrackArt is a compressed format.
  30. //
  31. //  Recommended suffixes:
  32. //
  33. //   CrackArt  Degas  Resolution  Getrez()
  34. //    CA1       PI1    STLow       0
  35. //    CA2       PI2    STMedium    1
  36. //    CA3       PI3    STHigh      2
  37. //    CA8       PI8    TTLow       7
  38. //    CA5       PI5    TTMedium    4
  39. //    CA6       PI6    TTHigh      5
  40. //
  41. //   ie.
  42. //     "CA"+('1'+Resolution)
  43. //     "PI"+('1'+Resolution)
  44. //
  45.  
  46. #include "resolution.h"
  47. #include "osbind.h"
  48.  
  49. #define DESKSCREEN ((char *)0)
  50.  
  51.  
  52. class Screen {
  53. private:
  54.     char *AllocArea;
  55.     long AllocSize;
  56.     char *location;
  57.     Resolution Res;
  58.     short *Palette;
  59.  
  60. public:
  61.     Screen(const Screen&);    // Copy image & Palette
  62.     Screen(Resolution);
  63.     Screen(Resolution, short LinesAbove, short LinesBelow);
  64.     Screen(short LinesAbove, short LinesBelow);
  65.     Screen();        // In current resolution
  66.     Screen(char *At); // DESKSCREEN = current screen, else specify desired location
  67.     ~Screen();
  68.  
  69.     void Clear();
  70.  
  71.     int LoadDegas(const char *);
  72.     int SaveDegas(const char *);
  73.     int LoadDegasPalette(const char *);
  74.     int LoadCrackArtPalette(const char *);
  75.     int LoadCrackArt(const char *);
  76.     int SaveCrackArt(const char *, int Compression=3);
  77.     // Compression 0 = minimal compression attempt
  78.     // Compression 8 = maximal compression attempt
  79.  
  80.     void ShowPalette();
  81.     void Show();    // Physically show
  82.     void Use();        // Logically activate (for VDI/BIOS writes)
  83.  
  84.     short* Colour(); // Returns array of RGB
  85.  
  86.     char *Location();
  87.     Resolution Rez();
  88. };
  89.  
  90. class PaletteChange // Resolution sensitive
  91. {
  92. public:
  93.     PaletteChange();
  94.     ~PaletteChange();
  95.  
  96. private:
  97.     short *col;
  98.     short ncols;
  99. };
  100.  
  101. // Always inline:
  102.  
  103. inline    char* Screen::Location() { return location; }
  104. inline    Resolution Screen::Rez() { return Res; }
  105. inline    void Screen::ShowPalette() { Setpallete(Palette); }
  106. inline    void Screen::Show() { Setscreen(-1,location,-1); }
  107. inline    void Screen::Use() { Setscreen(location,-1,-1); }
  108. inline     short* Screen::Colour() { return Palette; }
  109.  
  110.  
  111. #endif
  112.