DDPalette.h
资源名称:DXGuide.zip [点击查看]
上传用户:wymy58
上传日期:2007-01-07
资源大小:2086k
文件大小:2k
源码类别:
DirextX编程
开发平台:
Visual C++
- // Copyright (C) 1998-1999 DXGuide. All Rights Reserved.
- // File: DDPalette.h
- #ifndef _DDPALETTE__H
- #define _DDPALETTE__H
- #if _MSC_VER >= 1000
- #pragma once
- #endif // _MSC_VER >= 1000
- #include "DDSurface.h"
- class CPackFileManager;
- class CDDPalette
- {
- friend class CDDSurface;
- public:
- CDDPalette(void);
- virtual ~CDDPalette();
- public:
- bool Create(CDDDevice* pDDDevice, CPalette* pPalette);
- // Initialize the palette from an array of palette entries.
- bool Create(CDDDevice* pDDDevice, DWORD dwCount,
- LPPALETTEENTRY lpEntries, bool bAlpha = false);
- // Initialize the palette from a bitmap (resource or file).
- bool Create(CDDDevice* pDDDevice, LPCTSTR pszBitmap,
- CPackFileManager* pPackFileManager = NULL);
- protected:
- // Create the underlying interface
- bool Create(void);
- public:
- //The palette interface:
- HRESULT GetCaps(DWORD& caps) const;
- HRESULT GetEntries(DWORD dwBase, DWORD dwEntries,
- LPPALETTEENTRY lpEntries) const;
- HRESULT SetEntries(DWORD dwStartingEntry,
- DWORD dwCount, LPPALETTEENTRY lpEntries);
- HRESULT SetEntry(int nIndex, BYTE byteR,
- BYTE byteG, BYTE byteB);
- HRESULT GetEntry(int nIndex, BYTE& byteR,
- BYTE& byteG, BYTE& byteB);
- HRESULT FillPalette(BYTE byteR, BYTE byteG, BYTE byteB);
- HRESULT GreyScale(void);
- HRESULT SpectrumRGBPalette(float fS, float fV, int nSpectLen = 0);
- public:
- void FadeIn(int nDelay, LPPALETTEENTRY lpPE);
- void FadeOut(int nDelay);
- void FadeTo(BYTE byteR, BYTE byteG, BYTE byteB, int nDelay);
- #ifdef _DEBUG
- void Dump(void);
- #endif // _DEBUG
- protected:
- LPDIRECTDRAWPALETTE m_lpDDPalette;
- // Pointer to the default palette entries.
- PALETTEENTRY* m_pDefaultEntries;
- // The number of entries.
- int m_nEntries;
- bool m_bAlpha;
- CDDDevice* m_pDDDevice;
- public:
- #ifdef _DEBUG
- static ULONG m_ulDDPaletteCounter;
- #endif // _DEBUG
- };
- #endif // _DDPALETTE__H