Ejemplo n.º 1
0
        private void TattooImageFile_button_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.Filter          = ImageFilterOpen;
            openFileDialog1.Title           = "Select Image File";
            openFileDialog1.FilterIndex     = 1;
            openFileDialog1.CheckFileExists = true;
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                TattooImageFile.Text = openFileDialog1.FileName;
            }
            else
            {
                return;
            }
            if (String.CompareOrdinal(TattooImageFile.Text, " ") <= 0 || !File.Exists(TattooImageFile.Text))
            {
                MessageBox.Show("You must select a compatible image file!");
                return;
            }

            dds = ImageHandler.OpenDDS(TattooImageFile.Text);
            if (dds == null)
            {
                return;
            }

            Wait_label.Visible = true;
            Wait_label.Refresh();

            ddsOriginal = new DdsFile();
            ddsOriginal.CreateImage(dds, false);

            if (dds.AlphaDepth == 0)
            {
                dds.UseDXT     = false;
                dds.AlphaDepth = 8;
                dds.SetPixels(ZeroAlpha);
            }

            Update_DDSdisplay();
        }
Ejemplo n.º 2
0
        private void TransformReset_button_Click(object sender, EventArgs e)
        {
            Wait_label.Visible = true;
            Wait_label.Refresh();

            dds.CreateImage(ddsOriginal, false);
            if (dds.AlphaDepth == 0)
            {
                dds.UseDXT     = false;
                dds.AlphaDepth = 8;
                dds.SetPixels(ZeroAlpha);
            }

            Update_DDSdisplay();
            Black2Red_radioButton.Checked    = false;
            PhotoConvert_radioButton.Checked = false;
            ReplaceAlpha_checkBox.Checked    = false;
            Black2Alpha_radioButton.Checked  = false;
            White2Alpha_radioButton.Checked  = false;
            BlankAlpha_radioButton.Checked   = false;
            White2Back_checkBox.Checked      = false;
        }
Ejemplo n.º 3
0
        internal void Update_DDSdisplay()
        {
            if (dds == null)
            {
                return;
            }
            Wait_label.Visible = true;
            Wait_label.Refresh();
            DdsFile preview = new DdsFile();

            preview.CreateImage(dds, false);
            preview.SetPixels(TatPreview);
            if (!preview.Size.Equals(new System.Drawing.Size(512, 512)))
            {
                preview = preview.Resize(new System.Drawing.Size(512, 512));
            }
            Preview_pictureBox.Image = preview.Image;
            preview.Dispose();
            Wait_label.Visible      = false;
            Preset1_button.Font     = (currentPreset == 0) ? new Font(Preset1_button.Font, FontStyle.Bold) : new Font(Preset1_button.Font, FontStyle.Regular);
            Preset2_button.Font     = (currentPreset == 1) ? new Font(Preset2_button.Font, FontStyle.Bold) : new Font(Preset2_button.Font, FontStyle.Regular);
            Preset3_button.Font     = (currentPreset == 2) ? new Font(Preset3_button.Font, FontStyle.Bold) : new Font(Preset3_button.Font, FontStyle.Regular);
            Resize_checkBox.Checked = !dds.Size.Equals(new System.Drawing.Size(512, 512));
        }
Ejemplo n.º 4
0
        private void TransformGo_button_Click(object sender, EventArgs e)
        {
            Wait_label.Visible = true;
            Wait_label.Refresh();

            dds.SetPixels(TatTransform);
            if (Black2Red_radioButton.Checked)
            {
                ChannelG_checkBox.Checked = false;
                ChannelB_checkBox.Checked = false;
                ChannelA_checkBox.Checked = false;
            }
            if (Black2Alpha_radioButton.Checked)
            {
                for (int i = 0; i < 3; i++)
                {
                    presets[i].aChannelHue = 0x00000000;
                    Presets_dataGridView.Rows[i].Cells["ChannelA"].Style.BackColor = presets[i].aChannelColor.SystemColor;
                }
            }
            else if (White2Alpha_radioButton.Checked)
            {
                for (int i = 0; i < 3; i++)
                {
                    presets[i].aChannelHue = 0x00FFFFFF;
                    Presets_dataGridView.Rows[i].Cells["ChannelA"].Style.BackColor = presets[i].aChannelColor.SystemColor;
                }
            }

            if (Resize_checkBox.Checked & !dds.Size.Equals(new Size(512, 512)))
            {
                Bitmap bits   = dds.GetImage(true, true, true, true, false);
                int    width  = bits.Width;
                int    height = bits.Height;

                float factorH = height / 512f;
                if (width == height)
                {
                    dds = dds.Resize(new Size(512, 512));
                }
                else if (width > height)
                {
                    float factor = 512f / width;
                    resizeSize = new Size(512, (int)(height * factor));
                    DdsFile tmp = new DdsFile();
                    tmp.CreateImage(dds, resizeSize.Width, resizeSize.Height, false);
                    resizePixels = tmp.GetImage(true, true, true, true, false).ToARGBData();
                    dds          = dds.Resize(new Size(512, 512));
                    dds.SetPixels(Resizer);
                }
                else if (width < height)
                {
                    float factor = 512f / height;
                    resizeSize = new Size((int)(width * factor), 512);
                    DdsFile tmp = new DdsFile();
                    tmp.CreateImage(dds, resizeSize.Width, resizeSize.Height, false);
                    resizePixels = tmp.GetImage(true, true, true, true, false).ToARGBData();
                    dds          = dds.Resize(new Size(512, 512));
                    dds.SetPixels(Resizer);
                }
            }

            Update_DDSdisplay();
        }