使用soui开发的mbc,只支持windows版本
w1146869587
2022-01-24 0408576e9da10015ffa9da0079b8c985113ce4b3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#pragma once
 
#include "../stdafx.h"
#include <Gdiplus.h>
#include <atlconv.h>
#pragma comment(lib,"gdiplus")
using namespace Gdiplus;
 
 
 
 
namespace SOUI
{
 
    class AFX_EXT_CLASS SRoundImageCenter:public SWindow
    {
        SOUI_CLASS_NAME(SRoundImageCenter, L"RoundImageCenter")
    public:
        SRoundImageCenter(void);
        ~SRoundImageCenter(void);
 
        //˳ʱÕë½Ç¶ÈÐýת
        enum ROTATEANGLE
        {
            ROTATEANGLE0 = 0,
            ROTATEANGLE90,
            ROTATEANGLE180,
            ROTATEANGLE270,
        };
    public:
         void OnPaint(IRenderTarget *pRT);     
        /* void OnLButtonDown(UINT nFlags, SOUI::CPoint point);
        void OnLButtonUp(UINT nFlags, SOUI::CPoint point);
        void OnNcLButtonUp(UINT nFlags, SOUI::CPoint point);
        void OnMouseMove(UINT nFlags, SOUI::CPoint point);*/
    protected:
        SOUI_MSG_MAP_BEGIN()
            MSG_WM_PAINT_EX(OnPaint)
            /*MSG_WM_LBUTTONDOWN(OnLButtonDown)
            MSG_WM_LBUTTONUP(OnLButtonUp)
            MSG_WM_NCLBUTTONUP(OnNcLButtonUp)
            MSG_WM_MOUSEMOVE(OnMouseMove)*/
        SOUI_MSG_MAP_END()
    public:
        FilterLevel             m_fl;
        //ÉèÖõľø¶Ô·¾¶¡£
        void SetCenterImage(SStringT img);
        int GetCenterImageWidth();
        int GetCenterImageHeight();
        SStringT GetCenterImage();
        void SetRotate(ROTATEANGLE angle);
        int GetCurrentK();
        void SetCurrentTransferRect(int val);
        void MoveImage(int xpos, int ypos);
        void SetCurrentRect(RECT rc);
        RECT GetTransferRect();
        void ChangedCurrentRect(RECT oldRc);
        CAutoRefPtr<IBitmap> GetShowImage(int nWidth = 100, int nHeight = 100);
        BOOL SaveSelImage( CString strImagePath, int nWidth = 100, int nHeight = 100,CString strImageType = _T("image/png") );
    private:
        void InitCenterUI(int w, int h);
        bool ImageFromIDResource(UINT nID, CString strType, Image * & pImg ,HINSTANCE hInstance);
    private:
        int GetK(int w, int h);
        RECT GetDestDrawRect(int k);
 
    private:
        Bitmap * m_pSelImage;
        Bitmap * m_pOrignImage;
        ROTATEANGLE m_angle;
        SStringT  m_imageStr;
        float m_fAngle;
        int m_k;
        RECT m_currentRect;
        RECT m_currentTransferRect;
        SOUI::CPoint m_ptStart;
        Gdiplus::Image* m_pImgRoundMask;
    };
 
}