Click here to Skip to main content
13,003,930 members (128,248 online)
Click here to Skip to main content


82 bookmarked
Posted 8 Jan 2001

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.
// ImageImp.h : interface of the CImageImp class

#ifndef IMAGE_IMP
#define IMAGE_IMP

//	Predefined constants 
#ifndef SUCCESS 
#define SUCCESS		0

#ifndef FAILURE
#define FAILURE		-1

class CImageImp : public CObject
	// Constructor / Destructor
	public :
		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;

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

// CWinImp class declaration
class CWinImp : public CImageImp
	// Constructor / Destructor
	public :
		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();

	// Attributes
	protected :
		BYTE					* m_pBmi;
		CPalette				* m_pPalette;

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.


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


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.

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170627.1 | Last Updated 9 Jan 2001
Article Copyright 2001 by T. Kulathu Sarma
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid