示例#1
0
        private void btnAnimStart_Click(object sender, EventArgs e)
        {
            btnAnimStop.Enabled  = true;
            btnAnimStart.Enabled = false;
            btnAnimNext.Enabled  = false;

            int index = cboEntry.SelectedIndex;

            ms = GfxBattleBg.Masters[index];

            for (int i = 0; i < 2; i++)
            {
                try
                {
                    bgAlphas[i] = int.Parse(txtAlpha[i].Text);
                }
                catch
                {
                    txtAlpha[i].SelectAll();
                    return;
                }

                bgLayers[i]  = cboLayer[i].SelectedIndex;
                srcBitmap[i] = GfxBattleBg.GetBg(index, i);
                if (changed)
                {
                    srcPal[i] = (MPalette)GfxBattleBg.Bgs[bgLayers[i]].Palette.Clone();
                }
                srcBd[i] = srcBitmap[i].LockBits(ImageLockMode.ReadWrite);

                bufBitmap[i] = new Bitmap(256, 256, PixelFormat.Format8bppIndexed);
                bufBd[i]     = bufBitmap[i].LockBits(ImageLockMode.ReadWrite);
                buf[i]       = (byte *)bufBd[i].Scan0;

                dstBitmap[i] = new Bitmap(256, 256, PixelFormat.Format8bppIndexed);

                // Apply the alphas
                alphaAttr[i] = new ImageAttributes();

                float a = bgAlphas[i];
                alphaMatrix[i]          = new ColorMatrix();
                alphaMatrix[i].Matrix33 = a / 16.0f;

                alphaAttr[i].SetColorMatrix(alphaMatrix[i], ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
            }

            if (changed)
            {
                changed = false;
                t       = 0;
            }

            pAnimation.Visible = true;
            tm.Start();
        }
示例#2
0
        private void cboShowLayer_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (loading2)
            {
                return;
            }

            int bg = cboBg.SelectedIndex;

            if (bg == -1)
            {
                pBg.Image = null;
            }
            else
            {
                pBg.Image = GfxBattleBg.GetBg(bg, cboShowLayer.SelectedIndex);
            }
        }