コード例 #1
0
 private void AddLayer()
 {
     WriteableBitmap writeableBitmap = new WriteableBitmap(ContentPanel, null);
     mskdBmpImg = new MaskedBitmapImage(writeableBitmap, this.selectedMask);
     //WriteableBitmap writeableBitmap = mskdBmpImg.ImageSource();
     //SetImages(writeableBitmap);
     SetImages(mskdBmpImg.ImageSource());
 }
コード例 #2
0
        void photoChooserTask_Completed(object sender, PhotoResult e)
        {
            if (e.TaskResult == TaskResult.OK)
            {
                Stream selected = e.ChosenPhoto;

                //String maskString = "resources/" + ((ListPickerItem)MaskListPicker.SelectedItem).Content.ToString().ToLower() + "msk.png";

                // Code to display the photo on the page in an image control named myImage.
                mskdBmpImg = new MaskedBitmapImage(e.ChosenPhoto, this.selectedMask);
                SetImages(mskdBmpImg.ImageSource());

                WriteableBitmap source = mskdBmpImg.ImageSource();
                PreviewImage.Source = source;
                PreviewImage.Stretch = Stretch.UniformToFill;
                PreviewImage.OpacityMask = mskdBmpImg.GetMask();

                // save every step of the way
                //BackroundImage.Source = ImageSaver.SaveImage(ContentPanel);

                // TODO: Offer the ability to "stretch" or "constrain" the mask mode.
                // it appears as though masks are stretched to fit their parent images by default.
                // Perhaps the parent image needs to be constrained to the aspect ratio of the mask image at some point.

                MakeAppActive();
                AddLayer();
                AddLayer();
                SetActionLabel(ADD_LAYER);
            }
        }