// CONSTRUCTOR
        public LoadedImage(string path, Bitmap baseImage, PicViewer sender, int index)
        {
            PicViewer = sender;
            curIndex = index;
            originalVer = currentVer = baseImage; // baseImage already converted to ARGB

            name = Path.GetFileNameWithoutExtension(path);
            originalFormat = baseImage.RawFormat;
            defaultDir = Path.GetDirectoryName(path);
            correctRatio = (float)currentVer.Width / (float)currentVer.Height;

            // Create label to dock over thumbnail
            lblThumb = new Label();
            lblThumb.Dock = DockStyle.Left;
            lblThumb.Size = new Size(15, 15);
            lblThumb.Font = new Font(lblThumb.Font, FontStyle.Bold);
            lblThumb.ForeColor = Color.White;
            lblThumb.TextAlign = ContentAlignment.TopLeft;
            lblThumb.BackColor = Color.FromArgb(50, 0, 0, 0);

            UpdateThumbnail();

            // Names are given the index as a string, they will eventually be converted back to ints and used as indexing definitions.
            //thumbnail.Name = lblThumb.Name = index.ToString();

            // Add eventhandler references to clicks
            thumbnail.Click += PicViewer.picBox_Click;
            lblThumb.Click += PicViewer.picBox_Click;

            undo = new Stack<Bitmap>();
            redo = new Stack<Bitmap>();
        }
Ejemplo n.º 2
0
        // CONSTRUCTOR
        public BatchSettings(object sender)
        {
            InitializeComponent();
            // Stops manual editing of the combo box, meaning that somehting HAS to be arrIsProcessed
            comboBatchFileExportType.DropDownStyle = ComboBoxStyle.DropDownList;
            this.FormBorderStyle = FormBorderStyle.FixedDialog;

            // Tracks the currenty in-use filter
            curFilterIndex = 0;
            UpdateCheckedStatus();

            mainProgram = (PicViewer)sender; // Reference to main form
            arrIsProcessed = new bool[mainProgram.listLoadedImg.Count()]; // array of bool matching length of list

            // Populate checklist of images
            batchFileSelectionList.Items.Clear();
            for (int i = 0; i < arrIsProcessed.Length; i++)
            {
                // Add an item using the listLoadedImage collection's item names, prechecked
                batchFileSelectionList.Items.Add(mainProgram.listLoadedImg[i].GetName(), true);
            }

            // Suite of image adjustment tools
            ImgAdjust adjustImg = new ImgAdjust();

            // Used to create a LoadedImage object
            Bitmap imgForPreview;

            //// If check allows for development work without having to load an images every time
            //if (mainProgram.listLoadedImg.Count() == 0)
            //{
            //    imgForPreview = adjustImg.GetArgbVer(Bitmap.FromFile("..//..//testImage.jpg"));
            //}
            //else
            //{
            //    imgForPreview = mainProgram.listLoadedImg[0].GetBitmap("c");
            //}

            imgForPreview = mainProgram.listLoadedImg[0].GetBitmap("c");

            // LoadedImage class object is created, it's previewVer is displayed in the thumbnail
            previewLoadedImage = mainProgram.listLoadedImg[0];
            picBatchPreview.Image = previewLoadedImage.GetBitmap("p");

            comboBatchFileExportType.SelectedIndex = 0; // Creates a call to UpdateOptions();
        }
Ejemplo n.º 3
0
        // CONSTRUCTOR
        public LoadedImage(string path, Bitmap baseImage, PicViewer sender, int index)
        {
            //defaultLocation = Path.GetDirectoryName(path);
            PicViewer = sender;
            originalVer = currentVer = baseImage; // baseImage already converted to ARGB

            deaultName = Path.GetFileNameWithoutExtension(path);
            defaultDir = Path.GetDirectoryName(path);

            originalFormat = baseImage.RawFormat;
            correctRatio = (float)currentVer.Width / (float)currentVer.Height;

            // Create label to dock over thumbnail
            lblThumb = new Label();
            lblThumb.Dock = DockStyle.Left;
            lblThumb.Size = new Size(23, 15);
            lblThumb.Font = new Font(lblThumb.Font, FontStyle.Bold);
            lblThumb.ForeColor = Color.White;
            lblThumb.TextAlign = ContentAlignment.TopCenter;
            lblThumb.BackColor = Color.FromArgb(50, 0, 0, 0);

            UpdateThumbnail();

            // Names are given the index as a string, they will eventually be converted back to ints and used as indexing definitions.
            // thumbnail.Name = lblThumb.Name = index.ToString();

            // Add eventhandler references to clicks
            thumbnail.Click += PicViewer.picBox_Click;
            lblThumb.Click += PicViewer.picBox_Click;

            undo = new Stack<Bitmap>();
            redo = new Stack<Bitmap>();

            // previewVer will match currentVer when created
            UpdatePreview(currentVer);

            // Divide h/w, convert to decimal, round to two decimal places
            decimal aspectRatioRounded = Math.Round(Convert.ToDecimal(((float)baseImage.Width / (float)baseImage.Height)), 2);
            lblInfo = "File Name: " + GetName() + Environment.NewLine + Environment.NewLine + "Height: " + baseImage.Height + Environment.NewLine + "Width: " + baseImage.Width + Environment.NewLine + Environment.NewLine + "Aspect Ratio:" + aspectRatioRounded;
        }