예제 #1
0
        protected override void OnMouseDown( MouseEventArgs e )
        {
            base.OnMouseDown( e );

            m_MouseButtonsDown |= e.Button;
            Capture = true;

            switch ( m_ManipulationState )
            {
                case MANIPULATION_STATE.CROP_RECTANGLE:
                {	// Take care of crop rectangle manipulation
                    if ( m_CropRectangleManipulatedSpot == CROP_RECTANGLE_SPOT.NONE )
                        return;	// Nothing to manipulate...

                    m_CropRectangleManipulationStarted = true;
                    break;
                }

                case MANIPULATION_STATE.CALIBRATION_TARGET:
                {	// Take care of calibration manipulation
                    if ( m_CalibrationStage == CALIBRATION_STAGE.PICK_CENTER )
                        m_CalibrationStage = CALIBRATION_STAGE.SET_RADIUS;
                    else if ( m_CalibrationStage == CALIBRATION_STAGE.SET_RADIUS )
                    {	// We're done! Notify!
                        m_CalibrationDelegate( m_CalibrationCenter, m_CalibrationRadius );
                        ManipulationState = MANIPULATION_STATE.STOPPED;		// End manipulation
                    }
                    break;
                }
            }
        }
예제 #2
0
        protected override void OnMouseUp( MouseEventArgs e )
        {
            base.OnMouseUp( e );

            m_MouseButtonsDown &= ~e.Button;

            // End manipulation
            switch ( m_ManipulationState )
            {
                case MANIPULATION_STATE.PICK_COLOR:
                    ManipulationState = MANIPULATION_STATE.STOPPED;

                    // Notify end
                    ImageUtility.float2	UV0 = Client2ImageUV( m_ButtonDownMousePosition );
                    ImageUtility.float2	UV1 = Client2ImageUV( e.Location );
                    m_ColorPickingEndDelegate( UV0, UV1 );
                    break;
            }

            Invalidate();
            Capture = false;
            Cursor = Cursors.Default;
        }
예제 #3
0
 /// <summary>
 /// Starts calibration target picking mode (user is expected to place the target with the mouse, then change the radius so the calibration can take place)
 /// </summary>
 /// <param name="_Notify"></param>
 public void StartCalibrationTargetPicking( CalibrationDone _Notify )
 {
     m_CalibrationDelegate = _Notify;
     m_CalibrationRadius = 0.0f;
     ManipulationState = MANIPULATION_STATE.CALIBRATION_TARGET;
     m_CalibrationStage = CALIBRATION_STAGE.PICK_CENTER;
 }
예제 #4
0
 /// <summary>
 /// Starts color picking with the mouse, provided delegate is called on mouse move with new informations
 /// </summary>
 /// <param name="_Notify"></param>
 public void StartSwatchColorPicking( ColorPickingUpdate _Update, ColorPickingUpdate _PickingEnd )
 {
     m_ColorPickingUpdateDelegate = _Update;
     m_ColorPickingEndDelegate = _PickingEnd;
     ManipulationState = MANIPULATION_STATE.PICK_COLOR;
 }