Click here to Skip to main content
15,880,651 members
Articles / Desktop Programming / MFC

ImageStone - A Powerful C++ Class Library for Image Manipulation

Rate me:
Please Sign up or sign in to vote.
4.81/5 (250 votes)
6 Dec 2011Zlib3 min read 117.1K   51.5K   405  
An article on a library for image manipulation
#pragma once
#include "002Doc.h"
#include "interface_zoom.h"

//-------------------------------------------------------------------------------------
class CMy002View : public CScrollView,
                   public PCL_Interface_ZoomScale
{
public:
    // pt is coordinate on view
    void ShowMousePos (CPoint ptOnView) ;

    // coordinates on client of window --> on canvas
    void ViewToCanvas (CPoint& pt) ;

    CMy002Doc* GetDocument() {return (CMy002Doc*)m_pDocument;}

    // try to put ptCanvas at center of new view ratio.
    void SetViewRatio (int nNewRatio, CPoint ptCanvas) ;

private:
    void DrawAllLayer (FCObjImage& view_img, const FCObjImage& imgLayer, CRect canvas_on_img) ;
    void DrawCanvas (CDC* pDC) ;

	virtual void OnDraw(CDC* pDC);
	virtual void OnInitialUpdate();

	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);

    // get canvas offset when image center in view
    CPoint GetCanvasOffset() ;
    CSize GetCanvasScaledSize() ;

private:
    virtual BOOL OnScroll(UINT nScrollCode, UINT nPos, BOOL bDoScroll) ;
    virtual BOOL OnScrollBy(CSize sizeScroll, BOOL bDoScroll) ;

    afx_msg void OnViewZoomInStep();
    afx_msg void OnViewZoomOutStep();
    afx_msg void OnViewActual();

	afx_msg BOOL OnEraseBkgnd(CDC* pDC) {return FALSE;}
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	DECLARE_MESSAGE_MAP()

    DECLARE_DYNCREATE(CMy002View) // create from serialization only
};

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 zlib/libpng License


Written By
Team Leader PhoXo
China China
graduate from University of Science and Technology of China at 2002.

Now I work at www.phoxo.com.

Comments and Discussions