#ifndef __RV_PICK_H_INCLUDED_
#define __RV_PICK_H_INCLUDED_

     
#include <rvb\rvtypes.h> 
#include <rvb\xgui.h> 

#define PICK_API    WINAPI


 
//pick fill style
#define  RV_PFS_SOLID      (1)
#define  RV_PFS_GRID       (1<<1) 
#define  RV_PFS_DIAG       (1<<2)
#define  RV_PFS_CROSS      (1<<3)

#define  RV_PFS_IGNORE     0

 


#define  RV_PDS_NO_FILL    RV_PFS_IGNORE
#define  RV_PDS_NO_BORDER   (1<<16)
#define  RV_PFS_PREVIEW    (1<<17)

#define  RV_PDS_GET_FRAME_FLAG(style)  ((style) & 0xFFFF0000)
#define  RV_PDS_GET_FILL_FLAG(style)   ((style) & 0xFFFF)

//最新v2.0直接使用浮点角度，故不在使用整数角度
//在半径为10000的时候，1度的对应弧长大约是0.017左右
//不能使用float, 需要使用double
//#define PK_ANGLE_ACCURACY    (1.0/10000)

//#define RV_PK_UM_RESET   0
//#define RV_PK_UM_MERGE   1
//#define RV_PK_UM_SET     2

//RECT PICK的自身旋转忽略的角度
#define RV_IGNORE_DEGREE   0.0001f

//construction and destruction
extern "C" RvPick PICK_API rvCreatePick(RV_PICK_TYPE type, const RvImage sight=NULL);
extern "C" void  PICK_API    rvDestroyPick(RvPick self);

extern "C" RvPick PICK_API rpkClone(RvPick self);

//methods
//for count of polygon, index should be -1.
//this is the only exceptional case.
extern "C" void PICK_API  rpkSetGeometry(RvPick self, int index, RvFloat32 val);

//annulus的角度为浮点数，但是在返回的时候，已经换成了整数返回。
//公式: Angle / PK_ANGLE_ACCURACY
extern "C" RvFloat32 PICK_API   rpkGetGeometry(const RvPick self, int index);

//The geometry count of polygon is the total number of vertex.
//circle: 4
//annuls: 6
//rect: 4
//torus: 4
//cutsom: 4
//polygon: count *2
extern "C" int PICK_API    rpkGetGeometryCount(const RvPick self);
 
 


extern "C" RV_HANDLE PICK_API  rpkDraw(const RvPick self, HGDC pDc, GPen* pBorderPen = NULL, GRgb* pFillColor =NULL, RV_HANDLE hStroke=NULL);

extern "C" void PICK_API  rpkMove(RvPick self, int dx, int dy);

extern "C" void PICK_API  rpkSetAlignAngle(RvPick self, RvFloat32 angle);
extern "C" RvFloat32 PICK_API rpkGetAlignAngle(RvPick self  ); 

extern "C" void PICK_API rpkAlign (RvPick self ,RvFloat32 dx, RvFloat32 dy, RvFloat32 cx, RvFloat32 cy, RvFloat32 angle, int flags = RV_OA_NONE ); 

extern "C" void PICK_API rpkSetAlignType(RvPick self, int type);
extern "C" int PICK_API rpkGetAlignType(RvPick self);
 
extern "C" RvPoint_f PICK_API rpkGetAlignCenter(RvPick self  ); 
extern "C" void PICK_API rpkSetAlignCenter(RvPick self,  RvFloat32 cx, RvFloat32 cy  ); 

extern "C" RvOffset_f PICK_API rpkGetAlignOffset(RvPick self  ); 
extern "C" void PICK_API rpkSetAlignOffset(RvPick self, RvFloat32 dx, RvFloat32 dy ); 


extern "C" void PICK_API  rpkShot(RvPick self, const RvImage image);

extern "C" void PICK_API  rpkShrink(RvPick self, int offset);
extern "C" void PICK_API  rpkExpand(RvPick self, int offset);
extern "C" void PICK_API  rpkScale(RvPick self, float ratio);

//异向缩放
extern "C" void PICK_API  rpkScaleE1(RvPick self, float ratioX, float ratioY);

extern "C" void PICK_API  rpkRotate(RvPick self, float angle);




//for move
extern "C" void PICK_API rpkShotEx(RvPick self, const RvImage image, int dx, int dy  );
 
extern "C" RvImage PICK_API  rpkGetSubImage(RvPick self);
extern "C" int  PICK_API      rpkGetWidth(const RvPick self);
extern "C" int PICK_API      rpkGetHeight(const RvPick self);
extern "C" GPoint  PICK_API  rpkGetLeftTop(const RvPick self);
extern "C" GRect  PICK_API    rpkGetRect(const RvPick self);
extern "C" GSize  PICK_API    rpkGetSize(const RvPick self);



extern "C" void PICK_API  rpkUpdateMask(RvPick self );
//void PICK_API  rpkUpdateMask(RvPick self, int mode=RV_PK_UM_RESET, const RvMask mask=NULL); 



extern "C" RV_PICK_TYPE PICK_API rpkGetType(RvPick  self);



extern "C"  int PICK_API  rpkGetStyle(const RvPick  self);
extern "C"  void PICK_API rpkSetStyle(RvPick  self, int style);

  
extern "C" RvMask   PICK_API   rpkGetMask(RvPick self);
 


#endif
