Beispiel #1
0
        public QR(Image qr, Image pkm, string top, string bottom, string left, string right)
        {
            InitializeComponent();
            Font  font    = Main.unicode ? FontLabel.Font : PKX.getPKXFont((float)8.25);
            Image preview = new Bitmap(45, 45);

            using (Graphics gfx = Graphics.FromImage(preview))
            {
                gfx.FillRectangle(new SolidBrush(Color.White), 0, 0, preview.Width, preview.Height);
                gfx.DrawImage(pkm, preview.Width / 2 - pkm.Width / 2, preview.Height / 2 - pkm.Height / 2);
            }
            // Layer on Preview Image
            Image pic = Util.LayerImage(qr, preview, qr.Width / 2 - preview.Width / 2, qr.Height / 2 - preview.Height / 2, 1);

            // Layer on Text
            const int stretch = 50;

            Height += stretch;
            Image newpic = new Bitmap(PB_QR.Width, PB_QR.Height);

            using (Graphics g = Graphics.FromImage(newpic))
            {
                g.FillRectangle(new SolidBrush(Color.White), 0, 0, newpic.Width, newpic.Height);
                g.DrawImage(pic, 0, 0);

                g.DrawString(top, font, Brushes.Black, new PointF(18, qr.Height - 5));
                g.DrawString(bottom, font, Brushes.Black, new PointF(18, qr.Height + 8));
                g.DrawString(left.Replace(Environment.NewLine, "/").Replace("//", "   ").Replace(":/", ": "), font, Brushes.Black, new PointF(18, qr.Height + 20));
                g.DrawString(right, font, Brushes.Black, new PointF(18, qr.Height + 32));
            }
            PB_QR.BackgroundImage = newpic;
        }
Beispiel #2
0
        private void RefreshImage()
        {
            Font  font    = Main.unicode ? FontLabel.Font : PKX.getPKXFont((float)8.25);
            Image preview = new Bitmap(45, 45);

            using (Graphics gfx = Graphics.FromImage(preview))
            {
                gfx.FillRectangle(new SolidBrush(Color.White), 0, 0, preview.Width, preview.Height);
                gfx.DrawImage(icon, preview.Width / 2 - icon.Width / 2, preview.Height / 2 - icon.Height / 2);
            }
            // Layer on Preview Image
            Image pic = Util.LayerImage(qr, preview, qr.Width / 2 - preview.Width / 2, qr.Height / 2 - preview.Height / 2, 1);

            Image newpic = new Bitmap(PB_QR.Width, PB_QR.Height);

            using (Graphics g = Graphics.FromImage(newpic))
            {
                g.FillRectangle(new SolidBrush(Color.White), 0, 0, newpic.Width, newpic.Height);
                g.DrawImage(pic, 0, 0);

                g.DrawString(Line1, font, Brushes.Black, new PointF(18, qr.Height - 5));
                g.DrawString(Line2, font, Brushes.Black, new PointF(18, qr.Height + 8));
                g.DrawString(Line3.Replace(Environment.NewLine, "/").Replace("//", "   ").Replace(":/", ": "), font, Brushes.Black, new PointF(18, qr.Height + 20));
                g.DrawString(Line4 + extraText, font, Brushes.Black, new PointF(18, qr.Height + 32));
            }
            PB_QR.BackgroundImage = newpic;
        }
Beispiel #3
0
        private void getSlotFiller(int offset, PictureBox pb)
        {
            if (SAV.getData(offset, SAV.SIZE_STORED).SequenceEqual(new byte[SAV.SIZE_STORED]))
            {
                // 00s present in slot.
                pb.Image     = null;
                pb.BackColor = Color.Transparent;
                return;
            }
            PKM p = SAV.getStoredSlot(offset);

            if (!p.Valid) // Invalid
            {
                // Bad Egg present in slot.
                pb.Image     = null;
                pb.BackColor = Color.Red;
                return;
            }
            // Something stored in slot. Only display if species is valid.
            var  sprite = p.Species != 0 ? p.Sprite : null;
            int  slot   = getSlot(pb);
            bool locked = slot < 30 && SAV.getIsSlotLocked(CB_BoxSelect.SelectedIndex, slot);
            bool team   = slot < 30 && SAV.getIsTeamSet(CB_BoxSelect.SelectedIndex, slot);

            if (locked)
            {
                sprite = Util.LayerImage(sprite, Properties.Resources.locked, 26, 0, 1);
            }
            else if (team)
            {
                sprite = Util.LayerImage(sprite, Properties.Resources.team, 21, 0, 1);
            }
            pb.Image     = sprite;
            pb.BackColor = Color.Transparent;
        }
Beispiel #4
0
        internal static Image getSprite(MysteryGift gift)
        {
            Image img;
            if (gift.IsPokémon)
                img = PKX.getSprite(gift.convertToPKM(Main.SAV));
            else if (gift.IsItem)
                img = (Image)(Properties.Resources.ResourceManager.GetObject("item_" + gift.Item) ?? Properties.Resources.unknown);
            else
                img = Properties.Resources.unknown;

            if (gift.GiftUsed)
                img = Util.LayerImage(new Bitmap(img.Width, img.Height), img, 0, 0, 0.3);
            return img;
        }
Beispiel #5
0
        private void getQuickFiller(PictureBox pb, PKM pk)
        {
            var  sprite = pk.Species != 0 ? pk.Sprite : null;
            int  slot   = getSlot(pb);
            bool locked = slot < 30 && SAV.getIsSlotLocked(CB_BoxSelect.SelectedIndex, slot);

            if (locked)
            {
                sprite = Util.LayerImage(sprite, Properties.Resources.locked, 5, 0, 1);
            }
            pb.Image = sprite;
            if (pb.BackColor == Color.Red)
            {
                pb.BackColor = Color.Transparent;
            }
        }
Beispiel #6
0
        private Image getWCPreviewImage(byte[] data)
        {
            Image img;
            WC6   wc = new WC6(data);

            if (wc.IsPokémon)
            {
                img = PKX.getSprite(wc.Species, wc.Form, wc.Gender, wc.HeldItem, wc.IsEgg, wc.PIDType == 2);
            }
            else if (wc.IsItem)
            {
                img = (Image)(Properties.Resources.ResourceManager.GetObject("item_" + BitConverter.ToUInt16(data, 0x68)) ?? Properties.Resources.unknown);
            }
            else
            {
                img = Properties.Resources.unknown;
            }

            if (wc.GiftUsed)
            {
                img = Util.LayerImage(new Bitmap(img.Width, img.Height), img, 0, 0, 0.3);
            }
            return(img);
        }