コード例 #1
0
ファイル: ImageHashDB.cs プロジェクト: uk959595/FFTriadBuddy
 public void UpdatePreviewImage()
 {
     if (previewImage == null)
     {
         previewImage = ImageUtils.CreatePreviewImage(sourceImage, previewBounds, previewContextBounds);
     }
 }
コード例 #2
0
        private void FormAdjustCard_Load(object sender, EventArgs e)
        {
            labelCurrentCard.Text = string.Format("{0} [{1}-{2}-{3}-{4}]",
                                                  (cardState.card != null) ? cardState.card.Name : "unknown",
                                                  cardState.sideNumber[0], cardState.sideNumber[1], cardState.sideNumber[2], cardState.sideNumber[3]);

            skipNumUpdate        = true;
            numericUpDownU.Value = cardState.sideNumber[0];
            numericUpDownL.Value = cardState.sideNumber[1];
            numericUpDownD.Value = cardState.sideNumber[2];
            numericUpDownR.Value = cardState.sideNumber[3];
            labelStatus.Text     = cardState.state.ToString();

            PictureBox[] hashPreviewBox = new PictureBox[4] {
                pictureBoxU, pictureBoxL, pictureBoxD, pictureBoxR
            };
            Label[] sideInfoLabel = new Label[4] {
                labelDescU, labelDescL, labelDescD, labelDescR
            };

            Size hashSize = ScannerTriad.GetDigitHashSize();

            for (int idx = 0; idx < 4; idx++)
            {
                ImageUtils.HashPreview hashPreview = new ImageUtils.HashPreview();
                hashPreview.bounds     = new Rectangle(0, 0, hashSize.Width, hashSize.Height);
                hashPreview.hashValues = cardState.sideInfo[idx].hashValues;

                Bitmap bitmap = new Bitmap(hashSize.Width, hashSize.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
                ImageUtils.DrawDebugHash(bitmap, hashPreview, Color.White);

                hashPreviewBox[idx].Image = bitmap;

                sideInfoLabel[idx].Text = cardState.sideInfo[idx].hasOverride ? "custom" : string.Format("auto: {0:P0}", cardState.sideInfo[idx].matchPct);
            }

            pictureBoxNumBox.Image = ImageUtils.CreatePreviewImage(cardState.sourceImage, cardState.bounds, Rectangle.Empty);

            skipNumUpdate = false;
            UpdateAdjustedCard();
        }