home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-10-21 | 1.6 KB | 58 lines | [TEXT/CWIE] |
- // ImageCopier.h, use the declared copying objects (CopyGrafs, DynamicCopy, and
- // CopyBuffers) in your code to copy images instead of using CopyBits. Each
- // operator() guarantees to set the port and the addressing mode back to their
- // previous states when the function returns. Use CopyGrafs as you would CopyBits,
- // i.e. the port must be set to the destination first.
-
- // copyright © 1995, Macneil Shonle. All rights reserved.
-
- #ifndef __IMAGECOPIER__
- #define __IMAGECOPIER__
-
- #ifndef __BUFFERACCESSOR__
- #include <BufferAccessor.h>
- #endif
-
- #include <exception>
-
- // class ImageCopier
- class ImageCopier {
- public:
- virtual void operator()(const Rect& srcR, const Rect& dstR) throw(invalidargument) const = 0;
- };
-
- // class CGrafPortCopier
- class CGrafPortCopier : public ImageCopier {
- public:
- CGrafPortCopier();
- CGrafPortCopier(CGrafPtr srcPort, CGrafPtr dstPort);
-
- void operator()(const Rect& srcR, const Rect& dstR) throw(invalidargument) const;
- void operator()(CGrafPtr src, CGrafPtr dest, const Rect& srcR, const Rect& destR);
- void use(CGrafPtr srcPort, CGrafPtr dstPort);
-
- private:
- CGrafPtr source;
- CGrafPtr dest;
- };
-
- // class DirectCopier
- class BufferCopier : public ImageCopier {
- public:
- BufferCopier();
- BufferCopier(BufferAccessor& srcBuff, BufferAccessor& destBuff);
-
- void operator()(const Rect& srcR, const Rect& dstR) throw(invalidargument) const;
- void operator()(BufferAccessor& src, BufferAccessor& dest,
- const Rect& srcR, const Rect& destR);
- void use(BufferAccessor& srcPort, BufferAccessor& dstPort);
-
- private:
- BufferAccessor *source;
- BufferAccessor *dest;
- };
-
- extern CGrafPortCopier CopyGrafs;
- extern BufferCopier CopyBuffers;
-
- #endif