home *** CD-ROM | disk | FTP | other *** search
/ The Net: Ultimate Internet Guide / WWLCD1.ISO / mac / SiteBldr / AMOVIE / SDK / _SETUP / COMMON.Z / contrast.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-17  |  3.0 KB  |  100 lines

  1. //==========================================================================;
  2. //
  3. //  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  4. //  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  5. //  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  6. //  PURPOSE.
  7. //
  8. //  Copyright (c) 1992 - 1996  Microsoft Corporation.  All Rights Reserved.
  9. //
  10. //--------------------------------------------------------------------------;
  11. //
  12. // Contrast
  13. //
  14. // CTransformFilter derived. Alters the contrast of the supplied video image.
  15.  
  16. //
  17. // For performance reasons currently works on palettised data only.
  18.  
  19.  
  20.  
  21. const signed char    MaxContrastLevel = 127;
  22. const signed char    MinContrastLevel = -127;
  23.  
  24. //
  25. // CContrast
  26. //
  27. class CContrast : public CTransformFilter,
  28.           public IContrast,
  29.           public ISpecifyPropertyPages {
  30.  
  31. public:
  32.  
  33.     //
  34.     // --- COM Stuff ---
  35.     //
  36.  
  37.     static CUnknown *CreateInstance(LPUNKNOWN punk, HRESULT *phr);
  38.  
  39.     // Reveals IContrast & ISpecifyPropertyPages
  40.     STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv);
  41.  
  42.     DECLARE_IUNKNOWN;
  43.  
  44.  
  45.     //
  46.     // --- CTransformFilter Overrides --
  47.     //
  48.  
  49.     HRESULT Transform(IMediaSample *pIn, IMediaSample *pOut);
  50.     HRESULT CheckInputType(const CMediaType *mtIn);
  51.     HRESULT CheckTransform(const CMediaType *mtIn,const CMediaType *mtOut);
  52.     HRESULT GetMediaType(int iPosition, CMediaType *pMediaType);
  53.     HRESULT DecideBufferSize(IMemAllocator *pAlloc,
  54.                              ALLOCATOR_PROPERTIES *pProperties);
  55.  
  56.  
  57.     //
  58.     // --- IContrast ---
  59.     //
  60.  
  61.     STDMETHODIMP get_ContrastLevel(signed char *ContrastLevel);
  62.     STDMETHODIMP put_ContrastLevel(signed char ContrastLevel, unsigned long ChangeTime);
  63.     STDMETHODIMP put_DefaultContrastLevel(void);
  64.  
  65.  
  66.     //
  67.     // --- ISpecifyPropertyPages ---
  68.     //
  69.  
  70.     STDMETHODIMP GetPages(CAUUID *pPages);
  71.  
  72.     // setup helper
  73.     LPAMOVIESETUP_FILTER GetSetupData();
  74.  
  75. private:
  76.  
  77.     CContrast(TCHAR *tszName, LPUNKNOWN punk, HRESULT *phr);
  78.  
  79.     BOOL CanChangeContrastLevel(const CMediaType *pMediaType) const;
  80.  
  81.     HRESULT Copy(IMediaSample *pSource, IMediaSample *pDest) const;
  82.     HRESULT Transform(IMediaSample *pMediaSample);
  83.  
  84.     HRESULT Transform(AM_MEDIA_TYPE *pType, const signed char ContrastLevel) const;
  85.  
  86.     void IncreaseContrast(RGBQUAD *pElem, const int Low, const int High, const float Grad) const;
  87.     void IncreaseContrast(BYTE *pByte, const int Low, const int High, const float Grad) const;
  88.     void DecreaseContrast(RGBQUAD *pElem, const int Level, const float Grad) const;
  89.     void DecreaseContrast(BYTE *pByte, const int Level, const float Grad) const;
  90.  
  91.     CCritSec    m_ContrastLock;
  92.  
  93.     const signed char    m_DefaultContrastLevel;    // the default (no-change) level
  94.     signed char        m_ContrastLevel;    // The current level to set the palette to.
  95.     signed char        m_PrevLevel;        // the level the last frame's palette was set at
  96.  
  97.     const long m_lBufferRequest;        // the number of buffers to request on the output allocator
  98.  
  99. };
  100.