Click here to Skip to main content
15,881,812 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.2K   51.5K   405  
An article on a library for image manipulation
#pragma once

//-------------------------------------------------------------------------------------
class DlgEffectLib : public CDialogBar
{
private:
    //---------------------------------------------------------------------------------
    class CEffectThumb : public FCListItem_Base
    {
    public:
        CEffectThumb (int nCommandID, LPCWSTR sText) : m_command_id(nCommandID), m_text(sText) {}

        int      m_command_id ;
        CString  m_text ;
        CBitmap  m_img ;

        void SetImage (HBITMAP hBmp) ;

        void DrawTitle (CDC& dc, CRect rcItemOnDC) ;
        void DrawThumb (CDC& dc, CRect rcItemOnDC) ;
        virtual void OnPaint_Item (CDC& dc) ;
    };

    //---------------------------------------------------------------------------------
    class CThumbLayout : public FCLayout_HandlerBase
    {
        virtual void Layout_ListItem (CWnd* pWnd, std::deque<FCListItem_Base*>& item_list) ;
    };

    //---------------------------------------------------------------------------------
    class CEffectList : public FCListWindow
    {
        HANDLE   m_thread ;
    public:
        CEffectList() ;
        ~CEffectList() ;

    private:
        void AddThumb (int nCommand, LPCWSTR sText) ;
        static CString GetPureMenuText (LPCWSTR sName) ;

        virtual LRESULT WindowProc (UINT msg, WPARAM wParam, LPARAM lParam) ;

        struct THREAD_PARAM
        {
            HWND   m_wnd ;
            std::deque<int>   m_cmd ;
        };

        static FCImageEffect* CreateEffect (int nCommandID) ;
        static DWORD WINAPI MakeThumbThread (LPVOID lpParameter) ;
    };

public:
    void Create (CMDIFrameWnd* pMainFrame) ;

private:
    std::auto_ptr<CEffectList>   m_list ;

    void ShowList() ;
    void HideList() ;

    virtual CSize CalcDynamicLayout (int nLength, DWORD nMode) ;
    virtual LRESULT WindowProc (UINT msg, WPARAM wParam, LPARAM lParam) ;
    virtual void OnUpdateCmdUI (CFrameWnd* pTarget, BOOL bDisableIfNoHndler) {} // enable all button
};

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