home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-21 | 6.4 KB | 226 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWInk.cpp
- // Release Version: $ 1.0d1 $
- //
- // Creation Date: 3/28/94
- //
- // Copyright: © 1993, 1994 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWINK_H
- #include "FWInk.h"
- #endif
-
- #ifndef FWGCONST_H
- #include "FWGConst.h"
- #endif
-
- #ifndef FWGC_H
- #include "FWGC.h"
- #endif
-
- // ----- Macintosh Includes -----
-
- #if defined(FW_BUILD_MAC) && !defined(__QUICKDRAW__)
- #include <Quickdraw.h>
- #endif
-
- //==============================================================================
- // •• RunTime Info
- //==============================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment fwgraphx
- #endif
-
- //==============================================================================
- // •• class FW_CInk
- //==============================================================================
-
- //------------------------------------------------------------------------------
- // FW_CInk::FW_CInk
- //------------------------------------------------------------------------------
-
- FW_CInk::FW_CInk() :
- FW_CGraphicObjectPtr()
- {
- }
-
- //------------------------------------------------------------------------------
- // FW_CInk::FW_CInk
- //------------------------------------------------------------------------------
-
- FW_CInk::FW_CInk(const FW_CColor& foreColor, const FW_CColor& backColor, FW_TransferMode tranferMode) :
- FW_CGraphicObjectPtr()
- {
- SetRep(new FW_CInkRep(foreColor, backColor, tranferMode));
- }
-
- //------------------------------------------------------------------------------
- // FW_CInk::FW_CInk
- //------------------------------------------------------------------------------
-
- FW_CInk::FW_CInk(const FW_CInk& other) :
- FW_CGraphicObjectPtr(other)
- {
- }
-
- //------------------------------------------------------------------------------
- // FW_CInk::FW_CInk
- //------------------------------------------------------------------------------
-
- FW_CInk::FW_CInk(FW_CInkRep* rep) :
- FW_CGraphicObjectPtr(rep)
- {
- }
-
- //------------------------------------------------------------------------------
- // FW_CInk::operator=
- //------------------------------------------------------------------------------
-
- FW_CInk& FW_CInk::operator=(const FW_CInk& other)
- {
- SetRep(other.GetRep());
- return *this;
- }
-
- //------------------------------------------------------------------------------
- // FW_CInk::operator=
- //------------------------------------------------------------------------------
-
- FW_CInk& FW_CInk::operator=(FW_CInkRep* other)
- {
- SetRep(other);
- return *this;
- }
-
- //==============================================================================
- // •• class FW_CInkRep
- //==============================================================================
-
- //------------------------------------------------------------------------------
- // • FW_CInkRep::FW_CInkRep
- //------------------------------------------------------------------------------
-
- FW_CInkRep::FW_CInkRep():
- fForeColor(FW_kRGBBlack),
- fBackColor(FW_kRGBWhite),
- fTransferMode(FW_kCopy)
- {
- }
-
- //------------------------------------------------------------------------------
- // • FW_CInkRep::FW_CInkRep
- //------------------------------------------------------------------------------
-
- FW_CInkRep::FW_CInkRep(const FW_CInk& ink)
- {
- ink->GetForeColor(&fForeColor);
- ink->GetBackColor(&fBackColor);
- fTransferMode = ink->GetTransferMode();
- }
-
- //------------------------------------------------------------------------------
- // • FW_CInkRep::FW_CInkRep
- //------------------------------------------------------------------------------
-
- FW_CInkRep::FW_CInkRep(const FW_CColor& foreColor, const FW_CColor& backColor, FW_TransferMode transferMode):
- fForeColor(foreColor),
- fBackColor(backColor),
- fTransferMode(transferMode)
- {
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CInkRep::~FW_CInkRep
- //----------------------------------------------------------------------------------------
-
- FW_CInkRep::~FW_CInkRep()
- {
- }
-
- //------------------------------------------------------------------------------
- // • FW_CInkRep::SetForeColor
- //------------------------------------------------------------------------------
-
- void FW_CInkRep::SetForeColor(const FW_CColor& foreColor)
- {
- fForeColor = foreColor;
- Changed();
- }
-
- //------------------------------------------------------------------------------
- // • FW_CInkRep::SetBackColor
- //------------------------------------------------------------------------------
-
- void FW_CInkRep::SetBackColor(const FW_CColor& backColor)
- {
- fBackColor = backColor;
- Changed();
- }
-
- //------------------------------------------------------------------------------
- // • FW_CInkRep::SetTransferMode
- //------------------------------------------------------------------------------
-
- void FW_CInkRep::SetTransferMode(FW_TransferMode transferMode)
- {
- fTransferMode = transferMode;
- Changed();
- }
-
- //------------------------------------------------------------------------------
- // • FW_CInkRep::SelectInGC
- //------------------------------------------------------------------------------
-
- void FW_CInkRep::SelectInGC(FW_CGraphicContext* gc, FW_ShapeCategory shapeCategory)
- {
- FW_UNUSED(gc);
-
- #ifdef FW_BUILD_MAC
- ::RGBForeColor(&fForeColor);
- ::RGBBackColor(&fBackColor);
-
- if (shapeCategory == FW_kGeometricShape)
- ::PenMode(fTransferMode);
- else if (shapeCategory == FW_kTypographicShape)
- ::TextMode(fTransferMode);
- #endif
-
- }
-
- //----------------------------------------------------------------------------------------
- // • FW_CInkRep::Copy
- //----------------------------------------------------------------------------------------
-
- FW_CInk FW_CInkRep::Copy() const
- {
- FW_CInk ink(fForeColor, fBackColor, fTransferMode);
- return ink;
- }
-
- //----------------------------------------------------------------------------------------
- // • FW_CInkRep::Flatten
- //----------------------------------------------------------------------------------------
-
- void FW_CInkRep::Flatten(FW_CWritableStream& stream)
- {
- fForeColor.Flatten(stream);
- fBackColor.Flatten(stream);
- stream << fTransferMode;
- }
-
- //----------------------------------------------------------------------------------------
- // • FW_CInkRep::Unflatten
- //----------------------------------------------------------------------------------------
-
- void FW_CInkRep::Unflatten(FW_CReadableStream& stream)
- {
- fForeColor.Unflatten(stream);
- fBackColor.Unflatten(stream);
- stream >> fTransferMode;
- }
-
-