Esempio n. 1
0
        private async void cameraBtnClicked(object sender, EventArgs e)
        {
            var action = await DisplayActionSheet("Take or select photo", "Cancel", null, "Take Picture", "Select picture");

            MediaFile m = null;

            switch (action)
            {
            case "Take Picture":
                m = await App.MANAGER.MediaContorller.TakePicture();

                break;

            case "Select picture":
                m = await App.MANAGER.MediaContorller.SelectPicture();

                break;
            }

            if (m == null)
            {
                return;
            }

            IImageProcessing processer = DependencyService.Get <IImageProcessing>();


            Bitmap b = await processer.ScaleBitmap(m.Source, await processer.GetBitmapOptionsOfImageAsync(m.Source), 200, 200);

            image.SetImageBitmap(b);
            pic = processer.compress(b);
            m.Dispose();
        }
        protected async override void OnAppearing()
        {
            //disabling add item button if user is not logged in
            if (!App.CredManager.IsLoggedIn())
            {
                donateItem.IsEnabled = false;
            }
            else
            {
                donateItem.IsEnabled = true;
            }

            if (shouldGetChapter)
            {
                if (fbla == null)
                {
                    fbla = await App.MANAGER.YSSI.GetFBLAChapter(myfblaid);

                    populateProfileFields();
                }
            }


            IImageProcessing processer = DependencyService.Get <IImageProcessing>();

            profImg.SetImageBitmap(await processer.ScaleBitmap(fbla.picture, await processer.GetBitmapOptionsOfImageAsync(fbla.picture), 200, 200));
        }
        public void ManipulateSeam(IImageProcessing imgProcessor,SeamDirection seamDirection)
        {
            int[,] energy = imgProcessor.Energy(new LaMImageData.EnergyCalGradient(), false);

            int[] dynamicSeamArray = Library.CreateDynamicSeam(energy,seamDirection);

            imgProcessor.DynamicRow(new PixelColor(), dynamicSeamArray,seamDirection);
        }
        public void ManipulateSeam(IImageProcessing imgProcessor, SeamDirection seamDirection)
        {
            int[,] energy = imgProcessor.Energy(new LaMImageData.EnergyCalGradient(), false);

            int seam = Library.FindStaticSeam(Library.TabSum(energy));

            imgProcessor.StaticRow(new PixelRemove(), seam);
        }
Esempio n. 5
0
        private IImageProcessing actions(IImageProcessing action, String actionString)
        {
            Stopwatch sw = TimeCountStart();

            action.process();
            UIMessage(actionString, sw);
            setResultBitmap(action.getImage());
            return(action);
        }
 public EmployeeController(IUnitOfWork _work, IMapper _mapper,
                           IImageProcessing _image, UserManager <ApplicationUser> _userManager,
                           RoleManager <IdentityRole> _roleManager)
 {
     context     = _work;
     mapper      = _mapper;
     image       = _image;
     userManager = _userManager;
     roleManager = _roleManager;
 }
 public ShopController(ICategoryService categoryservice, IProductsService productservice,
                       IOrderService orderService, IOrderDetailService orderDetailService,
                       IImageProcessing imageProcessing)
 {
     _categoryservice    = categoryservice;
     _productservice     = productservice;
     _imageProcessing    = imageProcessing;
     _orderService       = orderService;
     _orderDetailService = orderDetailService;
 }
Esempio n. 8
0
 public GameLogics(IKinematics kinematics, IImageProcessing imageProcessing) : this()
 {
     // setting up the communication between the modules:
     PostMessageShowRequest                 += PostMessageHandler;         // game logics handles its own post messages
     kinematics.PostMessageShowRequest      += PostMessageHandler;         // game logics handles the post messages of the kinematics
     imageProcessing.PostMessageShowRequest += PostMessageHandler;         // game logics handles the post messages of the image processing
     kinematics.RobotStatusChanged          += RobotStatusChangedHandler;  // game logics handles the changes of the robot arm status (source: kinematics)
     imageProcessing.CameraStatusChanged    += CameraStatusChangedHandler; // game logics handles the changes of the camera status (source: image processing)
     imageProcessing.TableStateChanged      += TableSetupChangedHandler;   // game logics handles the changes of the table set-up (source: image processing)
     kinematics.SignUpToRobotMovementRequestEvent(this);                   // kinematics handles the robot movement requests (source: game logics)
 }
Esempio n. 9
0
        public ImageProcessingOutput ProcessLoadedImage()
        {
            IImageProcessing strategy = GetStrategy();

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            strategy.ToMainColors();
            stopWatch.Stop();

            TimeSpan ts = stopWatch.Elapsed;

            return(new ImageProcessingOutput(strategy.Result, ts));
        }
Esempio n. 10
0
        private async void InitializeApplication()
        {
            //textToSpeech = new SpeechSynthesizer();
            mediaDevice = new MediaCapture();

            imageProcessing        = new ProjectOxford();
            localPhotoStorage      = new LocalPhotoStorage(mediaDevice);
            localCameraImageSource = new LocalCameraImageSource(localPhotoStorage, mediaDevice);

            await localCameraImageSource.InitializeDevice();

            cameraElement.Source = mediaDevice;

            await mediaDevice.StartPreviewAsync();
        }
Esempio n. 11
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        ///
        public MainViewModel(IDialogService dialogService, IImageProcessing imageProcessing, IAdjustProvider adjustProvider, ILockBitmapFactory lockbitmapFactory)
        {
            _dialogService         = dialogService;
            _imageProcessing       = imageProcessing;
            _lockbitmapFactory     = lockbitmapFactory;
            _contrastFunction      = adjustProvider.CreateAdjustFunction <double>(AdjustType.Contrast);
            _brightnessFunction    = adjustProvider.CreateAdjustFunction <int>(AdjustType.Brightness);
            _grayscaleFunction     = adjustProvider.CreateAdjustFunction <object>(AdjustType.GrayScale);
            _negativescaleFunction = adjustProvider.CreateAdjustFunction <object>(AdjustType.NegativeScale);

            _brightNessValue = 0;
            _contrastValue   = 0.0;

            InitCommands();
        }
Esempio n. 12
0
        protected override async void OnAppearing()
        {
            IImageProcessing processer = DependencyService.Get <IImageProcessing>();

            profImg.SetImageBitmap(await processer.ScaleBitmap(item.picture, await processer.GetBitmapOptionsOfImageAsync(item.picture), 200, 200));

            if (App.CredManager.IsLoggedIn())
            {
                buyBtn.IsEnabled = true;
                buyBtn.Text      = "Buy Item";
            }
            else
            {
                buyBtn.IsEnabled = false;
                buyBtn.Text      = "Log in to buy Item";
            }
        }
        private async void InitializeApplication()
        {
            textToSpeech = new SpeechSynthesizer();
            mediaDevice  = new MediaCapture();

            imageProcessing        = new ProjectOxford();
            localPhotoStorage      = new LocalPhotoStorage(mediaDevice);
            localCameraImageSource = new LocalCameraImageSource(localPhotoStorage, mediaDevice);

            await localCameraImageSource.InitializeDevice();

            interogationResult.Text = "Hello my dear friend !!";

            PlayText(interogationResult.Text);

            cameraElement.Source = mediaDevice;

            await mediaDevice.StartPreviewAsync();
        }
 public void AddFilter(IImageProcessing imageFilter)
 {
     _tempList.Add(imageFilter);
 }
 public BrandController(IUnitOfWork unitOfWork, IImageProcessing imageProcessing)
 {
     context = unitOfWork;
     image   = imageProcessing;
 }
Esempio n. 16
0
 /// <summary>
 /// Returns a current effects queue
 /// </summary>
 /// <param name="effect"></param>
 public void AddEffectToQueue(IImageProcessing effect)
 {
     _effectsQueue.Add(effect);
 }
Esempio n. 17
0
        public fblaChapterListView()
        {
            SeparatorColor = Constants.palette.divider;
            Label schoolLabel = null;
            Label locLabel    = null;

            // Source of data items.
            VerticalOptions   = LayoutOptions.FillAndExpand;
            HorizontalOptions = LayoutOptions.FillAndExpand;

            RowHeight = 75;
            // Define template for displaying each item.
            // (Argument of DataTemplate constructor is called for
            //      each item; it must return a Cell derivative.)
            ItemTemplate = new DataTemplate(() =>
            {
                // Create views with bindings for displaying each property.
                schoolLabel = new Label {
                    FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label))
                };
                locLabel = new Label();
                schoolLabel.SetBinding(Label.TextProperty, "school");

                imageView = new CustomImageView
                {
                    HeightRequest = 75,
                    WidthRequest  = 75,
                };


                // Return an assembled ViewCell.
                return(new ViewCell
                {
                    View = new StackLayout
                    {
                        Padding = new Thickness(5, 5, 5, 5),
                        Orientation = StackOrientation.Horizontal,
                        Children =
                        {
                            imageView,
                            new StackLayout
                            {
                                //VerticalOptions = LayoutOptions.Center,
                                Spacing = 5,
                                Children =
                                {
                                    schoolLabel,
                                    locLabel,
                                }
                            }
                        }
                    }
                });
            });

            this.ItemSelected += ((sender, eventArgs) =>
            {
                if (this.SelectedItem != null)
                {
                    var c = SelectedItem as myDataTypes.fblaChapter;
                    var chapterView = new fblaChapterPage(c);
                    this.SelectedItem = null;
                    Navigation.PushAsync(chapterView);
                }
            });

            ItemAppearing += async(s, e) =>
            {
                if (e.Item == null)
                {
                    return;
                }

                myDataTypes.fblaChapter i = e.Item as myDataTypes.fblaChapter;


                locLabel.Text    = i.city + ", " + i.state;
                schoolLabel.Text = i.school;

                IImageProcessing processer = DependencyService.Get <IImageProcessing>();
                imageView.SetImageBitmap(await processer.ScaleBitmap(i.picture, await processer.GetBitmapOptionsOfImageAsync(i.picture), 200, 200));
            };
        }
Esempio n. 18
0
 public CategoryController(IUnitOfWork unitOfWork, IImageProcessing imageProcessing)
 {
     context = unitOfWork;
     image   = imageProcessing;
 }
Esempio n. 19
0
        public itemListView()
        {
            SeparatorColor = Constants.palette.divider;

            Label           conditionLabel = null;
            Label           priceLabel     = null;
            CustomImageView imageView      = null;

            // Source of data items.

            RowHeight = 80;
            // Define template for displaying each item.
            // (Argument of DataTemplate constructor is called for
            //      each item; it must return a Cell derivative.)
            ItemTemplate = new DataTemplate(() =>
            {
                // Create views with bindings for displaying each property.
                Label nameLabel = new Label()
                {
                    LineBreakMode = LineBreakMode.TailTruncation
                }, descLabel = new Label()
                {
                    LineBreakMode = LineBreakMode.TailTruncation
                };
                priceLabel     = new Label();
                conditionLabel = new Label();
                nameLabel.SetBinding(Label.TextProperty, "name");
                descLabel.SetBinding(Label.TextProperty, "description");



                //&#9734
                imageView = new CustomImageView
                {
                    HeightRequest = 100,
                    WidthRequest  = 100,
                };

                // Return an assembled ViewCell.
                return(new ViewCell
                {
                    View = new StackLayout
                    {
                        Padding = new Thickness(5, 5, 5, 5),
                        Orientation = StackOrientation.Horizontal,
                        Children =
                        {
                            imageView,
                            new StackLayout
                            {
                                VerticalOptions = LayoutOptions.Center,
                                //Spacing = 0,
                                Children =
                                {
                                    nameLabel,
                                    descLabel,
                                    new StackLayout {
                                        //Spacing = 0,
                                        Orientation = StackOrientation.Horizontal,
                                        Children =
                                        {
                                            priceLabel,
                                            conditionLabel
                                        }
                                    }
                                }
                            }
                        }
                    }
                });
            });

            ItemAppearing += async(s, e) =>
            {
                myDataTypes.item item = e.Item as myDataTypes.item;
                //formatting price to money
                CultureInfo culture = new CultureInfo("en-us");
                culture.NumberFormat.CurrencyNegativePattern = 1;

                priceLabel.Text = string.Format(culture, "{0:c2}", item.price);

                //giving stars to rating
                string st = "";
                for (int i = 0; i < item.quality; i++)
                {
                    st += "\u2605";
                }
                conditionLabel.Text = st;

                IImageProcessing processer = DependencyService.Get <IImageProcessing>();
                imageView.SetImageBitmap(await processer.ScaleBitmap(item.picture, await processer.GetBitmapOptionsOfImageAsync(item.picture), 200, 200));
            };

            this.ItemSelected += ((sender, eventArgs) =>
            {
                if (this.SelectedItem != null)
                {
                    var itemView = new itemPage(SelectedItem as myDataTypes.item);

                    this.SelectedItem = null;
                    Navigation.PushAsync(itemView);
                }
            });
        }
Esempio n. 20
0
 public ImageProcessingStrategy(IImageProcessing sync, IImageProcessing async)
 {
     AsyncStrategy = true;
     Sync          = sync;
     Async         = async;
 }
        /// <summary>
        /// Returns Instance of Singleton
        /// </summary>
        /// <param name="bmp">Image to Open</param>
        /// <returns></returns>
        public static IImageProcessing GetInstance(Bitmap bmp)
        {
            _instance = _instance ?? new GdiImageProces(bmp);

            return _instance;
        }
Esempio n. 22
0
        public void populateProfileFields()
        {
            donateItem.Clicked += (s, e) =>
            {
                Navigation.PushAsync(new newItemPage(fbla.id));
            };

            if (App.CredManager.IsLoggedIn())
            {
                int myid = -1;
                int.TryParse(App.CredManager.GetAccountValue("FBLA_chapter_id"), out myid);

                if (fbla.id == myid)                //is part of this chapter
                {
                    if (int.Parse(App.CredManager.GetAccountValue("FBLA_status")) > 4)
                    {
                        ToolbarItems.Add(new ToolbarItem("Settings", "@drawable/book", () =>
                        {
                            Navigation.PushAsync(new pendingMembersPage(fbla.id));
                        }));

                        profImg.GestureRecognizers.Add(new TapGestureRecognizer
                        {
                            Command = new Command(async() =>
                            {
                                var answer = await DisplayAlert("Change Chapter picture", "Would you like to change the Chapters picture?", "Yes", "No");
                                if (answer)
                                {
                                    var action  = await DisplayActionSheet("Take or select photo", "Cancel", null, "Take Picture", "Select picture");
                                    MediaFile m = null;
                                    switch (action)
                                    {
                                    case "Take Picture":
                                        m = await App.MANAGER.MediaContorller.TakePicture();
                                        break;

                                    case "Select picture":
                                        m = await App.MANAGER.MediaContorller.SelectPicture();
                                        break;
                                    }

                                    if (m == null)
                                    {
                                        return;
                                    }

                                    IImageProcessing processer = DependencyService.Get <IImageProcessing>();


                                    Bitmap b = await processer.ScaleBitmap(m.Source, await processer.GetBitmapOptionsOfImageAsync(m.Source), 200, 200);
                                    profImg.SetImageBitmap(b);
                                    App.MANAGER.YSSI.SetFBLAChapterPicture(fbla.id, processer.compress(b));

                                    m.Dispose();
                                }
                            }),
                            NumberOfTapsRequired = 1
                        });
                    }
                }
                if (myid == -1)
                {
                    ToolbarItems.Add(new ToolbarItem("Settings", "@drawable/book", async() =>
                    {
                        bool yes = await DisplayAlert("Apply to join chapter?", "Would you like to apply to join this chapter?", "Yes", "No");
                        if (yes)
                        {
                            bool sucess = await App.MANAGER.YSSI.SetChapterStatusOfUser(0, App.CredManager.GetAccountValue("G_id"));
                            if (sucess)
                            {
                                DisplayAlert("You have applied.", "You have applied to join this chapter. Once an administrator has accepted you you will be a part of " + fbla.school + " FBLA.", "OK");
                            }
                        }
                    }));
                }
            }

            baseStack        = makeGUI();
            Title            = fbla.school + " FBLA";
            lblSchool.Text   = fbla.school;
            lblLocation.Text = fbla.city + ", " + fbla.state;



            Content = baseStack;
        }
Esempio n. 23
0
 public MainWindow(IImageProcessing imageProcessing)
 {
     _imageProcessing = imageProcessing;
     InitializeComponent();
     loaderImg.Visibility = Visibility.Hidden;
 }
Esempio n. 24
0
 public SeamCarving(IImageProcessing imgProcessor)
     : this()
 {
     _imgProcessor = imgProcessor;
 }
 public VatAndTaxController(IUnitOfWork unitOfWork, IImageProcessing imageProcessing)
 {
     context = unitOfWork;
     image   = imageProcessing;
 }