You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
993 B
C++
38 lines
993 B
C++
#pragma once
|
|
#include "HTrackerCommon.h"
|
|
#include "HTrackerHandleCalculator.h"
|
|
//计算HTracker的变换矩阵
|
|
|
|
class HTrackerTransform
|
|
{
|
|
public:
|
|
HTrackerTransform();
|
|
void Init(int handle, const CRect & boundRect, CPoint mousePt);
|
|
void Draging(CPoint mousePt);
|
|
void EndDrag();
|
|
Gdiplus::Matrix * GetMatrix();
|
|
//设置变换的类型
|
|
void SetKind(HTRACKER_TRANSFORM_KIND kind);
|
|
protected:
|
|
void SetFixedPoints();
|
|
void Scale(CPoint & point);
|
|
void Move(CPoint & point);
|
|
bool IsCanMove(const CPoint& nPrevPoint, const CPoint& nCurPoint);
|
|
void Rotate(CPoint & point);
|
|
void Shear(CPoint & point);
|
|
private:
|
|
bool m_bDrag;
|
|
int m_handle;
|
|
CPoint m_StartPoint; //开始拖拽时,鼠标的坐标。
|
|
CRect m_boundRect; //tracker的外包矩形
|
|
CPoint m_FixedSrc;
|
|
CPoint m_FixedDest;
|
|
bool m_bCanMoved;
|
|
int m_nAllowMovePixel;
|
|
Gdiplus::Matrix m_Transform;
|
|
Gdiplus::REAL m_StartPhi;
|
|
HTrackerHandleCalculator m_calculator;
|
|
HTRACKER_TRANSFORM_KIND m_kind;
|
|
};
|
|
|