home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-09-29 | 2.3 KB | 102 lines | [TEXT/KAHL] |
- #include <stdlib.h>
-
- #include <Windows.h>
- #include <QDOffscreen.h>
-
- #include <Fonts.h>
- #include <Packages.h>
- #include <SegLoad.h>
- #include <ToolUtils.h>
- #include <TextEdit.h>
-
- #include "general.h"
- #include "port.h"
-
- const port *port::currentport = 0;
-
- port::~port()
- {
- if( currentport == this)
- {
- //
- // about to delete the current port. To be safe,
- // set the current port to something else.
- //
- SetPort( qd.thePort);
- currentport = 0;
- }
- }
-
- void port::use() const
- {
- if( currentport != this)
- {
- currentport = this;
- SetGWorld( myGWorldPtr, myGDHandle);
- CheckForError( QDError(), "SetGWorld");
- }
- }
-
- void port::copyfrom( const port &source, const Rect &origRect,
- const Rect &destRect, const short mode, const RgnHandle maskRgn) const
- {
- use();
- CopyBits( (BitMapPtr)(source.myPix), (BitMapPtr)myPix,
- &origRect, &destRect, mode, maskRgn);
- }
-
- void port::copyfrom( const port &source, const Rect &origRect,
- const short mode, const RgnHandle maskRgn) const
- {
- use();
- CopyBits( (BitMapPtr)(source.myPix), (BitMapPtr)myPix,
- &origRect, &myRect, mode, maskRgn);
- }
-
- void port::copyfrom( const port &source, const port &mask,
- const short mode, const RgnHandle maskRgn) const
- {
- use();
- CopyDeepMask( (BitMapPtr)(source.myPix), (BitMapPtr)(mask.myPix), (BitMapPtr)myPix,
- &source.myRect, &mask.myRect, &myRect, mode, maskRgn);
- }
-
- void port::copyfrom( const port &source, const port &mask, const Rect &origRect,
- const Rect &maskRect, const Rect &destRect,
- const short mode, const RgnHandle maskRgn) const
- {
- use();
- CopyDeepMask( (BitMapPtr)(source.myPix), (BitMapPtr)(mask.myPix), (BitMapPtr)myPix,
- &origRect, &maskRect, &destRect, mode, maskRgn);
- }
-
- void port::scroll( short dh, short dv) const
- {
- use();
- RgnHandle updateRgn = NewRgn();
- ScrollRect( &myGWorldPtr->portRect, dh, dv, updateRgn);
- DisposeRgn( updateRgn);
- }
-
- PicHandle port::getPICT() const
- {
- use();
- PicHandle thePICT = OpenPicture( &myGWorldPtr->portRect);
- CopyBits( (BitMapPtr)myPix, (BitMapPtr)myPix, &myRect, &myRect, srcCopy + ditherCopy, 0L);
- ClosePicture();
- return thePICT;
- }
-
- void port::SetColorTable( short resID) const
- {
- CTabHandle theColorTable = GetCTable( resID);
- SetColorTable( theColorTable);
- }
-
- void port::SetColorTable( CTabHandle theColorTable) const
- {
- DisposeCTable( myPix->pmTable);
- myPix->pmTable = theColorTable;
- GDeviceChanged( myGDHandle);
- }
-