Click here to Skip to main content
15,897,704 members
Articles / Mobile Apps / Windows Mobile

A Picture Viewer for the Pocket PC 2002

Rate me:
Please Sign up or sign in to vote.
4.79/5 (21 votes)
2 Nov 2003CPOL4 min read 499.3K   685   43  
Putting imgdecmp.lib to work with a few extras.
//---------------------------------------------------------------------------
//
//	PicViewDoc.h : interface of the CPicViewDoc class
//
//---------------------------------------------------------------------------


#if !defined(AFX_PICVIEWDOC_H__B0317E15_FD82_4FE5_9059_20021EC10A29__INCLUDED_)
#define AFX_PICVIEWDOC_H__B0317E15_FD82_4FE5_9059_20021EC10A29__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000


#include <imgdecmp.h>


class CPicViewDoc : public CDocument
{
protected: // create from serialization only
	CPicViewDoc();
	DECLARE_DYNCREATE(CPicViewDoc)

	enum ZoomLimits
	{
		zoomDelta	= 10,
		zoomMin		= 10,
		zoomDef		= 100,
		zoomMax		= 800
	};

// Attributes
public:

// Operations
public:
	HBITMAP GetBitmap		() {return m_hBmp;}
	int		GetWidth		() {return m_nWidth;}
	int		GetHeight		() {return m_nHeight;}
	int		GetZoom			() {return m_nZoom;}
	int		GetZoomWidth	() {return m_nWidth * m_nZoom / 100;}
	int		GetZoomHeight	() {return m_nHeight * m_nZoom / 100;}
	
	int		ScaleScreen		(int x) {return x * 100 / m_nZoom;}
	int		ScaleBitmap		(int x)	{return x * m_nZoom / 100;}


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CPicViewDoc)
	public:
	virtual BOOL OnNewDocument();
	virtual void Serialize(CArchive& ar);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CPicViewDoc();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:
	HBITMAP m_hBmp;
	int		m_nWidth,
			m_nHeight,
			m_nZoom;

	static DWORD CALLBACK GetImageData(LPSTR pBuf, DWORD dwBufMax, LPARAM lParam);
	static void	 CALLBACK ImageProgress(IImageRender *pRender, BOOL bComplete, LPARAM lParam);


protected:
	// Generated message map functions
	//{{AFX_MSG(CPicViewDoc)
	afx_msg void OnUpdateZoomMinus(CCmdUI* pCmdUI);
	afx_msg void OnZoomMinus();
	afx_msg void OnUpdateZoomPlus(CCmdUI* pCmdUI);
	afx_msg void OnZoomPlus();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft eMbedded Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_PICVIEWDOC_H__B0317E15_FD82_4FE5_9059_20021EC10A29__INCLUDED_)

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 Code Project Open License (CPOL)


Written By
Software Developer (Senior) Frotcom International
Portugal Portugal
I work on R&D for Frotcom International, a company that develops web-based fleet management solutions.

Comments and Discussions