Click here to Skip to main content
Click here to Skip to main content
Articles » Multimedia » OpenGL » General » Downloads
 
Add your own
alternative version

OpenGL MFC AppWizard

, 15 Jan 2009 GPL3
An article showing how to make a Custom AppWizard for OpenGL applictions in Visual Studio .NET 2008
OpenGLApplication.zip
OpenGLApplication
OpenGLApplication
res
OpenGLApplication.ico
Toolbar.bmp
OpenGLWizard.zip
OpenGLWizard
OpenGLWizard
1033
Images
DottedHori.gif
DottedVert.gif
spacer.gif
HTML
1033
Images
OpenGLWizard.png
OpenGLWizard_Background.gif
OpenGLWizard.ico
OpenGLWizard.vsdir
OpenGLWizard.vsz
Scripts
1033
Templates
1033
res
OpenGLApplication.ico
Toolbar.bmp
Templates.inf
//	DIBSurface.h
//	Copyright (C) Dave Kerr
//
//	This is an abstaction of a DIB surface.

#pragma once

#include <atlimage.h>

class CDIBSurface
{
public:
	CDIBSurface();
	virtual ~CDIBSurface();

	//	Creation/Destruction
	virtual bool	Create(int nWidth, int nHeight, int nBitCount = 24, void* pData = NULL);
	virtual void	Destroy(bool bHDC = true, bool bHBMP = true);

	//	Image Functions
	void			CreateImage(CImage& image);

	//	Palette / Pixel format
	void			SetPalette(CPalette* pPal);
	virtual bool	SetPixelFormat(int nBitCount);

	//	Diagnostics
	bool			IsValid();

	//	Device context
	CDC*			GetDC() {return m_pDC;}

	//	Drawing
	virtual void	SetPixel(int x, int y, COLORREF cl);
	virtual void	Draw(CDC* pTargetDC, int x, int y);
	virtual void	Draw(HDC hDC, int x, int y);
	virtual void	DrawMapped(CDC* pTargetDC, int x, int y, int cx, int cy);
	virtual void	Erase(COLORREF clColour);

	//	Accessors
	int				GetWidth() const {return m_szDIB.cx;}
	int				GetHeight() const {return m_szDIB.cy;}
	int				GetBitCount() const {return (int)m_byBitCount;}
	void*			GetData() {return m_pBits;}

protected:
	//	Member data
	CSize			m_szDIB;
	CDC*			m_pDC;
	HBITMAP			m_hBmp;
	HBITMAP			m_hBmpOld;
	void*			m_pBits;
	BYTE			m_byBitCount;	//	8,16,24 supported.
};

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, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)

Share

About the Author

Dave Kerr
Software Developer
United Kingdom United Kingdom
Follow my blog at www.dwmkerr.com and find out about my charity at www.childrenshomesnepal.org.
Follow on   Twitter

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.1411022.1 | Last Updated 15 Jan 2009
Article Copyright 2009 by Dave Kerr
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid