Ejemplo n.º 1
0
        // METHODS
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // Creating a LoadedImage object, most of which is handled by it's constructor.
        public void CreateLoadedImg(string path)
        {
            //First, create a Bitmap with the filepath, and convert it to Argb.
            Bitmap baseImage = adjustImg.GetArgbVer(new Bitmap(path));

            // Creating a LoadedImage object with, passing filepath and Bitmap to constructor
            LoadedImage img = new LoadedImage(path, baseImage, this, curImgIndex);

            // Add the new object to the list
            listLoadedImg.Add(img);
            curImgIndex++;
        }
Ejemplo n.º 2
0
        // Update the picbox with a passed image, ususally straight from the Load event ^
        private void UpdatePicbox(LoadedImage img)
        {
            // Assign current img to current and picbox
            picBoxMain.Image = img.GetBitmap("c");

            // Updating the display info
            UpdateSizeMode();
            UpdateLblInfo();
            UpdateText();
            UpdateImgOptions();
            UpdateGallery();
            txtImgWindowControl.Value = 100;

            pnlPicBox.AutoScrollMinSize = new Size(img.GetBitmap("c").Width - 10, img.GetBitmap("c").Height - 10);
        }
Ejemplo n.º 3
0
        // Apply the current set of effects from the BatchSettings window
        // In all instances, the previewVer of the image is being updated, so the effects will stack
        public void ApplyBatchSettingsEffects(BatchSettings bs, LoadedImage img)
        {
            // Initially set previewVer to match currentVer, start from plain image as opposed to previous preview effects
            img.UpdatePreview(img.GetBitmap("c"));

            // TRANSFORMS
            // Scale
            if (bs.arrChkOptions[1][0].Checked)
            {
                img.UpdatePreview(adjustImg.GetScaledVer(img.GetBitmap("p"), bs.transformScale, bs.transformScale, true));
            }
            // Rotation
            if (bs.arrChkOptions[1][1].Checked)
            {
                img.UpdatePreview(adjustImg.GetRotatedVer(img.GetBitmap("p"), bs.transformRotation));
            }
            // Flip
            if (bs.arrChkOptions[1][2].Checked)
            {
                img.UpdatePreview(adjustImg.GetFlippedVer(img.GetBitmap("p"), bs.flipV, bs.flipH));
            }

            // FILTERS
            int filterToApply = -1;
            for (int i = 0; i < bs.arrChkOptions[3].Length; i++)
            {
                // If a filter is found checked, stop and begin to work on it.
                if (bs.arrChkOptions[3][i].Checked)
                {
                    filterToApply = i;
                    break;
                }
            }

            // If a filter was found checked
            if (filterToApply != -1)
            {
                switch (filterToApply)
                {
                    case 0: // Sepia
                        {
                            // Get current bitmap, apply sepia and place in the preview slot of the loadedimg
                            img.UpdatePreview(adjustImg.GetSepia(img.GetBitmap("p")));
                        }
                        break;
                    case 1: // Grayscale
                        {
                            // tmp for readability. Apply Grayscale (with algorithm string from bs) to current version
                            Bitmap tmp = adjustImg.GetGrayscale(img.GetBitmap("p"), bs.grayAlgorithm);
                            // Then apply to preview slot
                            img.UpdatePreview(tmp);
                        }
                        break;
                    default:
                        {
                            Environment.Exit(25);
                        }
                        break;
                }
            }

            // ADJUSTMENTS

            // Transparency
            if (bs.arrChkOptions[2][0].Checked == true)
            {
                // The byte value is necessary for the image adjustment
                byte amount = bs.transpInput;
                // tmp for readability,
                Bitmap tmp = adjustImg.GetTransparent(img.GetBitmap("p"), amount);
                img.UpdatePreview(tmp);
            }
        }
Ejemplo n.º 4
0
        // Update the picbox with a passed image, ususally straight from the Load event ^
        private void UpdatePicbox(LoadedImage img)
        {
            // Assign current img to current and picbox
            picBoxMain.Image = img.GetBitmap("c");

            // Updating the display info
            UpdatePicboxInfoAndSizeMode();
            UpdateText();
            UpdateImgOptions();

            pnlPicBox.AutoScrollMinSize = new Size(img.GetBitmap("c").Width - 10, img.GetBitmap("c").Height - 10);

            if (chkAutoscaleLoad.Checked)
                menuFitWindow.PerformClick();
        }