예제 #1
0
 /**
  * Set the options of the crop image view to the given values.
  */
 public void setCropImageViewOptions(CropImageViewOptions options)
 {
     mCropImageView.SetScaleType(options.scaleType);
     mCropImageView.SetCropShape(options.cropShape);
     mCropImageView.SetGuidelines(options.guidelines);
     mCropImageView.SetAspectRatio((int)options.aspectRatio.First, (int)options.aspectRatio.Second);
     mCropImageView.SetFixedAspectRatio(options.fixAspectRatio);
     mCropImageView.ShowCropOverlay = options.showCropOverlay;
     mCropImageView.ShowProgressBar = options.showProgressBar;
     mCropImageView.AutoZoomEnabled = options.autoZoomEnabled;
     mCropImageView.MaxZoom         = options.maxZoomLevel;
 }
예제 #2
0
 /**
  * Set the options of the crop image view to the given values.
  */
 public void SetCropImageViewOptions(CropImageViewOptions options)
 {
     _cropImageView.SetScaleType(options.ScaleType);
     _cropImageView.SetCropShape(options.CropShape);
     _cropImageView.SetGuidelines(options.Guidelines);
     _cropImageView.SetAspectRatio(options.AspectRatio.AspectRatioX, options.AspectRatio.AspectRatioY);
     _cropImageView.SetFixedAspectRatio(options.FixAspectRatio);
     _cropImageView.SetMultiTouchEnabled(options.Multitouch);
     _cropImageView.ShowCropOverlay     = options.ShowCropOverlay;
     _cropImageView.ShowProgressBar     = options.ShowProgressBar;
     _cropImageView.AutoZoomEnabled     = options.AutoZoomEnabled;
     _cropImageView.MaxZoom             = options.MaxZoomLevel;
     _cropImageView.FlippedHorizontally = options.FlipHorizontally;
     _cropImageView.FlippedVertically   = options.FlipVertically;
 }
예제 #3
0
 public void SetCropImageViewOptions(CropImageViewOptions options)
 {
     mCropImageView.SetScaleType(options.scaleType);
     mCropImageView.SetCropShape(options.cropShape);
     mCropImageView.SetGuidelines(options.guidelines);
     mCropImageView.SetAspectRatio(options.aspectRatio.Item1, options.aspectRatio.Item2);
     mCropImageView.SetFixedAspectRatio(options.fixAspectRatio);
     mCropImageView.SetMultiTouchEnabled(options.multitouch);
     mCropImageView.ShowCropOverlay     = (options.showCropOverlay);
     mCropImageView.ShowProgressBar     = (options.showProgressBar);
     mCropImageView.AutoZoomEnabled     = (options.autoZoomEnabled);
     mCropImageView.MaxZoom             = (options.maxZoomLevel);
     mCropImageView.FlippedHorizontally = (options.flipHorizontally);
     mCropImageView.FlippedVertically   = (options.flipVertically);
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);
                RequestWindowFeature(WindowFeatures.NoTitle);
                SetContentView(Resource.Layout.activity_main);

                // Sets fonts for all
                Typeface mFont = Typeface.CreateFromAsset(Assets, "Roboto-Thin.ttf");
                var      root  = FindViewById <ViewGroup>(Resource.Id.mylayout);
                SetFont(root, mFont);

                // Initialize components of the app
                cropImageView = FindViewById <CropImageView>(Resource.Id.CropImageView);
                var showGuidelinesSpin = FindViewById <Spinner>(Resource.Id.showGuidelinesSpin);

                // Set initial spinner value
                showGuidelinesSpin.SetSelection(ON_TOUCH);

                //Set AspectRatio fixed for circular selection
                cropImageView.SetFixedAspectRatio(true);

                // Sets initial aspect ratio to 10/10
                cropImageView.SetAspectRatio(DEFAULT_ASPECT_RATIO_VALUES, DEFAULT_ASPECT_RATIO_VALUES);

                //Sets the rotate button
                var rotateButton = FindViewById <Button>(Resource.Id.Button_rotate);
                rotateButton.Click += delegate { cropImageView.RotateImage(ROTATE_NINETY_DEGREES); };

                // Sets up the Spinner
                showGuidelinesSpin.ItemSelected    += showGuidelinesSpin_ItemSelected;
                showGuidelinesSpin.NothingSelected += showGuidelinesSpin_NothingSelected;

                var cropButton = FindViewById <Button>(Resource.Id.Button_crop);
                cropButton.Click += delegate
                {
                    croppedImage = cropImageView.GetCroppedCircleImage();
                    var croppedImageView = FindViewById <ImageView>(Resource.Id.croppedImageView);
                    croppedImageView.SetImageBitmap(croppedImage);
                };
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
        }