www.pudn.com > VirtualVCR-src-v2.6.9.zip > Histogram.h


/* 
	Virtual VCR 
    Copyright (C) 2002  Shaun Faulds 
 
    This program is free software; you can redistribute it and/or modify 
    it under the terms of the GNU General Public License as published by 
    the Free Software Foundation; either version 2 of the License, or 
    (at your option) any later version. 
 
    This program is distributed in the hope that it will be useful, 
    but WITHOUT ANY WARRANTY; without even the implied warranty of 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    GNU General Public License for more details. 
 
    You should have received a copy of the GNU General Public License 
    along with this program; if not, write to the Free Software 
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
 
	Acknowledgments: 
	This application and associated filters are based on the examples 
	from the Microsoft DirectX DirectShow SDK. 
*/ 
 
#ifndef __IHistogramCLASS__ 
#define __IHistogramCLASS__ 
 
#include "../Common/Filter/iFilterProperties.h" 
 
class CHistogram : public CTransformFilter, 
		 public IHistogram, 
		 public IFilterProperties, 
		 public ISpecifyPropertyPages 
{ 
 
public: 
 
    DECLARE_IUNKNOWN; 
    static CUnknown * WINAPI CreateInstance(LPUNKNOWN punk, HRESULT *phr); 
 
    // Reveals IEZrgb24 and ISpecifyPropertyPages 
    STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv); 
 
    // Overrriden from CTransformFilter base class 
 
    HRESULT Transform(IMediaSample *pIn, IMediaSample *pOut); 
    HRESULT CheckInputType(const CMediaType *mtIn); 
    HRESULT CheckTransform(const CMediaType *mtIn, const CMediaType *mtOut); 
    HRESULT DecideBufferSize(IMemAllocator *pAlloc, 
			     ALLOCATOR_PROPERTIES *pProperties); 
    HRESULT GetMediaType(int iPosition, CMediaType *pMediaType); 
	HRESULT SetMediaType (PIN_DIRECTION direction, const CMediaType* mediaType); 
 
	// media type input and output setup helpers 
 
	HRESULT GetInputMediaType (const CMediaType* mediaType); 
	HRESULT SetOutputMediaType (const CMediaType* mediaType); 
 
	// Copy the media sample properties from input to output 
	HRESULT PrepareOutputSample (IMediaSample* inSample, IMediaSample* outSample); 
 
    // These implement the custom interface 
 
    STDMETHODIMP get_Channel(BOOL *Channel); 
    STDMETHODIMP set_Channel(BOOL Channel); 
    STDMETHODIMP set_RGBmask(int Channel); 
    STDMETHODIMP get_RGBmask(int *Channel); 
 
	// Filter Properties Setting getting methods 
 
	STDMETHODIMP get_Prop(char*& data); 
	STDMETHODIMP set_Prop(char* data); 
	STDMETHODIMP get_Version(char *data); 
 
    // ISpecifyPropertyPages interface 
 
    STDMETHODIMP GetPages(CAUUID *pPages); 
 
private: 
 
    // Constructor 
    CHistogram(TCHAR *tszName, LPUNKNOWN punk, HRESULT *phr); 
	~CHistogram(); 
 
	LONG CountPixels(IMediaSample *pMediaSample, LONG *pixelArray01, LONG *pixelArray02, LONG *pixelArray03); 
	HRESULT DrawHistogramRGB(IMediaSample *pOutput, LONG rgbMax, LONG *pixel01, LONG *pixel02, LONG *pixel03); 
	HRESULT DrawHistogramLUM(IMediaSample *pOutput, LONG rgbMax, LONG *pixel01, LONG *pixel02, LONG *pixel03); 
	HRESULT PlotPixel(int red, int green, int blue, int alpha, int x, int y, RGBTRIPLE *pixel, int width, int height); 
	BOOL ReconnectOutputPins(); 
	int MsgBOX(LPTSTR sz,...);  
 
	LONG *channel01; 
	LONG *channel02; 
	LONG *channel03; 
 
	BOOL Channels; 
	int ChannelSelection; 
 
	int input_width; 
	int input_height; 
	int pixel_length_bytes; 
 
	int output_width; 
	int output_height; 
 
	int inputColourFormat; 
 
};  
 
#endif