home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 5.3 KB | 191 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWInk.cpp
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "FWOS.hpp"
-
- #ifndef FWINK_H
- #include "FWInk.h"
- #endif
-
- #ifndef FWSTRMRW_H
- #include "FWStrmRW.h"
- #endif
-
- #ifdef FW_BUILD_MAC
- #pragma segment FWGraphics_Ink
- #endif
-
- //========================================================================================
- // Template instantiation
- //========================================================================================
-
- #include "FWGrRef.tpp"
-
- FW_DEFINE_AUTO_TEMPLATE(FW_TGrRefPtr, FW_HInk)
-
- #ifdef FW_USE_TEMPLATE_PRAGMAS
-
- #pragma template_access public
- #pragma template FW_TGrRefPtr<FW_HInk>
-
- #else
-
- template class FW_TGrRefPtr<FW_HInk>;
-
- #endif
-
- //========================================================================================
- // class FW_CInk
- //========================================================================================
-
- FW_DEFINE_AUTO(FW_CInk)
-
- //----------------------------------------------------------------------------------------
- // FW_PrivAcquireGrRep
- //----------------------------------------------------------------------------------------
-
- void FW_PrivAcquireGrRep(FW_HInk rep)
- {
- if (rep != 0)
- FW_PrivInk_Acquire(rep);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_PrivReleaseGrRep
- //----------------------------------------------------------------------------------------
-
- void FW_PrivReleaseGrRep(FW_HInk rep)
- {
- if (rep != 0)
- FW_PrivInk_Release(rep);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CInk::FW_CInk
- //----------------------------------------------------------------------------------------
-
- FW_CInk::FW_CInk(const FW_SColor& foreColor, const FW_SColor& backColor, FW_TransferModes transferMode)
- {
- FW_PlatformError error;
- FW_HInk rep = FW_PrivInk_Create(foreColor, backColor, transferMode, &error);
- FW_FailOnError(error);
- SetRep(rep);
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CInk::FW_CInk
- //----------------------------------------------------------------------------------------
-
- FW_CInk::FW_CInk(FW_TransferModes transferMode)
- {
- FW_PlatformError error;
- FW_HInk rep = FW_PrivInk_Create(FW_kRGBBlack, FW_kRGBWhite, transferMode, &error);
- FW_FailOnError(error);
- SetRep(rep);
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CInk::FW_CInk
- //----------------------------------------------------------------------------------------
-
- FW_CInk::FW_CInk(const FW_CInk& other) :
- FW_TGrRefPtr<FW_HInk>(other)
- {
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CInk::FW_CInk
- //----------------------------------------------------------------------------------------
-
-
- FW_CInk::FW_CInk(FW_EStandardInks std)
- {
- FW_PlatformError error;
- FW_HInk rep = FW_PrivInk_CreateStandard(std, &error);
- FW_FailOnError(error);
- SetRep(rep);
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CInk::FW_CInk
- //----------------------------------------------------------------------------------------
-
- FW_CInk::~FW_CInk()
- {
- FW_START_DESTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CInk::operator=
- //----------------------------------------------------------------------------------------
-
- FW_CInk& FW_CInk::operator=(const FW_CInk& other)
- {
- FW_TGrRefPtr<FW_HInk>::operator=(other);
- return *this;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CInk::operator=
- //----------------------------------------------------------------------------------------
-
- FW_CInk& FW_CInk::operator=(FW_EStandardInks std)
- {
- FW_PlatformError error;
- FW_HInk rep = FW_PrivInk_CreateStandard(std, &error);
- FW_FailOnError(error);
- SetRep(rep);
- return *this;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CInk::Copy
- //----------------------------------------------------------------------------------------
-
- FW_CInk FW_CInk::Copy() const
- {
- FW_PlatformError error;
- FW_HInk rep = FW_PrivInk_Copy(fRep, &error);
- FW_FailOnError(error);
-
- FW_CInk ink;
- ink.SetRep(rep);
- return ink;
- }
-
- //----------------------------------------------------------------------------------------
- // operator <<
- //----------------------------------------------------------------------------------------
-
- FW_CWritableStream& operator << (FW_CWritableStream& stream, const FW_CInk& ink)
- {
- FW_PlatformError error;
- FW_PrivInk_Write(ink.fRep, stream, &error);
- FW_FailOnError(error);
- return stream;
- }
-
- //----------------------------------------------------------------------------------------
- // operator >>
- //----------------------------------------------------------------------------------------
-
- FW_CReadableStream& operator >> (FW_CReadableStream& stream, FW_CInk& ink)
- {
- FW_PlatformError error;
- FW_HInk rep = FW_PrivInk_Read(stream, &error);
- FW_FailOnError(error);
- ink.SetRep(rep);
- return stream;
- }
-
-