home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / Blitting Class Library / Image Copier / ImageCopier.h < prev   
Encoding:
Text File  |  1995-10-21  |  1.6 KB  |  58 lines  |  [TEXT/CWIE]

  1. // ImageCopier.h, use the declared copying objects (CopyGrafs, DynamicCopy, and
  2. //    CopyBuffers) in your code to copy images instead of using CopyBits. Each
  3. //    operator() guarantees to set the port and the addressing mode back to their
  4. //    previous states when the function returns. Use CopyGrafs as you would CopyBits,
  5. //    i.e. the port must be set to the destination first.
  6.  
  7. // copyright © 1995, Macneil Shonle. All rights reserved.
  8.  
  9. #ifndef __IMAGECOPIER__
  10. #define __IMAGECOPIER__
  11.  
  12. #ifndef __BUFFERACCESSOR__
  13. #include <BufferAccessor.h>
  14. #endif
  15.  
  16. #include <exception>
  17.  
  18.         // class ImageCopier
  19. class ImageCopier {
  20. public:
  21.     virtual void operator()(const Rect& srcR, const Rect& dstR) throw(invalidargument) const = 0;
  22. };
  23.  
  24.         // class CGrafPortCopier
  25. class CGrafPortCopier : public ImageCopier {
  26. public:
  27.     CGrafPortCopier();
  28.     CGrafPortCopier(CGrafPtr srcPort, CGrafPtr dstPort);
  29.     
  30.     void operator()(const Rect& srcR, const Rect& dstR) throw(invalidargument) const;
  31.     void operator()(CGrafPtr src, CGrafPtr dest, const Rect& srcR, const Rect& destR);
  32.     void use(CGrafPtr srcPort, CGrafPtr dstPort);
  33.  
  34. private:
  35.     CGrafPtr source;
  36.     CGrafPtr dest;
  37. };
  38.  
  39.         // class DirectCopier
  40. class BufferCopier : public ImageCopier {
  41. public:
  42.     BufferCopier();
  43.     BufferCopier(BufferAccessor& srcBuff, BufferAccessor& destBuff);
  44.     
  45.     void operator()(const Rect& srcR, const Rect& dstR) throw(invalidargument) const;
  46.     void operator()(BufferAccessor& src, BufferAccessor& dest,
  47.         const Rect& srcR, const Rect& destR);
  48.     void use(BufferAccessor& srcPort, BufferAccessor& dstPort);
  49.  
  50. private:
  51.     BufferAccessor *source;
  52.     BufferAccessor *dest;
  53. };
  54.  
  55. extern CGrafPortCopier CopyGrafs;
  56. extern BufferCopier CopyBuffers;
  57.  
  58. #endif