Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

Bridge Pattern - Bridging the gap between Interface and Implementation

, 8 Jan 2001
This article discusses the Bridge Pattern, what it is, why and when it is needed.
bridge.zip
Bridge.clw
Bridge.mak
Bridge.mdp
res
BridgeDoc.ico
Bridge.ico
Bridge.dsp
Bridge.opt
Bridge.dsw
Bridge.bmp
// ImageImp.h : interface of the CImageImp class
//
/////////////////////////////////////////////////////////////////////////////

#ifndef IMAGE_IMP
#define IMAGE_IMP

//	Predefined constants 
#ifndef SUCCESS 
#define SUCCESS		0
#endif

#ifndef FAILURE
#define FAILURE		-1
#endif

class CImageImp : public CObject
{
	// Constructor / Destructor
	public :
		CImageImp();
		virtual ~CImageImp();

	// List of Services to be defined by the derived class
	public :
		virtual INT		InitImageInfo( LPSTR )					= 0;
		virtual INT		GetNumColors( LPSTR = NULL )			= 0;
		virtual LPSTR	GetColorTable()							= 0;
		virtual BOOL	PaintImage( CWnd *, CRect * )			= 0;
		virtual BOOL	CreateImagePalette()						= 0;
		DECLARE_DYNAMIC( CImageImp )

	// Attributes
	public :
		LPBYTE				m_pImage;
		LONG					m_lNormalWidth;
		LONG					m_lNormalHeight;
};

// CWinImp class declaration
class CWinImp : public CImageImp
{
	// Constructor / Destructor
	public :
		CWinImp();
		virtual ~CWinImp();

	// Services to be defined by this class
	public :
		INT		InitImageInfo( LPSTR );
		INT		GetNumColors( LPSTR = NULL );
		LPSTR		GetColorTable();
		BOOL		PaintImage( CWnd *, CRect * );
		BOOL		CreateImagePalette();
		DECLARE_DYNCREATE( CWinImp )

	// Attributes
	protected :
		BYTE					* m_pBmi;
		CPalette				* m_pPalette;
};
#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

T. Kulathu Sarma

Switzerland Switzerland
Kulathu Sarma is working as a Technology Manager for GoldAvenue, a company based in Geneva, Switzerland and responsible for supporting e-business initiatives of GoldAvenue in B2B and B2C Sectors. He has been programming in C/C++ for 9 years and actively working on Patterns for the past 5 years.

| Advertise | Privacy | Mobile
Web02 | 2.8.140926.1 | Last Updated 9 Jan 2001
Article Copyright 2001 by T. Kulathu Sarma
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid